From 13375e5f44bac2d66cab6111339c1c5a95869d9d Mon Sep 17 00:00:00 2001 From: Hugh Chen Date: Fri, 5 Nov 2021 09:22:13 +0000 Subject: [PATCH 1/3] Fix phone shows incorrect pairing code in pairing dialog Add PendingIntent.FLAG_UPDATE_CURRENT to let peding intent can be updated the intent extra. Bug: 204133175 Test: make -j64 RunSettingsRoboTests Change-Id: I42966432dacc3727d31231d10aa07b782bb1d92e --- .../android/settings/bluetooth/BluetoothPairingService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); From 42896d7fe195531aec68111de021e7e1f307c186 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 5 Nov 2021 14:06:10 -0400 Subject: [PATCH 2/3] Check if pref is disabled by admin Test: robotests Fixes: 137638270 Change-Id: I39953d5b7466281cff7a9a7ffaeb5ba99ab12934 --- .../RedactNotificationPreferenceController.java | 3 ++- .../RedactNotificationPreferenceControllerTest.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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/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(), From dc816116c5fa7fc4e74682de7e4d42cf3c791004 Mon Sep 17 00:00:00 2001 From: Ahaan Ugale Date: Sun, 7 Nov 2021 22:59:50 -0800 Subject: [PATCH 3/3] AF passwords settings: Start activity as new task. Settings app has a new 2-pane layout for larger screens. Activities that belong to other apps must now be started as a new task. Fix: 197702325 Test: manual Change-Id: Iaf800b7f9e6bf5d925047fed49d848f4d3973df7 --- .../applications/autofill/PasswordsPreferenceController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; });