Merge "Update shelf offset earlier when in gesture nav" into ub-launcher3-rvc-dev

This commit is contained in:
Winson Chung
2020-05-14 18:55:25 +00:00
committed by Android (Google) Code Review
6 changed files with 27 additions and 9 deletions
@@ -100,7 +100,7 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
onStateOrResumeChanged();
onStateOrResumeChanging(false /* inTransition */);
}
@Override
@@ -115,11 +115,9 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
@Override
protected void onActivityFlagsChanged(int changeBits) {
super.onActivityFlagsChanged(changeBits);
if ((changeBits & (ACTIVITY_STATE_DEFERRED_RESUMED | ACTIVITY_STATE_STARTED
| ACTIVITY_STATE_USER_ACTIVE | ACTIVITY_STATE_TRANSITION_ACTIVE)) != 0
&& (getActivityFlags() & ACTIVITY_STATE_TRANSITION_ACTIVE) == 0) {
onStateOrResumeChanged();
| ACTIVITY_STATE_USER_ACTIVE | ACTIVITY_STATE_TRANSITION_ACTIVE)) != 0) {
onStateOrResumeChanging((getActivityFlags() & ACTIVITY_STATE_TRANSITION_ACTIVE) == 0);
}
if (mHotseatPredictionController != null && ((changeBits & ACTIVITY_STATE_STARTED) != 0
@@ -164,14 +162,16 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
/**
* Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
*/
private void onStateOrResumeChanged() {
private void onStateOrResumeChanging(boolean inTransition) {
LauncherState state = getStateManager().getState();
DeviceProfile profile = getDeviceProfile();
boolean visible = (state == NORMAL || state == OVERVIEW) && isUserActive()
boolean willUserBeActive = (getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
boolean visible = (state == NORMAL || state == OVERVIEW)
&& (willUserBeActive || isUserActive())
&& !profile.isVerticalBarLayout();
UiThreadHelper.runAsyncCommand(this, SET_SHELF_HEIGHT, visible ? 1 : 0,
profile.hotseatBarSizePx);
if (state == NORMAL) {
if (state == NORMAL && !inTransition) {
((RecentsView) getOverviewPanel()).setSwipeDownShouldLaunchApp(false);
}
}
@@ -290,6 +290,11 @@ public final class LauncherActivityInterface extends
return true;
}
@Override
public void setHintUserWillBeActive() {
getCreatedActivity().setHintUserWillBeActive();
}
@Override
public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
return deviceState.isInDeferredGestureRegion(ev);
@@ -939,6 +939,7 @@ public class LauncherSwipeHandler extends BaseSwipeUpHandler<Launcher, RecentsVi
: null;
mActivity.getRootView().setForceHideBackArrow(true);
mActivityInterface.setHintUserWillBeActive();
homeAnimFactory = new HomeAnimationFactory(floatingIconView) {
@@ -304,4 +304,8 @@ public abstract class BaseQuickstepLauncher extends Launcher
public ShelfPeekAnim getShelfPeekAnim() {
return mShelfPeekAnim;
}
public void setHintUserWillBeActive() {
addActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
}
}
@@ -174,6 +174,8 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
recentsView.switchToScreenshot(thumbnailData, runnable);
}
public void setHintUserWillBeActive() {}
/**
* Sets the expected window size in multi-window mode
*/
+7 -1
View File
@@ -107,10 +107,15 @@ public abstract class BaseActivity extends Activity implements LogStateProvider,
*/
public static final int ACTIVITY_STATE_USER_ACTIVE = 1 << 4;
/**
* State flag indicating if the user will be active shortly.
*/
public static final int ACTIVITY_STATE_USER_WILL_BE_ACTIVE = 1 << 5;
/**
* State flag indicating that a state transition is in progress
*/
public static final int ACTIVITY_STATE_TRANSITION_ACTIVE = 1 << 5;
public static final int ACTIVITY_STATE_TRANSITION_ACTIVE = 1 << 6;
@Retention(SOURCE)
@IntDef(
@@ -180,6 +185,7 @@ public abstract class BaseActivity extends Activity implements LogStateProvider,
@Override
protected void onResume() {
addActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_USER_ACTIVE);
removeActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
super.onResume();
}