Removed the flag enable_modem_cipher_transparency_unsol_events

Removed the 24Q3 flag enable_modem_cipher_transparency_unsol_events

Bug: 283336425
Test: atest FrameworksTelephonyTests
Test: Basic telephony functionality tests
Flag: EXEMPT flag cleanup
Change-Id: I08e206d721f99f9422a117dbe009561b434a43bf
This commit is contained in:
Jack Yu
2025-02-07 15:41:18 -08:00
parent b0a4c54cc3
commit a8db4d190e
6 changed files with 1 additions and 93 deletions

View File

@@ -35,7 +35,6 @@ import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import com.android.internal.telephony.flags.Flags;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.SubSettingLauncher; import com.android.settings.core.SubSettingLauncher;
import com.android.settings.network.telephony.CellularSecuritySettingsFragment; import com.android.settings.network.telephony.CellularSecuritySettingsFragment;
@@ -71,8 +70,7 @@ public class CellularSecurityPreferenceController extends BasePreferenceControll
@Override @Override
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY) if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
|| !Flags.enableModemCipherTransparencyUnsolEvents()) {
return UNSUPPORTED_ON_DEVICE; return UNSUPPORTED_ON_DEVICE;
} }
if (mTelephonyManager == null) { if (mTelephonyManager == null) {

View File

@@ -26,7 +26,6 @@ import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import com.android.internal.telephony.flags.Flags;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settings.network.SubscriptionUtil; import com.android.settings.network.SubscriptionUtil;
@@ -60,9 +59,6 @@ public class CellularSecurityNotificationsDividerController extends
@Override @Override
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
if (!Flags.enableModemCipherTransparencyUnsolEvents()) {
return UNSUPPORTED_ON_DEVICE;
}
if (!isSafetyCenterSupported()) { if (!isSafetyCenterSupported()) {
return UNSUPPORTED_ON_DEVICE; return UNSUPPORTED_ON_DEVICE;
} }

View File

@@ -26,7 +26,6 @@ import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import com.android.internal.telephony.flags.Flags;
import com.android.settings.network.SubscriptionUtil; import com.android.settings.network.SubscriptionUtil;
import java.util.List; import java.util.List;
@@ -75,10 +74,6 @@ public class CellularSecurityNotificationsPreferenceController extends
return UNSUPPORTED_ON_DEVICE; return UNSUPPORTED_ON_DEVICE;
} }
if (!areFlagsEnabled()) {
return UNSUPPORTED_ON_DEVICE;
}
// Check there are valid SIM cards which can be displayed to the user, otherwise this // Check there are valid SIM cards which can be displayed to the user, otherwise this
// setting should not be shown. // setting should not be shown.
List<SubscriptionInfo> availableSubs = SubscriptionUtil.getAvailableSubscriptions(mContext); List<SubscriptionInfo> availableSubs = SubscriptionUtil.getAvailableSubscriptions(mContext);
@@ -106,10 +101,6 @@ public class CellularSecurityNotificationsPreferenceController extends
*/ */
@Override @Override
public boolean isChecked() { public boolean isChecked() {
if (!areFlagsEnabled()) {
return false;
}
try { try {
// Note: the default behavior for this toggle is disabled (as the underlying // Note: the default behavior for this toggle is disabled (as the underlying
// TelephonyManager APIs are disabled by default) // TelephonyManager APIs are disabled by default)
@@ -144,11 +135,6 @@ public class CellularSecurityNotificationsPreferenceController extends
Log.i(LOG_TAG, "Disabling cellular security notifications."); Log.i(LOG_TAG, "Disabling cellular security notifications.");
} }
// Check flag status
if (!areFlagsEnabled()) {
return false;
}
try { try {
setNotifications(isChecked); setNotifications(isChecked);
} catch (Exception e) { } catch (Exception e) {
@@ -177,13 +163,6 @@ public class CellularSecurityNotificationsPreferenceController extends
&& mTelephonyManager.isCellularIdentifierDisclosureNotificationsEnabled(); && mTelephonyManager.isCellularIdentifierDisclosureNotificationsEnabled();
} }
private boolean areFlagsEnabled() {
if (!Flags.enableModemCipherTransparencyUnsolEvents()) {
return false;
}
return true;
}
protected boolean isSafetyCenterSupported() { protected boolean isSafetyCenterSupported() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
return false; return false;

View File

@@ -31,7 +31,6 @@ import static org.mockito.Mockito.when;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.platform.test.flag.junit.SetFlagsRule;
import android.safetycenter.SafetyCenterManager; import android.safetycenter.SafetyCenterManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@@ -42,11 +41,8 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.platform.app.InstrumentationRegistry;
import com.android.internal.telephony.flags.Flags;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@@ -54,8 +50,6 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class CellularSecurityPreferenceControllerTest { public final class CellularSecurityPreferenceControllerTest {
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@Mock @Mock
private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager;
private Preference mPreference; private Preference mPreference;
@@ -91,9 +85,6 @@ public final class CellularSecurityPreferenceControllerTest {
@Test @Test
public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() { public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() {
// Enable telephony API flags for testing
enableFlags(true);
// Hardware support is enabled // Hardware support is enabled
doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled();
doReturn(true).when(mTelephonyManager) doReturn(true).when(mTelephonyManager)
@@ -120,9 +111,6 @@ public final class CellularSecurityPreferenceControllerTest {
@Test @Test
public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() { public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() {
// Enable telephony API flags for testing
enableFlags(true);
// Hardware support is disabled // Hardware support is disabled
doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager)
.isNullCipherNotificationsEnabled(); .isNullCipherNotificationsEnabled();
@@ -133,11 +121,4 @@ public final class CellularSecurityPreferenceControllerTest {
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE); assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
} }
private void enableFlags(boolean enabled) {
if (enabled) {
} else {
mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY_UNSOL_EVENTS);
}
}
} }

View File

@@ -28,7 +28,6 @@ import static org.mockito.Mockito.when;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.platform.test.flag.junit.SetFlagsRule;
import android.safetycenter.SafetyCenterManager; import android.safetycenter.SafetyCenterManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@@ -39,11 +38,8 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.platform.app.InstrumentationRegistry;
import com.android.internal.telephony.flags.Flags;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@@ -51,8 +47,6 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class CellularSecurityNotificationsDividerControllerTest { public class CellularSecurityNotificationsDividerControllerTest {
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@Mock @Mock
private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager;
private Preference mPreference; private Preference mPreference;
@@ -86,9 +80,6 @@ public class CellularSecurityNotificationsDividerControllerTest {
@Test @Test
public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() { public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() {
// Enable telephony API flags for testing
enableFlags(true);
// Hardware support is enabled // Hardware support is enabled
doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled();
doReturn(true).when(mTelephonyManager) doReturn(true).when(mTelephonyManager)
@@ -99,9 +90,6 @@ public class CellularSecurityNotificationsDividerControllerTest {
@Test @Test
public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() { public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() {
// Enable telephony API flags for testing
enableFlags(true);
// Hardware support is disabled // Hardware support is disabled
doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager)
.isNullCipherNotificationsEnabled(); .isNullCipherNotificationsEnabled();
@@ -110,12 +98,4 @@ public class CellularSecurityNotificationsDividerControllerTest {
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE); assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
} }
private void enableFlags(boolean enabled) {
if (enabled) {
mSetFlagsRule.enableFlags(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY_UNSOL_EVENTS);
} else {
mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY_UNSOL_EVENTS);
}
}
} }

View File

@@ -29,7 +29,6 @@ import static org.mockito.Mockito.when;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.platform.test.flag.junit.SetFlagsRule;
import android.safetycenter.SafetyCenterManager; import android.safetycenter.SafetyCenterManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@@ -40,11 +39,8 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.platform.app.InstrumentationRegistry;
import com.android.internal.telephony.flags.Flags;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@@ -52,8 +48,6 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class CellularSecurityNotificationsPreferenceControllerTest { public class CellularSecurityNotificationsPreferenceControllerTest {
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@Mock @Mock
private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager;
private Preference mPreference; private Preference mPreference;
@@ -87,9 +81,6 @@ public class CellularSecurityNotificationsPreferenceControllerTest {
@Test @Test
public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() { public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() {
// All flags enabled
enableFlags(true);
// Hardware support is enabled // Hardware support is enabled
doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled();
doReturn(true).when(mTelephonyManager) doReturn(true).when(mTelephonyManager)
@@ -100,9 +91,6 @@ public class CellularSecurityNotificationsPreferenceControllerTest {
@Test @Test
public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() { public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() {
// All flags enabled
enableFlags(true);
// Hardware support is disabled // Hardware support is disabled
doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager)
.isNullCipherNotificationsEnabled(); .isNullCipherNotificationsEnabled();
@@ -114,8 +102,6 @@ public class CellularSecurityNotificationsPreferenceControllerTest {
@Test @Test
public void setChecked_shouldReturnTrue() { public void setChecked_shouldReturnTrue() {
enableFlags(true);
// Hardware support is enabled, enabling the feature // Hardware support is enabled, enabling the feature
doNothing().when(mTelephonyManager).setNullCipherNotificationsEnabled(true); doNothing().when(mTelephonyManager).setNullCipherNotificationsEnabled(true);
doNothing().when(mTelephonyManager) doNothing().when(mTelephonyManager)
@@ -140,8 +126,6 @@ public class CellularSecurityNotificationsPreferenceControllerTest {
@Test @Test
public void isChecked_hardwareUnsupported_shouldReturnFalse() { public void isChecked_hardwareUnsupported_shouldReturnFalse() {
enableFlags(true);
// Hardware support is disabled // Hardware support is disabled
doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager)
.isNullCipherNotificationsEnabled(); .isNullCipherNotificationsEnabled();
@@ -153,8 +137,6 @@ public class CellularSecurityNotificationsPreferenceControllerTest {
@Test @Test
public void isChecked_notificationsDisabled_shouldReturnFalse() { public void isChecked_notificationsDisabled_shouldReturnFalse() {
enableFlags(true);
// Hardware support is enabled, but APIs are disabled // Hardware support is enabled, but APIs are disabled
doReturn(false).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(false).when(mTelephonyManager).isNullCipherNotificationsEnabled();
doReturn(false).when(mTelephonyManager) doReturn(false).when(mTelephonyManager)
@@ -165,12 +147,4 @@ public class CellularSecurityNotificationsPreferenceControllerTest {
doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled();
assertThat(mController.isChecked()).isFalse(); assertThat(mController.isChecked()).isFalse();
} }
private void enableFlags(boolean enabled) {
if (enabled) {
mSetFlagsRule.enableFlags(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY_UNSOL_EVENTS);
} else {
mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY_UNSOL_EVENTS);
}
}
} }