Account for various launcher states when setting back button alpha
- Previously we only check for the flag which is always true in the normal launcher state, so if the animation starts, we could end up writing the back alpha value without accounting for window focus or any other states that launcher is in that affects back button visibility Bug: 155129739 Test: Open -1 article and hit back Change-Id: I42d27a192b23f394f8565a6893ce092603e31654
This commit is contained in:
parent
eb885026ed
commit
2a00f81327
|
@ -252,13 +252,10 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
|||
super.onActivityFlagsChanged(changeBits);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the back button visibility based on the current state/window focus.
|
||||
*/
|
||||
private void onLauncherStateOrFocusChanged() {
|
||||
public boolean shouldBackButtonBeHidden(LauncherState toState) {
|
||||
Mode mode = SysUINavigationMode.getMode(this);
|
||||
boolean shouldBackButtonBeHidden = mode.hasGestures
|
||||
&& getStateManager().getState().hasFlag(FLAG_HIDE_BACK_BUTTON)
|
||||
&& toState.hasFlag(FLAG_HIDE_BACK_BUTTON)
|
||||
&& hasWindowFocus()
|
||||
&& (getActivityFlags() & ACTIVITY_STATE_TRANSITION_ACTIVE) == 0;
|
||||
if (shouldBackButtonBeHidden) {
|
||||
|
@ -266,6 +263,14 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
|||
shouldBackButtonBeHidden = AbstractFloatingView.getTopOpenViewWithType(this,
|
||||
TYPE_ALL & ~TYPE_HIDE_BACK_BUTTON) == null;
|
||||
}
|
||||
return shouldBackButtonBeHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the back button visibility based on the current state/window focus.
|
||||
*/
|
||||
private void onLauncherStateOrFocusChanged() {
|
||||
boolean shouldBackButtonBeHidden = shouldBackButtonBeHidden(getStateManager().getState());
|
||||
UiThreadHelper.setBackButtonAlphaAsync(this, SET_BACK_BUTTON_ALPHA,
|
||||
shouldBackButtonBeHidden ? 0f : 1f, true /* animate */);
|
||||
if (getDragLayer() != null) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class BackButtonAlphaHandler implements LauncherStateManager.StateHandler
|
|||
|
||||
mBackAlpha.value = SystemUiProxy.INSTANCE.get(mLauncher).getLastBackButtonAlpha();
|
||||
animation.setFloat(mBackAlpha, VALUE,
|
||||
toState.hasFlag(FLAG_HIDE_BACK_BUTTON) ? 0 : 1, LINEAR);
|
||||
mLauncher.shouldBackButtonBeHidden(toState) ? 0 : 1, LINEAR);
|
||||
}
|
||||
|
||||
private void updateBackAlpha() {
|
||||
|
|
Loading…
Reference in New Issue