Moving SysUI with legacy Recents to another build target

- Move all legacy recents code out of the core sysui code
- Add separate target for products which still depend on it
- Move overview proxy implementation into another implementation of the
  recents interface

Test: atest SystemUITests
Test: Push SystemUiWithLegacyRecents to the system image
      adb shell pm disable com.google.android.apps.nexuslauncher/com.android.quickstep.TouchInteractionService
      and ensure that the old recents implementation still works (and split
      screen)

Change-Id: Iad67218ec37c13c79b6393d87f6bdc4f3996e2c6
Signed-off-by: Winson Chung <winsonc@google.com>
This commit is contained in:
Winson Chung
2018-10-24 13:00:41 -07:00
parent f95d6a17f5
commit 2dbcf0973b
223 changed files with 2204 additions and 2219 deletions

View File

@@ -156,3 +156,43 @@ android_app {
],
}
// Only used for products that are shipping legacy Recents
android_app {
name: "SystemUIWithLegacyRecents",
overrides: [
"SystemUI",
],
platform_apis: true,
certificate: "platform",
privileged: true,
dxflags: ["--multi-dex"],
aaptflags: [
"--extra-packages",
"com.android.keyguard",
],
optimize: {
proguard_flags_files: ["proguard.flags", "legacy/recents/proguard.flags"],
},
static_libs: [
"SystemUI-core",
],
libs: [
"telephony-common",
"android.car",
"android.car.user",
],
srcs: [
"legacy/recents/src/**/*.java",
"legacy/recents/src/**/I*.aidl",
],
resource_dirs: [
"legacy/recents/res",
],
manifest: "legacy/recents/AndroidManifest.xml",
}

View File

@@ -128,9 +128,6 @@
<!-- Needed for WallpaperManager.clear in ImageWallpaper.updateWallpaperLocked -->
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<!-- Recents -->
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<!-- Wifi Display -->
<uses-permission android:name="android.permission.CONFIGURE_WIFI_DISPLAY" />
@@ -247,14 +244,14 @@
android:exported="true"
/>
<!-- Recents depends on every user having their own SystemUI process, so on user switch,
ensure that the process is created by starting this service.
<!-- On user switch, this service is started to ensure that the associated SystemUI
process for the current user is started. See the resource
"config_systemUIServiceComponentsPerUser".
-->
<service android:name="SystemUISecondaryUserService"
android:exported="true"
android:exported="false"
android:permission="com.android.systemui.permission.SELF" />
<!-- started from PhoneWindowManager
TODO: Should have an android:permission attribute -->
<service android:name=".screenshot.TakeScreenshotService"
@@ -313,27 +310,6 @@
</intent-filter>
</activity-alias>
<!-- Service used by secondary users to register themselves with the system user. -->
<service android:name=".recents.RecentsSystemUserService"
android:exported="false"
android:permission="com.android.systemui.permission.SELF" />
<!-- Alternate Recents -->
<activity android:name=".recents.RecentsActivity"
android:label="@string/accessibility_desc_recent_apps"
android:exported="false"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:stateNotNeeded="true"
android:resumeWhilePausing="true"
android:resizeableActivity="true"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden"
android:theme="@style/RecentsTheme.Wallpaper">
<intent-filter>
<action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
</intent-filter>
</activity>
<activity
android:name=".stackdivider.ForcedResizableInfoActivity"
android:theme="@style/ForcedResizableTheme"

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (c) 2018 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.systemui"
android:sharedUserId="android.uid.systemui"
coreApp="true">
<application
android:name="com.android.systemui.SystemUIApplication">
<!-- Service used by secondary users to register themselves with the system user. -->
<service android:name=".recents.RecentsSystemUserService"
android:exported="false"
android:permission="com.android.systemui.permission.SELF" />
<!-- Alternate Recents -->
<activity android:name=".recents.RecentsActivity"
android:label="@string/accessibility_desc_recent_apps"
android:exported="false"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:stateNotNeeded="true"
android:resumeWhilePausing="true"
android:resizeableActivity="true"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden"
android:theme="@style/RecentsTheme.Wallpaper">
<intent-filter>
<action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,14 @@
-keepclassmembers class ** {
public void onBusEvent(**);
public void onInterprocessBusEvent(**);
}
-keepclassmembers class ** extends **.EventBus$InterprocessEvent {
public <init>(android.os.Bundle);
}
-keep class com.android.systemui.recents.views.TaskView {
public int getDim();
public void setDim(int);
public float getTaskProgress();
public void setTaskProgress(float);
}

View File

@@ -1,31 +1,21 @@
/*
* Copyright (C) 2013 The Android Open Source Project
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2012, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui;
import android.graphics.Rect;
import android.view.Display;
import android.view.View;
public interface RecentsComponent {
void showRecentApps(boolean triggeredFromAltTab);
/**
* Docks the top-most task and opens recents.
*/
boolean splitPrimaryTask(int stackCreateMode, Rect initialBounds,
int metricsDockAction);
}
*/
-->
<resources>
<!-- The offsets the tasks animate from when recents is launched while docking -->
<dimen name="recents_task_stack_animation_launched_while_docking_offset">192dp</dimen>
</resources>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<declare-styleable name="RecentsPanelView">
<attr name="recentItemLayout" format="reference" />
<!-- Style for the "Clear all" button. -->
<attr name="clearAllStyle" format="reference" />
<attr name="clearAllBackgroundColor" format="reference" />
</declare-styleable>
</resources>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright 2010, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- The disabled recents task bar background color. -->
<color name="recents_task_bar_disabled_background_color">#ff676767</color>
<!-- The default recents task bar background color. -->
<color name="recents_task_bar_default_background_color">#ffe6e6e6</color>
<!-- The default recents task view background color. -->
<color name="recents_task_view_default_background_color">#fff3f3f3</color>
<!-- The recents task bar light text color to be drawn on top of dark backgrounds. -->
<color name="recents_task_bar_light_text_color">#ffeeeeee</color>
<!-- The recents task bar dark text color to be drawn on top of light backgrounds. -->
<color name="recents_task_bar_dark_text_color">#cc000000</color>
<!-- The recents task bar light dismiss icon color to be drawn on top of dark backgrounds. -->
<color name="recents_task_bar_light_icon_color">#ccffffff</color>
<!-- The recents task bar dark dismiss icon color to be drawn on top of light backgrounds. -->
<color name="recents_task_bar_dark_icon_color">#99000000</color>
<!-- The lock to task button background color. -->
<color name="recents_task_view_lock_to_app_button_background_color">#ffe6e6e6</color>
<!-- The lock to task button foreground color. -->
<color name="recents_task_view_lock_to_app_button_color">#ff666666</color>
<!-- The background color for the freeform workspace. -->
<color name="recents_freeform_workspace_bg_color">#33FFFFFF</color>
<!-- The background color for clear all button on light backgrounds if not transparent. -->
<color name="recents_clear_all_button_bg_light_color">#CCFFFFFF</color>
<!-- The background color for clear all button on dark backgrounds if not transparent. -->
<color name="recents_clear_all_button_bg_dark_color">#CC000000</color>
<!-- Shadow color for the first pixels around the fake shadow for recents. -->
<color name="fake_shadow_start_color">#44000000</color>
<!-- Shadow color for the furthest pixels around the fake shadow for recents. -->
<color name="fake_shadow_end_color">#03000000</color>
</resources>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources>
<!-- Component to be used as the recents implementation. Must implement the
RecentsImplementation interface. This name is in the ComponentName flattened format
(package/class) -->
<string name="config_recentsComponent" translatable="false">com.android.systemui.recents.LegacyRecentsImpl</string>
<!-- Whether recents should use hardware layers for its taskviews. This flag can be enabled
for devices where the java drawing of round rects may be slow -->
<bool name="config_recents_use_hardware_layers">false</bool>
<!-- The number of app thumbnails we keep in memory -->
<integer name="config_recents_max_thumbnail_count">10</integer>
<!-- The number of app icons we keep in memory -->
<integer name="config_recents_max_icon_count">20</integer>
<!-- Whether to use cheap, less good looking shadows for recents -->
<bool name="config_recents_fake_shadows">false</bool>
<!-- The duration in seconds to wait before the dismiss buttons are shown. -->
<integer name="recents_task_bar_dismiss_delay_seconds">1000</integer>
<!-- The duration for animating the task decorations in after transitioning from an app. -->
<integer name="recents_task_enter_from_app_duration">200</integer>
<!-- The duration for animating the task decorations in after transitioning from an app. -->
<integer name="recents_task_enter_from_affiliated_app_duration">125</integer>
<!-- The duration for animating the task decorations out before transitioning to an app. -->
<integer name="recents_task_exit_to_app_duration">125</integer>
<!-- The min animation duration for animating the nav bar scrim in. -->
<integer name="recents_nav_bar_scrim_enter_duration">400</integer>
<!-- The animation duration for scrolling the stack to a particular item. -->
<integer name="recents_animate_task_stack_scroll_duration">200</integer>
<!-- The delay to enforce between each alt-tab key press. -->
<integer name="recents_alt_tab_key_delay">200</integer>
<!-- Svelte specific logic, see RecentsConfiguration.SVELTE_* constants. -->
<integer name="recents_svelte_level">0</integer>
<!-- Recents: The relative range of visible tasks from the current scroll position
while the stack is focused. -->
<item name="recents_layout_focused_range_min" format="float" type="integer">-3</item>
<item name="recents_layout_focused_range_max" format="float" type="integer">2</item>
<!-- Recents: The relative range of visible tasks from the current scroll position
while the stack is not focused. -->
<item name="recents_layout_unfocused_range_min" format="float" type="integer">-2</item>
<item name="recents_layout_unfocused_range_max" format="float" type="integer">2.5</item>
</resources>

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2006, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- Recents Layout -->
<!-- The amount to inset the stack, specifically at the top and the other sides. We also
don't want this to change across configurations that Recents can be opened in, so we
define them statically for all display sizes. -->
<dimen name="recents_layout_min_margin">16dp</dimen>
<dimen name="recents_layout_top_margin_phone">16dp</dimen>
<dimen name="recents_layout_top_margin_tablet">32dp</dimen>
<dimen name="recents_layout_top_margin_tablet_xlarge">40dp</dimen>
<dimen name="recents_layout_bottom_margin">16dp</dimen>
<dimen name="recents_layout_side_margin_phone">16dp</dimen>
<dimen name="recents_layout_side_margin_tablet">48dp</dimen>
<dimen name="recents_layout_side_margin_tablet_docked">16dp</dimen>
<dimen name="recents_layout_side_margin_tablet_xlarge">64dp</dimen>
<dimen name="recents_layout_side_margin_tablet_xlarge_docked">16dp</dimen>
<!-- The height between the top margin and the top of the focused task. -->
<dimen name="recents_layout_top_peek_size">48dp</dimen>
<!-- The height between the bottom margin and the top of task in front of the focused task. -->
<dimen name="recents_layout_bottom_peek_size">56dp</dimen>
<!-- The offset from the top and bottom of the stack of the focused task. The bottom offset
will be additionally offset by the bottom system insets since it goes under the nav bar
in certain orientations. -->
<dimen name="recents_layout_initial_top_offset_phone_port">128dp</dimen>
<dimen name="recents_layout_initial_bottom_offset_phone_port">80dp</dimen>
<dimen name="recents_layout_initial_top_offset_phone_land">72dp</dimen>
<dimen name="recents_layout_initial_bottom_offset_phone_land">72dp</dimen>
<dimen name="recents_layout_initial_top_offset_tablet">160dp</dimen>
<dimen name="recents_layout_initial_bottom_offset_tablet">112dp</dimen>
<!-- The min/max translationZ for the tasks in the stack. -->
<dimen name="recents_layout_z_min">3dp</dimen>
<dimen name="recents_layout_z_max">24dp</dimen>
<!-- The margin between the freeform and stack. We also don't want this to change across
configurations that Recents can be opened in, so we define them statically for all
display sizes. -->
<dimen name="recents_freeform_layout_bottom_margin">16dp</dimen>
<!-- The padding between each freeform task. -->
<dimen name="recents_freeform_layout_task_padding">8dp</dimen>
<!-- Recents Views -->
<!-- The height of a task view bar. This has to be large enough to cover the action bar
height in either orientation at this smallest width. -->
<dimen name="recents_task_view_header_height">56dp</dimen>
<dimen name="recents_task_view_header_height_tablet_land">64dp</dimen>
<!-- The padding of a button in the recents task view header. -->
<dimen name="recents_task_view_header_button_padding">16dp</dimen>
<dimen name="recents_task_view_header_button_padding_tablet_land">20dp</dimen>
<!-- The radius of the rounded corners on a task view and its shadow (which can be larger
to create a softer corner effect. -->
<dimen name="recents_task_view_rounded_corners_radius">2dp</dimen>
<dimen name="recents_task_view_shadow_rounded_corners_radius">6dp</dimen>
<!-- The amount of highlight to make on each task view. -->
<dimen name="recents_task_view_highlight">1dp</dimen>
<!-- The size of the lock-to-app button and its icon. -->
<dimen name="recents_lock_to_app_size">56dp</dimen>
<dimen name="recents_lock_to_app_icon_size">28dp</dimen>
<!-- The amount of overscroll allowed when flinging to the end of the stack. -->
<dimen name="recents_fling_overscroll_distance">24dp</dimen>
<!-- The size of the drag hint text. -->
<dimen name="recents_drag_hint_text_size">14sp</dimen>
<!-- The min alpha to apply to a task affiliation group color. -->
<item name="recents_task_affiliation_color_min_alpha_percentage" format="float" type="dimen">0.6</item>
<!-- The amount to offset when animating into an affiliate group. -->
<dimen name="recents_task_stack_animation_affiliate_enter_offset">32dp</dimen>
<!-- The offsets the tasks animate from when recents is launched while docking -->
<dimen name="recents_task_stack_animation_launched_while_docking_offset">144dp</dimen>
<!-- The amount to translate when animating the removal of a task. -->
<dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen>
<!-- The alpha to apply to the recents row when it doesn't have focus -->
<item name="recents_recents_row_dim_alpha" format="float" type="dimen">0.5</item>
<!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
loading full resolution screenshots. -->
<dimen name="recents_fast_fling_velocity">600dp</dimen>
</resources>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2009, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Content description for the recent apps panel (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_desc_recent_apps">Overview.</string>
<!-- Content description to tell the user that this button will remove an application from recents -->
<string name="accessibility_recents_item_will_be_dismissed">Dismiss <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
<!-- Content description to tell the user an application has been removed from recents -->
<string name="accessibility_recents_item_dismissed"><xliff:g id="app" example="Calendar">%s</xliff:g> dismissed.</string>
<!-- Content description to tell the user all applications has been removed from recents -->
<string name="accessibility_recents_all_items_dismissed">All recent applications dismissed.</string>
<!-- Content description to tell the user that this button will open application info for an application in recents -->
<string name="accessibility_recents_item_open_app_info">Open <xliff:g id="app" example="Calendar">%s</xliff:g> application info.</string>
<!-- Content description to tell the user an application has been launched from recents -->
<string name="accessibility_recents_item_launched">Starting <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
<!-- Recents: The empty recents string. [CHAR LIMIT=NONE] -->
<string name="recents_empty_message">No recent items</string>
<!-- Recents: The empty recents string after dismissing all tasks. [CHAR LIMIT=NONE] -->
<string name="recents_empty_message_dismissed_all">You\'ve cleared everything</string>
<!-- Recents: The info panel app info button string. [CHAR LIMIT=NONE] -->
<string name="recents_app_info_button_label">Application Info</string>
<!-- Recents: The screen pinning button. [CHAR LIMIT=NONE] -->
<string name="recents_lock_to_app_button_label">screen pinning</string>
<!-- Recents: Temporary string for the button in the recents search bar. [CHAR LIMIT=NONE] -->
<string name="recents_search_bar_label">search</string>
<!-- Recents: Launch error string. [CHAR LIMIT=NONE] -->
<string name="recents_launch_error_message">Could not start <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
<!-- Recents: Launch disabled string. [CHAR LIMIT=NONE] -->
<string name="recents_launch_disabled_message"><xliff:g id="app" example="Calendar">%s</xliff:g> is disabled in safe-mode.</string>
<!-- Recents: Stack action button string. [CHAR LIMIT=NONE] -->
<string name="recents_stack_action_button_label">Clear all</string>
<!-- Recents: Hint text that shows on the drop targets to start multiwindow. [CHAR LIMIT=NONE] -->
<string name="recents_drag_hint_message">Drag here to use split screen</string>
<!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
<string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>
<!-- Recents: MultiStack add stack split vertical radio button. [CHAR LIMIT=NONE] -->
<string name="recents_multistack_add_stack_dialog_split_vertical">Split Vertical</string>
<!-- Recents: MultiStack add stack split custom radio button. [CHAR LIMIT=NONE] -->
<string name="recents_multistack_add_stack_dialog_split_custom">Split Custom</string>
<!-- Recents: Accessibility split to the top -->
<string name="recents_accessibility_split_screen_top">Split screen to the top</string>
<!-- Recents: Accessibility split to the left -->
<string name="recents_accessibility_split_screen_left">Split screen to the left</string>
<!-- Recents: Accessibility split to the right -->
<string name="recents_accessibility_split_screen_right">Split screen to the right</string>
</resources>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="RecentsTheme" parent="@android:style/Theme.Material">
<!-- NoTitle -->
<item name="android:windowNoTitle">true</item>
<!-- Misc -->
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:ambientShadowAlpha">0.35</item>
</style>
<!-- Recents theme -->
<style name="RecentsTheme.Wallpaper">
<item name="android:windowBackground">@*android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowDisablePreview">true</item>
<item name="clearAllStyle">@style/ClearAllButtonDefaultMargins</item>
<item name="clearAllBackgroundColor">@color/recents_clear_all_button_bg_dark_color</item>
<item name="wallpaperTextColor">@*android:color/primary_text_material_dark</item>
<item name="wallpaperTextColorSecondary">@*android:color/secondary_text_material_dark</item>
</style>
<style name="RecentsTheme.Wallpaper.Light">
<item name="clearAllBackgroundColor">@color/recents_clear_all_button_bg_light_color</item>
<item name="wallpaperTextColor">@*android:color/primary_text_material_light</item>
<item name="wallpaperTextColorSecondary">@*android:color/secondary_text_material_light</item>
</style>
<!-- Performance optimized Recents theme (no wallpaper) -->
<style name="RecentsTheme.NoWallpaper">
<item name="android:windowBackground">@android:color/black</item>
<item name="wallpaperTextColor">@android:color/white</item>
<item name="wallpaperTextColorSecondary">@android:color/white</item>
</style>
</resources>

View File

@@ -0,0 +1,744 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.recents;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.EventLog;
import android.util.Log;
import android.view.Display;
import android.widget.Toast;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.pip.PipUI;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent;
import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
import com.android.systemui.recents.events.component.ExpandPipEvent;
import com.android.systemui.recents.events.component.HidePipMenuEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
import com.android.systemui.recents.events.component.ShowUserToastEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.events.ui.RecentsGrowingEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.stackdivider.Divider;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
/**
* An implementation of the SystemUI recents component, which supports both system and secondary
* users.
*/
public class LegacyRecentsImpl implements RecentsImplementation {
private final static String TAG = "Recents";
public final static int EVENT_BUS_PRIORITY = 1;
public final static int BIND_TO_SYSTEM_USER_RETRY_DELAY = 5000;
public final static Set<String> RECENTS_ACTIVITIES = new HashSet<>();
static {
RECENTS_ACTIVITIES.add(RecentsImpl.RECENTS_ACTIVITY);
}
private static final String COUNTER_WINDOW_SUPPORTED = "window_enter_supported";
private static final String COUNTER_WINDOW_UNSUPPORTED = "window_enter_unsupported";
private static final String COUNTER_WINDOW_INCOMPATIBLE = "window_enter_incompatible";
private static SystemServicesProxy sSystemServicesProxy;
private static RecentsDebugFlags sDebugFlags;
private static RecentsTaskLoader sTaskLoader;
private static RecentsConfiguration sConfiguration;
private Context mContext;
private SysUiServiceProvider mSysUiServiceProvider;
private Handler mHandler;
private RecentsImpl mImpl;
// Only For system user, this is the callbacks instance we return to each secondary user
private RecentsSystemUser mSystemToUserCallbacks;
// Only for secondary users, this is the callbacks instance provided by the system user to make
// calls back
private IRecentsSystemUserCallbacks mUserToSystemCallbacks;
// The set of runnables to run after binding to the system user's service.
private final ArrayList<Runnable> mOnConnectRunnables = new ArrayList<>();
// Only for secondary users, this is the death handler for the binder from the system user
private final IBinder.DeathRecipient mUserToSystemCallbacksDeathRcpt = new IBinder.DeathRecipient() {
@Override
public void binderDied() {
mUserToSystemCallbacks = null;
EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
EventLogConstants.SYSUI_RECENTS_CONNECTION_USER_SYSTEM_UNBOUND,
sSystemServicesProxy.getProcessUser());
// Retry after a fixed duration
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
registerWithSystemUser();
}
}, BIND_TO_SYSTEM_USER_RETRY_DELAY);
}
};
// Only for secondary users, this is the service connection we use to connect to the system user
private final ServiceConnection mUserToSystemServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
if (service != null) {
mUserToSystemCallbacks = IRecentsSystemUserCallbacks.Stub.asInterface(
service);
EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
EventLogConstants.SYSUI_RECENTS_CONNECTION_USER_SYSTEM_BOUND,
sSystemServicesProxy.getProcessUser());
// Listen for system user's death, so that we can reconnect later
try {
service.linkToDeath(mUserToSystemCallbacksDeathRcpt, 0);
} catch (RemoteException e) {
Log.e(TAG, "Lost connection to (System) SystemUI", e);
}
// Run each of the queued runnables
runAndFlushOnConnectRunnables();
}
// Unbind ourselves now that we've registered our callbacks. The
// binder to the system user are still valid at this point.
mContext.unbindService(this);
}
@Override
public void onServiceDisconnected(ComponentName name) {
// Do nothing
}
};
/**
* Returns the callbacks interface that non-system users can call.
*/
public IBinder getSystemUserCallbacks() {
return mSystemToUserCallbacks;
}
public static RecentsTaskLoader getTaskLoader() {
return sTaskLoader;
}
public static SystemServicesProxy getSystemServices() {
return sSystemServicesProxy;
}
public static RecentsConfiguration getConfiguration() {
return sConfiguration;
}
public static RecentsDebugFlags getDebugFlags() {
return sDebugFlags;
}
@Override
public void onStart(Context context, SysUiServiceProvider sysUiServiceProvider) {
mContext = context;
mSysUiServiceProvider = sysUiServiceProvider;
final Resources res = mContext.getResources();
final int defaultTaskBarBackgroundColor =
mContext.getColor(R.color.recents_task_bar_default_background_color);
final int defaultTaskViewBackgroundColor =
mContext.getColor(R.color.recents_task_view_default_background_color);
sDebugFlags = new RecentsDebugFlags();
sSystemServicesProxy = SystemServicesProxy.getInstance(mContext);
sConfiguration = new RecentsConfiguration(mContext);
sTaskLoader = new RecentsTaskLoader(mContext,
// TODO: Once we start building the AAR, move these into the loader
res.getInteger(R.integer.config_recents_max_thumbnail_count),
res.getInteger(R.integer.config_recents_max_icon_count),
res.getInteger(R.integer.recents_svelte_level));
sTaskLoader.setDefaultColors(defaultTaskBarBackgroundColor, defaultTaskViewBackgroundColor);
mHandler = new Handler();
mImpl = new RecentsImpl(mContext);
// Register with the event bus
EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
EventBus.getDefault().register(sSystemServicesProxy, 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 = sSystemServicesProxy.getProcessUser();
if (sSystemServicesProxy.isSystemUser(processUser)) {
// For the system user, initialize an instance of the interface that we can pass to the
// secondary user
mSystemToUserCallbacks = new RecentsSystemUser(mContext, mImpl);
} else {
// For the secondary user, bind to the primary user's service to get a persistent
// interface to register its implementation and to later update its state
registerWithSystemUser();
}
}
@Override
public void onBootCompleted() {
mImpl.onBootCompleted();
}
@Override
public void growRecents() {
EventBus.getDefault().send(new RecentsGrowingEvent());
}
/**
* Shows the Recents.
*/
@Override
public void showRecentApps(boolean triggeredFromAltTab) {
ActivityManagerWrapper.getInstance().closeSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
int recentsGrowTarget = getComponent(Divider.class).getView().growsRecents();
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
true /* animate */, recentsGrowTarget);
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
true /* animate */, recentsGrowTarget);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
}
/**
* Hides the Recents.
*/
@Override
public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
}
/**
* Toggles the Recents activity.
*/
@Override
public void toggleRecentApps() {
int growTarget = getComponent(Divider.class).getView().growsRecents();
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.toggleRecents(growTarget);
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.toggleRecents(growTarget);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
}
/**
* Preloads info for the Recents activity.
*/
@Override
public void preloadRecentApps() {
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.preloadRecents();
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.preloadRecents();
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
}
@Override
public void cancelPreloadRecentApps() {
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.cancelPreloadingRecents();
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.cancelPreloadingRecents();
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
}
@Override
public boolean splitPrimaryTask(int stackCreateMode, Rect initialBounds, int metricsDockAction) {
Point realSize = new Point();
if (initialBounds == null) {
mContext.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY)
.getRealSize(realSize);
initialBounds = new Rect(0, 0, realSize.x, realSize.y);
}
int currentUser = sSystemServicesProxy.getCurrentUser();
ActivityManager.RunningTaskInfo runningTask =
ActivityManagerWrapper.getInstance().getRunningTask();
final int activityType = runningTask != null
? runningTask.configuration.windowConfiguration.getActivityType()
: ACTIVITY_TYPE_UNDEFINED;
boolean screenPinningActive = ActivityManagerWrapper.getInstance().isScreenPinningActive();
boolean isRunningTaskInHomeOrRecentsStack =
activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS;
if (runningTask != null && !isRunningTaskInHomeOrRecentsStack && !screenPinningActive) {
logDockAttempt(mContext, runningTask.topActivity, runningTask.resizeMode);
if (runningTask.supportsSplitScreenMultiWindow) {
if (metricsDockAction != -1) {
MetricsLogger.action(mContext, metricsDockAction,
runningTask.topActivity.flattenToShortString());
}
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.splitPrimaryTask(runningTask.id, stackCreateMode, initialBounds);
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.splitPrimaryTask(runningTask.id, stackCreateMode,
initialBounds);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
return true;
} else {
EventBus.getDefault().send(new ShowUserToastEvent(
R.string.dock_non_resizeble_failed_to_dock_text, Toast.LENGTH_SHORT));
return false;
}
} else {
return false;
}
}
public static void logDockAttempt(Context ctx, ComponentName activity, int resizeMode) {
if (resizeMode == ActivityInfo.RESIZE_MODE_UNRESIZEABLE) {
MetricsLogger.action(ctx, MetricsEvent.ACTION_WINDOW_DOCK_UNRESIZABLE,
activity.flattenToShortString());
}
MetricsLogger.count(ctx, getMetricsCounterForResizeMode(resizeMode), 1);
}
private static String getMetricsCounterForResizeMode(int resizeMode) {
switch (resizeMode) {
case ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE:
return COUNTER_WINDOW_UNSUPPORTED;
case ActivityInfo.RESIZE_MODE_RESIZEABLE:
case ActivityInfo.RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION:
return COUNTER_WINDOW_SUPPORTED;
default:
return COUNTER_WINDOW_INCOMPATIBLE;
}
}
@Override
public void onAppTransitionFinished() {
if (!LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
// Fallback, reset the flag once an app transition ends
EventBus.getDefault().send(new SetWaitingForTransitionStartEvent(
false /* waitingForTransitionStart */));
}
}
/**
* Updates on configuration change.
*/
public void onConfigurationChanged(Configuration newConfig) {
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.onConfigurationChanged();
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.onConfigurationChanged();
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
}
/**
* Handle Recents activity visibility changed.
*/
public final void onBusEvent(final RecentsVisibilityChangedEvent event) {
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
int processUser = ssp.getProcessUser();
if (ssp.isSystemUser(processUser)) {
mImpl.onVisibilityChanged(event.applicationContext, event.visible);
} else {
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.updateRecentsVisibility(event.visible);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
}
});
}
// This will catch the cases when a user launches from recents to another app
// (and vice versa) that is not in the recents stack (such as home or bugreport) and it
// would not reset the wait for transition flag. This will catch it and make sure that the
// flag is reset.
if (!event.visible) {
mImpl.setWaitingForTransitionStart(false);
}
}
public final void onBusEvent(DockedFirstAnimationFrameEvent event) {
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
int processUser = ssp.getProcessUser();
if (ssp.isSystemUser(processUser)) {
final Divider divider = getComponent(Divider.class);
if (divider != null) {
divider.onDockedFirstAnimationFrame();
}
} else {
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.sendDockedFirstAnimationFrameEvent();
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
}
});
}
}
/**
* Handle screen pinning request.
*/
public final void onBusEvent(final ScreenPinningRequestEvent event) {
int processUser = sSystemServicesProxy.getProcessUser();
if (sSystemServicesProxy.isSystemUser(processUser)) {
mImpl.onStartScreenPinning(event.applicationContext, event.taskId);
} else {
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.startScreenPinning(event.taskId);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
}
});
}
}
public final void onBusEvent(final RecentsDrawnEvent event) {
int processUser = sSystemServicesProxy.getProcessUser();
if (sSystemServicesProxy.isSystemUser(processUser)) {
final Divider divider = getComponent(Divider.class);
if (divider != null) {
divider.onRecentsDrawn();
}
} else {
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.sendRecentsDrawnEvent();
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
}
});
}
}
public final void onBusEvent(final DockedTopTaskEvent event) {
int processUser = sSystemServicesProxy.getProcessUser();
if (sSystemServicesProxy.isSystemUser(processUser)) {
final Divider divider = getComponent(Divider.class);
if (divider != null) {
divider.onDockedTopTask();
}
} else {
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.sendDockingTopTaskEvent(event.initialRect);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
}
});
}
}
public final void onBusEvent(final RecentsActivityStartingEvent event) {
int processUser = sSystemServicesProxy.getProcessUser();
if (sSystemServicesProxy.isSystemUser(processUser)) {
final Divider divider = getComponent(Divider.class);
if (divider != null) {
divider.onRecentsActivityStarting();
}
} else {
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.sendLaunchRecentsEvent();
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
}
});
}
}
public final void onBusEvent(LaunchTaskFailedEvent event) {
// Reset the transition when tasks fail to launch
mImpl.setWaitingForTransitionStart(false);
}
public final void onBusEvent(ConfigurationChangedEvent event) {
// Update the configuration for the Recents component when the activity configuration
// changes as well
mImpl.onConfigurationChanged();
}
public final void onBusEvent(ShowUserToastEvent event) {
int currentUser = sSystemServicesProxy.getCurrentUser();
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.onShowCurrentUserToast(event.msgResId, event.msgLength);
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.showCurrentUserToast(event.msgResId, event.msgLength);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
}
}
public final void onBusEvent(SetWaitingForTransitionStartEvent event) {
int processUser = sSystemServicesProxy.getProcessUser();
if (sSystemServicesProxy.isSystemUser(processUser)) {
mImpl.setWaitingForTransitionStart(event.waitingForTransitionStart);
} else {
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.setWaitingForTransitionStartEvent(
event.waitingForTransitionStart);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
}
});
}
}
public final void onBusEvent(ExpandPipEvent event) {
PipUI pipUi = getComponent(PipUI.class);
pipUi.expandPip();
}
public final void onBusEvent(HidePipMenuEvent event) {
PipUI pipUi = getComponent(PipUI.class);
event.getAnimationTrigger().increment();
pipUi.hidePipMenu(() -> {
event.getAnimationTrigger().increment();
}, () -> {
event.getAnimationTrigger().decrement();
});
event.getAnimationTrigger().decrement();
}
/**
* Attempts to register with the system user.
*/
private void registerWithSystemUser() {
final int processUser = sSystemServicesProxy.getProcessUser();
postToSystemUser(new Runnable() {
@Override
public void run() {
try {
mUserToSystemCallbacks.registerNonSystemUserCallbacks(
new RecentsImplProxy(mImpl), processUser);
} catch (RemoteException e) {
Log.e(TAG, "Failed to register", e);
}
}
});
}
/**
* Runs the runnable in the system user's Recents context, connecting to the service if
* necessary.
*/
private void postToSystemUser(final Runnable onConnectRunnable) {
mOnConnectRunnables.add(onConnectRunnable);
if (mUserToSystemCallbacks == null) {
Intent systemUserServiceIntent = new Intent();
systemUserServiceIntent.setClass(mContext, RecentsSystemUserService.class);
boolean bound = mContext.bindServiceAsUser(systemUserServiceIntent,
mUserToSystemServiceConnection, Context.BIND_AUTO_CREATE, UserHandle.SYSTEM);
EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
EventLogConstants.SYSUI_RECENTS_CONNECTION_USER_BIND_SERVICE,
sSystemServicesProxy.getProcessUser());
if (!bound) {
// Retry after a fixed duration
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
registerWithSystemUser();
}
}, BIND_TO_SYSTEM_USER_RETRY_DELAY);
}
} else {
runAndFlushOnConnectRunnables();
}
}
/**
* Runs all the queued runnables after a service connection is made.
*/
private void runAndFlushOnConnectRunnables() {
for (Runnable r : mOnConnectRunnables) {
r.run();
}
mOnConnectRunnables.clear();
}
private <T> T getComponent(Class<T> clazz) {
return mSysUiServiceProvider.getComponent(clazz);
}
@Override
public void dump(PrintWriter pw) {
pw.println("Recents");
pw.println(" currentUserId=" + SystemServicesProxy.getInstance(mContext).getCurrentUser());
}
}

View File

@@ -87,16 +87,15 @@ import com.android.systemui.recents.events.ui.focus.FocusPreviousTaskViewEvent;
import com.android.systemui.recents.events.ui.focus.NavigateTaskViewEvent;
import com.android.systemui.recents.events.ui.focus.NavigateTaskViewEvent.Direction;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.shared.recents.utilities.Utilities;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.shared.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.utilities.Utilities;
import com.android.systemui.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.TaskStack;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.RecentsView;
import com.android.systemui.recents.views.SystemBarScrimViews;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.WindowManagerWrapper;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -109,7 +108,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
private final static String TAG = "RecentsActivity";
private final static boolean DEBUG = false;
public final static int EVENT_BUS_PRIORITY = Recents.EVENT_BUS_PRIORITY + 1;
public final static int EVENT_BUS_PRIORITY = LegacyRecentsImpl.EVENT_BUS_PRIORITY + 1;
public final static int INCOMPATIBLE_APP_ALPHA_DURATION = 150;
private PackageMonitor mPackageMonitor = new PackageMonitor() {
@@ -217,8 +216,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
LatencyTracker.ACTION_TOGGLE_RECENTS));
}
DejankUtils.postAfterTraversal(() -> {
Recents.getTaskLoader().startLoader(RecentsActivity.this);
Recents.getTaskLoader().getHighResThumbnailLoader().setVisible(true);
LegacyRecentsImpl.getTaskLoader().startLoader(RecentsActivity.this);
LegacyRecentsImpl.getTaskLoader().getHighResThumbnailLoader().setVisible(true);
});
return true;
}
@@ -228,7 +227,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
* Dismisses recents if we are already visible and the intent is to toggle the recents view.
*/
boolean dismissRecentsToFocusedTask(int logCategory) {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (ssp.isRecentsActivityVisible()) {
// If we have a focused Task, launch that Task now
if (mRecentsView.launchFocusedTask(logCategory)) return true;
@@ -240,7 +239,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
* Dismisses recents back to the launch target task.
*/
boolean dismissRecentsToLaunchTargetTaskOrHome() {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (ssp.isRecentsActivityVisible()) {
// If we have a focused Task, launch that Task now
if (mRecentsView.launchPreviousTask()) return true;
@@ -254,7 +253,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
* Dismisses recents if we are already visible and the intent is to toggle the recents view.
*/
boolean dismissRecentsToFocusedTaskOrHome() {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (ssp.isRecentsActivityVisible()) {
// If we have a focused Task, launch that Task now
if (mRecentsView.launchFocusedTask(0 /* logCategory */)) return true;
@@ -289,7 +288,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
/** Dismisses Recents directly to Home if we currently aren't transitioning. */
boolean dismissRecentsToHomeIfVisible(boolean animated) {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (ssp.isRecentsActivityVisible()) {
// Return to Home
dismissRecentsToHome(animated);
@@ -306,7 +305,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
// In the case that the activity starts up before the Recents component has initialized
// (usually when debugging/pushing the SysUI apk), just finish this activity.
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (ssp == null) {
mFinishedOnStartup = true;
finish();
@@ -335,7 +334,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
mScrimViews = new SystemBarScrimViews(this);
getWindow().getAttributes().privateFlags |=
WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
if (Recents.getConfiguration().isLowRamDevice) {
if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
@@ -384,7 +383,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
// reset launch state with dock, app and home set to false
Object isRelaunching = getLastNonConfigurationInstance();
if (isRelaunching != null && isRelaunching instanceof Boolean && (boolean) isRelaunching) {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
launchState.launchedViaDockGesture = false;
launchState.launchedFromApp = false;
launchState.launchedFromHome = false;
@@ -418,14 +417,14 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
private void reloadStackView() {
// If the Recents component has preloaded a load plan, then use that to prevent
// reconstructing the task stack
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
RecentsTaskLoadPlan loadPlan = RecentsImpl.consumeInstanceLoadPlan();
if (loadPlan == null) {
loadPlan = new RecentsTaskLoadPlan(this);
}
// Start loading tasks according to the load plan
RecentsConfiguration config = Recents.getConfiguration();
RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
if (!loadPlan.hasTasks()) {
loader.preloadTasks(loadPlan, launchState.launchedToTaskId);
@@ -538,7 +537,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
mIsVisible = false;
EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
MetricsLogger.hidden(this, MetricsEvent.OVERVIEW_ACTIVITY);
Recents.getTaskLoader().getHighResThumbnailLoader().setVisible(false);
LegacyRecentsImpl.getTaskLoader().getHighResThumbnailLoader().setVisible(false);
// When recents starts again before onStop, do not reset launch flags so entrance animation
// can run
@@ -546,13 +545,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
// 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.
RecentsConfiguration config = Recents.getConfiguration();
RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
launchState.reset();
}
// Force a gc to attempt to clean up bitmap references more quickly (b/38258699)
Recents.getSystemServices().gc();
LegacyRecentsImpl.getSystemServices().gc();
}
@Override
@@ -587,7 +586,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
@Override
public void onTrimMemory(int level) {
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
if (loader != null) {
loader.onTrimMemory(level);
}
@@ -656,7 +655,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
/**** EventBus events ****/
public final void onBusEvent(ToggleRecentsEvent event) {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
if (launchState.launchedFromHome) {
dismissRecentsToHome(true /* animateTaskViews */);
} else {
@@ -700,7 +699,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
}
public final void onBusEvent(CancelEnterRecentsWindowAnimationEvent event) {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
int launchToTaskId = launchState.launchedToTaskId;
if (launchToTaskId != -1 &&
(event.launchTask == null || launchToTaskId != event.launchTask.key.id)) {
@@ -748,7 +747,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
public final void onBusEvent(DeleteTaskDataEvent event) {
// Remove any stored data from the loader
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
loader.deleteTaskData(event.task, false);
// Remove the task from activity manager
@@ -760,7 +759,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
}
public final void onBusEvent(AllTaskViewsDismissedEvent event) {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (ssp.hasDockedTask()) {
mRecentsView.showEmptyView(event.msgResId);
} else {
@@ -808,9 +807,9 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
private void reloadTaskStack(boolean isInMultiWindowMode, boolean sendConfigChangedEvent) {
// Reload the task stack completely
RecentsConfiguration config = Recents.getConfiguration();
RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
RecentsTaskLoadPlan loadPlan = new RecentsTaskLoadPlan(this);
loader.preloadTasks(loadPlan, -1 /* runningTaskId */);
@@ -839,7 +838,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
}
public void onPackageChanged(String packageName, int userId) {
Recents.getTaskLoader().onPackageChanged(packageName);
LegacyRecentsImpl.getTaskLoader().onPackageChanged(packageName);
EventBus.getDefault().send(new PackagesChangedEvent(packageName, userId));
}
@@ -847,7 +846,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
super.dump(prefix, fd, writer, args);
EventBus.getDefault().dump(prefix, writer);
Recents.getTaskLoader().dump(prefix, writer);
LegacyRecentsImpl.getTaskLoader().dump(prefix, writer);
String id = Integer.toHexString(System.identityHashCode(this));

View File

@@ -26,7 +26,6 @@ import android.os.SystemProperties;
import com.android.systemui.R;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.views.DockState;
import com.android.systemui.shared.recents.model.TaskStack;
/**
* Represents the dock regions for each orientation.
@@ -86,7 +85,7 @@ public class RecentsConfiguration {
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();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
mAppContext = context.getApplicationContext();
Resources res = mAppContext.getResources();
fakeShadows = res.getBoolean(R.bool.config_recents_fake_shadows);
@@ -116,7 +115,7 @@ public class RecentsConfiguration {
public DockState[] getDockStatesForCurrentOrientation() {
boolean isLandscape = mAppContext.getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE;
RecentsConfiguration config = Recents.getConfiguration();
RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
if (config.isLargeScreen) {
return isLandscape ? DockRegion.TABLET_LANDSCAPE : DockRegion.TABLET_PORTRAIT;
} else {

View File

@@ -47,7 +47,6 @@ import android.view.WindowManager;
import android.widget.Toast;
import com.android.systemui.Dependency;
import com.android.systemui.OverviewProxyService;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.pip.phone.ForegroundThread;
import com.google.android.collect.Lists;
@@ -55,7 +54,6 @@ import com.google.android.collect.Lists;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.policy.DockedDividerUtils;
import com.android.systemui.R;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
@@ -75,11 +73,11 @@ import com.android.systemui.recents.events.ui.TaskSnapshotChangedEvent;
import com.android.systemui.recents.misc.DozeTrigger;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.misc.SysUiTaskStackChangeListener;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.shared.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.TaskStack;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.recents.views.TaskStackLayoutAlgorithm;
import com.android.systemui.recents.views.TaskStackLayoutAlgorithm.VisibilityReport;
@@ -143,7 +141,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
}
// Preloads the next task
RecentsConfiguration config = Recents.getConfiguration();
RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
if (config.svelteLevel == RecentsTaskLoader.SVELTE_NONE) {
Rect windowRect = getWindowRect(null /* windowRectOverride */);
if (windowRect.isEmpty()) {
@@ -153,7 +151,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
// Load the next task only if we aren't svelte
ActivityManager.RunningTaskInfo runningTaskInfo =
ActivityManagerWrapper.getInstance().getRunningTask();
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
loader.preloadTasks(plan, -1);
TaskStack stack = plan.getTaskStack();
@@ -195,8 +193,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
// This time needs to be fetched the same way the last active time is fetched in
// {@link TaskRecord#touchActiveTime}
Recents.getConfiguration().getLaunchState().launchedFromPipApp = true;
Recents.getConfiguration().getLaunchState().launchedWithNextPipApp = false;
LegacyRecentsImpl.getConfiguration().getLaunchState().launchedFromPipApp = true;
LegacyRecentsImpl.getConfiguration().getLaunchState().launchedWithNextPipApp = false;
EventBus.getDefault().send(new ActivityPinnedEvent(taskId));
consumeInstanceLoadPlan();
sLastPipTime = System.currentTimeMillis();
@@ -278,7 +276,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
public void onConnectionChanged(boolean isConnected) {
if (!isConnected) {
// Clear everything when the connection to the overview service
Recents.getTaskLoader().onTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
LegacyRecentsImpl.getTaskLoader().onTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
}
}
};
@@ -313,7 +311,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
// When we start, preload the data associated with the previous recent tasks.
// We can use a new plan since the caches will be the same.
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
loader.preloadTasks(plan, -1);
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
@@ -334,16 +332,16 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
/**
* This is only called from the system user's Recents. Secondary users will instead proxy their
* visibility change events through to the system user via
* {@link Recents#onBusEvent(RecentsVisibilityChangedEvent)}.
* {@link LegacyRecentsImpl#onBusEvent(RecentsVisibilityChangedEvent)}.
*/
public void onVisibilityChanged(Context context, boolean visible) {
Recents.getSystemServices().setRecentsVisibility(visible);
LegacyRecentsImpl.getSystemServices().setRecentsVisibility(visible);
}
/**
* This is only called from the system user's Recents. Secondary users will instead proxy their
* visibility change events through to the system user via
* {@link Recents#onBusEvent(ScreenPinningRequestEvent)}.
* {@link LegacyRecentsImpl#onBusEvent(ScreenPinningRequestEvent)}.
*/
public void onStartScreenPinning(Context context, int taskId) {
final StatusBar statusBar = getStatusBar();
@@ -354,13 +352,13 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents,
boolean animate, int growTarget) {
final SystemServicesProxy ssp = Recents.getSystemServices();
final SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
final MutableBoolean isHomeStackVisible = new MutableBoolean(true);
final boolean isRecentsVisible = Recents.getSystemServices().isRecentsActivityVisible(
final boolean isRecentsVisible = LegacyRecentsImpl.getSystemServices().isRecentsActivityVisible(
isHomeStackVisible);
final boolean fromHome = isHomeStackVisible.value;
final boolean launchedWhileDockingTask =
Recents.getSystemServices().getSplitScreenPrimaryStack() != null;
LegacyRecentsImpl.getSystemServices().getSplitScreenPrimaryStack() != null;
mTriggeredFromAltTab = triggeredFromAltTab;
mDraggingInRecents = draggingInRecents;
@@ -439,12 +437,12 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
MutableBoolean isHomeStackVisible = new MutableBoolean(true);
long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
RecentsConfiguration config = Recents.getConfiguration();
RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
if (!launchState.launchedWithAltTab) {
if (Recents.getConfiguration().isGridEnabled) {
if (LegacyRecentsImpl.getConfiguration().isGridEnabled) {
// Has the user tapped quickly?
boolean isQuickTap = elapsedTime < ViewConfiguration.getDoubleTapTimeout();
if (isQuickTap) {
@@ -509,7 +507,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
// RecentsActivity) only if there is a task to animate to. Post this to ensure that we
// don't block the touch feedback on the nav bar button which triggers this.
mHandler.post(() -> {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
if (!ssp.isRecentsActivityVisible(null)) {
ActivityManager.RunningTaskInfo runningTask =
ActivityManagerWrapper.getInstance().getRunningTask();
@@ -517,7 +515,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
return;
}
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
sInstanceLoadPlan = new RecentsTaskLoadPlan(mContext);
loader.preloadTasks(sInstanceLoadPlan, runningTask.id);
TaskStack stack = sInstanceLoadPlan.getTaskStack();
@@ -556,8 +554,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
* Transitions to the next recent task in the stack.
*/
public void showNextTask() {
SystemServicesProxy ssp = Recents.getSystemServices();
RecentsTaskLoader loader = Recents.getTaskLoader();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
loader.preloadTasks(plan, -1);
TaskStack focusedStack = plan.getTaskStack();
@@ -612,8 +610,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
* Transitions to the next affiliated task.
*/
public void showRelativeAffiliatedTask(boolean showNextTask) {
SystemServicesProxy ssp = Recents.getSystemServices();
RecentsTaskLoader loader = Recents.getTaskLoader();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
loader.preloadTasks(plan, -1);
TaskStack focusedStack = plan.getTaskStack();
@@ -678,20 +676,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
null /* resultListener */, null /* resultCallbackHandler */);
}
public void showNextAffiliatedTask() {
// Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_next", 1);
showRelativeAffiliatedTask(true);
}
public void showPrevAffiliatedTask() {
// Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_prev", 1);
showRelativeAffiliatedTask(false);
}
public void splitPrimaryTask(int taskId, int stackCreateMode, Rect initialBounds) {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
// Make sure we inform DividerView before we actually start the activity so we can change
// the resize mode already.
@@ -758,7 +744,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
private void updateDummyStackViewLayout(TaskStackLayoutAlgorithm stackLayout,
TaskStack stack, Rect windowRect) {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
Rect displayRect = ssp.getDisplayRect();
Rect systemInsets = new Rect();
ssp.getStableInsets(systemInsets);
@@ -789,7 +775,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
private Rect getWindowRect(Rect windowRectOverride) {
return windowRectOverride != null
? new Rect(windowRectOverride)
: Recents.getSystemServices().getWindowRect();
: LegacyRecentsImpl.getSystemServices().getWindowRect();
}
/**
@@ -871,7 +857,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
launchOpts.runningTaskId = runningTaskId;
launchOpts.loadThumbnails = false;
launchOpts.onlyLoadForCache = true;
Recents.getTaskLoader().loadTasks(sInstanceLoadPlan, launchOpts);
LegacyRecentsImpl.getTaskLoader().loadTasks(sInstanceLoadPlan, launchOpts);
}
/**
@@ -900,7 +886,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
private Pair<ActivityOptions, AppTransitionAnimationSpecsFuture>
getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask,
Rect windowOverrideRect) {
final boolean isLowRamDevice = Recents.getConfiguration().isLowRamDevice;
final boolean isLowRamDevice = LegacyRecentsImpl.getConfiguration().isLowRamDevice;
// Update the destination rect
Task toTask = new Task();
@@ -955,7 +941,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
*/
private Bitmap drawThumbnailTransitionBitmap(Task toTask,
TaskViewTransform toTransform) {
SystemServicesProxy ssp = Recents.getSystemServices();
SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
int width = (int) toTransform.rect.width();
int height = (int) toTransform.rect.height();
if (toTransform != null && toTask.key != null && width > 0 && height > 0) {
@@ -1007,8 +993,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
private void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask,
boolean isHomeStackVisible, boolean animate, int growTarget) {
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
int runningTaskId = !mLaunchedWhileDocking && (runningTask != null)
? runningTask.id
@@ -1087,10 +1073,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
return SystemServicesProxy.getInstance(mContext).getWindowRect();
}
Rect result = new Rect();
Rect displayRect = Recents.getSystemServices().getDisplayRect();
Rect displayRect = LegacyRecentsImpl.getSystemServices().getDisplayRect();
DockedDividerUtils.calculateBoundsForPosition(growTarget, WindowManager.DOCKED_BOTTOM,
result, displayRect.width(), displayRect.height(),
Recents.getSystemServices().getDockedDividerSize(mContext));
LegacyRecentsImpl.getSystemServices().getDockedDividerSize(mContext));
return result;
}
@@ -1110,7 +1096,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
| Intent.FLAG_ACTIVITY_TASK_ON_HOME);
HidePipMenuEvent hideMenuEvent = new HidePipMenuEvent();
hideMenuEvent.addPostAnimationCallback(() -> {
Recents.getSystemServices().startActivityAsUserAsync(intent, opts);
LegacyRecentsImpl.getSystemServices().startActivityAsUserAsync(intent, opts);
EventBus.getDefault().send(new RecentsActivityStartingEvent());
if (future != null) {
future.composeSpecsSynchronous();

View File

@@ -22,7 +22,6 @@ import android.os.IBinder;
import android.util.Log;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.SystemUIApplication;
/**
* A strictly system-user service that is started by the secondary user's Recents (with a limited
@@ -41,7 +40,7 @@ public class RecentsSystemUserService extends Service {
@Override
public IBinder onBind(Intent intent) {
Recents recents = SysUiServiceProvider.getComponent(this, Recents.class);
LegacyRecentsImpl recents = SysUiServiceProvider.getComponent(this, LegacyRecentsImpl.class);
if (DEBUG) {
Log.d(TAG, "onBind: " + recents);
}

View File

@@ -17,7 +17,7 @@
package com.android.systemui.recents.events.activity;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.shared.recents.model.TaskStack;
import com.android.systemui.recents.model.TaskStack;
/**
* This is sent by the activity whenever the multi-window state has changed.

Some files were not shown because too many files have changed in this diff Show More