Cleaned up the flag enforce_telephony_feature_mapping_for_public_apis

Cleaned up the 24Q3 flag enforce_telephony_feature_mapping_for_public_apis

Test: Basic telephony functionality tests
Test: atest FrameworksTelephonyTests
Bug: 297989574
Flag: EXEMPT flag cleanup
Change-Id: Iefb9a02eebe06fb42a23d645e6be034c94508487
This commit is contained in:
Jack Yu
2025-02-18 13:31:50 -08:00
parent 2c90d30415
commit a38de2654d
4 changed files with 19 additions and 47 deletions

View File

@@ -29,7 +29,6 @@ import android.util.Log;
import androidx.annotation.VisibleForTesting;
import com.android.internal.telephony.flags.Flags;
import com.android.settings.network.GlobalSettingsChangeListener;
import com.android.settings.network.ProxySubscriptionManager;
import com.android.settings.overlay.FeatureFactory;
@@ -162,19 +161,13 @@ public class AirplaneModeEnabler extends GlobalSettingsChangeListener {
if (context == null || telephonyManager == null) {
return false;
}
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
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 {
try {
if (telephonyManager.getEmergencyCallbackMode()) {
return true;
}
} catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING
// Ignore exception, device is not in ECM mode.
}
final List<SubscriptionInfo> subInfoList =
ProxySubscriptionManager.getInstance(context).getActiveSubscriptionsInfo();
@@ -185,18 +178,12 @@ public class AirplaneModeEnabler extends GlobalSettingsChangeListener {
final TelephonyManager telephonyManagerForSubId =
telephonyManager.createForSubscriptionId(subInfo.getSubscriptionId());
if (telephonyManagerForSubId != null) {
if (!Flags.enforceTelephonyFeatureMappingForPublicApis()) {
try {
if (telephonyManagerForSubId.getEmergencyCallbackMode()) {
return true;
}
} else {
try {
if (telephonyManagerForSubId.getEmergencyCallbackMode()) {
return true;
}
} catch (UnsupportedOperationException e) {
// Ignore exception, device is not in ECM mode.
}
} catch (UnsupportedOperationException e) {
// Ignore exception, device is not in ECM mode.
}
}
}

View File

@@ -22,7 +22,6 @@ import android.provider.Settings;
import android.telephony.TelephonyManager;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.flags.Flags;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
import com.android.settings.overlay.FeatureFactory;
@@ -51,17 +50,12 @@ public class HearingAidCompatibilityPreferenceController extends TogglePreferenc
@Override
public int getAvailabilityStatus() {
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
try {
return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
} catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING
return UNSUPPORTED_ON_DEVICE;
}
} else {
try {
return mTelephonyManager.isHearingAidCompatibilitySupported() ? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
} catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING
return UNSUPPORTED_ON_DEVICE;
}
}

View File

@@ -911,15 +911,11 @@ public class EnabledNetworkModePreferenceController extends
// assign current call state so that it helps to show correct preference state even
// before first onCallStateChanged() by initial registration.
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
try {
mCallState = mTelephonyManager.getCallState(subId);
} catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING
mCallState = TelephonyManager.CALL_STATE_IDLE;
}
} else {
try {
mCallState = mTelephonyManager.getCallState(subId);
} catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING
mCallState = TelephonyManager.CALL_STATE_IDLE;
}
mTelephonyManager.registerTelephonyCallback(
mContext.getMainExecutor(), mTelephonyCallback);

View File

@@ -33,7 +33,6 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.TwoStatePreference;
import com.android.internal.telephony.flags.Flags;
import com.android.settings.R;
import com.android.settings.network.ims.VolteQueryImsState;
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
// before first onCallStateChanged() by initial registration.
if (Flags.enforceTelephonyFeatureMappingForPublicApis()) {
try {
mCallState = mTelephonyManager.getCallState(subId);
} catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING
mCallState = TelephonyManager.CALL_STATE_IDLE;
}
} else {
try {
mCallState = mTelephonyManager.getCallState(subId);
} catch (UnsupportedOperationException e) {
// Device doesn't support FEATURE_TELEPHONY_CALLING
mCallState = TelephonyManager.CALL_STATE_IDLE;
}
mTelephonyManager.registerTelephonyCallback(
mContext.getMainExecutor(), mTelephonyCallback);