Merge "Cleaned up the flag enforce_telephony_feature_mapping_for_public_apis" into main
This commit is contained in:
@@ -29,7 +29,6 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.internal.telephony.flags.Flags;
|
|
||||||
import com.android.settings.network.GlobalSettingsChangeListener;
|
import com.android.settings.network.GlobalSettingsChangeListener;
|
||||||
import com.android.settings.network.ProxySubscriptionManager;
|
import com.android.settings.network.ProxySubscriptionManager;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
@@ -162,19 +161,13 @@ public class AirplaneModeEnabler extends GlobalSettingsChangeListener {
|
|||||||
if (context == null || telephonyManager == null) {
|
if (context == null || telephonyManager == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
|
try {
|
||||||
try {
|
|
||||||
if (telephonyManager.getEmergencyCallbackMode()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (UnsupportedOperationException e) {
|
|
||||||
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
|
||||||
// Ignore exception, device is not in ECM mode.
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (telephonyManager.getEmergencyCallbackMode()) {
|
if (telephonyManager.getEmergencyCallbackMode()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
||||||
|
// Ignore exception, device is not in ECM mode.
|
||||||
}
|
}
|
||||||
final List<SubscriptionInfo> subInfoList =
|
final List<SubscriptionInfo> subInfoList =
|
||||||
ProxySubscriptionManager.getInstance(context).getActiveSubscriptionsInfo();
|
ProxySubscriptionManager.getInstance(context).getActiveSubscriptionsInfo();
|
||||||
@@ -185,18 +178,12 @@ public class AirplaneModeEnabler extends GlobalSettingsChangeListener {
|
|||||||
final TelephonyManager telephonyManagerForSubId =
|
final TelephonyManager telephonyManagerForSubId =
|
||||||
telephonyManager.createForSubscriptionId(subInfo.getSubscriptionId());
|
telephonyManager.createForSubscriptionId(subInfo.getSubscriptionId());
|
||||||
if (telephonyManagerForSubId != null) {
|
if (telephonyManagerForSubId != null) {
|
||||||
if (!Flags.enforceTelephonyFeatureMappingForPublicApis()) {
|
try {
|
||||||
if (telephonyManagerForSubId.getEmergencyCallbackMode()) {
|
if (telephonyManagerForSubId.getEmergencyCallbackMode()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} catch (UnsupportedOperationException e) {
|
||||||
try {
|
// Ignore exception, device is not in ECM mode.
|
||||||
if (telephonyManagerForSubId.getEmergencyCallbackMode()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (UnsupportedOperationException e) {
|
|
||||||
// Ignore exception, device is not in ECM mode.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import android.provider.Settings;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.telephony.flags.Flags;
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
@@ -51,17 +50,12 @@ public class HearingAidCompatibilityPreferenceController extends TogglePreferenc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
|
try {
|
||||||
try {
|
|
||||||
return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE
|
|
||||||
: UNSUPPORTED_ON_DEVICE;
|
|
||||||
} catch (UnsupportedOperationException e) {
|
|
||||||
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
|
||||||
return UNSUPPORTED_ON_DEVICE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE
|
return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE
|
||||||
: UNSUPPORTED_ON_DEVICE;
|
: UNSUPPORTED_ON_DEVICE;
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
||||||
|
return UNSUPPORTED_ON_DEVICE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -911,15 +911,11 @@ public class EnabledNetworkModePreferenceController extends
|
|||||||
|
|
||||||
// assign current call state so that it helps to show correct preference state even
|
// assign current call state so that it helps to show correct preference state even
|
||||||
// before first onCallStateChanged() by initial registration.
|
// before first onCallStateChanged() by initial registration.
|
||||||
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
|
try {
|
||||||
try {
|
|
||||||
mCallState = mTelephonyManager.getCallState(subId);
|
|
||||||
} catch (UnsupportedOperationException e) {
|
|
||||||
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
|
||||||
mCallState = TelephonyManager.CALL_STATE_IDLE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mCallState = mTelephonyManager.getCallState(subId);
|
mCallState = mTelephonyManager.getCallState(subId);
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
||||||
|
mCallState = TelephonyManager.CALL_STATE_IDLE;
|
||||||
}
|
}
|
||||||
mTelephonyManager.registerTelephonyCallback(
|
mTelephonyManager.registerTelephonyCallback(
|
||||||
mContext.getMainExecutor(), mTelephonyCallback);
|
mContext.getMainExecutor(), mTelephonyCallback);
|
||||||
|
@@ -33,7 +33,6 @@ import androidx.preference.Preference;
|
|||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.TwoStatePreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.telephony.flags.Flags;
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.network.ims.VolteQueryImsState;
|
import com.android.settings.network.ims.VolteQueryImsState;
|
||||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||||
@@ -233,15 +232,11 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
|
|||||||
}
|
}
|
||||||
// assign current call state so that it helps to show correct preference state even
|
// assign current call state so that it helps to show correct preference state even
|
||||||
// before first onCallStateChanged() by initial registration.
|
// before first onCallStateChanged() by initial registration.
|
||||||
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
|
try {
|
||||||
try {
|
|
||||||
mCallState = mTelephonyManager.getCallState(subId);
|
|
||||||
} catch (UnsupportedOperationException e) {
|
|
||||||
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
|
||||||
mCallState = TelephonyManager.CALL_STATE_IDLE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mCallState = mTelephonyManager.getCallState(subId);
|
mCallState = mTelephonyManager.getCallState(subId);
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// Device doesn't support FEATURE_TELEPHONY_CALLING
|
||||||
|
mCallState = TelephonyManager.CALL_STATE_IDLE;
|
||||||
}
|
}
|
||||||
mTelephonyManager.registerTelephonyCallback(
|
mTelephonyManager.registerTelephonyCallback(
|
||||||
mContext.getMainExecutor(), mTelephonyCallback);
|
mContext.getMainExecutor(), mTelephonyCallback);
|
||||||
|
Reference in New Issue
Block a user