diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-06-29 14:40:18 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-07-03 14:39:21 -0700 |
commit | d0e360a8586f17268d57eb6c4dc01d21f1883f32 (patch) | |
tree | 87402d5a20c5d3604d2312acf28803b461081641 /quickstep | |
parent | 87555c56dc464186219538c2b530bd275f8a8d1d (diff) | |
download | android_packages_apps_Trebuchet-d0e360a8586f17268d57eb6c4dc01d21f1883f32.tar.gz android_packages_apps_Trebuchet-d0e360a8586f17268d57eb6c4dc01d21f1883f32.tar.bz2 android_packages_apps_Trebuchet-d0e360a8586f17268d57eb6c4dc01d21f1883f32.zip |
Lazy loading LauncherAppState
Separating InvarantDeviceProfile out of LauncherAppState and creating
LauncherAppState only when it is actually used
Change-Id: I2ee55f53cae01f11203f94675bb5f70c65ad2b9d
Diffstat (limited to 'quickstep')
3 files changed, 10 insertions, 27 deletions
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index eff94fcb5..7094a53db 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -197,14 +197,10 @@ public class OverviewCommandHelper { } public void onTip(int actionType, int viewType) { - mMainThreadExecutor.execute(new Runnable() { - @Override - public void run() { + mMainThreadExecutor.execute(() -> UserEventDispatcher.newInstance(mContext, - new InvariantDeviceProfile(mContext).getDeviceProfile(mContext)) - .logActionTip(actionType, viewType); - } - }); + InvariantDeviceProfile.INSTANCE.get(mContext).getDeviceProfile(mContext)) + .logActionTip(actionType, viewType)); } public ActivityControlHelper getActivityControlHelper() { diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index ed8b4d2b1..32079bf13 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -42,7 +42,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAnimationRunner; -import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.badge.BadgeInfo; @@ -131,21 +130,13 @@ public class RecentsActivity extends BaseDraggingActivity { } private void initDeviceProfile() { - // In case we are reusing IDP, create a copy so that we dont conflict with Launcher + DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(this).getDeviceProfile(this); + + // In case we are reusing IDP, create a copy so that we don't conflict with Launcher // activity. - LauncherAppState appState = LauncherAppState.getInstanceNoCreate(); - if (isInMultiWindowModeCompat()) { - InvariantDeviceProfile idp = appState == null - ? new InvariantDeviceProfile(this) : appState.getInvariantDeviceProfile(); - DeviceProfile dp = idp.getDeviceProfile(this); - mDeviceProfile = mRecentsRootView == null ? dp.copy(this) - : dp.getMultiWindowProfile(this, mRecentsRootView.getLastKnownSize()); - } else { - // If we are reusing the Invariant device profile, make a copy. - mDeviceProfile = appState == null - ? new InvariantDeviceProfile(this).getDeviceProfile(this) - : appState.getInvariantDeviceProfile().getDeviceProfile(this).copy(this); - } + mDeviceProfile = (mRecentsRootView != null) && isInMultiWindowModeCompat() + ? dp.getMultiWindowProfile(this, mRecentsRootView.getLastKnownSize()) + : dp.copy(this); onDeviceProfileInitiated(); } diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java index 15ff19e26..366263309 100644 --- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -57,7 +57,6 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; @@ -611,10 +610,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { public void onRecentsAnimationStart(RecentsAnimationControllerCompat controller, RemoteAnimationTargetSet targets, Rect homeContentInsets, Rect minimizedHomeBounds) { - LauncherAppState appState = LauncherAppState.getInstanceNoCreate(); - InvariantDeviceProfile idp = appState == null ? - new InvariantDeviceProfile(mContext) : appState.getInvariantDeviceProfile(); - DeviceProfile dp = idp.getDeviceProfile(mContext); + DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext).getDeviceProfile(mContext); final Rect overviewStackBounds; RemoteAnimationTargetCompat runningTaskTarget = targets.findTask(mRunningTaskId); |