summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Iris Yang <irisykyang@google.com> 2022-04-26 17:00:38 +0800
committer Iris Yang <irisykyang@google.com> 2022-04-28 23:56:47 +0000
commit07550e290b880bc61e29ea97398b7ab0c7823455 (patch)
tree8fa4b4d813d3acf8d566efb03c8d74b59b7b8fe2
parent48d602a8a66340acc425a5810ac3fbd3442e344f (diff)
Don't show KeyguardPresentation on the display which is always unlocked
It's already the case that always unlocked display are in their own group, so with the existing logic we wont' show KeyguardPresentation on them. It's displays that are NOT always unlocked but also in a non-default group that we're changing to show KeyguardPresentation on. Bug: 218587709 Test: atest KeyguardDisplayManagerTest Change-Id: Idf1f71b59941daeb30f1bef3d87717e01e8d8f0f
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java6
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardDisplayManagerTest.java20
2 files changed, 12 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
index 1ede76fb1fa4..02776a295359 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
@@ -16,7 +16,6 @@
package com.android.keyguard;
import static android.view.Display.DEFAULT_DISPLAY;
-import static android.view.Display.DEFAULT_DISPLAY_GROUP;
import android.app.Presentation;
import android.content.Context;
@@ -119,10 +118,9 @@ public class KeyguardDisplayManager {
if (DEBUG) Log.i(TAG, "Do not show KeyguardPresentation on a private display");
return false;
}
- if (mTmpDisplayInfo.displayGroupId != DEFAULT_DISPLAY_GROUP) {
+ if ((mTmpDisplayInfo.flags & Display.FLAG_ALWAYS_UNLOCKED) != 0) {
if (DEBUG) {
- Log.i(TAG,
- "Do not show KeyguardPresentation on a non-default group display");
+ Log.i(TAG, "Do not show KeyguardPresentation on an unlocked display");
}
return false;
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardDisplayManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardDisplayManagerTest.java
index 4beec574cd2a..01365b43b4b8 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardDisplayManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardDisplayManagerTest.java
@@ -70,7 +70,7 @@ public class KeyguardDisplayManagerTest extends SysuiTestCase {
private Display mSecondaryDisplay;
// This display is in a different group from the default and secondary displays.
- private Display mDifferentGroupDisplay;
+ private Display mAlwaysUnlockedDisplay;
@Before
public void setUp() {
@@ -86,12 +86,12 @@ public class KeyguardDisplayManagerTest extends SysuiTestCase {
Display.DEFAULT_DISPLAY + 1,
new DisplayInfo(), DEFAULT_DISPLAY_ADJUSTMENTS);
- DisplayInfo differentGroupInfo = new DisplayInfo();
- differentGroupInfo.displayId = Display.DEFAULT_DISPLAY + 2;
- differentGroupInfo.displayGroupId = Display.DEFAULT_DISPLAY_GROUP + 1;
- mDifferentGroupDisplay = new Display(DisplayManagerGlobal.getInstance(),
+ DisplayInfo alwaysUnlockedDisplayInfo = new DisplayInfo();
+ alwaysUnlockedDisplayInfo.displayId = Display.DEFAULT_DISPLAY + 2;
+ alwaysUnlockedDisplayInfo.flags = Display.FLAG_ALWAYS_UNLOCKED;
+ mAlwaysUnlockedDisplay = new Display(DisplayManagerGlobal.getInstance(),
Display.DEFAULT_DISPLAY,
- differentGroupInfo, DEFAULT_DISPLAY_ADJUSTMENTS);
+ alwaysUnlockedDisplayInfo, DEFAULT_DISPLAY_ADJUSTMENTS);
}
@Test
@@ -110,18 +110,18 @@ public class KeyguardDisplayManagerTest extends SysuiTestCase {
}
@Test
- public void testShow_includeNonDefaultGroupDisplay() {
+ public void testShow_includeAlwaysUnlockedDisplay() {
when(mDisplayManager.getDisplays()).thenReturn(
- new Display[]{mDefaultDisplay, mDifferentGroupDisplay});
+ new Display[]{mDefaultDisplay, mAlwaysUnlockedDisplay});
mManager.show();
verify(mManager, never()).createPresentation(any());
}
@Test
- public void testShow_includeSecondaryAndNonDefaultGroupDisplays() {
+ public void testShow_includeSecondaryAndAlwaysUnlockedDisplays() {
when(mDisplayManager.getDisplays()).thenReturn(
- new Display[]{mDefaultDisplay, mSecondaryDisplay, mDifferentGroupDisplay});
+ new Display[]{mDefaultDisplay, mSecondaryDisplay, mAlwaysUnlockedDisplay});
mManager.show();
verify(mManager, times(1)).createPresentation(eq(mSecondaryDisplay));