Merge "Fix redirect to Mobile security page" into main

This commit is contained in:
Treehugger Robot
2024-11-22 04:19:44 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 1 deletions

View File

@@ -125,7 +125,7 @@ public class CellularSecurityPreferenceController extends BasePreferenceControll
return super.handlePreferenceTreeClick(preference); return super.handlePreferenceTreeClick(preference);
} }
boolean isSafetyCenterSupported = isSafetyCenterSupported(); boolean isSafetyCenterSupported = isSafetyCenterSupported();
if (isSafetyCenterSupported) { if (isSafetyCenterSupported && areNotificationsEnabled()) {
Intent safetyCenterIntent = new Intent(Intent.ACTION_SAFETY_CENTER); Intent safetyCenterIntent = new Intent(Intent.ACTION_SAFETY_CENTER);
safetyCenterIntent.putExtra(SafetyCenterManager.EXTRA_SAFETY_SOURCES_GROUP_ID, safetyCenterIntent.putExtra(SafetyCenterManager.EXTRA_SAFETY_SOURCES_GROUP_ID,
"AndroidCellularNetworkSecuritySources"); "AndroidCellularNetworkSecuritySources");

View File

@@ -152,6 +152,10 @@ public final class CellularSecurityPreferenceControllerTest {
public void handlePreferenceTreeClick_safetyCenterSupported_shouldRedirectToSafetyCenter() { public void handlePreferenceTreeClick_safetyCenterSupported_shouldRedirectToSafetyCenter() {
final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled();
doReturn(true).when(mTelephonyManager)
.isCellularIdentifierDisclosureNotificationsEnabled();
doReturn(true).when(mTelephonyManager).isNullCipherAndIntegrityPreferenceEnabled();
boolean prefHandled = mController.handlePreferenceTreeClick(mPreference); boolean prefHandled = mController.handlePreferenceTreeClick(mPreference);
assertThat(prefHandled).isTrue(); assertThat(prefHandled).isTrue();