Loading services/core/java/com/android/server/am/LockTaskController.java +5 −5 Original line number Diff line number Diff line Loading @@ -472,7 +472,7 @@ public class LockTaskController { setStatusBarState(LOCK_TASK_MODE_NONE, userId); setKeyguardState(LOCK_TASK_MODE_NONE, userId); if (mLockTaskModeState == LOCK_TASK_MODE_PINNED) { lockKeyguardIfNeeded(); lockKeyguardIfNeeded(userId); } if (getDevicePolicyManager() != null) { getDevicePolicyManager().notifyLockTaskModeChanged(false, null, userId); Loading Loading @@ -776,15 +776,15 @@ public class LockTaskController { * Helper method for locking the device immediately. This may be necessary when the device * leaves the pinned mode. */ private void lockKeyguardIfNeeded() { if (shouldLockKeyguard()) { private void lockKeyguardIfNeeded(int userId) { if (shouldLockKeyguard(userId)) { mWindowManager.lockNow(null); mWindowManager.dismissKeyguard(null /* callback */, null /* message */); getLockPatternUtils().requireCredentialEntry(USER_ALL); } } private boolean shouldLockKeyguard() { private boolean shouldLockKeyguard(int userId) { // This functionality should be kept consistent with // com.android.settings.security.ScreenPinningSettings (see b/127605586) try { Loading @@ -794,7 +794,7 @@ public class LockTaskController { } catch (Settings.SettingNotFoundException e) { // Log to SafetyNet for b/127605586 android.util.EventLog.writeEvent(0x534e4554, "127605586", -1, ""); return getLockPatternUtils().isSecure(USER_CURRENT); return getLockPatternUtils().isSecure(userId); } } Loading services/core/java/com/android/server/notification/SnoozeHelper.java +1 −0 Original line number Diff line number Diff line Loading @@ -309,6 +309,7 @@ public class SnoozeHelper { return PendingIntent.getBroadcast(mContext, REQUEST_CODE_REPOST, new Intent(REPOST_ACTION) .setPackage("android") .setData(new Uri.Builder().scheme(REPOST_SCHEME).appendPath(key).build()) .addFlags(Intent.FLAG_RECEIVER_FOREGROUND) .putExtra(EXTRA_KEY, key) Loading services/tests/servicestests/src/com/android/server/am/LockTaskControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -428,7 +428,7 @@ public class LockTaskControllerTest { Settings.Secure.clearProviderForTest(); // AND a password is set when(mLockPatternUtils.isSecure(anyInt())) when(mLockPatternUtils.isSecure(TEST_USER_ID)) .thenReturn(true); // AND there is a task record Loading services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.android.server.UiServiceTestCase; import com.android.server.pm.PackageManagerService; @SmallTest Loading Loading @@ -80,6 +81,16 @@ public class SnoozeHelperTest extends UiServiceTestCase { UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey())); } @Test public void testSnoozeSentToAndroid() throws Exception { NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); mSnoozeHelper.snooze(r, 1000); ArgumentCaptor<PendingIntent> captor = ArgumentCaptor.forClass(PendingIntent.class); verify(mAm, times(1)).setExactAndAllowWhileIdle( anyInt(), anyLong(), captor.capture()); assertEquals("android", captor.getValue().getIntent().getPackage()); } @Test public void testSnooze() throws Exception { NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); Loading Loading
services/core/java/com/android/server/am/LockTaskController.java +5 −5 Original line number Diff line number Diff line Loading @@ -472,7 +472,7 @@ public class LockTaskController { setStatusBarState(LOCK_TASK_MODE_NONE, userId); setKeyguardState(LOCK_TASK_MODE_NONE, userId); if (mLockTaskModeState == LOCK_TASK_MODE_PINNED) { lockKeyguardIfNeeded(); lockKeyguardIfNeeded(userId); } if (getDevicePolicyManager() != null) { getDevicePolicyManager().notifyLockTaskModeChanged(false, null, userId); Loading Loading @@ -776,15 +776,15 @@ public class LockTaskController { * Helper method for locking the device immediately. This may be necessary when the device * leaves the pinned mode. */ private void lockKeyguardIfNeeded() { if (shouldLockKeyguard()) { private void lockKeyguardIfNeeded(int userId) { if (shouldLockKeyguard(userId)) { mWindowManager.lockNow(null); mWindowManager.dismissKeyguard(null /* callback */, null /* message */); getLockPatternUtils().requireCredentialEntry(USER_ALL); } } private boolean shouldLockKeyguard() { private boolean shouldLockKeyguard(int userId) { // This functionality should be kept consistent with // com.android.settings.security.ScreenPinningSettings (see b/127605586) try { Loading @@ -794,7 +794,7 @@ public class LockTaskController { } catch (Settings.SettingNotFoundException e) { // Log to SafetyNet for b/127605586 android.util.EventLog.writeEvent(0x534e4554, "127605586", -1, ""); return getLockPatternUtils().isSecure(USER_CURRENT); return getLockPatternUtils().isSecure(userId); } } Loading
services/core/java/com/android/server/notification/SnoozeHelper.java +1 −0 Original line number Diff line number Diff line Loading @@ -309,6 +309,7 @@ public class SnoozeHelper { return PendingIntent.getBroadcast(mContext, REQUEST_CODE_REPOST, new Intent(REPOST_ACTION) .setPackage("android") .setData(new Uri.Builder().scheme(REPOST_SCHEME).appendPath(key).build()) .addFlags(Intent.FLAG_RECEIVER_FOREGROUND) .putExtra(EXTRA_KEY, key) Loading
services/tests/servicestests/src/com/android/server/am/LockTaskControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -428,7 +428,7 @@ public class LockTaskControllerTest { Settings.Secure.clearProviderForTest(); // AND a password is set when(mLockPatternUtils.isSecure(anyInt())) when(mLockPatternUtils.isSecure(TEST_USER_ID)) .thenReturn(true); // AND there is a task record Loading
services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.android.server.UiServiceTestCase; import com.android.server.pm.PackageManagerService; @SmallTest Loading Loading @@ -80,6 +81,16 @@ public class SnoozeHelperTest extends UiServiceTestCase { UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey())); } @Test public void testSnoozeSentToAndroid() throws Exception { NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); mSnoozeHelper.snooze(r, 1000); ArgumentCaptor<PendingIntent> captor = ArgumentCaptor.forClass(PendingIntent.class); verify(mAm, times(1)).setExactAndAllowWhileIdle( anyInt(), anyLong(), captor.capture()); assertEquals("android", captor.getValue().getIntent().getPackage()); } @Test public void testSnooze() throws Exception { NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); Loading