use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method updateRoamingState.
private void updateRoamingState(boolean newRoaming) {
if (mCT.getState() == PhoneConstants.State.IDLE) {
if (DBG)
Rlog.d(LOG_TAG, "updateRoamingState now: " + newRoaming);
mRoaming = newRoaming;
ImsManager imsMgr = ImsManager.getInstance(mContext, mPhoneId);
imsMgr.setWfcModeForSlot(imsMgr.getWfcModeForSlot(newRoaming), newRoaming);
} else {
if (DBG)
Rlog.d(LOG_TAG, "updateRoamingState postponed: " + newRoaming);
mCT.registerForVoiceCallEnded(this, EVENT_VOICE_CALL_ENDED, null);
}
}
use of com.android.ims.ImsManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiCallingSliceHelper method createWifiCallingSlice.
/**
* Returns Slice object for wifi calling settings.
*
* If wifi calling is being turned on and if wifi calling activation is needed for the current
* carrier, this method will return Slice with instructions to go to Settings App.
*
* If wifi calling is not supported for the current carrier, this method will return slice with
* not supported message.
*
* If wifi calling setting can be changed, this method will return the slice to toggle wifi
* calling option with ACTION_WIFI_CALLING_CHANGED as endItem.
*/
public Slice createWifiCallingSlice(Uri sliceUri) {
final int subId = getDefaultVoiceSubId();
if (subId <= SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
Log.d(TAG, "Invalid subscription Id");
return null;
}
final ImsManager imsManager = getImsManager(subId);
if (!imsManager.isWfcEnabledByPlatform() || !imsManager.isWfcProvisionedOnDevice()) {
Log.d(TAG, "Wifi calling is either not provisioned or not enabled by Platform");
return null;
}
try {
final boolean isWifiCallingEnabled = isWifiCallingEnabled(imsManager);
final Intent activationAppIntent = getWifiCallingCarrierActivityIntent(subId);
// only when there is no need for wifi calling activation with the server
if (activationAppIntent != null && !isWifiCallingEnabled) {
Log.d(TAG, "Needs Activation");
// Give instructions to go to settings app
return getNonActionableWifiCallingSlice(mContext.getText(R.string.wifi_calling_settings_title), mContext.getText(R.string.wifi_calling_settings_activation_instructions), sliceUri, getActivityIntent(ACTION_WIFI_CALLING_SETTINGS_ACTIVITY));
}
return getWifiCallingSlice(sliceUri, isWifiCallingEnabled);
} catch (InterruptedException | TimeoutException | ExecutionException e) {
Log.e(TAG, "Unable to read the current WiFi calling status", e);
return null;
}
}
use of com.android.ims.ImsManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class Enhanced4gLteSliceHelper method handleEnhanced4gLteChanged.
/**
* Handles Enhanced 4G LTE mode setting change from Enhanced 4G LTE slice and posts
* notification. Should be called when intent action is ACTION_ENHANCED_4G_LTE_CHANGED
*
* @param intent action performed
*/
public void handleEnhanced4gLteChanged(Intent intent) {
final int subId = getDefaultVoiceSubId();
if (subId > SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
final ImsManager imsManager = getImsManager(subId);
if (imsManager.isVolteEnabledByPlatform() && imsManager.isVolteProvisionedOnDevice()) {
final boolean currentValue = imsManager.isEnhanced4gLteModeSettingEnabledByUser() && imsManager.isNonTtyOrTtyOnVolteEnabled();
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE, currentValue);
if (newValue != currentValue) {
imsManager.setEnhanced4gLteModeSetting(newValue);
}
}
}
// notify change in slice in any case to get re-queried. This would result in displaying
// appropriate message with the updated setting.
mContext.getContentResolver().notifyChange(CustomSliceRegistry.ENHANCED_4G_SLICE_URI, null);
}
use of com.android.ims.ImsManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class Enhanced4gLteSliceHelper method createEnhanced4gLteSlice.
/**
* Returns Slice object for enhanced_4g_lte settings.
*
* If enhanced 4g LTE is not supported for the current carrier, this method will return slice
* with not supported message.
*
* If enhanced 4g LTE is not editable for the current carrier, this method will return slice
* with not editable message.
*
* If enhanced 4g LTE setting can be changed, this method will return the slice to toggle
* enhanced 4g LTE option with ACTION_ENHANCED_4G_LTE_CHANGED as endItem.
*/
public Slice createEnhanced4gLteSlice(Uri sliceUri) {
final int subId = getDefaultVoiceSubId();
if (subId <= SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
Log.d(TAG, "Invalid subscription Id");
return null;
}
final ImsManager imsManager = getImsManager(subId);
if (!imsManager.isVolteEnabledByPlatform() || !imsManager.isVolteProvisionedOnDevice()) {
Log.d(TAG, "Setting is either not provisioned or not enabled by Platform");
return null;
}
if (isCarrierConfigManagerKeyEnabled(CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL, subId, false) || !isCarrierConfigManagerKeyEnabled(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL, subId, true)) {
Log.d(TAG, "Setting is either hidden or not editable");
return null;
}
try {
return getEnhanced4gLteSlice(sliceUri, isEnhanced4gLteModeEnabled(imsManager), subId);
} catch (InterruptedException | TimeoutException | ExecutionException e) {
Log.e(TAG, "Unable to read the current Enhanced 4g LTE status", e);
return null;
}
}
use of com.android.ims.ImsManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MobileNetworkUtils method isWifiCallingEnabled.
/**
* Returns true if Wifi calling is enabled for the specific subscription with id {@code subId}.
*/
public static boolean isWifiCallingEnabled(Context context, int subId) {
final PhoneAccountHandle simCallManager = TelecomManager.from(context).getSimCallManagerForSubscription(subId);
final int phoneId = SubscriptionManager.getSlotIndex(subId);
boolean isWifiCallingEnabled;
if (simCallManager != null) {
Intent intent = buildPhoneAccountConfigureIntent(context, simCallManager);
isWifiCallingEnabled = intent != null;
} else {
ImsManager imsMgr = ImsManager.getInstance(context, phoneId);
isWifiCallingEnabled = imsMgr != null && imsMgr.isWfcEnabledByPlatform() && imsMgr.isWfcProvisionedOnDevice() && isImsServiceStateReady(imsMgr);
}
return isWifiCallingEnabled;
}
Aggregations