Fix issue with alphas not being applied to the same view on unlock
- It's possible for the nav bar configuration to change between locking
and unlocking the phone, which will prevent the alpha from being
restored on the bar layout correctly. This change updates the alpha
of both vertical/horizontal layouts in NavBarView since they should
always be in sync.
Bug: 206733387
Test: atest SystemUITests
Test: Lock screen in landscape app, turn screen on and unlock
Change-Id: I265d04e6e2192f2bb57b1f8d77390664236427fc
(cherry picked from commit 9b53d2ecab)
This commit is contained in:
@@ -108,6 +108,7 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
private final int mNavColorSampleMargin;
|
private final int mNavColorSampleMargin;
|
||||||
private final SysUiState mSysUiFlagContainer;
|
private final SysUiState mSysUiFlagContainer;
|
||||||
|
|
||||||
|
// The current view is one of mHorizontal or mVertical depending on the current configuration
|
||||||
View mCurrentView = null;
|
View mCurrentView = null;
|
||||||
private View mVertical;
|
private View mVertical;
|
||||||
private View mHorizontal;
|
private View mHorizontal;
|
||||||
@@ -370,12 +371,6 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onSetAlpha(int alpha) {
|
|
||||||
Log.e(TAG, "onSetAlpha", new Throwable());
|
|
||||||
return super.onSetAlpha(alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoHideController(AutoHideController autoHideController) {
|
public void setAutoHideController(AutoHideController autoHideController) {
|
||||||
mAutoHideController = autoHideController;
|
mAutoHideController = autoHideController;
|
||||||
}
|
}
|
||||||
@@ -474,6 +469,18 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
return mCurrentView;
|
return mCurrentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies {@param consumer} to each of the nav bar views.
|
||||||
|
*/
|
||||||
|
public void forEachView(Consumer<View> consumer) {
|
||||||
|
if (mVertical != null) {
|
||||||
|
consumer.accept(mVertical);
|
||||||
|
}
|
||||||
|
if (mHorizontal != null) {
|
||||||
|
consumer.accept(mHorizontal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public RotationButtonController getRotationButtonController() {
|
public RotationButtonController getRotationButtonController() {
|
||||||
return mRotationButtonController;
|
return mRotationButtonController;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -552,12 +552,13 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
public void onStartedWakingUp() {
|
public void onStartedWakingUp() {
|
||||||
mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
|
mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
|
||||||
.setAnimationsDisabled(false);
|
.setAnimationsDisabled(false);
|
||||||
View currentView = getCurrentNavBarView();
|
NavigationBarView navBarView = mStatusBar.getNavigationBarView();
|
||||||
if (currentView != null) {
|
if (navBarView != null) {
|
||||||
currentView.animate()
|
navBarView.forEachView(view ->
|
||||||
.alpha(1f)
|
view.animate()
|
||||||
.setDuration(NAV_BAR_CONTENT_FADE_DURATION)
|
.alpha(1f)
|
||||||
.start();
|
.setDuration(NAV_BAR_CONTENT_FADE_DURATION)
|
||||||
|
.start());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,12 +566,13 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
public void onStartedGoingToSleep() {
|
public void onStartedGoingToSleep() {
|
||||||
mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
|
mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
|
||||||
.setAnimationsDisabled(true);
|
.setAnimationsDisabled(true);
|
||||||
View currentView = getCurrentNavBarView();
|
NavigationBarView navBarView = mStatusBar.getNavigationBarView();
|
||||||
if (currentView != null) {
|
if (navBarView != null) {
|
||||||
currentView.animate()
|
navBarView.forEachView(view ->
|
||||||
.alpha(0f)
|
view.animate()
|
||||||
.setDuration(NAV_BAR_CONTENT_FADE_DURATION)
|
.alpha(0f)
|
||||||
.start();
|
.setDuration(NAV_BAR_CONTENT_FADE_DURATION)
|
||||||
|
.start());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,17 +998,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
mStatusBar.onKeyguardViewManagerStatesUpdated();
|
mStatusBar.onKeyguardViewManagerStatesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the visibility of the nav bar content views.
|
|
||||||
*/
|
|
||||||
private void updateNavigationBarContentVisibility(boolean navBarContentVisible) {
|
|
||||||
final NavigationBarView navBarView = mStatusBar.getNavigationBarView();
|
|
||||||
if (navBarView != null && navBarView.getCurrentView() != null) {
|
|
||||||
final View currentView = navBarView.getCurrentView();
|
|
||||||
currentView.setVisibility(navBarContentVisible ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private View getCurrentNavBarView() {
|
private View getCurrentNavBarView() {
|
||||||
final NavigationBarView navBarView = mStatusBar.getNavigationBarView();
|
final NavigationBarView navBarView = mStatusBar.getNavigationBarView();
|
||||||
return navBarView != null ? navBarView.getCurrentView() : null;
|
return navBarView != null ? navBarView.getCurrentView() : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user