Merge "Cleaned up the flag enforce_telephony_feature_mapping_for_public_apis" into main

This commit is contained in:
Jack Yu
2025-02-24 17:45:03 -08:00
committed by Android (Google) Code Review
4 changed files with 19 additions and 47 deletions

View File

@@ -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,7 +161,6 @@ 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()) { if (telephonyManager.getEmergencyCallbackMode()) {
return true; return true;
@@ -171,11 +169,6 @@ public class AirplaneModeEnabler extends GlobalSettingsChangeListener {
// Device doesn't support FEATURE_TELEPHONY_CALLING // Device doesn't support FEATURE_TELEPHONY_CALLING
// Ignore exception, device is not in ECM mode. // Ignore exception, device is not in ECM mode.
} }
} else {
if (telephonyManager.getEmergencyCallbackMode()) {
return true;
}
}
final List<SubscriptionInfo> subInfoList = final List<SubscriptionInfo> subInfoList =
ProxySubscriptionManager.getInstance(context).getActiveSubscriptionsInfo(); ProxySubscriptionManager.getInstance(context).getActiveSubscriptionsInfo();
if (subInfoList == null) { if (subInfoList == null) {
@@ -185,11 +178,6 @@ 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()) {
if (telephonyManagerForSubId.getEmergencyCallbackMode()) {
return true;
}
} else {
try { try {
if (telephonyManagerForSubId.getEmergencyCallbackMode()) { if (telephonyManagerForSubId.getEmergencyCallbackMode()) {
return true; return true;
@@ -199,7 +187,6 @@ public class AirplaneModeEnabler extends GlobalSettingsChangeListener {
} }
} }
} }
}
return false; return false;
} }

View File

@@ -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,7 +50,6 @@ public class HearingAidCompatibilityPreferenceController extends TogglePreferenc
@Override @Override
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
try { try {
return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE
: UNSUPPORTED_ON_DEVICE; : UNSUPPORTED_ON_DEVICE;
@@ -59,10 +57,6 @@ public class HearingAidCompatibilityPreferenceController extends TogglePreferenc
// Device doesn't support FEATURE_TELEPHONY_CALLING // Device doesn't support FEATURE_TELEPHONY_CALLING
return UNSUPPORTED_ON_DEVICE; return UNSUPPORTED_ON_DEVICE;
} }
} else {
return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
}
} }
@Override @Override

View File

@@ -911,16 +911,12 @@ 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); mCallState = mTelephonyManager.getCallState(subId);
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING // Device doesn't support FEATURE_TELEPHONY_CALLING
mCallState = TelephonyManager.CALL_STATE_IDLE; mCallState = TelephonyManager.CALL_STATE_IDLE;
} }
} else {
mCallState = mTelephonyManager.getCallState(subId);
}
mTelephonyManager.registerTelephonyCallback( mTelephonyManager.registerTelephonyCallback(
mContext.getMainExecutor(), mTelephonyCallback); mContext.getMainExecutor(), mTelephonyCallback);
} }

View File

@@ -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,16 +232,12 @@ 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); mCallState = mTelephonyManager.getCallState(subId);
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING // Device doesn't support FEATURE_TELEPHONY_CALLING
mCallState = TelephonyManager.CALL_STATE_IDLE; mCallState = TelephonyManager.CALL_STATE_IDLE;
} }
} else {
mCallState = mTelephonyManager.getCallState(subId);
}
mTelephonyManager.registerTelephonyCallback( mTelephonyManager.registerTelephonyCallback(
mContext.getMainExecutor(), mTelephonyCallback); mContext.getMainExecutor(), mTelephonyCallback);
} }