diff --git a/res/values/strings.xml b/res/values/strings.xml index aa484835065..949b6758d94 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9073,6 +9073,10 @@ Notifications on lock screen + + Show conversations, default, and silent + Show conversations, default, and silent @@ -9324,11 +9328,11 @@ ~%d notification per day - ~%d notifications per day + ~%,d notifications per day ~%d notification per week - ~%d notifications per week + ~%,d notifications per week Never diff --git a/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java b/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java index 1d67fb7539d..cb8b73d2896 100644 --- a/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java +++ b/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java @@ -16,6 +16,7 @@ package com.android.settings.applications.autofill; +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.service.autofill.AutofillService.EXTRA_RESULT; import static androidx.lifecycle.Lifecycle.Event.ON_CREATE; @@ -133,7 +134,8 @@ public class PasswordsPreferenceController extends BasePreferenceController new Intent(Intent.ACTION_MAIN) .setClassName( serviceInfo.packageName, - service.getPasswordsActivity()); + service.getPasswordsActivity()) + .setFlags(FLAG_ACTIVITY_NEW_TASK); prefContext.startActivityAsUser(intent, UserHandle.of(user)); return true; }); diff --git a/src/com/android/settings/bluetooth/BluetoothPairingService.java b/src/com/android/settings/bluetooth/BluetoothPairingService.java index 4c3c9a9be94..bc5dc6695d1 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingService.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingService.java @@ -188,7 +188,8 @@ public final class BluetoothPairingService extends Service { } PendingIntent pairIntent = PendingIntent.getService(this, 0, pairingDialogIntent, - PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE); + PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT + | PendingIntent.FLAG_IMMUTABLE); Intent serviceIntent = new Intent(ACTION_DISMISS_PAIRING); serviceIntent.setClass(this, BluetoothPairingService.class); diff --git a/src/com/android/settings/notification/RedactNotificationPreferenceController.java b/src/com/android/settings/notification/RedactNotificationPreferenceController.java index db34e5e960a..2d2718478c2 100644 --- a/src/com/android/settings/notification/RedactNotificationPreferenceController.java +++ b/src/com/android/settings/notification/RedactNotificationPreferenceController.java @@ -178,7 +178,8 @@ public class RedactNotificationPreferenceController extends TogglePreferenceCont private boolean getAllowPrivateNotifications(int userId) { return Settings.Secure.getIntForUser(mContext.getContentResolver(), - LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, userId) != 0; + LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, userId) != 0 + && getEnforcedAdmin(userId) == null; } private boolean getLockscreenNotificationsEnabled(int userId) { diff --git a/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java b/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java index f8f76caecbd..f7dc3913775 100644 --- a/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java +++ b/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java @@ -116,7 +116,7 @@ public class ShowOnLockScreenNotificationPreferenceController extends AbstractPr } else if (!getLockscreenSilentNotificationsEnabled()) { return mContext.getString(R.string.lock_screen_notifs_show_alerting); } else { - return mContext.getString(R.string.lock_screen_notifs_show_all); + return mContext.getString(R.string.lock_screen_notifs_show_all_summary); } } diff --git a/tests/robotests/src/com/android/settings/notification/RedactNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RedactNotificationPreferenceControllerTest.java index ae25474f81b..72a2c2451ee 100644 --- a/tests/robotests/src/com/android/settings/notification/RedactNotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/RedactNotificationPreferenceControllerTest.java @@ -292,6 +292,18 @@ public class RedactNotificationPreferenceControllerTest { assertThat(mWorkController.isChecked()).isFalse(); } + @Test + public void isChecked_admin() { + Settings.Secure.putIntForUser(mContext.getContentResolver(), + LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, + 1, 0); + + ShadowRestrictedLockUtilsInternal.setKeyguardDisabledFeatures( + KEYGUARD_DISABLE_SECURE_NOTIFICATIONS); + + assertThat(mController.isChecked()).isFalse(); + } + @Test public void setChecked_false() throws Exception { Settings.Secure.putIntForUser(mContext.getContentResolver(), diff --git a/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java index a8628c42c47..c7c21a7f3d2 100644 --- a/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java @@ -40,7 +40,6 @@ import com.android.settings.notification.NotificationBackend; import com.android.settingslib.widget.LayoutPreference; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -132,7 +131,6 @@ public class HeaderPreferenceControllerTest { } @Test - @Ignore public void testGetSummary() { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.label = "bananas"; @@ -140,8 +138,6 @@ public class HeaderPreferenceControllerTest { assertEquals("", mController.getSummary()); NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); - mController.onResume(appRow, null, group, null, null, null, null); - assertEquals(appRow.label, mController.getSummary()); NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE); mController.onResume(appRow, channel, group, null, null, null, null); @@ -159,7 +155,6 @@ public class HeaderPreferenceControllerTest { } @Test - @Ignore public void testGetSecondSummary() { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.label = "bananas"; @@ -167,8 +162,6 @@ public class HeaderPreferenceControllerTest { assertEquals("", mController.getSecondSummary()); NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); - mController.onResume(appRow, null, group, null, null, null, null); - assertEquals("", mController.getSecondSummary()); NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE); mController.onResume(appRow, channel, group, null, null, null, null);