Loading packages/SystemUI/src/com/android/systemui/recents/Recents.java +30 −17 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.model.RecentsTaskLoader; import java.util.ArrayList; Loading @@ -51,7 +52,9 @@ public class Recents extends SystemUI public final static int EVENT_BUS_PRIORITY = 1; public final static int BIND_TO_SYSTEM_USER_RETRY_DELAY = 5000; private SystemServicesProxy mSystemServicesProxy; private static SystemServicesProxy sSystemServicesProxy; private static RecentsTaskLoader sTaskLoader; private Handler mHandler; private RecentsImpl mImpl; Loading Loading @@ -118,20 +121,30 @@ public class Recents extends SystemUI return mSystemUserCallbacks; } public static RecentsTaskLoader getTaskLoader() { return sTaskLoader; } public static SystemServicesProxy getSystemServices() { return sSystemServicesProxy; } @Override public void start() { mSystemServicesProxy = new SystemServicesProxy(mContext); sSystemServicesProxy = new SystemServicesProxy(mContext); sTaskLoader = new RecentsTaskLoader(mContext); mHandler = new Handler(); mImpl = new RecentsImpl(mContext); // Register with the event bus EventBus.getDefault().register(this, EVENT_BUS_PRIORITY); EventBus.getDefault().register(sTaskLoader, EVENT_BUS_PRIORITY); // Due to the fact that RecentsActivity is per-user, we need to establish and interface for // the system user's Recents component to pass events (like show/hide/toggleRecents) to the // secondary user, and vice versa (like visibility change, screen pinning). final int processUser = mSystemServicesProxy.getProcessUser(); if (mSystemServicesProxy.isSystemUser(processUser)) { final int processUser = sSystemServicesProxy.getProcessUser(); if (sSystemServicesProxy.isSystemUser(processUser)) { // For the system user, initialize an instance of the interface that we can pass to the // secondary user mSystemUserCallbacks = new RecentsSystemUser(mContext, mImpl); Loading @@ -153,8 +166,8 @@ public class Recents extends SystemUI */ @Override public void showRecents(boolean triggeredFromAltTab, View statusBarView) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.showRecents(triggeredFromAltTab); } else { if (mSystemUserCallbacks != null) { Loading @@ -178,8 +191,8 @@ public class Recents extends SystemUI */ @Override public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.hideRecents(triggeredFromAltTab, triggeredFromHomeKey); } else { if (mSystemUserCallbacks != null) { Loading @@ -203,8 +216,8 @@ public class Recents extends SystemUI */ @Override public void toggleRecents(Display display, int layoutDirection, View statusBarView) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.toggleRecents(); } else { if (mSystemUserCallbacks != null) { Loading @@ -228,8 +241,8 @@ public class Recents extends SystemUI */ @Override public void preloadRecents() { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.preloadRecents(); } else { if (mSystemUserCallbacks != null) { Loading @@ -250,8 +263,8 @@ public class Recents extends SystemUI @Override public void cancelPreloadingRecents() { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.cancelPreloadingRecents(); } else { if (mSystemUserCallbacks != null) { Loading Loading @@ -284,8 +297,8 @@ public class Recents extends SystemUI * Updates on configuration change. */ public void onConfigurationChanged(Configuration newConfig) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.onConfigurationChanged(); } else { if (mSystemUserCallbacks != null) { Loading Loading @@ -350,7 +363,7 @@ public class Recents extends SystemUI * Attempts to register with the system user. */ private void registerWithSystemUser() { final int processUser = mSystemServicesProxy.getProcessUser(); final int processUser = sSystemServicesProxy.getProcessUser(); postToSystemUser(new Runnable() { @Override public void run() { Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +29 −38 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; import com.android.systemui.recents.events.ui.DismissTaskEvent; import com.android.systemui.recents.events.ui.ResizeTaskEvent; import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent; import com.android.systemui.recents.events.ui.UserInteractionEvent; import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent; import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent; import com.android.systemui.recents.misc.Console; Loading Loading @@ -137,7 +138,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView dismissRecentsToHomeIfVisible(false); } else if (action.equals(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED)) { // When the search activity changes, update the search widget view SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); mSearchWidgetInfo = ssp.getOrBindSearchAppWidget(context, mAppWidgetHost); refreshSearchWidgetView(); } Loading @@ -148,7 +149,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView void updateRecentsTasks() { // If AlternateRecentsComponent has preloaded a load plan, then use that to prevent // reconstructing the task stack RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = Recents.getTaskLoader(); RecentsTaskLoadPlan plan = RecentsImpl.consumeInstanceLoadPlan(); if (plan == null) { plan = loader.createLoadPlan(this); Loading Loading @@ -241,7 +242,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView /** Dismisses recents if we are already visible and the intent is to toggle the recents view */ boolean dismissRecentsToFocusedTaskOrHome(boolean checkFilteredStackState) { RecentsActivityLaunchState launchState = mConfig.getLaunchState(); SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // If we currently have filtered stacks, then unfilter those first if (checkFilteredStackState && Loading Loading @@ -284,7 +285,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView /** Dismisses Recents directly to Home if we currently aren't transitioning. */ boolean dismissRecentsToHomeIfVisible(boolean animated) { SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // Return to Home dismissRecentsToHome(animated); Loading @@ -301,16 +302,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // Register this activity with the event bus EventBus.getDefault().register(this, EVENT_BUS_PRIORITY); // For the non-primary user, ensure that the SystemServicesProxy and configuration is // initialized RecentsTaskLoader.initialize(this); SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); mConfig = RecentsConfiguration.initialize(this, ssp); mConfig.update(this, ssp, ssp.getWindowRect()); mPackageMonitor = new RecentsPackageMonitor(); // Initialize the widget host (the host id is static and does not change) mConfig = RecentsConfiguration.getInstance(); mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId); mPackageMonitor = new RecentsPackageMonitor(); mPackageMonitor.register(this); // Set the Recents layout setContentView(R.layout.recents); Loading @@ -323,6 +319,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView mScrimViews = new SystemBarScrimViews(this); // Bind the search app widget when we first start up SystemServicesProxy ssp = Recents.getSystemServices(); mSearchWidgetInfo = ssp.getOrBindSearchAppWidget(this, mAppWidgetHost); // Register the broadcast receiver to handle messages when the screen is turned off Loading @@ -341,16 +338,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override protected void onStart() { super.onStart(); RecentsActivityLaunchState launchState = mConfig.getLaunchState(); MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY); RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); SystemServicesProxy ssp = loader.getSystemServicesProxy(); // Notify that recents is now visible EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true)); // Register any broadcast receivers for the task loader mPackageMonitor.register(this); // Update the recent tasks updateRecentsTasks(); Loading @@ -358,6 +345,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // If this is a new instance from a configuration change, then we have to manually trigger // the enter animation state, or if recents was relaunched by AM, without going through // the normal mechanisms RecentsActivityLaunchState launchState = mConfig.getLaunchState(); boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromAppWithThumbnail; if (launchState.launchedHasConfigurationChanged || wasLaunchedByAm) { Loading @@ -367,6 +355,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView if (!launchState.launchedHasConfigurationChanged) { mRecentsView.disableLayersForOneFrame(); } // Notify that recents is now visible SystemServicesProxy ssp = Recents.getSystemServices(); EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true)); MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY); } @Override Loading @@ -381,19 +375,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override protected void onStop() { super.onStop(); MetricsLogger.hidden(this, MetricsLogger.OVERVIEW_ACTIVITY); RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); SystemServicesProxy ssp = loader.getSystemServicesProxy(); // Notify that recents is now hidden SystemServicesProxy ssp = Recents.getSystemServices(); EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, false)); // Notify the views that we are no longer visible mRecentsView.onRecentsHidden(); // Unregister any broadcast receivers for the task loader mPackageMonitor.unregister(); // Workaround for b/22542869, if the RecentsActivity is started again, but without going // through SystemUI, we need to reset the config launch flags to ensure that we do not // wait on the system to send a signal that was never queued. Loading @@ -404,6 +390,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView launchState.launchedToTaskId = -1; launchState.launchedWithAltTab = false; launchState.launchedHasConfigurationChanged = false; MetricsLogger.hidden(this, MetricsLogger.OVERVIEW_ACTIVITY); } @Override Loading @@ -413,6 +401,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // Unregister the system broadcast receivers unregisterReceiver(mSystemBroadcastReceiver); // Unregister any broadcast receivers for the task loader mPackageMonitor.unregister(); // Stop listening for widget package changes if there was one bound mAppWidgetHost.stopListening(); EventBus.getDefault().unregister(this); Loading @@ -432,7 +423,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override public void onTrimMemory(int level) { RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = Recents.getTaskLoader(); if (loader != null) { loader.onTrimMemory(level); } Loading Loading @@ -477,7 +468,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override public void onUserInteraction() { mRecentsView.onUserInteraction(); EventBus.getDefault().send(new UserInteractionEvent()); } @Override Loading Loading @@ -559,9 +550,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public final void onBusEvent(ShowApplicationInfoEvent event) { // Create a new task stack with the application info details activity Intent baseIntent = event.task.key.baseIntent; Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", baseIntent.getComponent().getPackageName(), null)); Uri.fromParts("package", event.task.key.getComponent().getPackageName(), null)); intent.setComponent(intent.resolveActivity(getPackageManager())); TaskStackBuilder.create(this) .addNextIntentWithParentStack(intent).startActivities(null, Loading @@ -573,11 +563,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public final void onBusEvent(DismissTaskEvent event) { // Remove any stored data from the loader RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = Recents.getTaskLoader(); loader.deleteTaskData(event.task, false); // Remove the task from activity manager loader.getSystemServicesProxy().removeTask(event.task.key.id); SystemServicesProxy ssp = Recents.getSystemServices(); ssp.removeTask(event.task.key.id); } public final void onBusEvent(ResizeTaskEvent event) { Loading @@ -602,7 +593,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView private void refreshSearchWidgetView() { if (mSearchWidgetInfo != null) { SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); int searchWidgetId = ssp.getSearchAppWidgetId(this); mSearchWidgetHostView = (RecentsAppWidgetHostView) mAppWidgetHost.createView( this, searchWidgetId, mSearchWidgetInfo); Loading packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +5 −4 Original line number Diff line number Diff line Loading @@ -111,8 +111,7 @@ public class RecentsConfiguration { void update(Context context, SystemServicesProxy ssp, Rect windowRect) { // Only update resources that can change after the first load, either through developer // settings or via multi window lockToAppEnabled = ssp.getSystemSetting(context, Settings.System.LOCK_TO_APP_ENABLED) != 0; lockToAppEnabled = ssp.getSystemSetting(context, Settings.System.LOCK_TO_APP_ENABLED) != 0; hasDockedTasks = ssp.hasDockedTask(); // Recompute some values based on the given state, since we can not rely on the resource Loading Loading @@ -143,8 +142,10 @@ public class RecentsConfiguration { return mLaunchState; } /** Called when the configuration has changed, and we want to reset any configuration specific * members. */ /** * Called when the configuration has changed, and we want to reset any configuration specific * members. */ public void updateOnConfigurationChange() { mLaunchState.updateOnConfigurationChange(); } Loading packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +42 −41 File changed.Preview size limit exceeded, changes collapsed. Show changes packages/SystemUI/src/com/android/systemui/recents/RecentsResizeTaskDialog.java +6 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.widget.Button; import android.widget.Toast; import com.android.systemui.R; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.views.RecentsView; Loading Loading @@ -80,7 +79,6 @@ public class RecentsResizeTaskDialog extends DialogFragment { private View mResizeTaskDialogContent; private RecentsActivity mRecentsActivity; private RecentsView mRecentsView; private SystemServicesProxy mSsp; private Rect[] mBounds = {new Rect(), new Rect(), new Rect(), new Rect()}; private Task[] mTasks = {null, null, null, null}; Loading @@ -93,7 +91,6 @@ public class RecentsResizeTaskDialog extends DialogFragment { public RecentsResizeTaskDialog(FragmentManager mgr, RecentsActivity activity) { mFragmentManager = mgr; mRecentsActivity = activity; mSsp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); } /** Shows the resize-task dialog. */ Loading Loading @@ -144,7 +141,8 @@ public class RecentsResizeTaskDialog extends DialogFragment { /** Helper function to place window(s) on the display according to an arrangement request. */ private void placeTasks(int arrangement) { Rect rect = mSsp.getDisplayRect(); SystemServicesProxy ssp = Recents.getSystemServices(); Rect rect = ssp.getDisplayRect(); for (int i = 0; i < mBounds.length; ++i) { mBounds[i].set(rect); if (i != 0) { Loading Loading @@ -240,7 +238,7 @@ public class RecentsResizeTaskDialog extends DialogFragment { // current app configuration. for (int i = additionalTasks; i >= 0; --i) { if (mTasks[i] != null) { mSsp.setTaskResizeable(mTasks[i].key.id); ssp.setTaskResizeable(mTasks[i].key.id); } } Loading Loading @@ -278,8 +276,9 @@ public class RecentsResizeTaskDialog extends DialogFragment { if (mTasks[0].key.stackId != DOCKED_STACK_ID) { int taskId = mTasks[0].key.id; mSsp.setTaskResizeable(taskId); mSsp.dockTask(taskId, createMode); SystemServicesProxy ssp = Recents.getSystemServices(); ssp.setTaskResizeable(taskId); ssp.dockTask(taskId, createMode); mRecentsView.launchTask(mTasks[0], null, DOCKED_STACK_ID); } else { Toast.makeText(getContext(), "Already docked", Toast.LENGTH_SHORT); Loading Loading
packages/SystemUI/src/com/android/systemui/recents/Recents.java +30 −17 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.model.RecentsTaskLoader; import java.util.ArrayList; Loading @@ -51,7 +52,9 @@ public class Recents extends SystemUI public final static int EVENT_BUS_PRIORITY = 1; public final static int BIND_TO_SYSTEM_USER_RETRY_DELAY = 5000; private SystemServicesProxy mSystemServicesProxy; private static SystemServicesProxy sSystemServicesProxy; private static RecentsTaskLoader sTaskLoader; private Handler mHandler; private RecentsImpl mImpl; Loading Loading @@ -118,20 +121,30 @@ public class Recents extends SystemUI return mSystemUserCallbacks; } public static RecentsTaskLoader getTaskLoader() { return sTaskLoader; } public static SystemServicesProxy getSystemServices() { return sSystemServicesProxy; } @Override public void start() { mSystemServicesProxy = new SystemServicesProxy(mContext); sSystemServicesProxy = new SystemServicesProxy(mContext); sTaskLoader = new RecentsTaskLoader(mContext); mHandler = new Handler(); mImpl = new RecentsImpl(mContext); // Register with the event bus EventBus.getDefault().register(this, EVENT_BUS_PRIORITY); EventBus.getDefault().register(sTaskLoader, EVENT_BUS_PRIORITY); // Due to the fact that RecentsActivity is per-user, we need to establish and interface for // the system user's Recents component to pass events (like show/hide/toggleRecents) to the // secondary user, and vice versa (like visibility change, screen pinning). final int processUser = mSystemServicesProxy.getProcessUser(); if (mSystemServicesProxy.isSystemUser(processUser)) { final int processUser = sSystemServicesProxy.getProcessUser(); if (sSystemServicesProxy.isSystemUser(processUser)) { // For the system user, initialize an instance of the interface that we can pass to the // secondary user mSystemUserCallbacks = new RecentsSystemUser(mContext, mImpl); Loading @@ -153,8 +166,8 @@ public class Recents extends SystemUI */ @Override public void showRecents(boolean triggeredFromAltTab, View statusBarView) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.showRecents(triggeredFromAltTab); } else { if (mSystemUserCallbacks != null) { Loading @@ -178,8 +191,8 @@ public class Recents extends SystemUI */ @Override public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.hideRecents(triggeredFromAltTab, triggeredFromHomeKey); } else { if (mSystemUserCallbacks != null) { Loading @@ -203,8 +216,8 @@ public class Recents extends SystemUI */ @Override public void toggleRecents(Display display, int layoutDirection, View statusBarView) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.toggleRecents(); } else { if (mSystemUserCallbacks != null) { Loading @@ -228,8 +241,8 @@ public class Recents extends SystemUI */ @Override public void preloadRecents() { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.preloadRecents(); } else { if (mSystemUserCallbacks != null) { Loading @@ -250,8 +263,8 @@ public class Recents extends SystemUI @Override public void cancelPreloadingRecents() { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.cancelPreloadingRecents(); } else { if (mSystemUserCallbacks != null) { Loading Loading @@ -284,8 +297,8 @@ public class Recents extends SystemUI * Updates on configuration change. */ public void onConfigurationChanged(Configuration newConfig) { int currentUser = mSystemServicesProxy.getCurrentUser(); if (mSystemServicesProxy.isSystemUser(currentUser)) { int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.onConfigurationChanged(); } else { if (mSystemUserCallbacks != null) { Loading Loading @@ -350,7 +363,7 @@ public class Recents extends SystemUI * Attempts to register with the system user. */ private void registerWithSystemUser() { final int processUser = mSystemServicesProxy.getProcessUser(); final int processUser = sSystemServicesProxy.getProcessUser(); postToSystemUser(new Runnable() { @Override public void run() { Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +29 −38 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; import com.android.systemui.recents.events.ui.DismissTaskEvent; import com.android.systemui.recents.events.ui.ResizeTaskEvent; import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent; import com.android.systemui.recents.events.ui.UserInteractionEvent; import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent; import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent; import com.android.systemui.recents.misc.Console; Loading Loading @@ -137,7 +138,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView dismissRecentsToHomeIfVisible(false); } else if (action.equals(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED)) { // When the search activity changes, update the search widget view SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); mSearchWidgetInfo = ssp.getOrBindSearchAppWidget(context, mAppWidgetHost); refreshSearchWidgetView(); } Loading @@ -148,7 +149,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView void updateRecentsTasks() { // If AlternateRecentsComponent has preloaded a load plan, then use that to prevent // reconstructing the task stack RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = Recents.getTaskLoader(); RecentsTaskLoadPlan plan = RecentsImpl.consumeInstanceLoadPlan(); if (plan == null) { plan = loader.createLoadPlan(this); Loading Loading @@ -241,7 +242,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView /** Dismisses recents if we are already visible and the intent is to toggle the recents view */ boolean dismissRecentsToFocusedTaskOrHome(boolean checkFilteredStackState) { RecentsActivityLaunchState launchState = mConfig.getLaunchState(); SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // If we currently have filtered stacks, then unfilter those first if (checkFilteredStackState && Loading Loading @@ -284,7 +285,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView /** Dismisses Recents directly to Home if we currently aren't transitioning. */ boolean dismissRecentsToHomeIfVisible(boolean animated) { SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // Return to Home dismissRecentsToHome(animated); Loading @@ -301,16 +302,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // Register this activity with the event bus EventBus.getDefault().register(this, EVENT_BUS_PRIORITY); // For the non-primary user, ensure that the SystemServicesProxy and configuration is // initialized RecentsTaskLoader.initialize(this); SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); mConfig = RecentsConfiguration.initialize(this, ssp); mConfig.update(this, ssp, ssp.getWindowRect()); mPackageMonitor = new RecentsPackageMonitor(); // Initialize the widget host (the host id is static and does not change) mConfig = RecentsConfiguration.getInstance(); mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId); mPackageMonitor = new RecentsPackageMonitor(); mPackageMonitor.register(this); // Set the Recents layout setContentView(R.layout.recents); Loading @@ -323,6 +319,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView mScrimViews = new SystemBarScrimViews(this); // Bind the search app widget when we first start up SystemServicesProxy ssp = Recents.getSystemServices(); mSearchWidgetInfo = ssp.getOrBindSearchAppWidget(this, mAppWidgetHost); // Register the broadcast receiver to handle messages when the screen is turned off Loading @@ -341,16 +338,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override protected void onStart() { super.onStart(); RecentsActivityLaunchState launchState = mConfig.getLaunchState(); MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY); RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); SystemServicesProxy ssp = loader.getSystemServicesProxy(); // Notify that recents is now visible EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true)); // Register any broadcast receivers for the task loader mPackageMonitor.register(this); // Update the recent tasks updateRecentsTasks(); Loading @@ -358,6 +345,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // If this is a new instance from a configuration change, then we have to manually trigger // the enter animation state, or if recents was relaunched by AM, without going through // the normal mechanisms RecentsActivityLaunchState launchState = mConfig.getLaunchState(); boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromAppWithThumbnail; if (launchState.launchedHasConfigurationChanged || wasLaunchedByAm) { Loading @@ -367,6 +355,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView if (!launchState.launchedHasConfigurationChanged) { mRecentsView.disableLayersForOneFrame(); } // Notify that recents is now visible SystemServicesProxy ssp = Recents.getSystemServices(); EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true)); MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY); } @Override Loading @@ -381,19 +375,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override protected void onStop() { super.onStop(); MetricsLogger.hidden(this, MetricsLogger.OVERVIEW_ACTIVITY); RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); SystemServicesProxy ssp = loader.getSystemServicesProxy(); // Notify that recents is now hidden SystemServicesProxy ssp = Recents.getSystemServices(); EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, false)); // Notify the views that we are no longer visible mRecentsView.onRecentsHidden(); // Unregister any broadcast receivers for the task loader mPackageMonitor.unregister(); // Workaround for b/22542869, if the RecentsActivity is started again, but without going // through SystemUI, we need to reset the config launch flags to ensure that we do not // wait on the system to send a signal that was never queued. Loading @@ -404,6 +390,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView launchState.launchedToTaskId = -1; launchState.launchedWithAltTab = false; launchState.launchedHasConfigurationChanged = false; MetricsLogger.hidden(this, MetricsLogger.OVERVIEW_ACTIVITY); } @Override Loading @@ -413,6 +401,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // Unregister the system broadcast receivers unregisterReceiver(mSystemBroadcastReceiver); // Unregister any broadcast receivers for the task loader mPackageMonitor.unregister(); // Stop listening for widget package changes if there was one bound mAppWidgetHost.stopListening(); EventBus.getDefault().unregister(this); Loading @@ -432,7 +423,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override public void onTrimMemory(int level) { RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = Recents.getTaskLoader(); if (loader != null) { loader.onTrimMemory(level); } Loading Loading @@ -477,7 +468,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override public void onUserInteraction() { mRecentsView.onUserInteraction(); EventBus.getDefault().send(new UserInteractionEvent()); } @Override Loading Loading @@ -559,9 +550,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public final void onBusEvent(ShowApplicationInfoEvent event) { // Create a new task stack with the application info details activity Intent baseIntent = event.task.key.baseIntent; Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", baseIntent.getComponent().getPackageName(), null)); Uri.fromParts("package", event.task.key.getComponent().getPackageName(), null)); intent.setComponent(intent.resolveActivity(getPackageManager())); TaskStackBuilder.create(this) .addNextIntentWithParentStack(intent).startActivities(null, Loading @@ -573,11 +563,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public final void onBusEvent(DismissTaskEvent event) { // Remove any stored data from the loader RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = Recents.getTaskLoader(); loader.deleteTaskData(event.task, false); // Remove the task from activity manager loader.getSystemServicesProxy().removeTask(event.task.key.id); SystemServicesProxy ssp = Recents.getSystemServices(); ssp.removeTask(event.task.key.id); } public final void onBusEvent(ResizeTaskEvent event) { Loading @@ -602,7 +593,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView private void refreshSearchWidgetView() { if (mSearchWidgetInfo != null) { SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); SystemServicesProxy ssp = Recents.getSystemServices(); int searchWidgetId = ssp.getSearchAppWidgetId(this); mSearchWidgetHostView = (RecentsAppWidgetHostView) mAppWidgetHost.createView( this, searchWidgetId, mSearchWidgetInfo); Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +5 −4 Original line number Diff line number Diff line Loading @@ -111,8 +111,7 @@ public class RecentsConfiguration { void update(Context context, SystemServicesProxy ssp, Rect windowRect) { // Only update resources that can change after the first load, either through developer // settings or via multi window lockToAppEnabled = ssp.getSystemSetting(context, Settings.System.LOCK_TO_APP_ENABLED) != 0; lockToAppEnabled = ssp.getSystemSetting(context, Settings.System.LOCK_TO_APP_ENABLED) != 0; hasDockedTasks = ssp.hasDockedTask(); // Recompute some values based on the given state, since we can not rely on the resource Loading Loading @@ -143,8 +142,10 @@ public class RecentsConfiguration { return mLaunchState; } /** Called when the configuration has changed, and we want to reset any configuration specific * members. */ /** * Called when the configuration has changed, and we want to reset any configuration specific * members. */ public void updateOnConfigurationChange() { mLaunchState.updateOnConfigurationChange(); } Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +42 −41 File changed.Preview size limit exceeded, changes collapsed. Show changes
packages/SystemUI/src/com/android/systemui/recents/RecentsResizeTaskDialog.java +6 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.widget.Button; import android.widget.Toast; import com.android.systemui.R; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.views.RecentsView; Loading Loading @@ -80,7 +79,6 @@ public class RecentsResizeTaskDialog extends DialogFragment { private View mResizeTaskDialogContent; private RecentsActivity mRecentsActivity; private RecentsView mRecentsView; private SystemServicesProxy mSsp; private Rect[] mBounds = {new Rect(), new Rect(), new Rect(), new Rect()}; private Task[] mTasks = {null, null, null, null}; Loading @@ -93,7 +91,6 @@ public class RecentsResizeTaskDialog extends DialogFragment { public RecentsResizeTaskDialog(FragmentManager mgr, RecentsActivity activity) { mFragmentManager = mgr; mRecentsActivity = activity; mSsp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); } /** Shows the resize-task dialog. */ Loading Loading @@ -144,7 +141,8 @@ public class RecentsResizeTaskDialog extends DialogFragment { /** Helper function to place window(s) on the display according to an arrangement request. */ private void placeTasks(int arrangement) { Rect rect = mSsp.getDisplayRect(); SystemServicesProxy ssp = Recents.getSystemServices(); Rect rect = ssp.getDisplayRect(); for (int i = 0; i < mBounds.length; ++i) { mBounds[i].set(rect); if (i != 0) { Loading Loading @@ -240,7 +238,7 @@ public class RecentsResizeTaskDialog extends DialogFragment { // current app configuration. for (int i = additionalTasks; i >= 0; --i) { if (mTasks[i] != null) { mSsp.setTaskResizeable(mTasks[i].key.id); ssp.setTaskResizeable(mTasks[i].key.id); } } Loading Loading @@ -278,8 +276,9 @@ public class RecentsResizeTaskDialog extends DialogFragment { if (mTasks[0].key.stackId != DOCKED_STACK_ID) { int taskId = mTasks[0].key.id; mSsp.setTaskResizeable(taskId); mSsp.dockTask(taskId, createMode); SystemServicesProxy ssp = Recents.getSystemServices(); ssp.setTaskResizeable(taskId); ssp.dockTask(taskId, createMode); mRecentsView.launchTask(mTasks[0], null, DOCKED_STACK_ID); } else { Toast.makeText(getContext(), "Already docked", Toast.LENGTH_SHORT); Loading