Merge "Add lock icon to bouncer when scrimmed"
This commit is contained in:
committed by
Android (Google) Code Review
commit
78d99aa245
@@ -77,15 +77,20 @@
|
||||
android:contentDescription="@string/accessibility_phone_button"
|
||||
android:tint="?attr/wallpaperTextColor" />
|
||||
|
||||
<com.android.systemui.statusbar.phone.LockIcon
|
||||
android:id="@+id/lock_icon"
|
||||
<FrameLayout
|
||||
android:id="@+id/lock_icon_container"
|
||||
android:layout_width="@dimen/keyguard_lock_width"
|
||||
android:layout_height="@dimen/keyguard_lock_height"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="@dimen/keyguard_lock_padding"
|
||||
android:src="@*android:drawable/ic_lock"
|
||||
android:contentDescription="@string/accessibility_unlock_button"
|
||||
android:scaleType="center" />
|
||||
android:layout_marginBottom="@dimen/keyguard_lock_padding">
|
||||
<com.android.systemui.statusbar.phone.LockIcon
|
||||
android:id="@+id/lock_icon"
|
||||
android:layout_width="@dimen/keyguard_lock_width"
|
||||
android:layout_height="@dimen/keyguard_lock_height"
|
||||
android:src="@*android:drawable/ic_lock"
|
||||
android:contentDescription="@string/accessibility_unlock_button"
|
||||
android:scaleType="center" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/overlay_container"
|
||||
|
||||
@@ -122,6 +122,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
||||
private KeyguardAffordanceView mRightAffordanceView;
|
||||
private KeyguardAffordanceView mLeftAffordanceView;
|
||||
private LockIcon mLockIcon;
|
||||
private ViewGroup mLockIconContainer;
|
||||
private ViewGroup mIndicationArea;
|
||||
private TextView mEnterpriseDisclosure;
|
||||
private TextView mIndicationText;
|
||||
@@ -244,6 +245,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
||||
mRightAffordanceView = findViewById(R.id.camera_button);
|
||||
mLeftAffordanceView = findViewById(R.id.left_button);
|
||||
mLockIcon = findViewById(R.id.lock_icon);
|
||||
mLockIconContainer = findViewById(R.id.lock_icon_container);
|
||||
mIndicationArea = findViewById(R.id.keyguard_indication_area);
|
||||
mEnterpriseDisclosure = findViewById(
|
||||
R.id.keyguard_indication_enterprise_disclosure);
|
||||
@@ -657,6 +659,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
||||
return mLockIcon;
|
||||
}
|
||||
|
||||
public ViewGroup getLockIconContainer() {
|
||||
return mLockIconContainer;
|
||||
}
|
||||
|
||||
public View getIndicationArea() {
|
||||
return mIndicationArea;
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ public class KeyguardBouncer {
|
||||
return;
|
||||
}
|
||||
ensureView();
|
||||
mIsScrimmed = isScrimmed;
|
||||
|
||||
// On the keyguard, we want to show the bouncer when the user drags up, but it's
|
||||
// not correct to end the falsing session. We still need to verify if those touches
|
||||
@@ -132,13 +133,13 @@ public class KeyguardBouncer {
|
||||
if (isScrimmed) {
|
||||
setExpansion(EXPANSION_VISIBLE);
|
||||
}
|
||||
mIsScrimmed = isScrimmed;
|
||||
|
||||
if (resetSecuritySelection) {
|
||||
// showPrimarySecurityScreen() updates the current security method. This is needed in
|
||||
// case we are already showing and the current security method changed.
|
||||
showPrimarySecurityScreen();
|
||||
}
|
||||
|
||||
if (mRoot.getVisibility() == View.VISIBLE || mShowingSoon) {
|
||||
return;
|
||||
}
|
||||
@@ -168,8 +169,8 @@ public class KeyguardBouncer {
|
||||
mCallback.onBouncerVisiblityChanged(true /* shown */);
|
||||
}
|
||||
|
||||
public boolean isShowingScrimmed() {
|
||||
return isShowing() && mIsScrimmed;
|
||||
public boolean isScrimmed() {
|
||||
return mIsScrimmed;
|
||||
}
|
||||
|
||||
public ViewGroup getLockIconContainer() {
|
||||
@@ -281,6 +282,7 @@ public class KeyguardBouncer {
|
||||
StatsLog.KEYGUARD_BOUNCER_STATE_CHANGED__STATE__HIDDEN);
|
||||
mDismissCallbackRegistry.notifyDismissCancelled();
|
||||
}
|
||||
mIsScrimmed = false;
|
||||
mFalsingManager.onBouncerHidden();
|
||||
mCallback.onBouncerVisiblityChanged(false /* shown */);
|
||||
cancelShowRunnable();
|
||||
|
||||
@@ -3040,6 +3040,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
}
|
||||
|
||||
ViewGroup bouncerContainer = mBouncer.getLockIconContainer();
|
||||
ViewGroup bottomContainer = mKeyguardBottomArea.getLockIconContainer();
|
||||
LockIcon lockIcon = mKeyguardBottomArea.getLockIcon();
|
||||
|
||||
if (mBouncer.isAnimatingAway()) {
|
||||
@@ -3051,9 +3052,21 @@ public class NotificationPanelView extends PanelView implements
|
||||
return;
|
||||
}
|
||||
|
||||
// Lock icon needs to be re-parented in case of a scrimmed bouncer,
|
||||
// otherwise it would be under the scrim.
|
||||
if (mBouncer.isScrimmed() && bouncerContainer != null
|
||||
&& lockIcon.getParent() != bouncerContainer) {
|
||||
((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
|
||||
bouncerContainer.addView(lockIcon);
|
||||
} else if (!mBouncer.isScrimmed() && bottomContainer != null
|
||||
&& lockIcon.getParent() != bottomContainer) {
|
||||
((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
|
||||
bottomContainer.addView(lockIcon);
|
||||
}
|
||||
|
||||
float translation = 0;
|
||||
if (bouncerContainer != null) {
|
||||
float bottomAreaContainerY = getCommonTop(lockIcon);
|
||||
if (bouncerContainer != null && bottomContainer != null && !mBouncer.isScrimmed()) {
|
||||
float bottomAreaContainerY = getCommonTop(bottomContainer);
|
||||
float bouncerLockY = getCommonTop(bouncerContainer);
|
||||
if (bouncerLockY < bottomAreaContainerY) {
|
||||
translation = bouncerLockY - bottomAreaContainerY;
|
||||
|
||||
@@ -86,6 +86,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
public void onFullyShown() {
|
||||
updateStates();
|
||||
mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE");
|
||||
mNotificationPanelView.updateLockIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,6 +97,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
@Override
|
||||
public void onFullyHidden() {
|
||||
updateStates();
|
||||
mNotificationPanelView.updateLockIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -759,7 +761,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
|
||||
public boolean bouncerNeedsScrimming() {
|
||||
return mOccluded || mBouncer.willDismissWithAction() || mBouncer.needsFullscreenBouncer()
|
||||
|| mStatusBar.isFullScreenUserSwitcherState() || mBouncer.isShowingScrimmed();
|
||||
|| mStatusBar.isFullScreenUserSwitcherState()
|
||||
|| (mBouncer.isShowing() && mBouncer.isScrimmed());
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -336,11 +337,25 @@ public class KeyguardBouncerTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsShowingScrimmed() {
|
||||
public void testIsShowingScrimmed_true() {
|
||||
doAnswer(invocation -> {
|
||||
assertThat(mBouncer.isScrimmed()).isTrue();
|
||||
return null;
|
||||
}).when(mExpansionCallback).onFullyShown();
|
||||
mBouncer.show(false /* resetSecuritySelection */, true /* animate */);
|
||||
assertThat(mBouncer.isShowingScrimmed()).isTrue();
|
||||
assertThat(mBouncer.isScrimmed()).isTrue();
|
||||
mBouncer.hide(false /* destroyView */);
|
||||
assertThat(mBouncer.isScrimmed()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsShowingScrimmed_false() {
|
||||
doAnswer(invocation -> {
|
||||
assertThat(mBouncer.isScrimmed()).isFalse();
|
||||
return null;
|
||||
}).when(mExpansionCallback).onFullyShown();
|
||||
mBouncer.show(false /* resetSecuritySelection */, false /* animate */);
|
||||
assertThat(mBouncer.isShowingScrimmed()).isFalse();
|
||||
assertThat(mBouncer.isScrimmed()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -120,7 +120,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void onPanelExpansionChanged_neverHidesScrimmedBouncer() {
|
||||
when(mBouncer.isShowingScrimmed()).thenReturn(true);
|
||||
when(mBouncer.isShowing()).thenReturn(true);
|
||||
when(mBouncer.isScrimmed()).thenReturn(true);
|
||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
|
||||
true /* tracking */);
|
||||
verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_VISIBLE));
|
||||
|
||||
Reference in New Issue
Block a user