Several app transition fixes:

> If launcher already started, creating the state transition only after threshold crossed, so that previous animations are not cancelled
> Not posting animaiton callbacks at the front of the queue, as that sometimes causes it get executed before onNewIntent
> Farking the activity as forceInvisible while launching an opaque app, so that quickly pressing home/back runs the reverse animation
> Not running state animations when force-invisible is true

Bug: 77830325
Bug: 77898806
Change-Id: I50a7e915ca35fd6aeb284c8f321ecca74396fe98
This commit is contained in:
Sunny Goyal
2018-04-11 15:30:46 -07:00
parent e9f31c1014
commit 7eff40ff2d
5 changed files with 104 additions and 62 deletions

View File

@@ -16,12 +16,15 @@
package com.android.launcher3;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Point;
import android.support.annotation.IntDef;
import android.view.Display;
import android.view.View.AccessibilityDelegate;
@@ -29,10 +32,22 @@ import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.util.SystemUiController;
import java.lang.annotation.Retention;
import java.util.ArrayList;
public abstract class BaseActivity extends Activity {
public static final int INVISIBLE_BY_STATE_HANDLER = 1 << 0;
public static final int INVISIBLE_BY_APP_TRANSITIONS = 1 << 1;
public static final int INVISIBLE_ALL =
INVISIBLE_BY_STATE_HANDLER | INVISIBLE_BY_APP_TRANSITIONS;
@Retention(SOURCE)
@IntDef(
flag = true,
value = {INVISIBLE_BY_STATE_HANDLER, INVISIBLE_BY_APP_TRANSITIONS})
public @interface InvisibilityFlags{}
private final ArrayList<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
private final ArrayList<MultiWindowModeChangedListener> mMultiWindowModeChangedListeners =
new ArrayList<>();
@@ -42,10 +57,11 @@ public abstract class BaseActivity extends Activity {
protected SystemUiController mSystemUiController;
private boolean mStarted;
private boolean mUserActive;
// When the recents animation is running, the visibility of the Launcher is managed by the
// animation
private boolean mForceInvisible;
private boolean mUserActive;
@InvisibilityFlags private int mForceInvisible;
public DeviceProfile getDeviceProfile() {
return mDeviceProfile;
@@ -114,7 +130,7 @@ public abstract class BaseActivity extends Activity {
@Override
protected void onStop() {
mStarted = false;
mForceInvisible = false;
mForceInvisible = 0;
super.onStop();
}
@@ -153,15 +169,20 @@ public abstract class BaseActivity extends Activity {
* recents animation.
* @see LauncherAppTransitionManagerImpl.getWallpaperOpenRunner()
*/
public void setForceInvisible(boolean invisible) {
mForceInvisible = invisible;
public void addForceInvisibleFlag(@InvisibilityFlags int flag) {
mForceInvisible |= flag;
}
public void clearForceInvisibleFlag(@InvisibilityFlags int flag) {
mForceInvisible &= ~flag;
}
/**
* @return Wether this activity should be considered invisible regardless of actual visibility.
*/
public boolean isForceInvisible() {
return mForceInvisible;
return mForceInvisible != 0;
}
/**