From 75d8994e6f947cdd3f74d1687fc8add6fbacdf4d Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Thu, 24 Aug 2023 15:01:27 -0700 Subject: [PATCH 1/2] Add nullable annotation It looks like from the stack trace that there is an NPE during the setApps() call. So adding nullable and null checking to make sure mApps is not null. bug: 296920692 test: presubmit flag: n/a Change-Id: If402c0b68db159f7a698e8e2e139d9bd5041b1c1 --- .../taskbar/allapps/TaskbarAllAppsController.java | 12 +++++++----- src/com/android/launcher3/allapps/AllAppsStore.java | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index 544f9bf27e..d786d94149 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -15,8 +15,11 @@ */ package com.android.launcher3.taskbar.allapps; +import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY; + import android.view.View; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; @@ -33,7 +36,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.function.Predicate; - /** * Handles the all apps overlay window initialization, updates, and its data. *

@@ -54,9 +56,9 @@ public final class TaskbarAllAppsController { private @Nullable TaskbarSearchSessionController mSearchSessionController; // Application data models. - private AppInfo[] mApps; + private @NonNull AppInfo[] mApps = EMPTY_ARRAY; private int mAppsModelFlags; - private List mPredictedApps; + private @NonNull List mPredictedApps = Collections.emptyList(); private @Nullable List mZeroStateSearchSuggestions; private boolean mDisallowGlobalDrag; private boolean mDisallowLongClick; @@ -82,8 +84,8 @@ public final class TaskbarAllAppsController { } /** Updates the current {@link AppInfo} instances. */ - public void setApps(AppInfo[] apps, int flags, Map map) { - mApps = apps; + public void setApps(@Nullable AppInfo[] apps, int flags, Map map) { + mApps = apps == null ? EMPTY_ARRAY : apps; mAppsModelFlags = flags; mPackageUserKeytoUidMap = map; if (mAppsView != null) { diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java index c3d0e6b530..e724858a79 100644 --- a/src/com/android/launcher3/allapps/AllAppsStore.java +++ b/src/com/android/launcher3/allapps/AllAppsStore.java @@ -61,7 +61,7 @@ public class AllAppsStore { private PackageUserKey mTempKey = new PackageUserKey(null, null); private AppInfo mTempInfo = new AppInfo(); - private AppInfo[] mApps = EMPTY_ARRAY; + private @NonNull AppInfo[] mApps = EMPTY_ARRAY; private final List mUpdateListeners = new CopyOnWriteArrayList<>(); private final ArrayList mIconContainers = new ArrayList<>(); @@ -85,8 +85,8 @@ public class AllAppsStore { * Sets the current set of apps and sets mapping for {@link PackageUserKey} to Uid for * the current set of apps. */ - public void setApps(AppInfo[] apps, int flags, Map map) { - mApps = apps; + public void setApps(@Nullable AppInfo[] apps, int flags, Map map) { + mApps = apps == null ? EMPTY_ARRAY : apps; mModelFlags = flags; notifyUpdate(); mPackageUserKeytoUidMap = map; From 7146fc249f3ba7ba7fc8674ecc86ab3e8a756d33 Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Thu, 31 Aug 2023 23:08:54 +0000 Subject: [PATCH 2/2] Ensure Gesture Nav Edu animation scales to fit different screen sizes The lottie animation in the gesture nav tutorial wasn't scaling correctly for certain devices leading to gaps around the animation. This change uses animation's scale transformation to ensure it fits the dimensions of the device. Flag: ENABLE_NEW_GESTURE_NAV_TUTORIAL Fix: 295809541 Test: Went through the tutorial on different types of devices and ensure the animation takes up the entire screen. (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3ca10a1325f2db21185d6143d310f55056865f05) Merged-In: Iadee0d0389a11aa38c9e947b4b40466acd8f4422 Change-Id: Iadee0d0389a11aa38c9e947b4b40466acd8f4422 --- .../android/quickstep/interaction/TutorialController.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java index 4a1fec3ecf..139083b074 100644 --- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java @@ -226,13 +226,11 @@ abstract class TutorialController implements BackGestureAttemptCallback, return; } Matrix scaleMatrix = new Matrix(); - float pivotX = mScreenWidth / 2f; - float pivotY = mScreenHeight; float scaleFactor = mScreenWidth / animationBoundsRect.width(); + float heightTranslate = (mScreenHeight - (scaleFactor * animationBoundsRect.height())); - scaleMatrix.postScale(scaleFactor, scaleFactor, pivotX, pivotY); - scaleMatrix.postTranslate(0, - mTutorialFragment.getDeviceProfile().heightPx - animationBoundsRect.height()); + scaleMatrix.postScale(scaleFactor, scaleFactor); + scaleMatrix.postTranslate(0, heightTranslate); mAnimatedGestureDemonstration.setImageMatrix(scaleMatrix); }