Defer starting the high-res thumbnail loader until quick step/scrub

- When hitting the home button, we may be loading high-res thumbnails
  unnecessarily since the high-res loader is already enabled when
  Launcher is started.

Bug: 111515602
Bug: 111156069

Change-Id: I367993b4ddf653b816355df005c745caed5e794a
This commit is contained in:
Winson Chung 2018-07-16 13:33:31 -07:00
parent f912bd955f
commit 8eb49e079e
5 changed files with 22 additions and 1 deletions

View File

@ -165,6 +165,14 @@ public class UiFactory {
}
}
public static void onEnterAnimationComplete(Context context) {
// After the transition to home, enable the high-res thumbnail loader if it wasn't enabled
// as a part of quickstep/scrub, so that high-res thumbnails can load the next time we
// enter overview
RecentsModel.getInstance(context).getRecentsTaskLoader()
.getHighResThumbnailLoader().setVisible(true);
}
public static void onLauncherStateOrResumeChanged(Launcher launcher) {
LauncherState state = launcher.getStateManager().getState();
DeviceProfile profile = launcher.getDeviceProfile();

View File

@ -232,7 +232,6 @@ public class RecentsModel extends TaskStackChangeListener {
public void onStart() {
mRecentsTaskLoader.startLoader(mContext);
mRecentsTaskLoader.getHighResThumbnailLoader().setVisible(true);
}
public void onTrimMemory(int level) {

View File

@ -483,6 +483,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
if (LatencyTrackerCompat.isEnabled(mContext)) {
LatencyTrackerCompat.logToggleRecents((int) (mLauncherFrameDrawnTime - mTouchTimeMs));
}
// This method is only called when STATE_GESTURE_STARTED_QUICKSTEP/
// STATE_GESTURE_STARTED_QUICKSCRUB is set, so we can enable the high-res thumbnail loader
// here once we are sure that we will end up in an overview state
RecentsModel.getInstance(mContext).getRecentsTaskLoader()
.getHighResThumbnailLoader().setVisible(true);
}
public void updateInteractionType(@InteractionType int interactionType) {

View File

@ -347,6 +347,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
TraceHelper.endSection("Launcher-onCreate");
}
@Override
public void onEnterAnimationComplete() {
super.onEnterAnimationComplete();
UiFactory.onEnterAnimationComplete(this);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
int diff = newConfig.diff(mOldConfig);

View File

@ -48,6 +48,8 @@ public class UiFactory {
public static void onStart(Launcher launcher) { }
public static void onEnterAnimationComplete(Context context) {}
public static void onLauncherStateOrResumeChanged(Launcher launcher) { }
public static void onTrimMemory(Launcher launcher, int level) { }