Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -204,8 +204,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD Recents.getSystemServices().removeTask(task.persistentId); } } Settings.Secure.putLongForUser(RecentsActivity.this.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, currentTime, currentUser); Recents.getSystemServices().updateOverviewLastStackActiveTimeAsync( currentTime, currentUser); // Clear the last PiP task time, it's an edge case and we'd rather it // not relaunch the PiP task if the user double taps Loading packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +44 −34 Original line number Diff line number Diff line Loading @@ -35,15 +35,18 @@ import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.SystemClock; import android.os.UserHandle; import android.util.Log; import android.util.MutableBoolean; import android.util.Pair; import android.view.AppTransitionAnimationSpec; import android.view.LayoutInflater; import android.view.ViewConfiguration; import android.view.WindowManager; import android.widget.Toast; import com.google.android.collect.Lists; import com.android.internal.logging.MetricsLogger; import com.android.internal.policy.DockedDividerUtils; import com.android.systemui.R; Loading Loading @@ -74,6 +77,8 @@ import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.TaskGrouping; import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.views.RecentsTransitionHelper; import com.android.systemui.recents.views.RecentsTransitionHelper.AppTransitionAnimationSpecsFuture; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm.VisibilityReport; import com.android.systemui.recents.views.TaskStackView; Loading Loading @@ -671,7 +676,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener windowRect.bottom -= systemInsets.bottom; systemInsets.bottom = 0; } calculateWindowStableInsets(systemInsets, windowRect); calculateWindowStableInsets(systemInsets, windowRect, displayRect); windowRect.offsetTo(0, 0); synchronized (mDummyStackView) { Loading Loading @@ -761,8 +766,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener * Given the stable insets and the rect for our window, calculates the insets that affect our * window. */ private void calculateWindowStableInsets(Rect inOutInsets, Rect windowRect) { Rect displayRect = Recents.getSystemServices().getDisplayRect(); private void calculateWindowStableInsets(Rect inOutInsets, Rect windowRect, Rect displayRect) { // Display rect without insets - available app space Rect appRect = new Rect(displayRect); Loading Loading @@ -812,8 +816,9 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener /** * Creates the activity options for an app->recents transition. */ private ActivityOptions getThumbnailTransitionActivityOptions( ActivityManager.RunningTaskInfo runningTask, Rect windowOverrideRect) { private Pair<ActivityOptions, AppTransitionAnimationSpecsFuture> getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask, Rect windowOverrideRect) { if (runningTask != null && runningTask.stackId == FREEFORM_WORKSPACE_STACK_ID) { ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>(); ArrayList<Task> tasks; Loading Loading @@ -844,23 +849,27 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener } AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()]; specs.toArray(specsArray); return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this); return new Pair<>(ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this), null); } else { // Update the destination rect Task toTask = new Task(); TaskViewTransform toTransform = getThumbnailTransitionTransform(mDummyStackView, toTask, windowOverrideRect); RectF toTaskRect = toTransform.rect; AppTransitionAnimationSpecsFuture future = new RecentsTransitionHelper(mContext).getAppTransitionFuture( () -> { Rect rect = new Rect(); toTaskRect.round(rect); Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, mThumbTransitionBitmapCache); if (thumbnail != null) { RectF toTaskRect = toTransform.rect; return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) toTaskRect.left, (int) toTaskRect.top, (int) toTaskRect.width(), (int) toTaskRect.height(), mHandler, null); } // If both the screenshot and thumbnail fails, then just fall back to the default transition return getUnknownTransitionActivityOptions(); return Lists.newArrayList(new AppTransitionAnimationSpec( toTask.key.id, thumbnail, rect)); }); return new Pair<>(ActivityOptions.makeMultiThumbFutureAspectScaleAnimation(mContext, mHandler, future.getFuture(), null, false /* scaleUp */), future); } } Loading Loading @@ -986,30 +995,31 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener launchState.launchedNumVisibleThumbnails = stackVr.numVisibleThumbnails; if (!animate) { startRecentsActivity(ActivityOptions.makeCustomAnimation(mContext, -1, -1)); startRecentsActivity(ActivityOptions.makeCustomAnimation(mContext, -1, -1), null /* future */); return; } ActivityOptions opts; Pair<ActivityOptions, AppTransitionAnimationSpecsFuture> pair; if (isBlacklisted) { opts = getUnknownTransitionActivityOptions(); pair = new Pair<>(getUnknownTransitionActivityOptions(), null); } else if (useThumbnailTransition) { // Try starting with a thumbnail transition opts = getThumbnailTransitionActivityOptions(runningTask, windowOverrideRect); pair = getThumbnailTransitionActivityOptions(runningTask, windowOverrideRect); } else { // If there is no thumbnail transition, but is launching from home into recents, then // use a quick home transition opts = hasRecentTasks pair = new Pair<>(hasRecentTasks ? getHomeTransitionActivityOptions() : getUnknownTransitionActivityOptions(); : getUnknownTransitionActivityOptions(), null); } startRecentsActivity(opts); startRecentsActivity(pair.first, pair.second); mLastToggleTime = SystemClock.elapsedRealtime(); } private Rect getWindowRectOverride(int growTarget) { if (growTarget == DividerView.INVALID_RECENTS_GROW_TARGET) { return null; return SystemServicesProxy.getInstance(mContext).getWindowRect(); } Rect result = new Rect(); Rect displayRect = Recents.getSystemServices().getDisplayRect(); Loading @@ -1022,21 +1032,21 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener /** * Starts the recents activity. */ private void startRecentsActivity(ActivityOptions opts) { private void startRecentsActivity(ActivityOptions opts, final AppTransitionAnimationSpecsFuture future) { Intent intent = new Intent(); intent.setClassName(RECENTS_PACKAGE, RECENTS_ACTIVITY); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_TASK_ON_HOME); Recents.getSystemServices().startActivityAsUserAsync(intent, opts); HidePipMenuEvent hideMenuEvent = new HidePipMenuEvent(); hideMenuEvent.addPostAnimationCallback(() -> { if (opts != null) { mContext.startActivityAsUser(intent, opts.toBundle(), UserHandle.CURRENT); } else { mContext.startActivityAsUser(intent, UserHandle.CURRENT); } Recents.getSystemServices().startActivityAsUserAsync(intent, opts); EventBus.getDefault().send(new RecentsActivityStartingEvent()); if (future != null) { future.precacheSpecs(); } }); EventBus.getDefault().send(hideMenuEvent); } Loading packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +41 −3 Original line number Diff line number Diff line Loading @@ -58,20 +58,22 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.IRemoteCallback; import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.provider.Settings.Secure; import android.service.dreams.DreamService; import android.service.dreams.IDreamManager; import android.util.ArraySet; import android.util.IconDrawableFactory; import android.util.Log; import android.util.MutableBoolean; import android.view.AppTransitionAnimationSpec; import android.view.Display; import android.view.IAppTransitionAnimationSpecsFuture; import android.view.IDockedStackListener; Loading @@ -91,7 +93,6 @@ import com.android.systemui.recents.RecentsDebugFlags; import com.android.systemui.recents.RecentsImpl; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.ThumbnailData; import com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer; import java.io.IOException; import java.util.ArrayList; Loading Loading @@ -130,6 +131,8 @@ public class SystemServicesProxy { PackageManager mPm; IconDrawableFactory mDrawableFactory; IPackageManager mIpm; private final IDreamManager mDreamManager; private final Context mContext; AssistUtils mAssistUtils; WindowManager mWm; IWindowManager mIwm; Loading Loading @@ -285,6 +288,7 @@ public class SystemServicesProxy { /** Private constructor */ private SystemServicesProxy(Context context) { mContext = context.getApplicationContext(); mAccm = AccessibilityManager.getInstance(context); mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); mIam = ActivityManager.getService(); Loading @@ -296,6 +300,8 @@ public class SystemServicesProxy { mIwm = WindowManagerGlobal.getWindowManagerService(); mKgm = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); mUm = UserManager.get(context); mDreamManager = IDreamManager.Stub.asInterface( ServiceManager.checkService(DreamService.DREAM_SERVICE)); mDisplay = mWm.getDefaultDisplay(); mRecentsPackage = context.getPackageName(); mHasFreeformWorkspaceSupport = Loading Loading @@ -1127,6 +1133,11 @@ public class SystemServicesProxy { } } public void startActivityAsUserAsync(Intent intent, ActivityOptions opts) { mOnewayExecutor.submit(() -> mContext.startActivityAsUser(intent, opts != null ? opts.toBundle() : null, UserHandle.CURRENT)); } /** Starts an activity from recents. */ public void startActivityFromRecents(Context context, Task.TaskKey taskKey, String taskName, ActivityOptions options, int stackId, Loading Loading @@ -1283,6 +1294,33 @@ public class SystemServicesProxy { } } public boolean isDreaming() { try { return mDreamManager.isDreaming(); } catch (RemoteException e) { Log.e(TAG, "Failed to query dream manager.", e); } return false; } public void awakenDreamsAsync() { mOnewayExecutor.submit(() -> { try { mDreamManager.awaken(); } catch (RemoteException e) { e.printStackTrace(); } }); } public void updateOverviewLastStackActiveTimeAsync(long newLastStackActiveTime, int currentUserId) { mOnewayExecutor.submit(() -> { Settings.Secure.putLongForUser(mContext.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, newLastStackActiveTime, currentUserId); }); } public interface StartActivityFromRecentsResultListener { void onStartActivityResult(boolean succeeded); } Loading packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java +4 −5 Original line number Diff line number Diff line Loading @@ -218,8 +218,8 @@ public class RecentsTaskLoadPlan { affiliatedTasks.put(taskKey.id, taskKey); } if (newLastStackActiveTime != -1) { Settings.Secure.putLongForUser(mContext.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, newLastStackActiveTime, currentUserId); Recents.getSystemServices().updateOverviewLastStackActiveTimeAsync( newLastStackActiveTime, currentUserId); } // Initialize the stacks Loading Loading @@ -316,9 +316,8 @@ public class RecentsTaskLoadPlan { for (int i = 0; i < users.size(); i++) { int userId = users.get(i).id; if (userId != currentUserId) { Settings.Secure.putLongForUser(mContext.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, legacyLastStackActiveTime, userId); Recents.getSystemServices().updateOverviewLastStackActiveTimeAsync( legacyLastStackActiveTime, userId); } } return legacyLastStackActiveTime; Loading packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java +7 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Trace; import android.util.Log; import android.util.LruCache; Loading Loading @@ -351,7 +352,12 @@ public class RecentsTaskLoader { /** Preloads recents tasks using the specified plan to store the output. */ public synchronized void preloadTasks(RecentsTaskLoadPlan plan, int runningTaskId, boolean includeFrontMostExcludedTask) { try { Trace.beginSection("preloadPlan"); plan.preloadPlan(this, runningTaskId, includeFrontMostExcludedTask); } finally { Trace.endSection(); } } /** Begins loading the heavy task data according to the specified options. */ Loading Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -204,8 +204,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD Recents.getSystemServices().removeTask(task.persistentId); } } Settings.Secure.putLongForUser(RecentsActivity.this.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, currentTime, currentUser); Recents.getSystemServices().updateOverviewLastStackActiveTimeAsync( currentTime, currentUser); // Clear the last PiP task time, it's an edge case and we'd rather it // not relaunch the PiP task if the user double taps Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +44 −34 Original line number Diff line number Diff line Loading @@ -35,15 +35,18 @@ import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.SystemClock; import android.os.UserHandle; import android.util.Log; import android.util.MutableBoolean; import android.util.Pair; import android.view.AppTransitionAnimationSpec; import android.view.LayoutInflater; import android.view.ViewConfiguration; import android.view.WindowManager; import android.widget.Toast; import com.google.android.collect.Lists; import com.android.internal.logging.MetricsLogger; import com.android.internal.policy.DockedDividerUtils; import com.android.systemui.R; Loading Loading @@ -74,6 +77,8 @@ import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.TaskGrouping; import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.views.RecentsTransitionHelper; import com.android.systemui.recents.views.RecentsTransitionHelper.AppTransitionAnimationSpecsFuture; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm.VisibilityReport; import com.android.systemui.recents.views.TaskStackView; Loading Loading @@ -671,7 +676,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener windowRect.bottom -= systemInsets.bottom; systemInsets.bottom = 0; } calculateWindowStableInsets(systemInsets, windowRect); calculateWindowStableInsets(systemInsets, windowRect, displayRect); windowRect.offsetTo(0, 0); synchronized (mDummyStackView) { Loading Loading @@ -761,8 +766,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener * Given the stable insets and the rect for our window, calculates the insets that affect our * window. */ private void calculateWindowStableInsets(Rect inOutInsets, Rect windowRect) { Rect displayRect = Recents.getSystemServices().getDisplayRect(); private void calculateWindowStableInsets(Rect inOutInsets, Rect windowRect, Rect displayRect) { // Display rect without insets - available app space Rect appRect = new Rect(displayRect); Loading Loading @@ -812,8 +816,9 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener /** * Creates the activity options for an app->recents transition. */ private ActivityOptions getThumbnailTransitionActivityOptions( ActivityManager.RunningTaskInfo runningTask, Rect windowOverrideRect) { private Pair<ActivityOptions, AppTransitionAnimationSpecsFuture> getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask, Rect windowOverrideRect) { if (runningTask != null && runningTask.stackId == FREEFORM_WORKSPACE_STACK_ID) { ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>(); ArrayList<Task> tasks; Loading Loading @@ -844,23 +849,27 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener } AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()]; specs.toArray(specsArray); return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this); return new Pair<>(ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this), null); } else { // Update the destination rect Task toTask = new Task(); TaskViewTransform toTransform = getThumbnailTransitionTransform(mDummyStackView, toTask, windowOverrideRect); RectF toTaskRect = toTransform.rect; AppTransitionAnimationSpecsFuture future = new RecentsTransitionHelper(mContext).getAppTransitionFuture( () -> { Rect rect = new Rect(); toTaskRect.round(rect); Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, mThumbTransitionBitmapCache); if (thumbnail != null) { RectF toTaskRect = toTransform.rect; return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) toTaskRect.left, (int) toTaskRect.top, (int) toTaskRect.width(), (int) toTaskRect.height(), mHandler, null); } // If both the screenshot and thumbnail fails, then just fall back to the default transition return getUnknownTransitionActivityOptions(); return Lists.newArrayList(new AppTransitionAnimationSpec( toTask.key.id, thumbnail, rect)); }); return new Pair<>(ActivityOptions.makeMultiThumbFutureAspectScaleAnimation(mContext, mHandler, future.getFuture(), null, false /* scaleUp */), future); } } Loading Loading @@ -986,30 +995,31 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener launchState.launchedNumVisibleThumbnails = stackVr.numVisibleThumbnails; if (!animate) { startRecentsActivity(ActivityOptions.makeCustomAnimation(mContext, -1, -1)); startRecentsActivity(ActivityOptions.makeCustomAnimation(mContext, -1, -1), null /* future */); return; } ActivityOptions opts; Pair<ActivityOptions, AppTransitionAnimationSpecsFuture> pair; if (isBlacklisted) { opts = getUnknownTransitionActivityOptions(); pair = new Pair<>(getUnknownTransitionActivityOptions(), null); } else if (useThumbnailTransition) { // Try starting with a thumbnail transition opts = getThumbnailTransitionActivityOptions(runningTask, windowOverrideRect); pair = getThumbnailTransitionActivityOptions(runningTask, windowOverrideRect); } else { // If there is no thumbnail transition, but is launching from home into recents, then // use a quick home transition opts = hasRecentTasks pair = new Pair<>(hasRecentTasks ? getHomeTransitionActivityOptions() : getUnknownTransitionActivityOptions(); : getUnknownTransitionActivityOptions(), null); } startRecentsActivity(opts); startRecentsActivity(pair.first, pair.second); mLastToggleTime = SystemClock.elapsedRealtime(); } private Rect getWindowRectOverride(int growTarget) { if (growTarget == DividerView.INVALID_RECENTS_GROW_TARGET) { return null; return SystemServicesProxy.getInstance(mContext).getWindowRect(); } Rect result = new Rect(); Rect displayRect = Recents.getSystemServices().getDisplayRect(); Loading @@ -1022,21 +1032,21 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener /** * Starts the recents activity. */ private void startRecentsActivity(ActivityOptions opts) { private void startRecentsActivity(ActivityOptions opts, final AppTransitionAnimationSpecsFuture future) { Intent intent = new Intent(); intent.setClassName(RECENTS_PACKAGE, RECENTS_ACTIVITY); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_TASK_ON_HOME); Recents.getSystemServices().startActivityAsUserAsync(intent, opts); HidePipMenuEvent hideMenuEvent = new HidePipMenuEvent(); hideMenuEvent.addPostAnimationCallback(() -> { if (opts != null) { mContext.startActivityAsUser(intent, opts.toBundle(), UserHandle.CURRENT); } else { mContext.startActivityAsUser(intent, UserHandle.CURRENT); } Recents.getSystemServices().startActivityAsUserAsync(intent, opts); EventBus.getDefault().send(new RecentsActivityStartingEvent()); if (future != null) { future.precacheSpecs(); } }); EventBus.getDefault().send(hideMenuEvent); } Loading
packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +41 −3 Original line number Diff line number Diff line Loading @@ -58,20 +58,22 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.IRemoteCallback; import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.provider.Settings.Secure; import android.service.dreams.DreamService; import android.service.dreams.IDreamManager; import android.util.ArraySet; import android.util.IconDrawableFactory; import android.util.Log; import android.util.MutableBoolean; import android.view.AppTransitionAnimationSpec; import android.view.Display; import android.view.IAppTransitionAnimationSpecsFuture; import android.view.IDockedStackListener; Loading @@ -91,7 +93,6 @@ import com.android.systemui.recents.RecentsDebugFlags; import com.android.systemui.recents.RecentsImpl; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.ThumbnailData; import com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer; import java.io.IOException; import java.util.ArrayList; Loading Loading @@ -130,6 +131,8 @@ public class SystemServicesProxy { PackageManager mPm; IconDrawableFactory mDrawableFactory; IPackageManager mIpm; private final IDreamManager mDreamManager; private final Context mContext; AssistUtils mAssistUtils; WindowManager mWm; IWindowManager mIwm; Loading Loading @@ -285,6 +288,7 @@ public class SystemServicesProxy { /** Private constructor */ private SystemServicesProxy(Context context) { mContext = context.getApplicationContext(); mAccm = AccessibilityManager.getInstance(context); mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); mIam = ActivityManager.getService(); Loading @@ -296,6 +300,8 @@ public class SystemServicesProxy { mIwm = WindowManagerGlobal.getWindowManagerService(); mKgm = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); mUm = UserManager.get(context); mDreamManager = IDreamManager.Stub.asInterface( ServiceManager.checkService(DreamService.DREAM_SERVICE)); mDisplay = mWm.getDefaultDisplay(); mRecentsPackage = context.getPackageName(); mHasFreeformWorkspaceSupport = Loading Loading @@ -1127,6 +1133,11 @@ public class SystemServicesProxy { } } public void startActivityAsUserAsync(Intent intent, ActivityOptions opts) { mOnewayExecutor.submit(() -> mContext.startActivityAsUser(intent, opts != null ? opts.toBundle() : null, UserHandle.CURRENT)); } /** Starts an activity from recents. */ public void startActivityFromRecents(Context context, Task.TaskKey taskKey, String taskName, ActivityOptions options, int stackId, Loading Loading @@ -1283,6 +1294,33 @@ public class SystemServicesProxy { } } public boolean isDreaming() { try { return mDreamManager.isDreaming(); } catch (RemoteException e) { Log.e(TAG, "Failed to query dream manager.", e); } return false; } public void awakenDreamsAsync() { mOnewayExecutor.submit(() -> { try { mDreamManager.awaken(); } catch (RemoteException e) { e.printStackTrace(); } }); } public void updateOverviewLastStackActiveTimeAsync(long newLastStackActiveTime, int currentUserId) { mOnewayExecutor.submit(() -> { Settings.Secure.putLongForUser(mContext.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, newLastStackActiveTime, currentUserId); }); } public interface StartActivityFromRecentsResultListener { void onStartActivityResult(boolean succeeded); } Loading
packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java +4 −5 Original line number Diff line number Diff line Loading @@ -218,8 +218,8 @@ public class RecentsTaskLoadPlan { affiliatedTasks.put(taskKey.id, taskKey); } if (newLastStackActiveTime != -1) { Settings.Secure.putLongForUser(mContext.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, newLastStackActiveTime, currentUserId); Recents.getSystemServices().updateOverviewLastStackActiveTimeAsync( newLastStackActiveTime, currentUserId); } // Initialize the stacks Loading Loading @@ -316,9 +316,8 @@ public class RecentsTaskLoadPlan { for (int i = 0; i < users.size(); i++) { int userId = users.get(i).id; if (userId != currentUserId) { Settings.Secure.putLongForUser(mContext.getContentResolver(), Secure.OVERVIEW_LAST_STACK_ACTIVE_TIME, legacyLastStackActiveTime, userId); Recents.getSystemServices().updateOverviewLastStackActiveTimeAsync( legacyLastStackActiveTime, userId); } } return legacyLastStackActiveTime; Loading
packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java +7 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Trace; import android.util.Log; import android.util.LruCache; Loading Loading @@ -351,7 +352,12 @@ public class RecentsTaskLoader { /** Preloads recents tasks using the specified plan to store the output. */ public synchronized void preloadTasks(RecentsTaskLoadPlan plan, int runningTaskId, boolean includeFrontMostExcludedTask) { try { Trace.beginSection("preloadPlan"); plan.preloadPlan(this, runningTaskId, includeFrontMostExcludedTask); } finally { Trace.endSection(); } } /** Begins loading the heavy task data according to the specified options. */ Loading