Loading src/com/android/settings/network/CellularSecurityPreferenceController.java +1 −3 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.internal.telephony.flags.Flags; import com.android.settings.core.BasePreferenceController; import com.android.settings.core.SubSettingLauncher; import com.android.settings.network.telephony.CellularSecuritySettingsFragment; Loading Loading @@ -71,8 +70,7 @@ public class CellularSecurityPreferenceController extends BasePreferenceControll @Override public int getAvailabilityStatus() { if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY) || !Flags.enableModemCipherTransparencyUnsolEvents()) { if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { return UNSUPPORTED_ON_DEVICE; } if (mTelephonyManager == null) { Loading src/com/android/settings/network/telephony/CellularSecurityNotificationsDividerController.java +0 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.telephony.flags.Flags; import com.android.settings.core.BasePreferenceController; import com.android.settings.network.SubscriptionUtil; Loading Loading @@ -60,9 +59,6 @@ public class CellularSecurityNotificationsDividerController extends @Override public int getAvailabilityStatus() { if (!Flags.enableModemCipherTransparencyUnsolEvents()) { return UNSUPPORTED_ON_DEVICE; } if (!isSafetyCenterSupported()) { return UNSUPPORTED_ON_DEVICE; } Loading src/com/android/settings/network/telephony/CellularSecurityNotificationsPreferenceController.java +0 −21 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.telephony.flags.Flags; import com.android.settings.network.SubscriptionUtil; import java.util.List; Loading Loading @@ -75,10 +74,6 @@ public class CellularSecurityNotificationsPreferenceController extends 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 // setting should not be shown. List<SubscriptionInfo> availableSubs = SubscriptionUtil.getAvailableSubscriptions(mContext); Loading Loading @@ -106,10 +101,6 @@ public class CellularSecurityNotificationsPreferenceController extends */ @Override public boolean isChecked() { if (!areFlagsEnabled()) { return false; } try { // Note: the default behavior for this toggle is disabled (as the underlying // TelephonyManager APIs are disabled by default) Loading Loading @@ -144,11 +135,6 @@ public class CellularSecurityNotificationsPreferenceController extends Log.i(LOG_TAG, "Disabling cellular security notifications."); } // Check flag status if (!areFlagsEnabled()) { return false; } try { setNotifications(isChecked); } catch (Exception e) { Loading Loading @@ -177,13 +163,6 @@ public class CellularSecurityNotificationsPreferenceController extends && mTelephonyManager.isCellularIdentifierDisclosureNotificationsEnabled(); } private boolean areFlagsEnabled() { if (!Flags.enableModemCipherTransparencyUnsolEvents()) { return false; } return true; } protected boolean isSafetyCenterSupported() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { return false; Loading tests/unit/src/com/android/settings/network/CellularSecurityPreferenceControllerTest.java +0 −19 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.content.Intent; import android.os.Build; import android.platform.test.flag.junit.SetFlagsRule; import android.safetycenter.SafetyCenterManager; import android.telephony.TelephonyManager; Loading @@ -42,11 +41,8 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; import com.android.internal.telephony.flags.Flags; import org.junit.Assume; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; Loading @@ -54,8 +50,6 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidJUnit4.class) public final class CellularSecurityPreferenceControllerTest { @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Mock private TelephonyManager mTelephonyManager; private Preference mPreference; Loading Loading @@ -91,9 +85,6 @@ public final class CellularSecurityPreferenceControllerTest { @Test public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is enabled doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager) Loading @@ -120,9 +111,6 @@ public final class CellularSecurityPreferenceControllerTest { @Test public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is disabled doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) .isNullCipherNotificationsEnabled(); Loading @@ -133,11 +121,4 @@ public final class CellularSecurityPreferenceControllerTest { 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); } } } tests/unit/src/com/android/settings/network/telephony/CellularSecurityNotificationsDividerControllerTest.java +0 −20 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.os.Build; import android.platform.test.flag.junit.SetFlagsRule; import android.safetycenter.SafetyCenterManager; import android.telephony.TelephonyManager; Loading @@ -39,11 +38,8 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; import com.android.internal.telephony.flags.Flags; import org.junit.Assume; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; Loading @@ -51,8 +47,6 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidJUnit4.class) public class CellularSecurityNotificationsDividerControllerTest { @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Mock private TelephonyManager mTelephonyManager; private Preference mPreference; Loading Loading @@ -86,9 +80,6 @@ public class CellularSecurityNotificationsDividerControllerTest { @Test public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is enabled doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager) Loading @@ -99,9 +90,6 @@ public class CellularSecurityNotificationsDividerControllerTest { @Test public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is disabled doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) .isNullCipherNotificationsEnabled(); Loading @@ -110,12 +98,4 @@ public class CellularSecurityNotificationsDividerControllerTest { 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); } } } Loading
src/com/android/settings/network/CellularSecurityPreferenceController.java +1 −3 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.internal.telephony.flags.Flags; import com.android.settings.core.BasePreferenceController; import com.android.settings.core.SubSettingLauncher; import com.android.settings.network.telephony.CellularSecuritySettingsFragment; Loading Loading @@ -71,8 +70,7 @@ public class CellularSecurityPreferenceController extends BasePreferenceControll @Override public int getAvailabilityStatus() { if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY) || !Flags.enableModemCipherTransparencyUnsolEvents()) { if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { return UNSUPPORTED_ON_DEVICE; } if (mTelephonyManager == null) { Loading
src/com/android/settings/network/telephony/CellularSecurityNotificationsDividerController.java +0 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.telephony.flags.Flags; import com.android.settings.core.BasePreferenceController; import com.android.settings.network.SubscriptionUtil; Loading Loading @@ -60,9 +59,6 @@ public class CellularSecurityNotificationsDividerController extends @Override public int getAvailabilityStatus() { if (!Flags.enableModemCipherTransparencyUnsolEvents()) { return UNSUPPORTED_ON_DEVICE; } if (!isSafetyCenterSupported()) { return UNSUPPORTED_ON_DEVICE; } Loading
src/com/android/settings/network/telephony/CellularSecurityNotificationsPreferenceController.java +0 −21 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.telephony.flags.Flags; import com.android.settings.network.SubscriptionUtil; import java.util.List; Loading Loading @@ -75,10 +74,6 @@ public class CellularSecurityNotificationsPreferenceController extends 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 // setting should not be shown. List<SubscriptionInfo> availableSubs = SubscriptionUtil.getAvailableSubscriptions(mContext); Loading Loading @@ -106,10 +101,6 @@ public class CellularSecurityNotificationsPreferenceController extends */ @Override public boolean isChecked() { if (!areFlagsEnabled()) { return false; } try { // Note: the default behavior for this toggle is disabled (as the underlying // TelephonyManager APIs are disabled by default) Loading Loading @@ -144,11 +135,6 @@ public class CellularSecurityNotificationsPreferenceController extends Log.i(LOG_TAG, "Disabling cellular security notifications."); } // Check flag status if (!areFlagsEnabled()) { return false; } try { setNotifications(isChecked); } catch (Exception e) { Loading Loading @@ -177,13 +163,6 @@ public class CellularSecurityNotificationsPreferenceController extends && mTelephonyManager.isCellularIdentifierDisclosureNotificationsEnabled(); } private boolean areFlagsEnabled() { if (!Flags.enableModemCipherTransparencyUnsolEvents()) { return false; } return true; } protected boolean isSafetyCenterSupported() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { return false; Loading
tests/unit/src/com/android/settings/network/CellularSecurityPreferenceControllerTest.java +0 −19 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.content.Intent; import android.os.Build; import android.platform.test.flag.junit.SetFlagsRule; import android.safetycenter.SafetyCenterManager; import android.telephony.TelephonyManager; Loading @@ -42,11 +41,8 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; import com.android.internal.telephony.flags.Flags; import org.junit.Assume; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; Loading @@ -54,8 +50,6 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidJUnit4.class) public final class CellularSecurityPreferenceControllerTest { @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Mock private TelephonyManager mTelephonyManager; private Preference mPreference; Loading Loading @@ -91,9 +85,6 @@ public final class CellularSecurityPreferenceControllerTest { @Test public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is enabled doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager) Loading @@ -120,9 +111,6 @@ public final class CellularSecurityPreferenceControllerTest { @Test public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is disabled doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) .isNullCipherNotificationsEnabled(); Loading @@ -133,11 +121,4 @@ public final class CellularSecurityPreferenceControllerTest { 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); } } }
tests/unit/src/com/android/settings/network/telephony/CellularSecurityNotificationsDividerControllerTest.java +0 −20 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.os.Build; import android.platform.test.flag.junit.SetFlagsRule; import android.safetycenter.SafetyCenterManager; import android.telephony.TelephonyManager; Loading @@ -39,11 +38,8 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; import com.android.internal.telephony.flags.Flags; import org.junit.Assume; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; Loading @@ -51,8 +47,6 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidJUnit4.class) public class CellularSecurityNotificationsDividerControllerTest { @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Mock private TelephonyManager mTelephonyManager; private Preference mPreference; Loading Loading @@ -86,9 +80,6 @@ public class CellularSecurityNotificationsDividerControllerTest { @Test public void getAvailabilityStatus_hardwareSupported_shouldReturnTrue() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is enabled doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled(); doReturn(true).when(mTelephonyManager) Loading @@ -99,9 +90,6 @@ public class CellularSecurityNotificationsDividerControllerTest { @Test public void getAvailabilityStatus_noHardwareSupport_shouldReturnFalse() { // Enable telephony API flags for testing enableFlags(true); // Hardware support is disabled doThrow(new UnsupportedOperationException("test")).when(mTelephonyManager) .isNullCipherNotificationsEnabled(); Loading @@ -110,12 +98,4 @@ public class CellularSecurityNotificationsDividerControllerTest { 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); } } }