Merge "Don't show KeyguardPresentation on the display which is always unlocked" into tm-dev am: 300f68deaf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17956063 Change-Id: Ibff17b901c9acda4219b1ffa713ea3c55d58508e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
package com.android.keyguard;
|
package com.android.keyguard;
|
||||||
|
|
||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
import static android.view.Display.DEFAULT_DISPLAY_GROUP;
|
|
||||||
|
|
||||||
import android.app.Presentation;
|
import android.app.Presentation;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -119,10 +118,9 @@ public class KeyguardDisplayManager {
|
|||||||
if (DEBUG) Log.i(TAG, "Do not show KeyguardPresentation on a private display");
|
if (DEBUG) Log.i(TAG, "Do not show KeyguardPresentation on a private display");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mTmpDisplayInfo.displayGroupId != DEFAULT_DISPLAY_GROUP) {
|
if ((mTmpDisplayInfo.flags & Display.FLAG_ALWAYS_UNLOCKED) != 0) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.i(TAG,
|
Log.i(TAG, "Do not show KeyguardPresentation on an unlocked display");
|
||||||
"Do not show KeyguardPresentation on a non-default group display");
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class KeyguardDisplayManagerTest extends SysuiTestCase {
|
|||||||
private Display mSecondaryDisplay;
|
private Display mSecondaryDisplay;
|
||||||
|
|
||||||
// This display is in a different group from the default and secondary displays.
|
// This display is in a different group from the default and secondary displays.
|
||||||
private Display mDifferentGroupDisplay;
|
private Display mAlwaysUnlockedDisplay;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -86,12 +86,12 @@ public class KeyguardDisplayManagerTest extends SysuiTestCase {
|
|||||||
Display.DEFAULT_DISPLAY + 1,
|
Display.DEFAULT_DISPLAY + 1,
|
||||||
new DisplayInfo(), DEFAULT_DISPLAY_ADJUSTMENTS);
|
new DisplayInfo(), DEFAULT_DISPLAY_ADJUSTMENTS);
|
||||||
|
|
||||||
DisplayInfo differentGroupInfo = new DisplayInfo();
|
DisplayInfo alwaysUnlockedDisplayInfo = new DisplayInfo();
|
||||||
differentGroupInfo.displayId = Display.DEFAULT_DISPLAY + 2;
|
alwaysUnlockedDisplayInfo.displayId = Display.DEFAULT_DISPLAY + 2;
|
||||||
differentGroupInfo.displayGroupId = Display.DEFAULT_DISPLAY_GROUP + 1;
|
alwaysUnlockedDisplayInfo.flags = Display.FLAG_ALWAYS_UNLOCKED;
|
||||||
mDifferentGroupDisplay = new Display(DisplayManagerGlobal.getInstance(),
|
mAlwaysUnlockedDisplay = new Display(DisplayManagerGlobal.getInstance(),
|
||||||
Display.DEFAULT_DISPLAY,
|
Display.DEFAULT_DISPLAY,
|
||||||
differentGroupInfo, DEFAULT_DISPLAY_ADJUSTMENTS);
|
alwaysUnlockedDisplayInfo, DEFAULT_DISPLAY_ADJUSTMENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -110,18 +110,18 @@ public class KeyguardDisplayManagerTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShow_includeNonDefaultGroupDisplay() {
|
public void testShow_includeAlwaysUnlockedDisplay() {
|
||||||
when(mDisplayManager.getDisplays()).thenReturn(
|
when(mDisplayManager.getDisplays()).thenReturn(
|
||||||
new Display[]{mDefaultDisplay, mDifferentGroupDisplay});
|
new Display[]{mDefaultDisplay, mAlwaysUnlockedDisplay});
|
||||||
|
|
||||||
mManager.show();
|
mManager.show();
|
||||||
verify(mManager, never()).createPresentation(any());
|
verify(mManager, never()).createPresentation(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShow_includeSecondaryAndNonDefaultGroupDisplays() {
|
public void testShow_includeSecondaryAndAlwaysUnlockedDisplays() {
|
||||||
when(mDisplayManager.getDisplays()).thenReturn(
|
when(mDisplayManager.getDisplays()).thenReturn(
|
||||||
new Display[]{mDefaultDisplay, mSecondaryDisplay, mDifferentGroupDisplay});
|
new Display[]{mDefaultDisplay, mSecondaryDisplay, mAlwaysUnlockedDisplay});
|
||||||
|
|
||||||
mManager.show();
|
mManager.show();
|
||||||
verify(mManager, times(1)).createPresentation(eq(mSecondaryDisplay));
|
verify(mManager, times(1)).createPresentation(eq(mSecondaryDisplay));
|
||||||
|
|||||||
Reference in New Issue
Block a user