Merge "[Settings] replace isNonTtyOrTtyOnVolteEnabled() in VoLTE"
This commit is contained in:
@@ -26,7 +26,7 @@ import com.android.settings.network.SubscriptionUtil;
|
|||||||
/**
|
/**
|
||||||
* Controller class for querying Volte status
|
* Controller class for querying Volte status
|
||||||
*/
|
*/
|
||||||
public class VolteQueryImsState {
|
public class VolteQueryImsState extends ImsQueryController {
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private int mSubId;
|
private int mSubId;
|
||||||
@@ -42,6 +42,20 @@ public class VolteQueryImsState {
|
|||||||
mSubId = subId;
|
mSubId = subId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get allowance status for user to alter configuration
|
||||||
|
*
|
||||||
|
* @return true when changing configuration by user is allowed.
|
||||||
|
*/
|
||||||
|
public boolean isAllowUserControl() {
|
||||||
|
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((!isSystemTtyEnabled(mContext).directQuery())
|
||||||
|
|| (isTtyOnVolteEnabled(mSubId).directQuery()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user's configuration
|
* Get user's configuration
|
||||||
*
|
*
|
||||||
|
@@ -108,6 +108,7 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
|
|||||||
return CONDITIONALLY_UNAVAILABLE;
|
return CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
|
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
|
||||||
|
final VolteQueryImsState queryState = queryImsState(subId);
|
||||||
final boolean isVisible = SubscriptionManager.isValidSubscriptionId(subId)
|
final boolean isVisible = SubscriptionManager.isValidSubscriptionId(subId)
|
||||||
&& mImsManager != null && carrierConfig != null
|
&& mImsManager != null && carrierConfig != null
|
||||||
&& mImsManager.isVolteEnabledByPlatform()
|
&& mImsManager.isVolteEnabledByPlatform()
|
||||||
@@ -115,7 +116,8 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
|
|||||||
&& MobileNetworkUtils.isImsServiceStateReady(mImsManager)
|
&& MobileNetworkUtils.isImsServiceStateReady(mImsManager)
|
||||||
&& !carrierConfig.getBoolean(CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL);
|
&& !carrierConfig.getBoolean(CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL);
|
||||||
return isVisible
|
return isVisible
|
||||||
? (isPrefEnabled() ? AVAILABLE : AVAILABLE_UNSEARCHABLE)
|
? (isUserControlAllowed() && queryState.isAllowUserControl()
|
||||||
|
? AVAILABLE : AVAILABLE_UNSEARCHABLE)
|
||||||
: CONDITIONALLY_UNAVAILABLE;
|
: CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,9 +143,10 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
|
|||||||
final SwitchPreference switchPreference = (SwitchPreference) preference;
|
final SwitchPreference switchPreference = (SwitchPreference) preference;
|
||||||
|
|
||||||
final VolteQueryImsState queryState = queryImsState(mSubId);
|
final VolteQueryImsState queryState = queryImsState(mSubId);
|
||||||
switchPreference.setEnabled(isPrefEnabled());
|
switchPreference.setEnabled(isUserControlAllowed()
|
||||||
|
&& queryState.isAllowUserControl());
|
||||||
switchPreference.setChecked(queryState.isEnabledByUser()
|
switchPreference.setChecked(queryState.isEnabledByUser()
|
||||||
&& mImsManager.isNonTtyOrTtyOnVolteEnabled());
|
&& queryState.isAllowUserControl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,13 +194,6 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
|
|||||||
return new VolteQueryImsState(mContext, subId);
|
return new VolteQueryImsState(mContext, subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPrefEnabled() {
|
|
||||||
return SubscriptionManager.isValidSubscriptionId(mSubId)
|
|
||||||
&& isUserControlAllowed()
|
|
||||||
&& mImsManager != null
|
|
||||||
&& mImsManager.isNonTtyOrTtyOnVolteEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isUserControlAllowed() {
|
private boolean isUserControlAllowed() {
|
||||||
return (mCallState != null) && (mCallState == TelephonyManager.CALL_STATE_IDLE)
|
return (mCallState != null) && (mCallState == TelephonyManager.CALL_STATE_IDLE)
|
||||||
&& mCarrierConfig.getBoolean(
|
&& mCarrierConfig.getBoolean(
|
||||||
|
@@ -48,7 +48,6 @@ import com.android.settings.network.ims.VolteQueryImsState;
|
|||||||
import com.android.settings.slices.CustomSliceRegistry;
|
import com.android.settings.slices.CustomSliceRegistry;
|
||||||
import com.android.settings.slices.SliceBroadcastReceiver;
|
import com.android.settings.slices.SliceBroadcastReceiver;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to control slices for enhanced 4g LTE settings.
|
* Helper class to control slices for enhanced 4g LTE settings.
|
||||||
*/
|
*/
|
||||||
@@ -70,11 +69,6 @@ public class Enhanced4gLteSliceHelper {
|
|||||||
public static final String ACTION_MOBILE_NETWORK_SETTINGS_ACTIVITY =
|
public static final String ACTION_MOBILE_NETWORK_SETTINGS_ACTIVITY =
|
||||||
"android.settings.NETWORK_OPERATOR_SETTINGS";
|
"android.settings.NETWORK_OPERATOR_SETTINGS";
|
||||||
|
|
||||||
/**
|
|
||||||
* Timeout for querying enhanced 4g lte setting from ims manager.
|
|
||||||
*/
|
|
||||||
private static final int TIMEOUT_MILLIS = 2000;
|
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,7 +187,7 @@ public class Enhanced4gLteSliceHelper {
|
|||||||
if (imsManager.isVolteEnabledByPlatform() && isVolteProvisionedOnDevice(subId)) {
|
if (imsManager.isVolteEnabledByPlatform() && isVolteProvisionedOnDevice(subId)) {
|
||||||
final VolteQueryImsState queryState = queryImsState(subId);
|
final VolteQueryImsState queryState = queryImsState(subId);
|
||||||
final boolean currentValue = queryState.isEnabledByUser()
|
final boolean currentValue = queryState.isEnabledByUser()
|
||||||
&& imsManager.isNonTtyOrTtyOnVolteEnabled();
|
&& queryState.isAllowUserControl();
|
||||||
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
|
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
|
||||||
currentValue);
|
currentValue);
|
||||||
if (newValue != currentValue) {
|
if (newValue != currentValue) {
|
||||||
|
Reference in New Issue
Block a user