RecentsConfigurationpublic class RecentsConfiguration extends Object A static Recents configuration for the current context
NOTE: We should not hold any references to a Context from a static instance |
Fields Summary |
---|
static RecentsConfiguration | sInstance | static int | sPrevConfigurationHashCode | public static final int | SVELTE_NONELevels of svelte in increasing severity/austerity. | public static final int | SVELTE_LIMIT_CACHE | public static final int | SVELTE_DISABLE_CACHE | public static final int | SVELTE_DISABLE_LOADING | public float | animationPxMovementPerSecondAnimations | public android.view.animation.Interpolator | fastOutSlowInInterpolatorInterpolators | public android.view.animation.Interpolator | fastOutLinearInInterpolator | public android.view.animation.Interpolator | linearOutSlowInInterpolator | public android.view.animation.Interpolator | quintOutInterpolator | public int | filteringCurrentViewsAnimDurationFiltering | public int | filteringNewViewsAnimDuration | public android.graphics.Rect | systemInsetsInsets | public android.graphics.Rect | displayRect | boolean | isLandscapeLayout | boolean | hasTransposedSearchBar | boolean | hasTransposedNavBar | public int | maxNumTasksToLoadLoading | int | searchBarAppWidgetIdSearch bar | public int | searchBarSpaceHeightPx | public int | taskStackScrollDurationTask stack | public int | taskStackMaxDim | public int | taskStackTopPaddingPx | public float | taskStackWidthPaddingPct | public float | taskStackOverscrollPct | public int | transitionEnterFromAppDelayTransitions | public int | transitionEnterFromHomeDelay | public int | taskViewEnterFromAppDurationTask view animation and styles | public int | taskViewEnterFromHomeDuration | public int | taskViewEnterFromHomeStaggerDelay | public int | taskViewExitToAppDuration | public int | taskViewExitToHomeDuration | public int | taskViewRemoveAnimDuration | public int | taskViewRemoveAnimTranslationXPx | public int | taskViewTranslationZMinPx | public int | taskViewTranslationZMaxPx | public int | taskViewRoundedCornerRadiusPx | public int | taskViewHighlightPx | public int | taskViewAffiliateGroupEnterOffsetPx | public float | taskViewThumbnailAlpha | public int | taskBarViewDefaultBackgroundColorTask bar colors | public int | taskBarViewLightTextColor | public int | taskBarViewDarkTextColor | public int | taskBarViewHighlightColor | public float | taskBarViewAffiliationColorMinAlpha | public int | taskBarHeightTask bar size & animations | public int | taskBarDismissDozeDelaySeconds | public int | navBarScrimEnterDurationNav bar scrim | public boolean | launchedWithAltTabLaunch states | public boolean | launchedWithNoRecentTasks | public boolean | launchedFromAppWithThumbnail | public boolean | launchedFromHome | public boolean | launchedFromSearchHome | public boolean | launchedReuseTaskStackViews | public boolean | launchedHasConfigurationChanged | public int | launchedToTaskId | public int | launchedNumVisibleTasks | public int | launchedNumVisibleThumbnails | public boolean | useHardwareLayersMisc | public int | altTabKeyDelay | public boolean | fakeShadows | public boolean | lockToAppEnabledDev options and global settings | public boolean | developerOptionsEnabled | public boolean | debugModeEnabled | public int | svelteLevel |
Constructors Summary |
---|
private RecentsConfiguration(android.content.Context context)Private constructor
// Properties that don't have to be reloaded with each configuration change can be loaded
// here.
// Interpolators
fastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.fast_out_slow_in);
fastOutLinearInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.fast_out_linear_in);
linearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.linear_out_slow_in);
quintOutInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.decelerate_quint);
|
Methods Summary |
---|
public static com.android.systemui.recents.RecentsConfiguration | getInstance()Returns the current recents configuration
return sInstance;
| public void | getSearchBarBounds(int windowWidth, int windowHeight, int topInset, android.graphics.Rect searchBarSpaceBounds)Returns the search bar bounds in the current orientation. These bounds do not account for
the system insets.
// Return empty rects if search is not enabled
int searchBarSize = searchBarSpaceHeightPx;
if (!Constants.DebugFlags.App.EnableSearchLayout || !hasSearchBarAppWidget()) {
searchBarSize = 0;
}
if (isLandscape && hasTransposedSearchBar) {
// In landscape, the search bar appears on the left
searchBarSpaceBounds.set(0, topInset, searchBarSize, windowHeight);
} else {
// In portrait, the search bar appears on the top
searchBarSpaceBounds.set(0, topInset, windowWidth, topInset + searchBarSize);
}
| public void | getTaskStackBounds(int windowWidth, int windowHeight, int topInset, int rightInset, android.graphics.Rect taskStackBounds)Returns the task stack bounds in the current orientation. These bounds do not account for
the system insets.
Rect searchBarBounds = new Rect();
getSearchBarBounds(windowWidth, windowHeight, topInset, searchBarBounds);
if (isLandscape && hasTransposedSearchBar) {
// In landscape, the search bar appears on the left, but we overlay it on top
taskStackBounds.set(0, topInset, windowWidth - rightInset, windowHeight);
} else {
// In portrait, the search bar appears on the top (which already has the inset)
taskStackBounds.set(0, searchBarBounds.bottom, windowWidth, windowHeight);
}
| public boolean | hasHorizontalLayout()Returns whether the current layout is horizontal.
return isLandscape && hasTransposedSearchBar;
| public boolean | hasNavBarScrim()Returns whether the nav bar scrim should be visible.
// Only show the scrim if we have recent tasks, and if the nav bar is not transposed
return !launchedWithNoRecentTasks && (!hasTransposedNavBar || !isLandscape);
| public boolean | hasSearchBarAppWidget()Returns whether the search bar app widget exists.
return searchBarAppWidgetId >= 0;
| public boolean | hasStatusBarScrim()Returns whether the status bar scrim should be visible.
return !launchedWithNoRecentTasks;
| public static com.android.systemui.recents.RecentsConfiguration | reinitialize(android.content.Context context, com.android.systemui.recents.misc.SystemServicesProxy ssp)Updates the configuration to the current context
if (sInstance == null) {
sInstance = new RecentsConfiguration(context);
}
int configHashCode = context.getResources().getConfiguration().hashCode();
if (sPrevConfigurationHashCode != configHashCode) {
sInstance.update(context);
sPrevConfigurationHashCode = configHashCode;
}
sInstance.updateOnReinitialize(context, ssp);
return sInstance;
| public boolean | shouldAnimateNavBarScrim()Returns whether the nav bar scrim should be animated when shown for the first time.
return true;
| public boolean | shouldAnimateStatusBarScrim()Returns whether the status bar scrim should be animated when shown for the first time.
return launchedFromHome;
| void | update(android.content.Context context)Updates the state, given the specified context
SharedPreferences settings = context.getSharedPreferences(context.getPackageName(), 0);
Resources res = context.getResources();
DisplayMetrics dm = res.getDisplayMetrics();
// Debug mode
debugModeEnabled = settings.getBoolean(Constants.Values.App.Key_DebugModeEnabled, false);
if (debugModeEnabled) {
Console.Enabled = true;
}
// Layout
isLandscape = res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
hasTransposedSearchBar = res.getBoolean(R.bool.recents_has_transposed_search_bar);
hasTransposedNavBar = res.getBoolean(R.bool.recents_has_transposed_nav_bar);
// Insets
displayRect.set(0, 0, dm.widthPixels, dm.heightPixels);
// Animations
animationPxMovementPerSecond =
res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
// Filtering
filteringCurrentViewsAnimDuration =
res.getInteger(R.integer.recents_filter_animate_current_views_duration);
filteringNewViewsAnimDuration =
res.getInteger(R.integer.recents_filter_animate_new_views_duration);
// Loading
maxNumTasksToLoad = ActivityManager.getMaxRecentTasksStatic();
// Search Bar
searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height);
searchBarAppWidgetId = settings.getInt(Constants.Values.App.Key_SearchAppWidgetId, -1);
// Task stack
taskStackScrollDuration =
res.getInteger(R.integer.recents_animate_task_stack_scroll_duration);
TypedValue widthPaddingPctValue = new TypedValue();
res.getValue(R.dimen.recents_stack_width_padding_percentage, widthPaddingPctValue, true);
taskStackWidthPaddingPct = widthPaddingPctValue.getFloat();
TypedValue stackOverscrollPctValue = new TypedValue();
res.getValue(R.dimen.recents_stack_overscroll_percentage, stackOverscrollPctValue, true);
taskStackOverscrollPct = stackOverscrollPctValue.getFloat();
taskStackMaxDim = res.getInteger(R.integer.recents_max_task_stack_view_dim);
taskStackTopPaddingPx = res.getDimensionPixelSize(R.dimen.recents_stack_top_padding);
// Transition
transitionEnterFromAppDelay =
res.getInteger(R.integer.recents_enter_from_app_transition_duration);
transitionEnterFromHomeDelay =
res.getInteger(R.integer.recents_enter_from_home_transition_duration);
// Task view animation and styles
taskViewEnterFromAppDuration =
res.getInteger(R.integer.recents_task_enter_from_app_duration);
taskViewEnterFromHomeDuration =
res.getInteger(R.integer.recents_task_enter_from_home_duration);
taskViewEnterFromHomeStaggerDelay =
res.getInteger(R.integer.recents_task_enter_from_home_stagger_delay);
taskViewExitToAppDuration =
res.getInteger(R.integer.recents_task_exit_to_app_duration);
taskViewExitToHomeDuration =
res.getInteger(R.integer.recents_task_exit_to_home_duration);
taskViewRemoveAnimDuration =
res.getInteger(R.integer.recents_animate_task_view_remove_duration);
taskViewRemoveAnimTranslationXPx =
res.getDimensionPixelSize(R.dimen.recents_task_view_remove_anim_translation_x);
taskViewRoundedCornerRadiusPx =
res.getDimensionPixelSize(R.dimen.recents_task_view_rounded_corners_radius);
taskViewHighlightPx = res.getDimensionPixelSize(R.dimen.recents_task_view_highlight);
taskViewTranslationZMinPx = res.getDimensionPixelSize(R.dimen.recents_task_view_z_min);
taskViewTranslationZMaxPx = res.getDimensionPixelSize(R.dimen.recents_task_view_z_max);
taskViewAffiliateGroupEnterOffsetPx =
res.getDimensionPixelSize(R.dimen.recents_task_view_affiliate_group_enter_offset);
TypedValue thumbnailAlphaValue = new TypedValue();
res.getValue(R.dimen.recents_task_view_thumbnail_alpha, thumbnailAlphaValue, true);
taskViewThumbnailAlpha = thumbnailAlphaValue.getFloat();
// Task bar colors
taskBarViewDefaultBackgroundColor =
res.getColor(R.color.recents_task_bar_default_background_color);
taskBarViewLightTextColor =
res.getColor(R.color.recents_task_bar_light_text_color);
taskBarViewDarkTextColor =
res.getColor(R.color.recents_task_bar_dark_text_color);
taskBarViewHighlightColor =
res.getColor(R.color.recents_task_bar_highlight_color);
TypedValue affMinAlphaPctValue = new TypedValue();
res.getValue(R.dimen.recents_task_affiliation_color_min_alpha_percentage, affMinAlphaPctValue, true);
taskBarViewAffiliationColorMinAlpha = affMinAlphaPctValue.getFloat();
// Task bar size & animations
taskBarHeight = res.getDimensionPixelSize(R.dimen.recents_task_bar_height);
taskBarDismissDozeDelaySeconds =
res.getInteger(R.integer.recents_task_bar_dismiss_delay_seconds);
// Nav bar scrim
navBarScrimEnterDuration =
res.getInteger(R.integer.recents_nav_bar_scrim_enter_duration);
// Misc
useHardwareLayers = res.getBoolean(R.bool.config_recents_use_hardware_layers);
altTabKeyDelay = res.getInteger(R.integer.recents_alt_tab_key_delay);
fakeShadows = res.getBoolean(R.bool.config_recents_fake_shadows);
svelteLevel = res.getInteger(R.integer.recents_svelte_level);
| public void | updateOnConfigurationChange()Called when the configuration has changed, and we want to reset any configuration specific
members.
// Reset this flag on configuration change to ensure that we recreate new task views
launchedReuseTaskStackViews = false;
// Set this flag to indicate that the configuration has changed since Recents last launched
launchedHasConfigurationChanged = true;
| void | updateOnReinitialize(android.content.Context context, com.android.systemui.recents.misc.SystemServicesProxy ssp)Updates the states that need to be re-read whenever we re-initialize.
// Check if the developer options are enabled
developerOptionsEnabled = ssp.getGlobalSetting(context,
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED) != 0;
lockToAppEnabled = ssp.getSystemSetting(context,
Settings.System.LOCK_TO_APP_ENABLED) != 0;
| public void | updateSearchBarAppWidgetId(android.content.Context context, int appWidgetId)Updates the search bar app widget
searchBarAppWidgetId = appWidgetId;
SharedPreferences settings = context.getSharedPreferences(context.getPackageName(), 0);
settings.edit().putInt(Constants.Values.App.Key_SearchAppWidgetId,
appWidgetId).apply();
| public void | updateSystemInsets(android.graphics.Rect insets)Updates the system insets
systemInsets.set(insets);
|
|