Merge "Avoid crash when widget previews have no intrinsic size" into ub-launcher3-edmonton
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index cac7606..aadd44f 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -18,16 +18,14 @@
import static android.content.Intent.ACTION_PACKAGE_ADDED;
import static android.content.Intent.ACTION_PACKAGE_CHANGED;
import static android.content.Intent.ACTION_PACKAGE_REMOVED;
-
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
-import static com.android.systemui.shared.system.ActivityManagerWrapper
- .CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
-import static com.android.systemui.shared.system.PackageManagerWrapper
- .ACTION_PREFERRED_ACTIVITY_CHANGED;
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR;
+import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
+import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
+import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
@@ -37,7 +35,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ResolveInfo;
-import android.graphics.Matrix.ScaleToFit;
import android.graphics.Rect;
import android.os.Build;
import android.os.PatternMatcher;
@@ -49,7 +46,7 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.MainThreadExecutor;
-import com.android.launcher3.anim.AnimatorPlaybackController;
+import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.quickstep.ActivityControlHelper.ActivityInitListener;
import com.android.quickstep.ActivityControlHelper.AnimationFactory;
import com.android.quickstep.ActivityControlHelper.FallbackActivityControllerHelper;
@@ -210,6 +207,7 @@
private ActivityInitListener mListener;
private T mActivity;
+ private RecentsView mRecentsView;
public RecentsActivityCommand() {
mHelper = getActivityControlHelper();
@@ -271,6 +269,8 @@
factory.createActivityController(RECENTS_LAUNCH_DURATION);
}
mActivity = activity;
+ mRecentsView = mActivity.getOverviewPanel();
+ mRecentsView.setFirstTaskIconScaledDown(true /* isScaledDown */, false /* animate */);
return false;
}
@@ -280,6 +280,15 @@
}
RemoteAnimationProvider.showOpeningTarget(targetCompats);
AnimatorSet anim = new AnimatorSet();
+ anim.addListener(new AnimationSuccessListener() {
+ @Override
+ public void onAnimationSuccess(Animator animator) {
+ if (mRecentsView != null) {
+ mRecentsView.setFirstTaskIconScaledDown(false /* isScaledDown */,
+ true /* animate */);
+ }
+ }
+ });
if (mActivity == null) {
Log.e(TAG, "Animation created, before activity");
anim.play(ValueAnimator.ofInt(0, 1).setDuration(100));
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index d69beb6..90749eb 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -35,6 +35,7 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
+import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.util.LayoutUtils;
/**
@@ -118,6 +119,12 @@
public AnimatorSet createAdjacentPageAnimForTaskLaunch(TaskView tv) {
AnimatorSet anim = super.createAdjacentPageAnimForTaskLaunch(tv);
+ if (!OverviewInteractionState.getInstance(mActivity).isSwipeUpGestureEnabled()) {
+ // Hotseat doesn't move when opening recents with the button,
+ // so don't animate it here either.
+ return anim;
+ }
+
float allAppsProgressOffscreen = ALL_APPS_PROGRESS_OFF_SCREEN;
LauncherState state = mActivity.getStateManager().getState();
if ((state.getVisibleElements(mActivity) & ALL_APPS_HEADER_EXTRA) != 0) {