From 03c4fa83427366bdf66cc6c1ebbe94fa626ad0ff Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Mon, 14 Jun 2021 13:49:33 -0700 Subject: [PATCH 01/26] Update gesture nav tutorial back left and right videos Bug: 188972959 Test: manual Change-Id: I03aef0ad47f9a648f7a661c607dd3d4f1f2187c4 --- ... => gesture_tutorial_motion_back_left.xml} | 1405 +++++++--------- ...e_tutorial_motion_back_left_light_mode.xml | 1412 ---------------- ...=> gesture_tutorial_motion_back_right.xml} | 1406 +++++++--------- ..._tutorial_motion_back_right_light_mode.xml | 1413 ----------------- .../BackGestureTutorialFragment.java | 8 +- 5 files changed, 1228 insertions(+), 4416 deletions(-) rename quickstep/res/drawable/{gesture_tutorial_motion_back_left_dark_mode.xml => gesture_tutorial_motion_back_left.xml} (82%) delete mode 100644 quickstep/res/drawable/gesture_tutorial_motion_back_left_light_mode.xml rename quickstep/res/drawable/{gesture_tutorial_motion_back_right_dark_mode.xml => gesture_tutorial_motion_back_right.xml} (82%) delete mode 100644 quickstep/res/drawable/gesture_tutorial_motion_back_right_light_mode.xml diff --git a/quickstep/res/drawable/gesture_tutorial_motion_back_left_dark_mode.xml b/quickstep/res/drawable/gesture_tutorial_motion_back_left.xml similarity index 82% rename from quickstep/res/drawable/gesture_tutorial_motion_back_left_dark_mode.xml rename to quickstep/res/drawable/gesture_tutorial_motion_back_left.xml index f5ad56916b..a6860fac64 100644 --- a/quickstep/res/drawable/gesture_tutorial_motion_back_left_dark_mode.xml +++ b/quickstep/res/drawable/gesture_tutorial_motion_back_left.xml @@ -1,306 +1,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -313,11 +21,11 @@ @@ -330,11 +38,11 @@ @@ -347,11 +55,11 @@ @@ -364,11 +72,11 @@ @@ -381,11 +89,11 @@ @@ -398,11 +106,11 @@ @@ -415,11 +123,11 @@ @@ -432,11 +140,11 @@ @@ -449,11 +157,11 @@ @@ -466,11 +174,11 @@ @@ -483,11 +191,11 @@ @@ -500,11 +208,11 @@ @@ -517,11 +225,11 @@ @@ -530,203 +238,486 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -973,7 +814,7 @@ @@ -1090,104 +931,104 @@ android:viewportWidth="412"> - - + + - - - - - + android:translateX="-17.875" + android:translateY="322.017"> + android:translateX="123.282" + android:translateY="129.757"> + android:pathData=" M-109 27.43 C-109,27.43 -112.61,23.81 -112.61,23.81 C-112.61,23.81 -133.03,44.23 -133.03,44.23 C-133.03,44.23 -112.61,64.64 -112.61,64.64 C-112.61,64.64 -109,61.03 -109,61.03 C-109,61.03 -125.8,44.23 -125.8,44.23 C-125.8,44.23 -109,27.43 -109,27.43c " /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/quickstep/res/drawable/gesture_tutorial_motion_back_right_dark_mode.xml b/quickstep/res/drawable/gesture_tutorial_motion_back_right.xml similarity index 82% rename from quickstep/res/drawable/gesture_tutorial_motion_back_right_dark_mode.xml rename to quickstep/res/drawable/gesture_tutorial_motion_back_right.xml index b898dc17a6..b368d9d045 100644 --- a/quickstep/res/drawable/gesture_tutorial_motion_back_right_dark_mode.xml +++ b/quickstep/res/drawable/gesture_tutorial_motion_back_right.xml @@ -1,306 +1,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -313,11 +21,11 @@ @@ -330,11 +38,11 @@ @@ -347,11 +55,11 @@ @@ -364,11 +72,11 @@ @@ -381,11 +89,11 @@ @@ -398,11 +106,11 @@ @@ -415,11 +123,11 @@ @@ -432,11 +140,11 @@ @@ -449,11 +157,11 @@ @@ -466,11 +174,11 @@ @@ -483,11 +191,11 @@ @@ -500,11 +208,11 @@ @@ -517,11 +225,11 @@ @@ -530,203 +238,486 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -973,7 +814,7 @@ @@ -1090,104 +931,104 @@ android:viewportWidth="412"> - - + + - - - - - + android:translateX="-17.875" + android:translateY="322.017"> + android:translateX="565.282" + android:translateY="129.757"> + android:pathData=" M-109 27.43 C-109,27.43 -112.61,23.81 -112.61,23.81 C-112.61,23.81 -133.03,44.23 -133.03,44.23 C-133.03,44.23 -112.61,64.64 -112.61,64.64 C-112.61,64.64 -109,61.03 -109,61.03 C-109,61.03 -125.8,44.23 -125.8,44.23 C-125.8,44.23 -109,27.43 -109,27.43c " /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java index 32f4c58d7f..9b6afd6a97 100644 --- a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java +++ b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java @@ -29,12 +29,8 @@ public class BackGestureTutorialFragment extends TutorialFragment { @Override Integer getFeedbackVideoResId(boolean forDarkMode) { return mTutorialType == TutorialType.RIGHT_EDGE_BACK_NAVIGATION - ? (forDarkMode - ? R.drawable.gesture_tutorial_motion_back_right_dark_mode - : R.drawable.gesture_tutorial_motion_back_right_light_mode) - : (forDarkMode - ? R.drawable.gesture_tutorial_motion_back_left_dark_mode - : R.drawable.gesture_tutorial_motion_back_left_light_mode); + ? R.drawable.gesture_tutorial_motion_back_right + : R.drawable.gesture_tutorial_motion_back_left; } @Nullable From 696c6129642c02bcdceced283ffc4d220770827c Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 18 Jun 2021 17:42:18 -0700 Subject: [PATCH 02/26] Fixing TaskView.launchTask.onEndCallback is not called Sometimes onAnimaitonCancelled can be called without onCreate. Calling onEnd in this case so that the sate is cleared Removing additional subclassing for the runner Bug: 190856140 Test: Manual Change-Id: If105cb343cab446a4eac90a45184ce50c6e4c485 --- .../launcher3/BaseQuickstepLauncher.java | 2 +- .../launcher3/LauncherAnimationRunner.java | 82 ++++++++++++++----- .../launcher3/QuickstepTransitionManager.java | 39 ++++----- .../launcher3/WrappedAnimationRunnerImpl.java | 32 -------- .../WrappedLauncherAnimationRunner.java | 65 --------------- .../QuickstepInteractionHandler.java | 2 +- .../android/quickstep/RecentsActivity.java | 74 +++++++++-------- .../util/RemoteAnimationProvider.java | 7 +- .../util/SplitSelectStateController.java | 13 ++- 9 files changed, 134 insertions(+), 182 deletions(-) delete mode 100644 quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java delete mode 100644 quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 33dc6cf5bd..2498d12931 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -430,7 +430,7 @@ public abstract class BaseQuickstepLauncher extends Launcher public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) { ActivityOptionsWrapper activityOptions = mAppTransitionManager.hasControlRemoteAppTransitionPermission() - ? mAppTransitionManager.getActivityLaunchOptions(this, v) + ? mAppTransitionManager.getActivityLaunchOptions(v) : super.getActivityLaunchOptions(v, item); if (mLastTouchUpTime > 0) { ActivityOptionsCompat.setLauncherSourceInfo( diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java index 1090099d2f..661053af18 100644 --- a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java +++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java @@ -36,26 +36,48 @@ import androidx.annotation.UiThread; import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; +import java.lang.ref.WeakReference; + +/** + * This class is needed to wrap any animation runner that is a part of the + * RemoteAnimationDefinition: + * - Launcher creates a new instance of the LauncherAppTransitionManagerImpl whenever it is + * created, which in turn registers a new definition + * - When the definition is registered, window manager retains a strong binder reference to the + * runner passed in + * - If the Launcher activity is recreated, the new definition registered will replace the old + * reference in the system's activity record, but until the system server is GC'd, the binder + * reference will still exist, which references the runner in the Launcher process, which + * references the (old) Launcher activity through this class + * + * Instead we make the runner provided to the definition static only holding a weak reference to + * the runner implementation. When this animation manager is destroyed, we remove the Launcher + * reference to the runner, leaving only the weak ref from the runner. + */ @TargetApi(Build.VERSION_CODES.P) -public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCompat { +public class LauncherAnimationRunner implements RemoteAnimationRunnerCompat { + + private static final RemoteAnimationFactory DEFAULT_FACTORY = + (transit, appTargets, wallpaperTargets, nonAppTargets, result) -> + result.setAnimation(null, null); private final Handler mHandler; private final boolean mStartAtFrontOfQueue; + private final WeakReference mFactory; + private AnimationResult mAnimationResult; /** * @param startAtFrontOfQueue If true, the animation start will be posted at the front of the * queue to minimize latency. */ - public LauncherAnimationRunner(Handler handler, boolean startAtFrontOfQueue) { + public LauncherAnimationRunner(Handler handler, RemoteAnimationFactory factory, + boolean startAtFrontOfQueue) { mHandler = handler; + mFactory = new WeakReference<>(factory); mStartAtFrontOfQueue = startAtFrontOfQueue; } - public Handler getHandler() { - return mHandler; - } - // Called only in S+ platform @BinderThread public void onAnimationStart( @@ -67,7 +89,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo Runnable r = () -> { finishExistingAnimation(); mAnimationResult = new AnimationResult(() -> mAnimationResult = null, runnable); - onCreateAnimation(transit, appTargets, wallpaperTargets, nonAppTargets, + getFactory().onCreateAnimation(transit, appTargets, wallpaperTargets, nonAppTargets, mAnimationResult); }; if (mStartAtFrontOfQueue) { @@ -92,17 +114,11 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo onAnimationStart(appTargets, new RemoteAnimationTargetCompat[0], runnable); } - /** - * Called on the UI thread when the animation targets are received. The implementation must - * call {@link AnimationResult#setAnimation} with the target animation to be run. - */ - @UiThread - public abstract void onCreateAnimation( - int transit, - RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, - RemoteAnimationTargetCompat[] nonAppTargets, - AnimationResult result); + + private RemoteAnimationFactory getFactory() { + RemoteAnimationFactory factory = mFactory.get(); + return factory != null ? factory : DEFAULT_FACTORY; + } @UiThread private void finishExistingAnimation() { @@ -118,7 +134,10 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo @BinderThread @Override public void onAnimationCancelled() { - postAsyncCallback(mHandler, this::finishExistingAnimation); + postAsyncCallback(mHandler, () -> { + finishExistingAnimation(); + getFactory().onAnimationCancelled(); + }); } public static final class AnimationResult { @@ -153,7 +172,6 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo @UiThread public void setAnimation(AnimatorSet animation, Context context) { setAnimation(animation, context, null, true); - } /** @@ -198,4 +216,28 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo } } } + + /** + * Used with LauncherAnimationRunner as an interface for the runner to call back to the + * implementation. + */ + @FunctionalInterface + public interface RemoteAnimationFactory { + + /** + * Called on the UI thread when the animation targets are received. The implementation must + * call {@link AnimationResult#setAnimation} with the target animation to be run. + */ + void onCreateAnimation(int transit, + RemoteAnimationTargetCompat[] appTargets, + RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, + LauncherAnimationRunner.AnimationResult result); + + /** + * Called when the animation is cancelled. This can happen with or without + * the create being called. + */ + default void onAnimationCancelled() { } + } } diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index dd248e4e83..3b3f0bde8b 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -79,6 +79,7 @@ import androidx.annotation.Nullable; import androidx.core.graphics.ColorUtils; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; +import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.icons.FastBitmapDrawable; @@ -197,11 +198,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener private RemoteAnimationProvider mRemoteAnimationProvider; // Strong refs to runners which are cleared when the launcher activity is destroyed - private WrappedAnimationRunnerImpl mWallpaperOpenRunner; - private WrappedAnimationRunnerImpl mAppLaunchRunner; - private WrappedAnimationRunnerImpl mKeyguardGoingAwayRunner; + private RemoteAnimationFactory mWallpaperOpenRunner; + private RemoteAnimationFactory mAppLaunchRunner; + private RemoteAnimationFactory mKeyguardGoingAwayRunner; - private WrappedAnimationRunnerImpl mWallpaperOpenTransitionRunner; + private RemoteAnimationFactory mWallpaperOpenTransitionRunner; private RemoteTransitionCompat mLauncherOpenTransition; private final AnimatorListenerAdapter mForceInvisibleListener = new AnimatorListenerAdapter() { @@ -257,11 +258,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener * @return ActivityOptions with remote animations that controls how the window of the opening * targets are displayed. */ - public ActivityOptionsWrapper getActivityLaunchOptions(Launcher launcher, View v) { + public ActivityOptionsWrapper getActivityLaunchOptions(View v) { boolean fromRecents = isLaunchingFromRecents(v, null /* targets */); RunnableList onEndCallback = new RunnableList(); - mAppLaunchRunner = new AppLaunchAnimationRunner(mHandler, v, onEndCallback); - RemoteAnimationRunnerCompat runner = new WrappedLauncherAnimationRunner<>( + mAppLaunchRunner = new AppLaunchAnimationRunner(v, onEndCallback); + RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner( mHandler, mAppLaunchRunner, true /* startAtFrontOfQueue */); // Note that this duration is a guess as we do not know if the animation will be a @@ -1006,7 +1007,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener definition.addRemoteAnimation(WindowManagerWrapper.TRANSIT_WALLPAPER_OPEN, WindowManagerWrapper.ACTIVITY_TYPE_STANDARD, new RemoteAnimationAdapterCompat( - new WrappedLauncherAnimationRunner<>(mHandler, mWallpaperOpenRunner, + new LauncherAnimationRunner(mHandler, mWallpaperOpenRunner, false /* startAtFrontOfQueue */), CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */)); @@ -1015,7 +1016,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener definition.addRemoteAnimation( WindowManagerWrapper.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, new RemoteAnimationAdapterCompat( - new WrappedLauncherAnimationRunner<>( + new LauncherAnimationRunner( mHandler, mKeyguardGoingAwayRunner, true /* startAtFrontOfQueue */), CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */)); @@ -1035,7 +1036,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (hasControlRemoteAppTransitionPermission()) { mWallpaperOpenTransitionRunner = createWallpaperOpenRunner(false /* fromUnlock */); mLauncherOpenTransition = RemoteAnimationAdapterCompat.buildRemoteTransition( - new WrappedLauncherAnimationRunner<>(mHandler, mWallpaperOpenTransitionRunner, + new LauncherAnimationRunner(mHandler, mWallpaperOpenTransitionRunner, false /* startAtFrontOfQueue */)); mLauncherOpenTransition.addHomeOpenCheck(); SystemUiProxy.INSTANCE.getNoCreate().registerRemoteTransition(mLauncherOpenTransition); @@ -1085,7 +1086,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener * @return Runner that plays when user goes to Launcher * ie. pressing home, swiping up from nav bar. */ - WrappedAnimationRunnerImpl createWallpaperOpenRunner(boolean fromUnlock) { + RemoteAnimationFactory createWallpaperOpenRunner(boolean fromUnlock) { return new WallpaperOpenLauncherAnimationRunner(mHandler, fromUnlock); } @@ -1235,7 +1236,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener /** * Remote animation runner for animation from the app to Launcher, including recents. */ - protected class WallpaperOpenLauncherAnimationRunner implements WrappedAnimationRunnerImpl { + protected class WallpaperOpenLauncherAnimationRunner implements RemoteAnimationFactory { private final Handler mHandler; private final boolean mFromUnlock; @@ -1323,17 +1324,12 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener /** * Remote animation runner for animation to launch an app. */ - private class AppLaunchAnimationRunner implements WrappedAnimationRunnerImpl { + private class AppLaunchAnimationRunner implements RemoteAnimationFactory { - private static final String TRANSITION_LAUNCH_FROM_RECENTS = "transition:LaunchFromRecents"; - private static final String TRANSITION_LAUNCH_FROM_ICON = "transition:LaunchFromIcon"; - - private final Handler mHandler; private final View mV; private final RunnableList mOnEndCallback; - AppLaunchAnimationRunner(Handler handler, View v, RunnableList onEndCallback) { - mHandler = handler; + AppLaunchAnimationRunner(View v, RunnableList onEndCallback) { mV = v; mOnEndCallback = onEndCallback; } @@ -1377,6 +1373,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener result.setAnimation(anim, mLauncher, mOnEndCallback::executeAllAndDestroy, skipFirstFrame); } + + @Override + public void onAnimationCancelled() { + mOnEndCallback.executeAllAndDestroy(); + } } /** diff --git a/quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java b/quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java deleted file mode 100644 index 16727ecfda..0000000000 --- a/quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3; - -import com.android.systemui.shared.system.RemoteAnimationTargetCompat; - -/** - * Used with WrappedLauncherAnimationRunner as an interface for the runner to call back to the - * implementation. - */ -public interface WrappedAnimationRunnerImpl { - - void onCreateAnimation(int transit, - RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, - RemoteAnimationTargetCompat[] nonAppTargets, - LauncherAnimationRunner.AnimationResult result); -} diff --git a/quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java deleted file mode 100644 index fcf9857649..0000000000 --- a/quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3; - -import android.os.Handler; - -import com.android.systemui.shared.system.RemoteAnimationTargetCompat; - -import java.lang.ref.WeakReference; - -/** - * This class is needed to wrap any animation runner that is a part of the - * RemoteAnimationDefinition: - * - Launcher creates a new instance of the LauncherAppTransitionManagerImpl whenever it is - * created, which in turn registers a new definition - * - When the definition is registered, window manager retains a strong binder reference to the - * runner passed in - * - If the Launcher activity is recreated, the new definition registered will replace the old - * reference in the system's activity record, but until the system server is GC'd, the binder - * reference will still exist, which references the runner in the Launcher process, which - * references the (old) Launcher activity through this class - * - * Instead we make the runner provided to the definition static only holding a weak reference to - * the runner implementation. When this animation manager is destroyed, we remove the Launcher - * reference to the runner, leaving only the weak ref from the runner. - */ -public class WrappedLauncherAnimationRunner - extends LauncherAnimationRunner { - private WeakReference mImpl; - - public WrappedLauncherAnimationRunner( - Handler handler, R animationRunnerImpl, boolean startAtFrontOfQueue) { - super(handler, startAtFrontOfQueue); - mImpl = new WeakReference<>(animationRunnerImpl); - } - - @Override - public void onCreateAnimation(int transit, - RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, - RemoteAnimationTargetCompat[] nonAppTargets, - AnimationResult result) { - R animationRunnerImpl = mImpl.get(); - if (animationRunnerImpl != null) { - animationRunnerImpl.onCreateAnimation(transit, appTargets, wallpaperTargets, - nonAppTargets, result); - } else { - result.setAnimation(null, null); - } - } -} diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java index d15113184d..50038d9252 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java @@ -56,7 +56,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler { } Pair options = remoteResponse.getLaunchOptions(view); ActivityOptionsWrapper activityOptions = mLauncher.getAppTransitionManager() - .getActivityLaunchOptions(mLauncher, hostView); + .getActivityLaunchOptions(hostView); if (Utilities.ATLEAST_S && !pendingIntent.isActivity()) { // In the event this pending intent eventually launches an activity, i.e. a trampoline, // use the Quickstep transition animation. diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 3d66823c98..9d99f97a3d 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -49,9 +49,8 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherAnimationRunner; import com.android.launcher3.LauncherAnimationRunner.AnimationResult; +import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory; import com.android.launcher3.R; -import com.android.launcher3.WrappedAnimationRunnerImpl; -import com.android.launcher3.WrappedLauncherAnimationRunner; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PendingAnimation; @@ -109,7 +108,7 @@ public final class RecentsActivity extends StatefulActivity { private StateManager mStateManager; // Strong refs to runners which are cleared when the activity is destroyed - private WrappedAnimationRunnerImpl mActivityLaunchAnimationRunner; + private RemoteAnimationFactory mActivityLaunchAnimationRunner; /** * Init drag layer and overview panel views. @@ -206,19 +205,25 @@ public final class RecentsActivity extends StatefulActivity { final TaskView taskView = (TaskView) v; RunnableList onEndCallback = new RunnableList(); - mActivityLaunchAnimationRunner = (int transit, - RemoteAnimationTargetCompat[] appTargets, + mActivityLaunchAnimationRunner = new RemoteAnimationFactory() { + @Override + public void onCreateAnimation(int transit, RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, - RemoteAnimationTargetCompat[] nonAppTargets, - AnimationResult result) -> { - AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets, - wallpaperTargets, nonAppTargets); - anim.addListener(resetStateListener()); - result.setAnimation(anim, RecentsActivity.this, onEndCallback::executeAllAndDestroy, - true /* skipFirstFrame */); + RemoteAnimationTargetCompat[] nonAppTargets, AnimationResult result) { + AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets, + wallpaperTargets, nonAppTargets); + anim.addListener(resetStateListener()); + result.setAnimation(anim, RecentsActivity.this, onEndCallback::executeAllAndDestroy, + true /* skipFirstFrame */); + } + + @Override + public void onAnimationCancelled() { + onEndCallback.executeAllAndDestroy(); + } }; - final LauncherAnimationRunner wrapper = new WrappedLauncherAnimationRunner<>( + final LauncherAnimationRunner wrapper = new LauncherAnimationRunner( mUiHandler, mActivityLaunchAnimationRunner, true /* startAtFrontOfQueue */); RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat( wrapper, RECENTS_LAUNCH_DURATION, @@ -362,34 +367,37 @@ public final class RecentsActivity extends StatefulActivity { } private void startHomeInternal() { - WrappedLauncherAnimationRunner runner = new WrappedLauncherAnimationRunner( - getMainThreadHandler(), this::onCreateAnimationToHome, true); + LauncherAnimationRunner runner = new LauncherAnimationRunner( + getMainThreadHandler(), mAnimationToHomeFactory, true); RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(runner, HOME_APPEAR_DURATION, 0); startActivity(createHomeIntent(), ActivityOptionsCompat.makeRemoteAnimation(adapterCompat).toBundle()); } - private void onCreateAnimationToHome( - int transit, RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, - RemoteAnimationTargetCompat[] nonAppTargets, AnimationResult result) { - AnimatorPlaybackController controller = getStateManager() - .createAnimationToNewWorkspace(RecentsState.BG_LAUNCHER, HOME_APPEAR_DURATION); - controller.dispatchOnStart(); + private final RemoteAnimationFactory mAnimationToHomeFactory = + new RemoteAnimationFactory() { + @Override + public void onCreateAnimation(int transit, RemoteAnimationTargetCompat[] appTargets, + RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, AnimationResult result) { + AnimatorPlaybackController controller = getStateManager() + .createAnimationToNewWorkspace(RecentsState.BG_LAUNCHER, HOME_APPEAR_DURATION); + controller.dispatchOnStart(); - RemoteAnimationTargets targets = new RemoteAnimationTargets( - appTargets, wallpaperTargets, nonAppTargets, MODE_OPENING); - for (RemoteAnimationTargetCompat app : targets.apps) { - new Transaction().setAlpha(app.leash.getSurfaceControl(), 1).apply(); + RemoteAnimationTargets targets = new RemoteAnimationTargets( + appTargets, wallpaperTargets, nonAppTargets, MODE_OPENING); + for (RemoteAnimationTargetCompat app : targets.apps) { + new Transaction().setAlpha(app.leash.getSurfaceControl(), 1).apply(); + } + AnimatorSet anim = new AnimatorSet(); + anim.play(controller.getAnimationPlayer()); + anim.setDuration(HOME_APPEAR_DURATION); + result.setAnimation(anim, RecentsActivity.this, + () -> getStateManager().goToState(RecentsState.HOME, false), + true /* skipFirstFrame */); } - AnimatorSet anim = new AnimatorSet(); - anim.play(controller.getAnimationPlayer()); - anim.setDuration(HOME_APPEAR_DURATION); - result.setAnimation(anim, this, - () -> getStateManager().goToState(RecentsState.HOME, false), - true /* skipFirstFrame */); - } + }; @Override protected void collectStateHandlers(List out) { diff --git a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java index 5c6da1611f..98dbd47ba4 100644 --- a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java +++ b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java @@ -21,15 +21,14 @@ import android.content.Context; import android.os.Handler; import com.android.launcher3.LauncherAnimationRunner; -import com.android.launcher3.WrappedAnimationRunnerImpl; -import com.android.launcher3.WrappedLauncherAnimationRunner; +import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory; import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.RemoteAnimationAdapterCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; public abstract class RemoteAnimationProvider { - WrappedAnimationRunnerImpl mAnimationRunner; + RemoteAnimationFactory mAnimationRunner; public abstract AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets); @@ -37,7 +36,7 @@ public abstract class RemoteAnimationProvider { ActivityOptions toActivityOptions(Handler handler, long duration, Context context) { mAnimationRunner = (transit, appTargets, wallpaperTargets, nonApps, result) -> result.setAnimation(createWindowAnimation(appTargets, wallpaperTargets), context); - final LauncherAnimationRunner wrapper = new WrappedLauncherAnimationRunner( + final LauncherAnimationRunner wrapper = new LauncherAnimationRunner( handler, mAnimationRunner, false /* startAtFrontOfQueue */); return ActivityOptionsCompat.makeRemoteAnimation( new RemoteAnimationAdapterCompat(wrapper, duration, 0)); diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java index 3d33e57a36..a147b6808c 100644 --- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java @@ -41,9 +41,8 @@ import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.LauncherAnimationRunner; +import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory; import com.android.launcher3.R; -import com.android.launcher3.WrappedAnimationRunnerImpl; -import com.android.launcher3.WrappedLauncherAnimationRunner; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TaskAnimationManager; @@ -101,14 +100,14 @@ public class SplitSelectStateController { return; } // Assume initial mInitialTaskId is for top/left part of screen - WrappedAnimationRunnerImpl initialSplitRunnerWrapped = new SplitLaunchAnimationRunner( + RemoteAnimationFactory initialSplitRunnerWrapped = new SplitLaunchAnimationRunner( mInitialTaskView, 0); - WrappedAnimationRunnerImpl secondarySplitRunnerWrapped = new SplitLaunchAnimationRunner( + RemoteAnimationFactory secondarySplitRunnerWrapped = new SplitLaunchAnimationRunner( taskView, 1); - RemoteAnimationRunnerCompat initialSplitRunner = new WrappedLauncherAnimationRunner( + RemoteAnimationRunnerCompat initialSplitRunner = new LauncherAnimationRunner( new Handler(Looper.getMainLooper()), initialSplitRunnerWrapped, true /* startAtFrontOfQueue */); - RemoteAnimationRunnerCompat secondarySplitRunner = new WrappedLauncherAnimationRunner( + RemoteAnimationRunnerCompat secondarySplitRunner = new LauncherAnimationRunner( new Handler(Looper.getMainLooper()), secondarySplitRunnerWrapped, true /* startAtFrontOfQueue */); ActivityOptions initialOptions = ActivityOptionsCompat.makeRemoteAnimation( @@ -192,7 +191,7 @@ public class SplitSelectStateController { * LEGACY * Remote animation runner for animation to launch an app. */ - private class SplitLaunchAnimationRunner implements WrappedAnimationRunnerImpl { + private class SplitLaunchAnimationRunner implements RemoteAnimationFactory { private final TaskView mV; private final int mTargetState; From 4a76315805812fe4c74e64c900c4d4458935904e Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 21 Jun 2021 16:07:09 -0400 Subject: [PATCH 03/26] Use wallpaper colors for widgets in wallpaper change preview Test: Widgets should adapt to new wallpaper colors in launcher preview. Bug: 191499358 Change-Id: I3fb76b6036cb909771b789eac15742df78c2c742 --- lint-baseline-launcher3.xml | 11 ++++++++ .../graphics/LauncherPreviewRenderer.java | 28 +++++++++++++++---- .../graphics/PreviewSurfaceRenderer.java | 2 +- .../launcher3/widget/LocalColorExtractor.java | 8 ++++++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/lint-baseline-launcher3.xml b/lint-baseline-launcher3.xml index 469ad942d9..e77c88926d 100644 --- a/lint-baseline-launcher3.xml +++ b/lint-baseline-launcher3.xml @@ -573,4 +573,15 @@ column="42"/> + + + + diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index a27d5c8e06..cfb38e5d6e 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -26,6 +26,7 @@ import static com.android.launcher3.model.ModelUtils.sortWorkspaceItemsSpatially import android.annotation.TargetApi; import android.app.Fragment; +import android.app.WallpaperColors; import android.appwidget.AppWidgetHost; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetProviderInfo; @@ -42,6 +43,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Process; import android.util.AttributeSet; +import android.util.SparseIntArray; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; @@ -87,6 +89,7 @@ import com.android.launcher3.views.BaseDragLayer; import com.android.launcher3.widget.BaseLauncherAppWidgetHostView; import com.android.launcher3.widget.LauncherAppWidgetHost; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; +import com.android.launcher3.widget.LocalColorExtractor; import com.android.launcher3.widget.NavigableAppWidgetHostView; import com.android.launcher3.widget.custom.CustomWidgetManager; @@ -206,8 +209,12 @@ public class LauncherPreviewRenderer extends ContextWrapper private final Hotseat mHotseat; private final CellLayout mWorkspace; private final AppWidgetHost mAppWidgetHost; + private final SparseIntArray mWallpaperColorResources; + + public LauncherPreviewRenderer(Context context, + InvariantDeviceProfile idp, + WallpaperColors wallpaperColors) { - public LauncherPreviewRenderer(Context context, InvariantDeviceProfile idp) { super(context); mUiHandler = new Handler(Looper.getMainLooper()); mContext = context; @@ -260,9 +267,16 @@ public class LauncherPreviewRenderer extends ContextWrapper mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx, mDp.workspacePadding.bottom); - mAppWidgetHost = FeatureFlags.WIDGETS_IN_LAUNCHER_PREVIEW.get() - ? new LauncherPreviewAppWidgetHost(context) - : null; + if (FeatureFlags.WIDGETS_IN_LAUNCHER_PREVIEW.get()) { + mAppWidgetHost = new LauncherPreviewAppWidgetHost(context); + mWallpaperColorResources = wallpaperColors != null + ? LocalColorExtractor.newInstance(context) + .generateColorsOverride(wallpaperColors) + : null; + } else { + mAppWidgetHost = null; + mWallpaperColorResources = null; + } } /** Populate preview and render it. */ @@ -507,10 +521,12 @@ public class LauncherPreviewRenderer extends ContextWrapper } } - private static class LauncherPreviewAppWidgetHostView extends BaseLauncherAppWidgetHostView { - + private class LauncherPreviewAppWidgetHostView extends BaseLauncherAppWidgetHostView { private LauncherPreviewAppWidgetHostView(Context context) { super(context); + if (Utilities.ATLEAST_S && mWallpaperColorResources != null) { + setColorResources(mWallpaperColorResources); + } } @Override diff --git a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java index a8c3d15bde..df493599ed 100644 --- a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +++ b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java @@ -209,7 +209,7 @@ public class PreviewSurfaceRenderer { if (mDestroyed) { return; } - View view = new LauncherPreviewRenderer(inflationContext, mIdp) + View view = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors) .getRenderedView(dataModel, widgetProviderInfoMap); // This aspect scales the view to fit in the surface and centers it final float scale = Math.min(mWidth / (float) view.getMeasuredWidth(), diff --git a/src/com/android/launcher3/widget/LocalColorExtractor.java b/src/com/android/launcher3/widget/LocalColorExtractor.java index 8ae6b2e435..23d9e151f7 100644 --- a/src/com/android/launcher3/widget/LocalColorExtractor.java +++ b/src/com/android/launcher3/widget/LocalColorExtractor.java @@ -75,6 +75,14 @@ public class LocalColorExtractor implements ResourceBasedOverride { */ public void applyColorsOverride(Context base, WallpaperColors colors) { } + /** + * Generates color resource overrides from {@link WallpaperColors}. + */ + @Nullable + public SparseIntArray generateColorsOverride(WallpaperColors colors) { + return null; + } + /** * Takes a view and returns its rect that can be used by the wallpaper local color extractor. * From 2c815020286b54aba7c2265950bcc048492b893f Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 21 Jun 2021 19:21:40 -0700 Subject: [PATCH 04/26] Improving TAPL diagnostics Test: presubmit Bug: 187761685 Change-Id: Ib8e965862c6accb393681c8b3ede60c7f9d26e48 --- .../com/android/launcher3/tapl/AppIcon.java | 5 +++ .../launcher3/tapl/AppIconMenuItem.java | 7 ++-- .../android/launcher3/tapl/Launchable.java | 34 +++++++++++-------- .../tapl/LauncherInstrumentation.java | 2 +- .../com/android/launcher3/tapl/Widget.java | 5 +++ 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/tapl/com/android/launcher3/tapl/AppIcon.java index 57fd08ae2c..21099b4934 100644 --- a/tests/tapl/com/android/launcher3/tapl/AppIcon.java +++ b/tests/tapl/com/android/launcher3/tapl/AppIcon.java @@ -75,4 +75,9 @@ public final class AppIcon extends Launchable { protected void expectActivityStartEvents() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } + + @Override + protected String launchableType() { + return "app icon"; + } } diff --git a/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java b/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java index a40919b1bd..ac0db0876c 100644 --- a/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java +++ b/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java @@ -20,8 +20,6 @@ import androidx.test.uiautomator.UiObject2; import com.android.launcher3.testing.TestProtocol; -import java.util.regex.Pattern; - /** * Menu item in an app icon menu. */ @@ -51,4 +49,9 @@ public class AppIconMenuItem extends Launchable { protected void expectActivityStartEvents() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } + + @Override + protected String launchableType() { + return "app icon menu item"; + } } diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index c4a566b2c0..ec0a740dca 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -53,23 +53,29 @@ abstract class Launchable { protected abstract void expectActivityStartEvents(); + protected abstract String launchableType(); + private Background launch(BySelector selector) { - LauncherInstrumentation.log("Launchable.launch before click " + - mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject)); - final String label = mObject.getText(); + try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "clicking " + launchableType())) { + LauncherInstrumentation.log("Launchable.launch before click " + + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject)); + final String label = mObject.getText(); - mLauncher.executeAndWaitForEvent( - () -> { - mLauncher.clickLauncherObject(mObject); - expectActivityStartEvents(); - }, - event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED, - () -> "Launching an app didn't open a new window: " + label); + mLauncher.executeAndWaitForEvent( + () -> { + mLauncher.clickLauncherObject(mObject); + expectActivityStartEvents(); + }, + event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED, + () -> "Launching an app didn't open a new window: " + label); - mLauncher.assertTrue( - "App didn't start: " + label + " (" + selector + ")", - TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); - return new Background(mLauncher); + mLauncher.assertTrue( + "App didn't start: " + label + " (" + selector + ")", + TestHelpers.wait(Until.hasObject(selector), + LauncherInstrumentation.WAIT_TIME_MS)); + return new Background(mLauncher); + } } /** diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 96e82224b1..1332df3512 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -499,7 +499,7 @@ public final class LauncherInstrumentation { private void fail(String message) { checkForAnomaly(); Assert.fail(formatSystemHealthMessage(formatErrorWithEvents( - "http://go/tapl test failure:\nSummary: " + getContextDescription() + "http://go/tapl test failure:\nContext: " + getContextDescription() + " - visible state is " + getVisibleStateMessage() + ";\nDetails: " + message, true))); } diff --git a/tests/tapl/com/android/launcher3/tapl/Widget.java b/tests/tapl/com/android/launcher3/tapl/Widget.java index 53ef796c90..35203185ed 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widget.java +++ b/tests/tapl/com/android/launcher3/tapl/Widget.java @@ -46,4 +46,9 @@ public final class Widget extends Launchable { protected void addExpectedEventsForLongClick() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT); } + + @Override + protected String launchableType() { + return "widget"; + } } From 8af0dd3e0cce1bcc4bb69631ca5111d0e548793b Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 24 May 2021 00:31:10 -0700 Subject: [PATCH 05/26] Null check on target set before rendering task open animation Fixes: 190854921 Test: N/A Change-Id: Iae7ef7cf3f4d2309223bfabe6d40f24b7e34439c --- .../com/android/quickstep/views/TaskView.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index b2a7b1b85d..ae429d91d8 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -554,7 +554,13 @@ public class TaskView extends FrameLayout implements Reusable { mIsClickableAsLiveTile = false; RecentsView recentsView = getRecentsView(); - RemoteAnimationTargets targets = recentsView.getLiveTileParams().getTargetSet(); + final RemoteAnimationTargets targets = recentsView.getLiveTileParams().getTargetSet(); + if (targets == null) { + // If the recents animation is cancelled somehow between the parent if block and + // here, try to launch the task as a non live tile task. + launcherNonLiveTileTask(); + return; + } AnimatorSet anim = new AnimatorSet(); TaskViewUtils.composeRecentsLaunchAnimator( @@ -576,17 +582,21 @@ public class TaskView extends FrameLayout implements Reusable { }); anim.start(); } else { - if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) { - // User tapped to select second split screen app - getRecentsView().confirmSplitSelect(this); - } else { - launchTaskAnimated(); - } + launcherNonLiveTileTask(); } mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo()) .log(LAUNCHER_TASK_LAUNCH_TAP); } + private void launcherNonLiveTileTask() { + if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) { + // User tapped to select second split screen app + getRecentsView().confirmSplitSelect(this); + } else { + launchTaskAnimated(); + } + } + /** * Starts the task associated with this view and animates the startup. * @return CompletionStage to indicate the animation completion or null if the launch failed. From f158ec33d8ef409a6c2d4c9f4c4731e16b59ee81 Mon Sep 17 00:00:00 2001 From: Cyrus Boadway Date: Tue, 22 Jun 2021 10:14:06 +0000 Subject: [PATCH 06/26] Use icon splash screen when starting activity from widget interaction Set the flag to use the icon splash screen rather than the empty splash screen when starting an activity from a widget interaction. Bug: 191738655 Test: manual Change-Id: Iff771a43648bbf6dfb88e2a6749c4526fd17da07 --- .../launcher3/uioverrides/QuickstepInteractionHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java index d15113184d..5e9515d0d3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java @@ -26,6 +26,7 @@ import android.util.Log; import android.util.Pair; import android.view.View; import android.widget.RemoteViews; +import android.window.SplashScreen; import com.android.launcher3.Utilities; import com.android.launcher3.logging.StatsLogManager; @@ -70,6 +71,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler { } } activityOptions.options.setPendingIntentLaunchFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); Object itemInfo = hostView.getTag(); if (itemInfo instanceof ItemInfo) { mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options); From 267e9b0c043df9aaa27944152937f5227d04eb3c Mon Sep 17 00:00:00 2001 From: Alina Zaidi Date: Tue, 22 Jun 2021 09:11:01 +0100 Subject: [PATCH 07/26] Rename strings for no search results and no widgets in widget picker. Also update text size and font. Bug: 191732424 Test: Not needed, minor string change Change-Id: I90f00f1316524c48520c4cfc265ab2d5e78e3281 --- res/layout/widgets_full_sheet.xml | 2 ++ res/values/strings.xml | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/res/layout/widgets_full_sheet.xml b/res/layout/widgets_full_sheet.xml index dca3e79c62..1b4f3b984e 100644 --- a/res/layout/widgets_full_sheet.xml +++ b/res/layout/widgets_full_sheet.xml @@ -33,6 +33,8 @@ android:layout_height="match_parent" android:gravity="center" android:visibility="gone" + android:fontFamily="sans-serif-medium" + android:textSize="20sp" tools:text="No widgets available" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index 60c0774ff8..3dbd760d1e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -85,12 +85,12 @@ Clear text from search box - - No widgets available - - No search results + Widgets and shortcuts aren\'t available + + No widgets or shortcuts found Personal From fa1e14c4b8c2f28d767f3776923030ef671bfa38 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 21 Jun 2021 18:05:25 -0700 Subject: [PATCH 08/26] Polish folder icon bugs. - Fix bug where folders are misaligned. - Fix bug when closing on 2nd page of large folder. Bug: 184822585 Test: drag folder originally in hotseat to workspace, vice versa test on grid where isScalable=true and isScalable=false Change-Id: I08a79b8d280df3e3974baaa07e80db6bc4165e58 --- src/com/android/launcher3/CellLayout.java | 3 --- src/com/android/launcher3/ShortcutAndWidgetContainer.java | 8 +++++--- .../android/launcher3/folder/FolderAnimationManager.java | 5 ++--- src/com/android/launcher3/folder/FolderIcon.java | 5 ----- src/com/android/launcher3/folder/PreviewBackground.java | 3 +-- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index bfa1769ea8..382343793c 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -684,9 +684,6 @@ public class CellLayout extends ViewGroup { if (child instanceof BubbleTextView) { BubbleTextView bubbleChild = (BubbleTextView) child; bubbleChild.setTextVisibility(mContainerType != HOTSEAT); - if (mActivity.getDeviceProfile().isScalableGrid) { - bubbleChild.setCenterVertically(mContainerType != HOTSEAT); - } } child.setScaleX(mChildScale); diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index 4579705f5a..2a5187d025 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -138,12 +138,14 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon. mBorderSpacing, null); // Center the icon/folder int cHeight = getCellContentHeight(); - int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f)); + int cellPaddingY = dp.isScalableGrid && mContainerType == WORKSPACE + ? dp.cellYPaddingPx + : (int) Math.max(0, ((lp.height - cHeight) / 2f)); // No need to add padding when cell layout border spacing is present. - boolean noPadding = (dp.cellLayoutBorderSpacingPx > 0 && mContainerType == WORKSPACE) + boolean noPaddingX = (dp.cellLayoutBorderSpacingPx > 0 && mContainerType == WORKSPACE) || (dp.folderCellLayoutBorderSpacingPx > 0 && mContainerType == FOLDER); - int cellPaddingX = noPadding + int cellPaddingX = noPaddingX ? 0 : mContainerType == WORKSPACE ? dp.workspaceCellPaddingXPx diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java index 4fe85be820..cb3884dc47 100644 --- a/src/com/android/launcher3/folder/FolderAnimationManager.java +++ b/src/com/android/launcher3/folder/FolderAnimationManager.java @@ -245,9 +245,8 @@ public class FolderAnimationManager { + mDeviceProfile.folderCellHeightPx * 2; int page = mIsOpening ? mContent.getCurrentPage() : mContent.getDestinationPage(); int left = mContent.getPaddingLeft() + page * lp.width; - Rect contentStart = new Rect(0, 0, width, height); - Rect contentEnd = new Rect(endRect.left + left, endRect.top, endRect.right + left, - endRect.bottom); + Rect contentStart = new Rect(left, 0, left + width, height); + Rect contentEnd = new Rect(left, 0, left + lp.width, lp.height); play(a, getShape().createRevealAnimator( mFolder.getContent(), contentStart, contentEnd, finalRadius, !mIsOpening)); diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index 5c11451535..25a01414d2 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -174,8 +174,6 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel folder.setFolderIcon(icon); folder.bind(folderInfo); icon.setFolder(folder); - icon.mBackground.paddingY = icon.isInHotseat() - ? 0 : activityContext.getDeviceProfile().cellYPaddingPx; return icon; } @@ -217,7 +215,6 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel icon.setAccessibilityDelegate(activity.getAccessibilityDelegate()); - icon.mBackground.paddingY = icon.isInHotseat() ? 0 : grid.cellYPaddingPx; icon.mPreviewVerifier = new FolderGridOrganizer(activity.getDeviceProfile().inv); icon.mPreviewVerifier.setFolderInfo(folderInfo); icon.updatePreviewItems(false); @@ -580,7 +577,6 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel public void setFolderBackground(PreviewBackground bg) { mBackground = bg; mBackground.setInvalidateDelegate(this); - mBackground.paddingY = isInHotseat() ? 0 : mActivity.getDeviceProfile().cellYPaddingPx; } @Override @@ -628,7 +624,6 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel if (!mForceHideDot && ((mDotInfo != null && mDotInfo.hasDot()) || mDotScale > 0)) { Rect iconBounds = mDotParams.iconBounds; BubbleTextView.getIconBounds(this, iconBounds, mActivity.getDeviceProfile().iconSizePx); - iconBounds.offset(0, mBackground.paddingY); float iconScale = (float) mBackground.previewSize / iconBounds.width(); Utilities.scaleRectAboutCenter(iconBounds, iconScale); diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java index 204decbee4..460521f1a4 100644 --- a/src/com/android/launcher3/folder/PreviewBackground.java +++ b/src/com/android/launcher3/folder/PreviewBackground.java @@ -77,7 +77,6 @@ public class PreviewBackground extends CellLayout.DelegatedCellDrawing { int previewSize; int basePreviewOffsetX; int basePreviewOffsetY; - int paddingY; private CellLayout mDrawingDelegate; @@ -161,7 +160,7 @@ public class PreviewBackground extends CellLayout.DelegatedCellDrawing { previewSize = grid.folderIconSizePx; basePreviewOffsetX = (availableSpaceX - previewSize) / 2; - basePreviewOffsetY = paddingY + topPadding + grid.folderIconOffsetYPx; + basePreviewOffsetY = topPadding + grid.folderIconOffsetYPx; // Stroke width is 1dp mStrokeWidth = context.getResources().getDisplayMetrics().density; From 856cd1bd4d98c776839f786fbc18a9d48b322771 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 21 Jun 2021 21:59:34 -0700 Subject: [PATCH 09/26] Don't finish to home when launching a task from recents - When launching without a task view, we should also not be finishing to home (similar to composeRecentsLaunchAnimator) since it will clobber the newly launched task Fixes: 191182965 Test: Open overview with live tile, try to open usb debugging settings page Change-Id: If7464ebf155cee33e81205fbf4899e9ab49a52d0 --- quickstep/src/com/android/quickstep/views/RecentsView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 8c3e5b513b..2b256a43c6 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -874,7 +874,7 @@ public abstract class RecentsView Date: Mon, 21 Jun 2021 16:14:52 -0400 Subject: [PATCH 10/26] Enable widgets in launcher preview flag Test: Widgets fully load in launcher preview with correct size and color Fix: 185306338, 191499358 Change-Id: I2d02d7a1328ed9ef5d3dfbec090dc1f9908dd527 --- src/com/android/launcher3/config/FeatureFlags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 1c16b1c4d8..5087c2caab 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -248,7 +248,7 @@ public final class FeatureFlags { "Enables scrim over wallpaper for text protection."); public static final BooleanFlag WIDGETS_IN_LAUNCHER_PREVIEW = getDebugFlag( - "WIDGETS_IN_LAUNCHER_PREVIEW", false, + "WIDGETS_IN_LAUNCHER_PREVIEW", true, "Enables widgets in Launcher preview for the Wallpaper app."); public static void initialize(Context context) { From 92335ed7bd6c4a9112ce7273fbd3af52fd837541 Mon Sep 17 00:00:00 2001 From: Steven Ng Date: Tue, 22 Jun 2021 23:26:05 +0100 Subject: [PATCH 11/26] Add null check before detach content view from dragView at onDropComplete Test: Drop a conversation widget on a configuration button. No crash is observed. Fix: 191762933 Change-Id: I483c6f4dbc9fc6c096383682284a4c854707f583 --- src/com/android/launcher3/Workspace.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 303bb01df0..f28f54a024 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2792,7 +2792,7 @@ public class Workspace extends PagedView } } else if (mDragInfo != null) { // When drag is cancelled, reattach content view back to its original parent. - if (mDragInfo.cell instanceof LauncherAppWidgetHostView) { + if (mDragInfo.cell instanceof LauncherAppWidgetHostView && d.dragView != null) { d.dragView.detachContentView(/* reattachToPreviousParent= */ true); } final CellLayout cellLayout = mLauncher.getCellLayout( From 2f65e7f27405920e9ab61e1bdba9a0a553f48ad2 Mon Sep 17 00:00:00 2001 From: Thiru Ramasamy Date: Mon, 14 Jun 2021 13:43:33 -0700 Subject: [PATCH 12/26] [AA+] Adds CorrectedDeviceSearchResultContainer to log user interactions on search results from corrected queries. Bug: 188840584 Test: Local Change-Id: Ibbf2b228537a19be1e77993efee5edc421ff70eb --- quickstep/protos_overrides/launcher_atom_extension.proto | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/quickstep/protos_overrides/launcher_atom_extension.proto b/quickstep/protos_overrides/launcher_atom_extension.proto index 6253b41aac..d2dc0cb745 100644 --- a/quickstep/protos_overrides/launcher_atom_extension.proto +++ b/quickstep/protos_overrides/launcher_atom_extension.proto @@ -26,6 +26,7 @@ message ExtendedContainers { oneof Container{ DeviceSearchResultContainer device_search_result_container = 1; + CorrectedDeviceSearchResultContainer corrected_device_search_result_container = 2; } } @@ -33,3 +34,9 @@ message ExtendedContainers { message DeviceSearchResultContainer{ optional int32 query_length = 1; } + +// Represents on-device search result container with results from spell-corrected query. +message CorrectedDeviceSearchResultContainer{ + optional int32 query_length = 1; +} + From e2c4687e51441c9200d88500b85dc483518b22b1 Mon Sep 17 00:00:00 2001 From: zakcohen Date: Mon, 21 Jun 2021 12:29:08 -0700 Subject: [PATCH 13/26] Sets a simple locus id when Overview is enabled Bug: 189968849 Test: Ran with logcat to check correct locus is set Change-Id: I5253d83b4cf5862e49c3183a843bf8f26dce149e --- .../com/android/quickstep/RecentsActivity.java | 2 ++ .../android/quickstep/views/RecentsView.java | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 3d66823c98..412ff60a28 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -263,6 +263,7 @@ public final class RecentsActivity extends StatefulActivity { // onActivityStart callback. mFallbackRecentsView.setContentAlpha(1); super.onStart(); + mFallbackRecentsView.updateLocusId(); } @Override @@ -271,6 +272,7 @@ public final class RecentsActivity extends StatefulActivity { // Workaround for b/78520668, explicitly trim memory once UI is hidden onTrimMemory(TRIM_MEMORY_UI_HIDDEN); + mFallbackRecentsView.updateLocusId(); } @Override diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index df7f8b5a2a..428a886dc1 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -63,6 +63,7 @@ import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; +import android.content.LocusId; import android.content.res.Configuration; import android.graphics.BlendMode; import android.graphics.Canvas; @@ -75,6 +76,7 @@ import android.graphics.RectF; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Build; +import android.os.Bundle; import android.os.UserHandle; import android.text.Layout; import android.text.StaticLayout; @@ -943,6 +945,7 @@ public abstract class RecentsView mActivity.setLocusContext(id, Bundle.EMPTY)); + } } From 143748fbf4a70a3cd8c15525563119b011a39275 Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 22 Jun 2021 14:09:29 -0700 Subject: [PATCH 14/26] Detect leaks only on test success Bug: 191690396 Test: presubmit Change-Id: Ie59c3b944d420ac25ebba86bf500fcf33700ca99 --- .../com/android/quickstep/FallbackRecentsTest.java | 2 +- .../launcher3/ui/AbstractLauncherUiTest.java | 6 +++--- .../android/launcher3/util/rule/FailureWatcher.java | 13 ++++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java index 9630d274df..a683d01f6c 100644 --- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java @@ -107,7 +107,7 @@ public class FallbackRecentsTest { mOrderSensitiveRules = RuleChain .outerRule(new NavigationModeSwitchRule(mLauncher)) - .around(new FailureWatcher(mDevice)); + .around(new FailureWatcher(mDevice, mLauncher)); mOtherLauncherActivity = context.getPackageManager().queryIntentActivities( getHomeIntentInPackage(context), diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index cbd948035c..2712bc02ce 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -229,7 +229,7 @@ public abstract class AbstractLauncherUiTest { protected TestRule getRulesInsideActivityMonitor() { final RuleChain inner = RuleChain.outerRule(new PortraitLandscapeRunner(this)) - .around(new FailureWatcher(mDevice)); + .around(new FailureWatcher(mDevice, mLauncher)); return TestHelpers.isInLauncherProcess() ? RuleChain.outerRule(ShellCommandRule.setDefaultLauncher()) @@ -310,7 +310,6 @@ public abstract class AbstractLauncherUiTest { assertEquals("Launcher crashed, pid mismatch:", mLauncherPid, mLauncher.getPid().intValue()); } - checkDetectedLeaks(mLauncher); } finally { mLauncher.onTestFinish(); } @@ -618,5 +617,6 @@ public abstract class AbstractLauncherUiTest { isResumed); } - protected void onLauncherActivityClose(Launcher launcher) { } + protected void onLauncherActivityClose(Launcher launcher) { + } } diff --git a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java index cdda0f0dcc..4c4794789e 100644 --- a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java +++ b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java @@ -6,6 +6,9 @@ import android.util.Log; import androidx.test.uiautomator.UiDevice; +import com.android.launcher3.tapl.LauncherInstrumentation; +import com.android.launcher3.ui.AbstractLauncherUiTest; + import org.junit.rules.TestWatcher; import org.junit.runner.Description; @@ -16,9 +19,11 @@ import java.io.IOException; public class FailureWatcher extends TestWatcher { private static final String TAG = "FailureWatcher"; final private UiDevice mDevice; + private final LauncherInstrumentation mLauncher; - public FailureWatcher(UiDevice device) { + public FailureWatcher(UiDevice device, LauncherInstrumentation launcher) { mDevice = device; + mLauncher = launcher; } private static void dumpViewHierarchy(UiDevice device) { @@ -35,6 +40,12 @@ public class FailureWatcher extends TestWatcher { } } + @Override + protected void succeeded(Description description) { + super.succeeded(description); + AbstractLauncherUiTest.checkDetectedLeaks(mLauncher); + } + @Override protected void failed(Throwable e, Description description) { onError(mDevice, description, e); From 2591768d543f0b1f98a23c509456349f70e07247 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 22 Jun 2021 21:09:05 -0700 Subject: [PATCH 15/26] Finish recents animation on task dismissal only if the task is a live tile task Fixes: 191831190 Test: manual Change-Id: Ie1dd02a2e8cc401a613a0ed2199400712c6d5291 --- .../android/quickstep/views/RecentsView.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 7adac22f0e..b87e369632 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2421,12 +2421,12 @@ public abstract class RecentsView { - UI_HELPER_EXECUTOR.getHandler().postDelayed(() -> - ActivityManagerWrapper.getInstance().removeTask( - dismissedTaskId), REMOVE_TASK_WAIT_FOR_APP_STOP_MS); - }); + if (LIVE_TILE.get() && dismissedTaskView.isRunningTask()) { + finishRecentsAnimation(true /* toRecents */, false /* shouldPip */, + () -> removeTaskInternal(dismissedTaskId)); + } else { + removeTaskInternal(dismissedTaskId); + } mActivity.getStatsLogManager().logger() .withItemInfo(dismissedTaskView.getItemInfo()) .log(LAUNCHER_TASK_DISMISS_SWIPE_UP); @@ -2472,6 +2472,12 @@ public abstract class RecentsView ActivityManagerWrapper.getInstance().removeTask(dismissedTaskId), + REMOVE_TASK_WAIT_FOR_APP_STOP_MS); + } + /** * @return {@code true} if one of the task thumbnails would intersect/overlap with the * {@link #mSplitPlaceholderView} From 7d3b25734a66b51cef7660b418362bb9a13896d0 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Wed, 16 Jun 2021 10:35:14 -0700 Subject: [PATCH 16/26] Hide searchbox when header protection is on. Bug: 191726215 Test: manual Change-Id: I086a05654faf718683ebe5dfbcf64b6bd6347ca8 --- src/com/android/launcher3/ExtendedEditText.java | 3 +++ .../android/launcher3/allapps/AllAppsContainerView.java | 7 +++++++ .../android/launcher3/allapps/AllAppsRecyclerView.java | 1 + src/com/android/launcher3/views/OptionsPopupView.java | 9 +++++++++ 4 files changed, 20 insertions(+) diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java index 20c69380cc..e8510b7600 100644 --- a/src/com/android/launcher3/ExtendedEditText.java +++ b/src/com/android/launcher3/ExtendedEditText.java @@ -96,6 +96,9 @@ public class ExtendedEditText extends EditText { } } + // inherited class can override to change the appearance of the edit text. + public void show() {} + public void showKeyboard() { mShowImeAfterFirstLayout = !showSoftInput(); } diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 67f2a9eb32..aabbe650ab 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -717,6 +717,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo : mSearchContainer.getBottom(); canvas.drawRect(0, 0, getWidth(), bottom + getTranslationY(), mHeaderPaint); + + if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && getTranslationY() == 0) { + mSearchUiManager.getEditText().setBackground(null); + } } } @@ -805,6 +809,9 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo getSearchView().setBackgroundColor(viewBG); getFloatingHeaderView().setHeaderColor(viewBG); invalidateHeader(); + if (scrolledOffset == 0 && mSearchUiManager.getEditText() != null) { + mSearchUiManager.getEditText().show(); + } } } diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 4ad694b31b..52dc19bbfc 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -188,6 +188,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView { StatsLogManager mgr = BaseDraggingActivity.fromContext(getContext()).getStatsLogManager(); switch (state) { case SCROLL_STATE_DRAGGING: + requestFocus(); mgr.logger().sendToInteractionJankMonitor( LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN, this); break; diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java index 06ccbbd53e..ecdd206224 100644 --- a/src/com/android/launcher3/views/OptionsPopupView.java +++ b/src/com/android/launcher3/views/OptionsPopupView.java @@ -132,6 +132,12 @@ public class OptionsPopupView extends ArrowPopup public static OptionsPopupView show( Launcher launcher, RectF targetRect, List items, boolean shouldAddArrow) { + return show(launcher, targetRect, items, shouldAddArrow, 0 /* width */); + } + + public static OptionsPopupView show( + Launcher launcher, RectF targetRect, List items, boolean shouldAddArrow, + int width) { OptionsPopupView popup = (OptionsPopupView) launcher.getLayoutInflater() .inflate(R.layout.longpress_options_menu, launcher.getDragLayer(), false); popup.mTargetRect = targetRect; @@ -140,6 +146,9 @@ public class OptionsPopupView extends ArrowPopup for (OptionItem item : items) { DeepShortcutView view = (DeepShortcutView) popup.inflateAndAdd(R.layout.system_shortcut, popup); + if (width > 0) { + view.getLayoutParams().width = width; + } view.getIconView().setBackgroundDrawable(item.icon); view.getBubbleText().setText(item.label); view.setOnClickListener(popup); From 0d284852d9fdab15911242a4553f1aa315ebdc54 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 22 Jun 2021 14:50:55 -0700 Subject: [PATCH 17/26] Fix bug where icons in hotseat were clipped when display size is Small. Simplify calculations to ensure the hotseat sizes are always accurate. Bug: 186556930 Test: changed display setting from small to largest on different grid sizes (5x5, 4x4, 4x5, 3x3, 2x2) Change-Id: I97580c50a9d821577eb63335950d5695d9bf035d --- src/com/android/launcher3/DeviceProfile.java | 33 +++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index e9245b0819..d301787cbc 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -149,10 +149,11 @@ public class DeviceProfile { // Hotseat public final int numShownHotseatIcons; public int hotseatCellHeightPx; + private final int hotseatExtraVerticalSize; // In portrait: size = height, in landscape: size = width public int hotseatBarSizePx; public final int hotseatBarTopPaddingPx; - public int hotseatBarBottomPaddingPx; + public final int hotseatBarBottomPaddingPx; // Start is the side next to the nav bar, end is the side next to the workspace public final int hotseatBarSidePaddingStartPx; public final int hotseatBarSidePaddingEndPx; @@ -326,13 +327,9 @@ public class DeviceProfile { res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding); // Add a bit of space between nav bar and hotseat in vertical bar layout. hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0; - int hotseatExtraVerticalSize = + hotseatExtraVerticalSize = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size); - hotseatBarSizePx = pxFromDp(inv.iconSize, mMetrics, 1f) - + (isVerticalBarLayout() - ? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx) - : (hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx - + (isScalableGrid ? 0 : hotseatExtraVerticalSize))); + updateHotseatIconSize(pxFromDp(inv.iconSize, mMetrics, 1f)); overviewTaskMarginPx = res.getDimensionPixelSize(R.dimen.overview_task_margin); overviewTaskIconSizePx = @@ -362,7 +359,6 @@ public class DeviceProfile { extraHotseatBottomPadding = Math.round(paddingHotseatBottom * iconScale); hotseatBarSizePx += extraHotseatBottomPadding; - hotseatBarBottomPaddingPx += extraHotseatBottomPadding; } else if (!isVerticalBarLayout() && isPhone && isTallDevice) { // We increase the hotseat size when there is extra space. // ie. For a display with a large aspect ratio, we can keep the icons on the workspace @@ -371,7 +367,6 @@ public class DeviceProfile { int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx * 2 - workspacePageIndicatorHeight; hotseatBarSizePx += extraSpace; - hotseatBarBottomPaddingPx += extraSpace; // Recalculate the available dimensions using the new hotseat size. updateAvailableDimensions(res); @@ -388,6 +383,17 @@ public class DeviceProfile { new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE); } + private void updateHotseatIconSize(int hotseatIconSizePx) { + hotseatCellHeightPx = hotseatIconSizePx; + if (isVerticalBarLayout()) { + hotseatBarSizePx = hotseatIconSizePx + hotseatBarSidePaddingStartPx + + hotseatBarSidePaddingEndPx; + } else { + hotseatBarSizePx = hotseatIconSizePx + hotseatBarTopPaddingPx + + hotseatBarBottomPaddingPx + (isScalableGrid ? 0 : hotseatExtraVerticalSize); + } + } + private void setCellLayoutBorderSpacing(int borderSpacing) { cellLayoutBorderSpacingPx = isScalableGrid ? borderSpacing : 0; } @@ -573,11 +579,7 @@ public class DeviceProfile { } // Hotseat - if (isVerticalLayout) { - hotseatBarSizePx = iconSizePx + hotseatBarSidePaddingStartPx - + hotseatBarSidePaddingEndPx; - } - hotseatCellHeightPx = iconSizePx; + updateHotseatIconSize(iconSizePx); if (!isVerticalLayout) { int expectedWorkspaceHeight = availableHeightPx - hotseatBarSizePx @@ -763,7 +765,8 @@ public class DeviceProfile { hotseatBarTopPaddingPx, hotseatAdjustment + workspacePadding.right + cellLayoutPaddingLeftRightPx + mInsets.right, - hotseatBarBottomPaddingPx + mInsets.bottom + cellLayoutBottomPaddingPx); + hotseatBarSizePx - hotseatCellHeightPx - hotseatBarTopPaddingPx + + cellLayoutBottomPaddingPx + mInsets.bottom); } return mHotseatPadding; } From b60fff3929ccaa2bcff3700ef88e09a12c3a0496 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 22 Jun 2021 16:57:34 -0700 Subject: [PATCH 18/26] Disable blurs when dev setting or battery saver Stop rendering blurs whenever a user: - disables blurs on developer settings - enables battery saver Test: manual Bug: 191814337 Change-Id: I8fd04796054d92171732c8db95b64cfa3ec469ec --- .../statehandlers/DepthController.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index e6333d196b..4503e308e6 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -25,6 +25,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.os.IBinder; import android.util.FloatProperty; +import android.view.CrossWindowBlurListeners; import android.view.SurfaceControl; import android.view.View; import android.view.ViewRootImpl; @@ -41,6 +42,8 @@ import com.android.launcher3.states.StateAnimationConfig; import com.android.systemui.shared.system.BlurUtils; import com.android.systemui.shared.system.WallpaperManagerCompat; +import java.util.function.Consumer; + /** * Controls blur and wallpaper zoom, for the Launcher surface only. */ @@ -96,11 +99,17 @@ public class DepthController implements StateHandler, } }; + private final Consumer mCrossWindowBlurListener = (enabled) -> { + mCrossWindowBlursEnabled = enabled; + dispatchTransactionSurface(); + }; + private final Launcher mLauncher; /** * Blur radius when completely zoomed out, in pixels. */ private int mMaxBlurRadius; + private boolean mCrossWindowBlursEnabled; private WallpaperManagerCompat mWallpaperManager; private SurfaceControl mSurface; /** @@ -123,6 +132,7 @@ public class DepthController implements StateHandler, mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius); mWallpaperManager = new WallpaperManagerCompat(mLauncher); } + if (mLauncher.getRootView() != null && mOnAttachListener == null) { mOnAttachListener = new View.OnAttachStateChangeListener() { @Override @@ -132,13 +142,20 @@ public class DepthController implements StateHandler, if (windowToken != null) { mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth); } + CrossWindowBlurListeners.getInstance().addListener(mLauncher.getMainExecutor(), + mCrossWindowBlurListener); } @Override public void onViewDetachedFromWindow(View view) { + CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener); } }; mLauncher.getRootView().addOnAttachStateChangeListener(mOnAttachListener); + if (mLauncher.getRootView().isAttachedToWindow()) { + CrossWindowBlurListeners.getInstance().addListener(mLauncher.getMainExecutor(), + mCrossWindowBlurListener); + } } } @@ -220,7 +237,8 @@ public class DepthController implements StateHandler, boolean isOverview = mLauncher.isInState(LauncherState.OVERVIEW); boolean opaque = mLauncher.getScrimView().isFullyOpaque() && !isOverview; - int blur = opaque || isOverview ? 0 : (int) (mDepth * mMaxBlurRadius); + int blur = opaque || isOverview || !mCrossWindowBlursEnabled + ? 0 : (int) (mDepth * mMaxBlurRadius); new SurfaceControl.Transaction() .setBackgroundBlurRadius(mSurface, blur) .setOpaque(mSurface, opaque) From 0571a370d1c838ce47c534f4c1a3ca8dd30e6d30 Mon Sep 17 00:00:00 2001 From: Steven Ng Date: Wed, 23 Jun 2021 17:11:05 +0100 Subject: [PATCH 19/26] Use default spans as min spans if the min spans > default spans This is to match the behavior described in AppWidgetProviderInfo#minResizeWidth/Height documentation. Test: run LauncherAppWidgetProviderInfoTest Bug: 191223844 Change-Id: I37c0c8bf5e4588919e5b30fab6d2fde7236e114b --- .../LauncherAppWidgetProviderInfoTest.java | 24 +++++++++++++++++++ .../widget/LauncherAppWidgetProviderInfo.java | 7 ++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/robolectric_tests/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfoTest.java b/robolectric_tests/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfoTest.java index 2d87957cf7..a6f892c048 100644 --- a/robolectric_tests/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfoTest.java +++ b/robolectric_tests/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfoTest.java @@ -122,6 +122,8 @@ public final class LauncherAppWidgetProviderInfoTest { @Test public void initSpans_minResizeWidthSmallerThanCellWidth_shouldInitializeMinSpansToOne() { LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo(); + info.minWidth = 100; + info.minHeight = 100; info.minResizeWidth = 20; info.minResizeHeight = 20; InvariantDeviceProfile idp = createIDP(); @@ -135,6 +137,8 @@ public final class LauncherAppWidgetProviderInfoTest { @Test public void initSpans_minResizeWidthLargerThanCellWidth_shouldInitializeMinSpans() { LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo(); + info.minWidth = 100; + info.minHeight = 100; info.minResizeWidth = 80; info.minResizeHeight = 80; InvariantDeviceProfile idp = createIDP(); @@ -157,6 +161,8 @@ public final class LauncherAppWidgetProviderInfoTest { Mockito.when(dp.shouldInsetWidgets()).thenReturn(true); LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo(); + info.minWidth = CELL_SIZE * 3; + info.minHeight = CELL_SIZE * 3; info.minResizeWidth = CELL_SIZE * 2 + maxPadding; info.minResizeHeight = CELL_SIZE * 2 + maxPadding; @@ -177,6 +183,8 @@ public final class LauncherAppWidgetProviderInfoTest { dp.cellLayoutBorderSpacingPx = maxPadding - 1; Mockito.when(dp.shouldInsetWidgets()).thenReturn(false); LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo(); + info.minWidth = CELL_SIZE * 3; + info.minHeight = CELL_SIZE * 3; info.minResizeWidth = CELL_SIZE * 2 + maxPadding; info.minResizeHeight = CELL_SIZE * 2 + maxPadding; @@ -186,6 +194,22 @@ public final class LauncherAppWidgetProviderInfoTest { assertThat(info.minSpanY).isEqualTo(3); } + @Test + public void + initSpans_minResizeWidthHeightLargerThanMinWidth_shouldUseMinWidthHeightAsMinSpans() { + LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo(); + info.minWidth = 20; + info.minHeight = 20; + info.minResizeWidth = 80; + info.minResizeHeight = 80; + InvariantDeviceProfile idp = createIDP(); + + info.initSpans(mContext, idp); + + assertThat(info.minSpanX).isEqualTo(1); + assertThat(info.minSpanY).isEqualTo(1); + } + @Test public void isMinSizeFulfilled_minWidthAndHeightWithinGridSize_shouldReturnTrue() { LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo(); diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java b/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java index 5a29171361..d77d99dfa3 100644 --- a/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java +++ b/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java @@ -160,8 +160,11 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo } } - this.minSpanX = minSpanX; - this.minSpanY = minSpanY; + // If minSpanX/Y > spanX/Y, ignore the minSpanX/Y to match the behavior described in + // minResizeWidth & minResizeHeight Android documentation. See + // https://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo + this.minSpanX = Math.min(spanX, minSpanX); + this.minSpanY = Math.min(spanY, minSpanY); this.maxSpanX = maxSpanX; this.maxSpanY = maxSpanY; this.mIsMinSizeFulfilled = Math.min(spanX, minSpanX) <= idp.numColumns From 95d6df3647e8ca34096d377c6e3a1dc0a37a4ea9 Mon Sep 17 00:00:00 2001 From: Alina Zaidi Date: Wed, 23 Jun 2021 12:24:59 +0100 Subject: [PATCH 20/26] Update string for no room on this Home screen toast. Bug: 191852136 Test: Tested manually to check that the toast has updated string. Change-Id: I28f73eda17fdc49dee18e4f8be89224f04471697 --- res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 60c0774ff8..d594610801 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -140,8 +140,8 @@ Double-tap & hold to move a shortcut or use custom actions. - - No more room on this Home screen. + + No room on this Home screen No more room in the Favorites tray From ce820f51e25cea292ddd13815b79941223bfca38 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Fri, 18 Jun 2021 17:23:48 -0500 Subject: [PATCH 21/26] Polish work for work profile Bug: 191478900 Work profile toggle specs Bug: 187761192 Fix issue where Installing app scrolling apps to top Bug: 191121890 Fix issue where top of AllApps becomes empty when returning to AllApps Bug: 191477329 String change for work profile paused state Test: local Change-Id: Idbaab333566b54afa3dc879f5bea98e1f77c44fc --- res/drawable/work_apps_toggle_background.xml | 8 ++++++-- res/layout/work_apps_edu.xml | 2 +- res/layout/work_apps_paused.xml | 10 +++++----- res/layout/work_mode_fab.xml | 2 ++ res/values/strings.xml | 2 +- src/com/android/launcher3/Launcher.java | 2 +- .../launcher3/allapps/AllAppsContainerView.java | 10 ++++++---- .../android/launcher3/views/SpringRelativeLayout.java | 5 ++--- 8 files changed, 24 insertions(+), 17 deletions(-) diff --git a/res/drawable/work_apps_toggle_background.xml b/res/drawable/work_apps_toggle_background.xml index b7115f86b5..a47c8fef7c 100644 --- a/res/drawable/work_apps_toggle_background.xml +++ b/res/drawable/work_apps_toggle_background.xml @@ -18,14 +18,18 @@ - + - + diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml index 97feb23745..919f1b27cf 100644 --- a/res/layout/work_apps_edu.xml +++ b/res/layout/work_apps_edu.xml @@ -42,7 +42,7 @@