Loading packages/SystemUI/src/com/android/systemui/recents/Recents.java +6 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ public class Recents extends SystemUI private static SystemServicesProxy sSystemServicesProxy; private static RecentsTaskLoader sTaskLoader; private static RecentsConfiguration sConfiguration; private Handler mHandler; private RecentsImpl mImpl; Loading Loading @@ -129,10 +130,15 @@ public class Recents extends SystemUI return sSystemServicesProxy; } public static RecentsConfiguration getConfiguration() { return sConfiguration; } @Override public void start() { sSystemServicesProxy = new SystemServicesProxy(mContext); sTaskLoader = new RecentsTaskLoader(mContext); sConfiguration = new RecentsConfiguration(mContext); mHandler = new Handler(); mImpl = new RecentsImpl(mContext); Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +10 −7 Original line number Diff line number Diff line Loading @@ -80,7 +80,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public final static int EVENT_BUS_PRIORITY = Recents.EVENT_BUS_PRIORITY + 1; RecentsConfiguration mConfig; RecentsPackageMonitor mPackageMonitor; long mLastTabKeyEventTime; boolean mFinishedOnStartup; Loading Loading @@ -174,7 +173,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView } // Start loading tasks according to the load plan RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); if (!plan.hasTasks()) { loader.preloadTasks(plan, launchState.launchedFromHome); } Loading Loading @@ -280,7 +280,8 @@ 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(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // If we currently have filtered stacks, then unfilter those first Loading Loading @@ -352,7 +353,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView EventBus.getDefault().register(this, EVENT_BUS_PRIORITY); // Initialize the widget host (the host id is static and does not change) mConfig = RecentsConfiguration.getInstance(); if (!Constants.DebugFlags.App.DisableSearchBar) { mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId); } Loading Loading @@ -399,7 +399,8 @@ 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(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromAppWithThumbnail; if (launchState.launchedHasConfigurationChanged || wasLaunchedByAm) { Loading Loading @@ -442,7 +443,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // 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. RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); launchState.launchedFromHome = false; launchState.launchedFromSearchHome = false; launchState.launchedFromAppWithThumbnail = false; Loading Loading @@ -629,7 +631,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public void run() { // If we are not launching with alt-tab and fast-toggle is enabled, then start // the dozer now RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); if (Constants.DebugFlags.App.EnableFastToggleRecents && !launchState.launchedWithAltTab) { mIterateTrigger.startDozing(); Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +2 −7 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ package com.android.systemui.recents; */ public class RecentsActivityLaunchState { public RecentsConfiguration mConfig; public boolean launchedWithAltTab; public boolean launchedWithNoRecentTasks; public boolean launchedFromAppWithThumbnail; Loading @@ -41,10 +39,6 @@ public class RecentsActivityLaunchState { public int launchedNumVisibleTasks; public int launchedNumVisibleThumbnails; RecentsActivityLaunchState(RecentsConfiguration config) { mConfig = config; } /** Called when the configuration has changed, and we want to reset any configuration specific * members. */ public void updateOnConfigurationChange() { Loading Loading @@ -72,6 +66,7 @@ public class RecentsActivityLaunchState { /** Returns whether the nav bar scrim should be visible. */ public boolean hasNavBarScrim() { // Only show the scrim if we have recent tasks, and if the nav bar is not transposed return !launchedWithNoRecentTasks && !mConfig.hasTransposedNavBar; RecentsConfiguration config = Recents.getConfiguration(); return !launchedWithNoRecentTasks && !config.hasTransposedNavBar; } } packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +3 −17 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import com.android.systemui.recents.misc.SystemServicesProxy; * tied to the current activity. */ public class RecentsConfiguration { static RecentsConfiguration sInstance; private static final int LARGE_SCREEN_MIN_DP = 600; private static final int XLARGE_SCREEN_MIN_DP = 720; Loading @@ -53,7 +52,7 @@ public class RecentsConfiguration { public static final int SVELTE_DISABLE_LOADING = 3; // Launch states public RecentsActivityLaunchState mLaunchState = new RecentsActivityLaunchState(this); public RecentsActivityLaunchState mLaunchState = new RecentsActivityLaunchState(); // TODO: Values determined by the current context, needs to be refactored into something that is // agnostic of the activity context, but still calculable from the Recents component for Loading @@ -79,10 +78,10 @@ public class RecentsConfiguration { /** Dev options and global settings */ public boolean lockToAppEnabled; /** Private constructor */ private RecentsConfiguration(Context context, SystemServicesProxy ssp) { public RecentsConfiguration(Context context) { // Load only resources that can not change after the first load either through developer // settings or via multi window SystemServicesProxy ssp = Recents.getSystemServices(); Context appContext = context.getApplicationContext(); Resources res = appContext.getResources(); useHardwareLayers = res.getBoolean(R.bool.config_recents_use_hardware_layers); Loading Loading @@ -121,19 +120,6 @@ public class RecentsConfiguration { hasTransposedSearchBar = isLandscape && isLargeScreen && !isXLargeScreen; } /** Updates the configuration to the current context */ public static RecentsConfiguration initialize(Context context, SystemServicesProxy ssp) { if (sInstance == null) { sInstance = new RecentsConfiguration(context, ssp); } return sInstance; } /** Returns the current recents configuration */ public static RecentsConfiguration getInstance() { return sInstance; } /** * Returns the activity launch state. * TODO: This will be refactored out of RecentsConfiguration. Loading packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +9 −9 Original line number Diff line number Diff line Loading @@ -135,7 +135,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub boolean mCanReuseTaskStackViews = true; // Task launching RecentsConfiguration mConfig; Rect mSearchBarBounds = new Rect(); Rect mTaskStackBounds = new Rect(); Rect mLastTaskViewBounds = new Rect(); Loading Loading @@ -174,7 +173,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub ssp.registerTaskStackListener(mTaskStackListener); // Initialize the static configuration resources mConfig = RecentsConfiguration.initialize(mContext, ssp); mStatusBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); mNavBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_height); mNavBarWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width); Loading Loading @@ -205,7 +203,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub public void onConfigurationChanged() { // Don't reuse task stack views if the configuration changes mCanReuseTaskStackViews = false; mConfig.updateOnConfigurationChange(); Recents.getConfiguration().updateOnConfigurationChange(); } /** Loading Loading @@ -445,24 +443,25 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub * is not already bound (can be expensive) */ private void reloadHeaderBarLayout(boolean tryAndBindSearchWidget) { RecentsConfiguration config = Recents.getConfiguration(); SystemServicesProxy ssp = Recents.getSystemServices(); Rect windowRect = ssp.getWindowRect(); // Update the configuration for the current state mConfig.update(mContext, ssp, ssp.getWindowRect()); config.update(mContext, ssp, ssp.getWindowRect()); if (!Constants.DebugFlags.App.DisableSearchBar && tryAndBindSearchWidget) { // Try and pre-emptively bind the search widget on startup to ensure that we // have the right thumbnail bounds to animate to. // Note: We have to reload the widget id before we get the task stack bounds below if (ssp.getOrBindSearchAppWidget(mContext, mAppWidgetHost) != null) { mConfig.getSearchBarBounds(windowRect, mStatusBarHeight, mSearchBarBounds); config.getSearchBarBounds(windowRect, mStatusBarHeight, mSearchBarBounds); } } Rect systemInsets = new Rect(0, mStatusBarHeight, (mConfig.hasTransposedNavBar ? mNavBarWidth : 0), (mConfig.hasTransposedNavBar ? 0 : mNavBarHeight)); mConfig.getTaskStackBounds(windowRect, systemInsets.top, systemInsets.right, (config.hasTransposedNavBar ? mNavBarWidth : 0), (config.hasTransposedNavBar ? 0 : mNavBarHeight)); config.getTaskStackBounds(windowRect, systemInsets.top, systemInsets.right, mSearchBarBounds, mTaskStackBounds); // Rebind the header bar and draw it for the transition Loading Loading @@ -718,7 +717,8 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub mStartAnimationTriggered = false; // Update the configuration based on the launch options RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); launchState.launchedFromHome = fromSearchHome || fromHome; launchState.launchedFromSearchHome = fromSearchHome; launchState.launchedFromAppWithThumbnail = fromThumbnail; Loading Loading
packages/SystemUI/src/com/android/systemui/recents/Recents.java +6 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ public class Recents extends SystemUI private static SystemServicesProxy sSystemServicesProxy; private static RecentsTaskLoader sTaskLoader; private static RecentsConfiguration sConfiguration; private Handler mHandler; private RecentsImpl mImpl; Loading Loading @@ -129,10 +130,15 @@ public class Recents extends SystemUI return sSystemServicesProxy; } public static RecentsConfiguration getConfiguration() { return sConfiguration; } @Override public void start() { sSystemServicesProxy = new SystemServicesProxy(mContext); sTaskLoader = new RecentsTaskLoader(mContext); sConfiguration = new RecentsConfiguration(mContext); mHandler = new Handler(); mImpl = new RecentsImpl(mContext); Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +10 −7 Original line number Diff line number Diff line Loading @@ -80,7 +80,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public final static int EVENT_BUS_PRIORITY = Recents.EVENT_BUS_PRIORITY + 1; RecentsConfiguration mConfig; RecentsPackageMonitor mPackageMonitor; long mLastTabKeyEventTime; boolean mFinishedOnStartup; Loading Loading @@ -174,7 +173,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView } // Start loading tasks according to the load plan RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); if (!plan.hasTasks()) { loader.preloadTasks(plan, launchState.launchedFromHome); } Loading Loading @@ -280,7 +280,8 @@ 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(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // If we currently have filtered stacks, then unfilter those first Loading Loading @@ -352,7 +353,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView EventBus.getDefault().register(this, EVENT_BUS_PRIORITY); // Initialize the widget host (the host id is static and does not change) mConfig = RecentsConfiguration.getInstance(); if (!Constants.DebugFlags.App.DisableSearchBar) { mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId); } Loading Loading @@ -399,7 +399,8 @@ 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(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromAppWithThumbnail; if (launchState.launchedHasConfigurationChanged || wasLaunchedByAm) { Loading Loading @@ -442,7 +443,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // 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. RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); launchState.launchedFromHome = false; launchState.launchedFromSearchHome = false; launchState.launchedFromAppWithThumbnail = false; Loading Loading @@ -629,7 +631,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public void run() { // If we are not launching with alt-tab and fast-toggle is enabled, then start // the dozer now RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); if (Constants.DebugFlags.App.EnableFastToggleRecents && !launchState.launchedWithAltTab) { mIterateTrigger.startDozing(); Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +2 −7 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ package com.android.systemui.recents; */ public class RecentsActivityLaunchState { public RecentsConfiguration mConfig; public boolean launchedWithAltTab; public boolean launchedWithNoRecentTasks; public boolean launchedFromAppWithThumbnail; Loading @@ -41,10 +39,6 @@ public class RecentsActivityLaunchState { public int launchedNumVisibleTasks; public int launchedNumVisibleThumbnails; RecentsActivityLaunchState(RecentsConfiguration config) { mConfig = config; } /** Called when the configuration has changed, and we want to reset any configuration specific * members. */ public void updateOnConfigurationChange() { Loading Loading @@ -72,6 +66,7 @@ public class RecentsActivityLaunchState { /** Returns whether the nav bar scrim should be visible. */ public boolean hasNavBarScrim() { // Only show the scrim if we have recent tasks, and if the nav bar is not transposed return !launchedWithNoRecentTasks && !mConfig.hasTransposedNavBar; RecentsConfiguration config = Recents.getConfiguration(); return !launchedWithNoRecentTasks && !config.hasTransposedNavBar; } }
packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +3 −17 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import com.android.systemui.recents.misc.SystemServicesProxy; * tied to the current activity. */ public class RecentsConfiguration { static RecentsConfiguration sInstance; private static final int LARGE_SCREEN_MIN_DP = 600; private static final int XLARGE_SCREEN_MIN_DP = 720; Loading @@ -53,7 +52,7 @@ public class RecentsConfiguration { public static final int SVELTE_DISABLE_LOADING = 3; // Launch states public RecentsActivityLaunchState mLaunchState = new RecentsActivityLaunchState(this); public RecentsActivityLaunchState mLaunchState = new RecentsActivityLaunchState(); // TODO: Values determined by the current context, needs to be refactored into something that is // agnostic of the activity context, but still calculable from the Recents component for Loading @@ -79,10 +78,10 @@ public class RecentsConfiguration { /** Dev options and global settings */ public boolean lockToAppEnabled; /** Private constructor */ private RecentsConfiguration(Context context, SystemServicesProxy ssp) { public RecentsConfiguration(Context context) { // Load only resources that can not change after the first load either through developer // settings or via multi window SystemServicesProxy ssp = Recents.getSystemServices(); Context appContext = context.getApplicationContext(); Resources res = appContext.getResources(); useHardwareLayers = res.getBoolean(R.bool.config_recents_use_hardware_layers); Loading Loading @@ -121,19 +120,6 @@ public class RecentsConfiguration { hasTransposedSearchBar = isLandscape && isLargeScreen && !isXLargeScreen; } /** Updates the configuration to the current context */ public static RecentsConfiguration initialize(Context context, SystemServicesProxy ssp) { if (sInstance == null) { sInstance = new RecentsConfiguration(context, ssp); } return sInstance; } /** Returns the current recents configuration */ public static RecentsConfiguration getInstance() { return sInstance; } /** * Returns the activity launch state. * TODO: This will be refactored out of RecentsConfiguration. Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +9 −9 Original line number Diff line number Diff line Loading @@ -135,7 +135,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub boolean mCanReuseTaskStackViews = true; // Task launching RecentsConfiguration mConfig; Rect mSearchBarBounds = new Rect(); Rect mTaskStackBounds = new Rect(); Rect mLastTaskViewBounds = new Rect(); Loading Loading @@ -174,7 +173,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub ssp.registerTaskStackListener(mTaskStackListener); // Initialize the static configuration resources mConfig = RecentsConfiguration.initialize(mContext, ssp); mStatusBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); mNavBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_height); mNavBarWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width); Loading Loading @@ -205,7 +203,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub public void onConfigurationChanged() { // Don't reuse task stack views if the configuration changes mCanReuseTaskStackViews = false; mConfig.updateOnConfigurationChange(); Recents.getConfiguration().updateOnConfigurationChange(); } /** Loading Loading @@ -445,24 +443,25 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub * is not already bound (can be expensive) */ private void reloadHeaderBarLayout(boolean tryAndBindSearchWidget) { RecentsConfiguration config = Recents.getConfiguration(); SystemServicesProxy ssp = Recents.getSystemServices(); Rect windowRect = ssp.getWindowRect(); // Update the configuration for the current state mConfig.update(mContext, ssp, ssp.getWindowRect()); config.update(mContext, ssp, ssp.getWindowRect()); if (!Constants.DebugFlags.App.DisableSearchBar && tryAndBindSearchWidget) { // Try and pre-emptively bind the search widget on startup to ensure that we // have the right thumbnail bounds to animate to. // Note: We have to reload the widget id before we get the task stack bounds below if (ssp.getOrBindSearchAppWidget(mContext, mAppWidgetHost) != null) { mConfig.getSearchBarBounds(windowRect, mStatusBarHeight, mSearchBarBounds); config.getSearchBarBounds(windowRect, mStatusBarHeight, mSearchBarBounds); } } Rect systemInsets = new Rect(0, mStatusBarHeight, (mConfig.hasTransposedNavBar ? mNavBarWidth : 0), (mConfig.hasTransposedNavBar ? 0 : mNavBarHeight)); mConfig.getTaskStackBounds(windowRect, systemInsets.top, systemInsets.right, (config.hasTransposedNavBar ? mNavBarWidth : 0), (config.hasTransposedNavBar ? 0 : mNavBarHeight)); config.getTaskStackBounds(windowRect, systemInsets.top, systemInsets.right, mSearchBarBounds, mTaskStackBounds); // Rebind the header bar and draw it for the transition Loading Loading @@ -718,7 +717,8 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub mStartAnimationTriggered = false; // Update the configuration based on the launch options RecentsActivityLaunchState launchState = mConfig.getLaunchState(); RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); launchState.launchedFromHome = fromSearchHome || fromHome; launchState.launchedFromSearchHome = fromSearchHome; launchState.launchedFromAppWithThumbnail = fromThumbnail; Loading