Merge "Fix NPE when consuming snapshots for recent animation" into sc-v2-dev

This commit is contained in:
Jerry Chang 2022-01-12 01:21:14 +00:00 committed by Android (Google) Code Review
commit f6086e74e3
1 changed files with 9 additions and 4 deletions

View File

@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import android.annotation.Nullable;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.content.Intent; import android.content.Intent;
@ -397,12 +398,16 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
* while STATE_RECENTS_ANIMATION_CANCELED state is being set, and the caller is responsible for * while STATE_RECENTS_ANIMATION_CANCELED state is being set, and the caller is responsible for
* calling {@link RecentsAnimationController#cleanupScreenshot()}. * calling {@link RecentsAnimationController#cleanupScreenshot()}.
*/ */
@Nullable
HashMap<Integer, ThumbnailData> consumeRecentsAnimationCanceledSnapshot() { HashMap<Integer, ThumbnailData> consumeRecentsAnimationCanceledSnapshot() {
if (mRecentsAnimationCanceledSnapshots != null) {
HashMap<Integer, ThumbnailData> data = HashMap<Integer, ThumbnailData> data =
new HashMap<Integer, ThumbnailData>(mRecentsAnimationCanceledSnapshots); new HashMap<Integer, ThumbnailData>(mRecentsAnimationCanceledSnapshots);
mRecentsAnimationCanceledSnapshots = null; mRecentsAnimationCanceledSnapshots = null;
return data; return data;
} }
return null;
}
void setSwipeUpStartTimeMs(long uptimeMs) { void setSwipeUpStartTimeMs(long uptimeMs) {
mSwipeUpStartTimeMs = uptimeMs; mSwipeUpStartTimeMs = uptimeMs;