Merging from ub-launcher3-master @ build 6767682
Test: manual, presubmit on the source branch
x20/teams/android-launcher/merge/ub-launcher3-master_master_6767682.html
Change-Id: I5e9c73a7ac3033fe82006c4bd72824f56b8988f8
diff --git a/Android.mk b/Android.mk
index 7805b32..752b530 100644
--- a/Android.mk
+++ b/Android.mk
@@ -48,7 +48,7 @@
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java
LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
+LOCAL_MIN_SDK_VERSION := 26
LOCAL_MODULE := Launcher3CommonDepsLib
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MANIFEST_FILE := AndroidManifest-common.xml
@@ -77,7 +77,7 @@
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
+LOCAL_MIN_SDK_VERSION := 26
LOCAL_PACKAGE_NAME := Launcher3
LOCAL_PRIVILEGED_MODULE := true
LOCAL_SYSTEM_EXT_MODULE := true
@@ -108,7 +108,7 @@
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
+LOCAL_MIN_SDK_VERSION := 26
LOCAL_PACKAGE_NAME := Launcher3Go
LOCAL_PRIVILEGED_MODULE := true
LOCAL_SYSTEM_EXT_MODULE := true
@@ -149,12 +149,9 @@
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
$(call all-java-files-under, quickstep/src) \
- $(call all-java-files-under, quickstep/recents_ui_overrides/src) \
$(call all-java-files-under, src_shortcuts_overrides)
-LOCAL_RESOURCE_DIR := \
- $(LOCAL_PATH)/quickstep/res \
- $(LOCAL_PATH)/quickstep/recents_ui_overrides/res
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/quickstep/res
LOCAL_PROGUARD_ENABLED := disabled
@@ -183,9 +180,7 @@
LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3
LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3
-LOCAL_RESOURCE_DIR := \
- $(LOCAL_PATH)/quickstep/res \
- $(LOCAL_PATH)/quickstep/recents_ui_overrides/res
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/quickstep/res
LOCAL_FULL_LIBS_MANIFEST_FILES := \
$(LOCAL_PATH)/quickstep/AndroidManifest-launcher.xml \
@@ -220,12 +215,10 @@
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
$(call all-java-files-under, quickstep/src) \
- $(call all-java-files-under, quickstep/recents_ui_overrides/src) \
$(call all-java-files-under, go/src)
LOCAL_RESOURCE_DIR := \
$(LOCAL_PATH)/quickstep/res \
- $(LOCAL_PATH)/quickstep/recents_ui_overrides/res \
$(LOCAL_PATH)/go/res
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index 19a16e3..97e3786 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -29,12 +29,6 @@
at compile time. Note that the components defined in AndroidManifest.xml are also required,
with some minor changed based on the derivative app.
-->
- <permission
- android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
- android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
- android:protectionLevel="dangerous"
- android:label="@string/permlab_install_shortcut"
- android:description="@string/permdesc_install_shortcut" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
@@ -79,17 +73,6 @@
android:restoreAnyVersion="true"
android:supportsRtl="true" >
- <!-- Intent received used to install shortcuts from other applications -->
- <receiver
- android:name="com.android.launcher3.InstallShortcutReceiver"
- android:permission="com.android.launcher.permission.INSTALL_SHORTCUT"
- android:exported="true"
- android:enabled="@bool/enable_install_shortcut_api" >
- <intent-filter>
- <action android:name="com.android.launcher.action.INSTALL_SHORTCUT" />
- </intent-filter>
- </receiver>
-
<!-- Intent received when a session is committed -->
<receiver
android:name="com.android.launcher3.SessionCommitReceiver"
@@ -116,7 +99,6 @@
<service
android:name="com.android.launcher3.notification.NotificationListener"
android:label="@string/notification_dots_service_title"
- android:enabled="@bool/notification_dots_enabled"
android:exported="true"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4664c93..97bce9c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -20,7 +20,7 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.launcher3">
- <uses-sdk android:targetSdkVersion="29" android:minSdkVersion="25"/>
+ <uses-sdk android:targetSdkVersion="29" android:minSdkVersion="26"/>
<!--
Manifest entries specific to Launcher3. This is merged with AndroidManifest-common.xml.
Refer comments around specific entries on how to extend individual components.
diff --git a/buglist.txt b/buglist.txt
new file mode 100644
index 0000000..382ccfd
--- /dev/null
+++ b/buglist.txt
@@ -0,0 +1,38 @@
+160759508
+144170434
+144170434
+161801331
+162564471
+160361464
+161901771
+160568387
+162623012
+162012217
+160718310
+160361464
+160718310
+162012217
+160748731
+154951045
+162861289
+149934536
+149934536
+144170434
+144170434
+162454040
+161273376
+149934536
+149934536
+158701272
+162871508
+149934536
+161939759
+154964045
+161536946
+149934536
+161685099
+162812884
+162480567
+162480567
+149934536
+149934536
diff --git a/buglist_unique.txt b/buglist_unique.txt
new file mode 100644
index 0000000..d33f4f1
--- /dev/null
+++ b/buglist_unique.txt
@@ -0,0 +1,24 @@
+144170434
+149934536
+154951045
+154964045
+158701272
+160361464
+160568387
+160718310
+160748731
+160759508
+161273376
+161536946
+161685099
+161801331
+161901771
+161939759
+162012217
+162454040
+162480567
+162564471
+162623012
+162812884
+162861289
+162871508
diff --git a/buglist_with_title.txt b/buglist_with_title.txt
new file mode 100644
index 0000000..aa8b413
--- /dev/null
+++ b/buglist_with_title.txt
@@ -0,0 +1,24 @@
+144170434 twickham P1 FIXED Improve Overview -> Home transition ----
+149934536 twickham P2 FIXED Update gesture nav pullback logic ----
+154951045 peanutbutter P1 FIXED Odd animation occuring at times when swiping to home ----
+154964045 awickham P2 FIXED "Clear all" text is not in the middle of app's window vertically ----
+158701272 twickham P4 FIXED Discontinuities when long-swiping to home ----
+160361464 tracyzhou P2 FIXED Place launcher above the target app in live tile mode ----
+160568387 twickham P2 FIXED Can't get to app switcher by swiping up (motion pause not detected) ----
+160718310 xuqiu P1 FIXED With "Select" overview action selected, App icon is missing in other overview apps after orientation change ----
+160748731 sunnygoyal P2 ASSIGNED Unify prediction model with Launcher model ----
+160759508 twickham P2 FIXED Swipe up cannot back to home screen in overview. ----
+161273376 xuqiu P2 FIXED [Overview Actions] Add logging and helpful messages ----
+161536946 twickham P2 FIXED Haptics don't indicate snap-to in overview, ----
+161685099 winsonc P2 FIXED Screen still stay at the quick settings/notification when I swipe up with 3 finger to check the all apps. ----
+161801331 hyunyoungs P2 FIXED Change AllAppsSearch plugin to support only data fetch ----
+161901771 xuqiu P1 FIXED Overlapping layer of highlights with app layout getting darker when keep rotating the device from "Feedback" viewpoint in split screen ----
+161939759 sunnygoyal P2 FIXED RD1A: Going to overview in landscape mode clips the screen content ----
+162012217 perumaal P2 ASSIGNED Leaked Activity Caused by Gleams ----
+162454040 bookatz P2 ASSIGNED Create multiuser test that checks that opening an app works properly ----
+162480567 sfufa P4 FIXED Enable Item Decorations for search items ----
+162564471 tracyzhou P2 FIXED [Live tile] Handle tapping overview actions in live tile mode ----
+162623012 zakcohen P1 ASSIGNED Enable chips flag ----
+162812884 winsonc P2 ASSIGNED [R]The color have not changed in some page after turning on the dark theme. ----
+162861289 hyunyoungs P2 FIXED Add FocusIndicator support to DEVICE_SEARCH feature in S ----
+162871508 sfufa P2 ASSIGNED Introduce support for Hero app section ----
diff --git a/commitlist.txt b/commitlist.txt
new file mode 100644
index 0000000..e8eb105
--- /dev/null
+++ b/commitlist.txt
@@ -0,0 +1,1133 @@
+[34mCOMMAND>> git log 23bb2d1a4d632c46ed42b22808c052b19365fcb4..532b962a034762b231c0fbb95e145459897e45d5(B[m
+commit 532b962a034762b231c0fbb95e145459897e45d5
+Merge: 87be28a67 107fe60f6
+Author: Tony Wickham <twickham@google.com>
+Date: Sat Aug 15 00:20:36 2020 +0000
+
+ resolve merge conflicts of 107fe60f6ef5b3336ece35122650d9ccc1c69913 to ub-launcher3-master
+
+ Change-Id: I9a1c52e66edd627fd54cc3cb423fa28a6175f8ac
+
+commit 87be28a67b12c5b12a89155c794c0ddd438e8750
+Merge: 4fedc4e58 d844fe758
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Fri Aug 14 23:47:44 2020 +0000
+
+ Merge "Remove ENABLE_OVERVIEW_ACTIONS flag, defaulting to true" into ub-launcher3-master
+
+commit 4fedc4e583fd5b6edcd4ea9b66d4c32991f04867
+Merge: 4fb5f74bb 6c1a88f17
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Fri Aug 14 23:00:09 2020 +0000
+
+ [automerger skipped] Merge "Track OverviewToHomeAnim with StateManager" into ub-launcher3-rvc-qpr-dev am: 6c1a88f172 -s ours
+
+ am skip reason: Change-Id I5348565b9e705d8ffba39818dde9efe82b16bb7a with SHA-1 4fb5f74bb4 is in history
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12352271
+
+ Change-Id: I2a164ac97082a33bd8e859d6fb3f40d338996304
+
+commit d844fe758c880447bff8708646ecfcd92e98ba06
+Author: Tony Wickham <twickham@google.com>
+Date: Thu Aug 13 19:33:26 2020 -0700
+
+ Remove ENABLE_OVERVIEW_ACTIONS flag, defaulting to true
+
+ We no longer support the "peeking" model where the shelf would
+ peek on motion pause from an app and overview would peek on motion
+ pause from home. Thus, removed/inlined the following:
+ - FlingAndHoldTouchController (merged into its sole subclass
+ NoButtonNavbarToOverviewTouchController)
+ - ShelfPeekAnim
+ - OverviewPeekState
+
+ Change-Id: I066a3ad2636fde4786089c922b896bf1e03361fd
+
+commit 107fe60f6ef5b3336ece35122650d9ccc1c69913
+Author: Tony Wickham <twickham@google.com>
+Date: Wed Aug 12 12:30:00 2020 -0700
+
+ Ensure we clearState() when going to Overview from home
+
+ We need to do this before potentially starting another
+ interaction during the animation, or we could end up in
+ an inconsistent state.
+
+ Fixes: 160759508
+ Change-Id: Ia28dceddcc258679fc0b968f5a83fae5ef3f5acb
+
+commit 6c1a88f1720a102d8a3ef94073754b7cd163d6a8
+Merge: 20983ae1f 9dfcc316c
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Fri Aug 14 22:45:17 2020 +0000
+
+ Merge "Track OverviewToHomeAnim with StateManager" into ub-launcher3-rvc-qpr-dev
+
+commit 9dfcc316c1519978e49462707ba36156d7abb2e5
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 18:33:01 2020 -0700
+
+ Track OverviewToHomeAnim with StateManager
+
+ This way we mark the the current state as NORMAL at the start of
+ the animation, and cancel it as part of other state transitions.
+ This allows us to interact with launcher (e.g. to go to all apps
+ or pull down the notification shade) during the animation.
+
+ Also use OverviewToHomeAnim from RecentsView#startHome() to
+ ensure the animation is consistent, e.g. doesn't fade out
+ RecentsView, scrolls to page 1, etc.
+
+ Bug: 144170434
+ Change-Id: I5348565b9e705d8ffba39818dde9efe82b16bb7a
+ Merged-In: I5348565b9e705d8ffba39818dde9efe82b16bb7a
+
+commit 4fb5f74bb4884794a1a5f08f62092f7f63c2d05b
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 18:33:01 2020 -0700
+
+ Track OverviewToHomeAnim with StateManager
+
+ This way we mark the the current state as NORMAL at the start of
+ the animation, and cancel it as part of other state transitions.
+ This allows us to interact with launcher (e.g. to go to all apps
+ or pull down the notification shade) during the animation.
+
+ Also use OverviewToHomeAnim from RecentsView#startHome() to
+ ensure the animation is consistent, e.g. doesn't fade out
+ RecentsView, scrolls to page 1, etc.
+
+ Bug: 144170434
+ Change-Id: I5348565b9e705d8ffba39818dde9efe82b16bb7a
+
+commit 1ae2937f7527517eafcf79071b4547800c1daad4
+Merge: 5fb83a47f 8cac927bd
+Author: Hyunyoung Song <hyunyoungs@google.com>
+Date: Fri Aug 14 19:34:50 2020 +0000
+
+ Merge "Hookup existing AllAppsSearchPlugin interface to SearchBarController Bug: 161801331" into ub-launcher3-master
+
+commit 5fb83a47f292df4be2f55380caac65e36048052d
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Mon Aug 10 10:50:36 2020 -0700
+
+ Removing icon recents version
+
+ Change-Id: Ibdc88715e38590cedf8a7b5174061bb2c6ef9533
+
+commit 8cac927bdb1054de643db86c918bb825f0860177
+Author: Hyunyoung Song <hyunyoungs@google.com>
+Date: Fri Aug 14 00:11:36 2020 -0700
+
+ Hookup existing AllAppsSearchPlugin interface to SearchBarController
+ Bug: 161801331
+
+ Change-Id: Ied575f78ad2139c6818ae5a13467b7399b9ab17a
+
+commit 8ad575e1e65c8a73b37abcd89062c22a27f0ad37
+Author: Tracy Zhou <tracyzhou@google.com>
+Date: Sat Aug 1 16:08:48 2020 -0700
+
+ Handle overview actions in Live Tile mode
+
+ - Switch to screenshot and finish recents animation when an overview action is selected
+
+ Fixes: 162564471
+ Test: Manual
+ Change-Id: I3db20619435d079bb39ce4cb37b46ea775416336
+
+commit 9a472fbd7dba66d756631ec98430b1da0fb9f00e
+Merge: a9f955173 81c0cac45
+Author: Tracy Zhou <tracyzhou@google.com>
+Date: Thu Aug 13 21:29:28 2020 +0000
+
+ Merge "[Live Tile] Place the target app back above Launcher when swipe up end target is home" into ub-launcher3-master
+
+commit a9f955173239fb734da22bd56cd0c2178a72213d
+Merge: 895ece297 a310e9c03
+Author: Andy Wickham <awickham@google.com>
+Date: Thu Aug 13 19:22:12 2020 +0000
+
+ Merge "Refactors LauncherPreviewRenderer to better support subclassing." into ub-launcher3-master
+
+commit 895ece297d748291fcd7b3b429511729e64a1bb2
+Merge: ba9415162 20983ae1f
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 18:57:49 2020 +0000
+
+ Merge "[Overview Actions] Reset the modal task view when rotate from select mode." into ub-launcher3-rvc-qpr-dev am: 20983ae1f8
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12366024
+
+ Change-Id: I3fec240a659c5a1c80bf4f78aca1af6ace270e27
+
+commit 20983ae1f8a5896f15cbee61397c554990e6bf58
+Merge: 2ddbe127f ba6fec3ea
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 18:42:46 2020 +0000
+
+ Merge "[Overview Actions] Reset the modal task view when rotate from select mode." into ub-launcher3-rvc-qpr-dev
+
+commit ba9415162cf2b3c0f46d4c252e50bafcd853616a
+Merge: 58a1689ce 59d04e6ea
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 18:17:41 2020 +0000
+
+ Merge "Use system VelocityTracker instead of forking least squares algorithm" into ub-launcher3-master
+
+commit 58a1689cef9f638467cb4dc9835bb6a92d704ce3
+Merge: 9529b95e0 2ddbe127f
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 18:05:50 2020 +0000
+
+ Merge "Overview Actions - enable proactive actions flag." into ub-launcher3-rvc-qpr-dev am: 2ddbe127fb
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12286410
+
+ Change-Id: I54898c6a1a47d271c8d18c17d24a5acb6e67fd1e
+
+commit 81c0cac4574915a6bf77955bbb74ecc1cde79c6f
+Author: Tracy Zhou <tracyzhou@google.com>
+Date: Thu Aug 13 11:01:15 2020 -0700
+
+ [Live Tile] Place the target app back above Launcher when swipe up end target is home
+
+ Test: manual
+ Bug: 160361464
+ Change-Id: Ic2b332774fe3f25f36f0bfd2b5e6cf66fb1d09dd
+
+commit 2ddbe127fb69bd860fc4176893015b63474c6609
+Merge: f35053ad5 1e414d500
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 17:50:30 2020 +0000
+
+ Merge "Overview Actions - enable proactive actions flag." into ub-launcher3-rvc-qpr-dev
+
+commit 59d04e6ea69dc0c81fceab601194d8c0a6238fa0
+Author: Tony Wickham <twickham@google.com>
+Date: Wed Aug 12 18:05:42 2020 -0700
+
+ Use system VelocityTracker instead of forking least squares algorithm
+
+ Change-Id: I8e03cdd0942b9037054cd1955bdb6809c89f3ea2
+
+commit a310e9c035c87c4fc5b3d23bbcc70f11ffc48561
+Author: Andy Wickham <awickham@google.com>
+Date: Mon Aug 10 17:04:40 2020 -0700
+
+ Refactors LauncherPreviewRenderer to better support subclassing.
+
+ Basically this removes the inner class MainThreadRenderer, which
+ was only created and used for its populate() method in the parent's
+ getRenderedView() method. All methods and members of that subclass
+ are merged into the parent LauncherPreviewRenderer class, and
+ getRenderedView() simply inlines the previous populate() code.
+
+ Other smaller changes:
+ - Extracted out shouldShowQsb() and shouldShowRealLauncherPreview()
+ - Disables search view and its children to prevent interaction
+
+ Change-Id: I7d0cce73efbe022c16661a0ad66eefe5cb285641
+
+commit 9529b95e06a6ab91650f373d5a335b6bc090ce77
+Merge: 72385839e f35053ad5
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 02:25:50 2020 +0000
+
+ Merge "Store mHistoricTimes as longs intead of floats" into ub-launcher3-rvc-qpr-dev am: f35053ad58
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12365858
+
+ Change-Id: I3c21d9d47a525e9c975c6acf38c99a2f1668359c
+
+commit f35053ad588974b4daf37fa19866e416b880360d
+Merge: 30fe240f9 a14567096
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 02:10:20 2020 +0000
+
+ Merge "Store mHistoricTimes as longs intead of floats" into ub-launcher3-rvc-qpr-dev
+
+commit 72385839ed9038607e186c198ce31a54c52778a4
+Merge: 635c08095 30fe240f9
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 01:01:07 2020 +0000
+
+ Merge "TaskOverlayFactory - remove static factory." into ub-launcher3-rvc-qpr-dev am: 30fe240f99
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12353636
+
+ Change-Id: Ic165b6184f4f36b5956493d3880a9d93ad27a0d6
+
+commit 30fe240f99f38dfb81a6075b8ab2b0ed436afb75
+Merge: cbe1fc063 cf8275438
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 13 00:47:34 2020 +0000
+
+ Merge "TaskOverlayFactory - remove static factory." into ub-launcher3-rvc-qpr-dev
+
+commit ba6fec3eaeb2087428c8e33826429d72ad0290cf
+Author: Becky Qiu <xuqiu@google.com>
+Date: Wed Aug 12 17:17:00 2020 -0700
+
+ [Overview Actions] Reset the modal task view when rotate from select mode.
+
+ Test: local
+ Bug: 161901771
+ Change-Id: I103e59ad68874db7fcb39556764d315983ac047c
+
+commit 635c08095a9057cce7e25952c0f5d5b12a7903d7
+Merge: 93caa9310 cbe1fc063
+Author: Zak Cohen <zakcohen@google.com>
+Date: Thu Aug 13 00:12:20 2020 +0000
+
+ Merge "Overscroll plugin - give the plugin its own factory." into ub-launcher3-rvc-qpr-dev am: cbe1fc063d
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12353635
+
+ Change-Id: Ia471594443d1b744c5c34f0c9c45e7191bbf7938
+
+commit a14567096922f23d6e03c84fc930e3451e7471c2
+Author: Tony Wickham <twickham@google.com>
+Date: Wed Aug 12 16:48:33 2020 -0700
+
+ Store mHistoricTimes as longs intead of floats
+
+ The loss of precision was causing us to miscalculate the age of
+ events, and thus not detecting any pause due to denominator = 0.
+
+ Test: have a device that hasn't been rebooted for a certain
+ amount of time such that SystemClock#uptimeMillis can't be
+ accurately converted to a float, then try to swipe up and hold
+
+ Fixes: 160568387
+ Change-Id: Idef112187f34a18feea7e6a0b77258626f9d0ed4
+
+commit cbe1fc063d924b2c68a2de8929687baab06439df
+Merge: 9367f9834 fac874152
+Author: Zak Cohen <zakcohen@google.com>
+Date: Wed Aug 12 23:58:38 2020 +0000
+
+ Merge "Overscroll plugin - give the plugin its own factory." into ub-launcher3-rvc-qpr-dev
+
+commit 93caa93102df1b84e8b8d66fe7ca63e8950e4a6f
+Merge: 74f218530 9367f9834
+Author: Becky Qiu <xuqiu@google.com>
+Date: Wed Aug 12 23:43:10 2020 +0000
+
+ [automerger skipped] [Overview Actions] Set launcher state to Overview when rotate in recents. am: 9367f98348 -s ours
+
+ am skip reason: Change-Id I73f498151d7cc6a9db9d352549124c9d550ae6f2 with SHA-1 cb956ff4f5 is in history
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12354807
+
+ Change-Id: I02f43e3ee9a7f0f1730b673be220055d72a07d81
+
+commit 74f218530e069c11b36cf4a2cfcc1b76726aea6b
+Merge: cb956ff4f fd58da6a7
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Wed Aug 12 23:36:27 2020 +0000
+
+ Merge "Wrapping display properties in a wrapper class" into ub-launcher3-master
+
+commit 1e414d500591e88c027bfead4c0e456444dc5407
+Author: Zak Cohen <zakcohen@google.com>
+Date: Fri Jul 31 15:54:36 2020 -0700
+
+ Overview Actions - enable proactive actions flag.
+
+ Bug: 162623012
+ Test: local
+ Change-Id: I343ae83601ebdab4dacc9f4611b069f87b5542eb
+
+commit cf82754384a26d2038ba1f13c0ecea57c0d3116d
+Author: Zak Cohen <zakcohen@google.com>
+Date: Tue Aug 11 16:17:41 2020 -0700
+
+ TaskOverlayFactory - remove static factory.
+
+ Make the overlay factory a member of the recents view.
+ Before the factory was static. The factory has references to activity
+ objects so was causing leaks.
+
+ Bug: 162012217
+ Tested: local, factory still works
+ Change-Id: I2283134f3008b630ba2056f07e65ac042957cdbd
+
+commit fd58da6a75b55eb2ef40dd53fc6135636812ac6a
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Tue Aug 11 12:06:49 2020 -0700
+
+ Wrapping display properties in a wrapper class
+
+ This would allow us to support gestures on multiple-displays
+
+ Change-Id: I8f426bbdf04520f4189cadce2bde6aab4933c8d9
+
+commit cb956ff4f5adf0c4abb586940d9e89582a70bfd3
+Author: Becky Qiu <xuqiu@google.com>
+Date: Mon Aug 10 12:44:48 2020 -0700
+
+ [Overview Actions] Set launcher state to Overview when rotate in recents.
+
+ Test: local
+ Bug: 160718310
+
+ Change-Id: I73f498151d7cc6a9db9d352549124c9d550ae6f2
+
+commit 73f0c3698fe74bb051e0e65a523a2f750b1ba40d
+Merge: 53116c6cc d6c3315a6
+Author: Tracy Zhou <tracyzhou@google.com>
+Date: Wed Aug 12 16:53:23 2020 +0000
+
+ Merge "Only draw app below launcher for TaskViewSimulator at swipe up or in Overview" into ub-launcher3-master
+
+commit d6c3315a67980c90712103135bae302b86ee080e
+Author: Tracy Zhou <tracyzhou@google.com>
+Date: Tue Aug 11 22:46:22 2020 -0700
+
+ Only draw app below launcher for TaskViewSimulator at swipe up or in Overview
+
+ Bug: 160361464
+ Test: Manual
+ Change-Id: Ic4d912f1656d87f445a8016640c0eb166cace0d5
+
+commit 9367f98348f9db5b5b6840b8003dd62c037d8be8
+Author: Becky Qiu <xuqiu@google.com>
+Date: Mon Aug 10 12:44:48 2020 -0700
+
+ [Overview Actions] Set launcher state to Overview when rotate in recents.
+
+ Test: local
+ Bug: 160718310
+
+ Change-Id: I73f498151d7cc6a9db9d352549124c9d550ae6f2
+ Merged-In: I73f498151d7cc6a9db9d352549124c9d550ae6f2
+
+commit fac87415221447f8f47ef4a88d187b7e175a6296
+Author: Zak Cohen <zakcohen@google.com>
+Date: Mon Aug 10 15:51:45 2020 -0700
+
+ Overscroll plugin - give the plugin its own factory.
+
+ Separate out the overscroll plugin from the task overlay.
+ These two classes aren't really related.
+
+ Bug: 162012217
+ Tested: checked plugin still works
+ Change-Id: Id89eff1ad2ae9766efaaecd8cfc66d6521b9ca8c
+
+commit 53116c6cc84236ac49064efa9988f92b5b558599
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Fri Aug 7 16:32:18 2020 -0700
+
+ Simplifying InstallShortcutReceiver
+
+ > Removing support for legacy shortcuts (with embedded icon)
+ > Unifying pattern for storing the data in prefs
+
+ Change-Id: Ife250807c7ce5337969d25444ee23c751bc2a487
+
+commit b313f71615c64c8022f587ef3c4ebd34bfdc6171
+Merge: 762d06136 2104d72b2
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Tue Aug 11 21:44:37 2020 +0000
+
+ Merge "LauncherInstrumentation enables even when non-system user" into ub-launcher3-master
+
+commit 762d06136cc7c91afe8cdfdac5426b58c174edd8
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Wed Jul 29 15:03:46 2020 -0700
+
+ Caching last predictions and loading it with model
+
+ Adding support for persisting itemInfos on disk. This uses
+ a separate xml file. Unlike prefs, it does not keep the items
+ in memory and is just a wraper over reading/writing a file.
+
+ Bug: 160748731
+ Change-Id: Iaccab9928ab8f30127fb3c2d630ca8ca83f0bd05
+
+commit d62e797d1834306ec394ebf64f4c84939f033d97
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Tue Aug 11 12:10:36 2020 -0700
+
+ Disabling debug log as the associated bug is closed
+
+ Bug: 154951045
+ Change-Id: I2e503c6d2f0a9f694ee1f88167924114fe495c2f
+
+commit 1bdb8f0efc73419b114074375126883162f4c838
+Merge: 3003e57d1 66aead7d2
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Tue Aug 11 18:57:13 2020 +0000
+
+ Merge "Removing some obsolete methods and wrapper" into ub-launcher3-master
+
+commit 3003e57d1714ba7016c89e520f11aebe83b71b7d
+Merge: fe9b7e37a 5dd045bec
+Author: Hyunyoung Song <hyunyoungs@google.com>
+Date: Tue Aug 11 17:56:59 2020 +0000
+
+ Merge "Handle IME selection focus for ENABLE_DEVICE_SEARCH" into ub-launcher3-master
+
+commit 5dd045bec67ca12a3de4b4adc88a92a0166c0f50
+Author: Hyunyoung Song <hyunyoungs@google.com>
+Date: Tue Aug 4 22:22:49 2020 -0700
+
+ Handle IME selection focus for ENABLE_DEVICE_SEARCH
+
+ Bug: 162861289
+ Change-Id: I15e4eae09be2aa9f89a5157fd74c95e91e64bc53
+
+commit fe9b7e37a801135f959e03ecf26ee454a24d6f8e
+Merge: b810c10bb e14b55c2a
+Author: Tony Wickham <twickham@google.com>
+Date: Tue Aug 11 00:37:05 2020 +0000
+
+ [automerger skipped] Merge "Don't reapply window transform if we are already running a window anim" into ub-launcher3-rvc-qpr-dev am: e14b55c2a9 -s ours
+
+ am skip reason: Change-Id I3fa7f0b2581ca83923a42f37f52850b02c22e995 with SHA-1 c830bef923 is in history
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12346435
+
+ Change-Id: I35f6f3572754e49626c7a09b832aecf114413bd7
+
+commit e14b55c2a94a255750bca8b2fa4e068fcbeba0cc
+Merge: b460ff1ef 06513f11c
+Author: Tony Wickham <twickham@google.com>
+Date: Tue Aug 11 00:19:28 2020 +0000
+
+ Merge "Don't reapply window transform if we are already running a window anim" into ub-launcher3-rvc-qpr-dev
+
+commit b810c10bb90a2bae5adf02b7050dcb595f383707
+Merge: 9fc65cb0b b55f7591e
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 10 23:55:24 2020 +0000
+
+ Merge "Ensure that the task is always clipped to match the tile aspect ratio" into ub-launcher3-master
+
+commit 9fc65cb0b79e6d87098aa72aeaadb425619dd656
+Merge: c830bef92 b460ff1ef
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 10 23:02:20 2020 +0000
+
+ Merge "Fix TaskViewTouchController success progress to match haptic" into ub-launcher3-rvc-qpr-dev am: b460ff1ef1
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12321076
+
+ Change-Id: Ic4317b94cca7d760d23da0c1c115d422236586e7
+
+commit b460ff1ef1f7fac734f1d0411fd7284e6c1eea7b
+Merge: 03a4a0cd5 b8b3e957a
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 10 22:46:03 2020 +0000
+
+ Merge "Fix TaskViewTouchController success progress to match haptic" into ub-launcher3-rvc-qpr-dev
+
+commit b55f7591ed2fee28e1c2a4059d19d2f069185cf5
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Mon Aug 10 15:08:36 2020 -0700
+
+ Ensure that the task is always clipped to match the tile aspect ratio
+
+ Instead of trying to estimate the insets, we clip the task such it is
+ restricted within the task insets when possible.
+
+ Change-Id: If160115fda07dfd2e01e96d41e4b5dc43a77ac94
+
+commit 06513f11c2304a371a7c79cec371562d65393322
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 15:06:02 2020 -0700
+
+ Don't reapply window transform if we are already running a window anim
+
+ Bug: 149934536
+ Change-Id: I3fa7f0b2581ca83923a42f37f52850b02c22e995
+ Merged-In: I3fa7f0b2581ca83923a42f37f52850b02c22e995
+
+commit c830bef923200e97ad8d0ef9bf37d0c121d7e56d
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 15:06:02 2020 -0700
+
+ Don't reapply window transform if we are already running a window anim
+
+ Bug: 149934536
+ Change-Id: I3fa7f0b2581ca83923a42f37f52850b02c22e995
+
+commit cf5aea05b3888ea0adc8a53fad62987405206eeb
+Merge: 2fe0d5f71 03a4a0cd5
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 21:29:00 2020 +0000
+
+ Update overview from home transitions am: 03a4a0cd53
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12184426
+
+ Change-Id: Iac33ad0742264a97e754a1cc4336ed3ab727944a
+
+commit 2fe0d5f71ded4537c42d07df1464a71daf27e047
+Merge: a2c6c9737 90751820d
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 21:08:54 2020 +0000
+
+ Merge "Add back code missing from upstream merge" into ub-launcher3-master
+
+commit 03a4a0cd530c6d13f01882e81568ab1544030c12
+Author: Tony Wickham <twickham@google.com>
+Date: Fri Jul 17 13:06:57 2020 -0700
+
+ Update overview from home transitions
+
+ For both NoButtonNavbarToOverviewTouchController and
+ NavBarToHomeTouchController:
+ - Have consistent resistance applied such that RecentsView scales
+ down and translates up slightly (but not as much as from an app)
+ - Have consistent animation to home if you fling to that state
+ rather than stay in overview. This is handled by a new class,
+ OverviewToHomeAnim, which consolidates logic from NBTHTC and
+ overrides some interpolators such that RecentsView doesn't fade
+ out or translate downwards during the animation (it just slides
+ off the screen while the home animation plays).
+
+ Also make overview actions not clickable when alpha == 0, so that
+ you can tap the hotseat/qsb during the transition from home to
+ overview.
+
+ Bug: 144170434
+ Change-Id: Ic291f285ff2f63c477633c48d4fadb23cf70c28a
+
+commit 90751820d9ef8f09ece7aba656dfe881e3b149dd
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 13:11:43 2020 -0700
+
+ Add back code missing from upstream merge
+
+ Change-Id: I7c2f08ed1b9c7462feabe1ad793af4ddc55aff1b
+
+commit a2c6c973749e1a67bcdbb33cb316c0ba467e3c6d
+Merge: c0ed292cc e6f9e0eb7
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 10 20:01:06 2020 +0000
+
+ Merge "Revert "Update overview from home transitions"" into ub-launcher3-master
+
+commit e6f9e0eb7ea49b0f2feae80d7a2d57fe9db5e38e
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 19:13:17 2020 +0000
+
+ Revert "Update overview from home transitions"
+
+ This reverts commit f3bc79718201cf17479a46e9860ea518a900d68f.
+
+ Reason for revert: updating upstream, need to wait to cherry-pick until that's approved
+
+ Change-Id: I702286dba66fb4582ab682a5b0b8cd80ccebf346
+
+commit c0ed292ccbaa5b94bd3e54a85f5d7e9c1b2a1229
+Merge: cb4c4dea9 999e08f6f
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Aug 10 16:32:08 2020 +0000
+
+ Merge "Add swipe up resistance to quick switch from home" into ub-launcher3-rvc-qpr-dev am: 999e08f6ff
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12174364
+
+ Change-Id: I6ce2dbb31ec8ed0d340165b2fc9a9f0532081d3e
+
+commit cb4c4dea95157c8bce1561bec6cd38daa57cec9e
+Merge: e54db4fbd 6bd1882ea
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 10 16:31:55 2020 +0000
+
+ Merge "[Overview Actions] Add a logging event for tapping images in select mode." into ub-launcher3-rvc-qpr-dev am: 6bd1882eae
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12336644
+
+ Change-Id: I2dba3dda4d6ef8a8857e18708a96ebab9da30f20
+
+commit e54db4fbd4a293ecbe0c959aaae356472f9e8db6
+Merge: d72857950 2ace6a25d
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 10 16:31:44 2020 +0000
+
+ Merge "Fixing cutouts insets not clipped properly during swipeup for rotated activities" into ub-launcher3-rvc-qpr-dev am: 2ace6a25d2
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12327967
+
+ Change-Id: I6e3f28e464a8ca63840a53f1b35c86cf377c4ad4
+
+commit d72857950461c1b82ce80f85bf359c050c0f0b0c
+Merge: f3bc79718 1a965c190
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 10 16:28:35 2020 +0000
+
+ Merge "resolve merge conflicts of 3a22956f0a6214285500ac040b4ae565d882cc47 to ub-launcher3-master" into ub-launcher3-master
+
+commit f3bc79718201cf17479a46e9860ea518a900d68f
+Author: Tony Wickham <twickham@google.com>
+Date: Fri Jul 17 13:06:57 2020 -0700
+
+ Update overview from home transitions
+
+ For both NoButtonNavbarToOverviewTouchController and
+ NavBarToHomeTouchController:
+ - Have consistent resistance applied such that RecentsView scales
+ down and translates up slightly (but not as much as from an app)
+ - Have consistent animation to home if you fling to that state
+ rather than stay in overview. This is handled by a new class,
+ OverviewToHomeAnim, which consolidates logic from NBTHTC and
+ overrides some interpolators such that RecentsView doesn't fade
+ out or translate downwards during the animation (it just slides
+ off the screen while the home animation plays).
+
+ Also make overview actions not clickable when alpha == 0, so that
+ you can tap the hotseat/qsb during the transition from home to
+ overview.
+
+ Bug: 144170434
+ Change-Id: Ic291f285ff2f63c477633c48d4fadb23cf70c28a
+
+commit 1a965c190d07140690602761c497495ad1875d03
+Merge: 70a556da1 3a22956f0
+Author: Tony Wickham <twickham@google.com>
+Date: Sat Aug 8 19:12:11 2020 +0000
+
+ resolve merge conflicts of 3a22956f0a6214285500ac040b4ae565d882cc47 to ub-launcher3-master
+
+ Change-Id: I2bb370e63d7206d52acb912d5b55a0f0c5f59c3d
+
+commit 999e08f6ffdcf2aa4eb3697cfd2c6c1488a72710
+Merge: 6bd1882ea d6a1063f2
+Author: Tony Wickham <twickham@google.com>
+Date: Sat Aug 8 02:18:46 2020 +0000
+
+ Merge "Add swipe up resistance to quick switch from home" into ub-launcher3-rvc-qpr-dev
+
+commit 6bd1882eaec5c0571b78e47b58c524f1fcaae207
+Merge: 2ace6a25d 14e03d1c4
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Sat Aug 8 00:53:33 2020 +0000
+
+ Merge "[Overview Actions] Add a logging event for tapping images in select mode." into ub-launcher3-rvc-qpr-dev
+
+commit 2ace6a25d2835eb6bfd7082456dda1a07e419930
+Merge: 3a22956f0 d00340f7a
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Sat Aug 8 00:00:28 2020 +0000
+
+ Merge "Fixing cutouts insets not clipped properly during swipeup for rotated activities" into ub-launcher3-rvc-qpr-dev
+
+commit 66aead7d2cf426f64d06b573470d0658c858b1b3
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Fri Aug 7 16:56:50 2020 -0700
+
+ Removing some obsolete methods and wrapper
+
+ Change-Id: I9d3c8d851ad596ba0d5165ab3c0f6661575166fc
+
+commit 3a22956f0a6214285500ac040b4ae565d882cc47
+Merge: ce8b2b518 3af714f05
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Fri Aug 7 23:44:37 2020 +0000
+
+ Merge "Remove overscroll on running task when it's not attached to RecentsView" into ub-launcher3-rvc-qpr-dev
+
+commit 2104d72b281ef4ee9f15aef333bd65a03f8f7eb4
+Author: Adam Bookatz <bookatz@google.com>
+Date: Wed Jul 29 15:46:16 2020 -0700
+
+ LauncherInstrumentation enables even when non-system user
+
+ Attempting to run a tapl test while the device is in a secondary user
+ currently fails because the test app doesn't get enabled for
+ this secondary user. We fix that (at least one issue with it) in this cl.
+
+ Test: make PlatformScenarioTests; adb root && adb install -r -g ${ANDROID_PRODUCT_OUT}/testcases/PlatformScenarioTests/$(get_build_var TARGET_ARCH)/PlatformScenarioTests.apk
+ adb shell am instrument -w -r -e class android.platform.test.scenario.chrome.OpenApp android.platform.test.scenario/androidx.test.runner.AndroidJUnitRunner
+ (Do this while the current user is SYSTEM as well as Guest)
+
+ Bug: 162454040
+ Change-Id: If6d8e545b41eb20e3fed2935c39069ce97d8b6cd
+
+commit 14e03d1c4d6c68e84f3f4d9867e0757562a78e4a
+Author: Becky Qiu <xuqiu@google.com>
+Date: Fri Aug 7 15:06:38 2020 -0700
+
+ [Overview Actions] Add a logging event for tapping images in select mode.
+
+ Event IDs were generated by command line on my workstation by uieventscli.
+ Manually added to StatsLogManager.
+
+ Test: local
+ Bug: 161273376
+ Change-Id: Iee36c450ddb207f87653a8da2355c720369caa34
+
+commit 70a556da1d02fa32218d8dfcd4f4105f090997d9
+Merge: 87805cd94 ce8b2b518
+Author: Tony Wickham <twickham@google.com>
+Date: Fri Aug 7 20:22:52 2020 +0000
+
+ Add translation component to swipe up resistance am: ce8b2b5180
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12174363
+
+ Change-Id: I18d7be49bb3bfc9f846c14a9138b5daf381e1d56
+
+commit d6a1063f258452b5f34dcad22dc416cc03c16dd4
+Author: Tony Wickham <twickham@google.com>
+Date: Mon Jul 6 17:26:39 2020 -0700
+
+ Add swipe up resistance to quick switch from home
+
+ Bug: 149934536
+ Change-Id: I1b355a16d972f94d541231449ef323a41861a3e6
+
+commit ce8b2b51800e42fc61c14f516ec563c3561b7adb
+Author: Tony Wickham <twickham@google.com>
+Date: Wed Jul 1 17:25:28 2020 -0700
+
+ Add translation component to swipe up resistance
+
+ Now recents view follows your finger all the way to the top of the
+ screen. Specifically, your finger tracks the bottom of the window
+ until resistance starts (when RecentsView is at 75% scale), then
+ we add translation to compensate for the slower rate of scaling
+ down, such that your finger slips to the top of the window by the
+ time it reaches the top of the screen.
+
+ Also reset this translation back to 0 in the state handlers.
+
+ Bug: 149934536
+ Fixes: 158701272
+ Change-Id: Iaee58da758d422f0173c29d002f5c451ce0c1809
+
+commit 87805cd9415b7cfb968c1785bbd9845aa4b9db9e
+Merge: 4ade3fd56 4a53c70c5
+Author: Samuel Fufa <sfufa@google.com>
+Date: Fri Aug 7 18:11:59 2020 +0000
+
+ Merge "Introduce support for Hero app Section" into ub-launcher3-master
+
+commit 4a53c70c5734f65d210c1b425549224acbe7c642
+Author: Samuel Fufa <sfufa@google.com>
+Date: Tue Aug 4 14:06:55 2020 -0700
+
+ Introduce support for Hero app Section
+
+ [Video attached to bug report]
+
+ Bug: 162871508
+ Test: Manual
+ Change-Id: Ia6f5621d6220f55e6fd5e56530853c267838442c
+
+commit 4ade3fd561e357744c41da715d4dfda65f2fee9e
+Merge: 8ccd877f4 3f20e33af
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Fri Aug 7 00:10:05 2020 +0000
+
+ Merge "Fix adjacent page offset in landscape orientation" into ub-launcher3-rvc-qpr-dev am: 3f20e33af6
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12327711
+
+ Change-Id: I8f2da96439372a9f6671469c3c41e4c0a43a4067
+
+commit 3f20e33af652f8ecdd729d3f861bf6d95e3f1fa0
+Merge: 3f8d86811 3b9d5843c
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Thu Aug 6 23:52:04 2020 +0000
+
+ Merge "Fix adjacent page offset in landscape orientation" into ub-launcher3-rvc-qpr-dev
+
+commit 3b9d5843c94d042655d5d43a673cf2738f69c5f9
+Author: Tony Wickham <twickham@google.com>
+Date: Thu Aug 6 15:04:51 2020 -0700
+
+ Fix adjacent page offset in landscape orientation
+
+ Before, the adjacent tasks were coming in from the top and bottom
+ of the screen rather than the sides.
+
+ Bug: 149934536
+ Change-Id: Id6e57dcbc1967d70869df06068d25717de116934
+
+commit d00340f7a24d11db58954298eb979e6c8ac0438f
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Thu Aug 6 14:28:13 2020 -0700
+
+ Fixing cutouts insets not clipped properly during swipeup
+ for rotated activities
+
+ Bug: 161939759
+ Change-Id: Ia55f938fdc51e2813c205d7d13d5f1bf852c9bb2
+
+commit 8ccd877f424070dbf5bec170722d46cea40bf827
+Merge: 7f28b8814 17d0080cc
+Author: Andy Wickham <awickham@google.com>
+Date: Thu Aug 6 19:37:35 2020 +0000
+
+ Merge "Adjusts Clear all to be vertically centered with the tasks." into ub-launcher3-master
+
+commit 17d0080cc32ed36df154f52f6cf2b5082e7e3c31
+Author: Andy Wickham <awickham@google.com>
+Date: Tue Aug 4 19:51:26 2020 -0700
+
+ Adjusts Clear all to be vertically centered with the tasks.
+
+ I made a sample task where the content of the app was
+ centered, and I added lines to demonstrate the center
+ while in Overview. As you can see, the center of the
+ app content is slightly different from the TaskView
+ in Recents - it seems part of the bottom of the app
+ gets removed when transitioning to Recents (for the
+ rounded corner radius or nav bar?). On Pixel 4, I
+ had to add 46dp of padding to the bottom line for it
+ to appear at the bottom of the screenshot in Recents.
+
+ Screenshot: https://drive.google.com/file/d/1xzQNXWb0T0UGDhDS9Ov-AduM3nd-pfg8/view?usp=sharing
+ Before: https://drive.google.com/file/d/1ghN9VWP44XjcZkdmI106dy4_jB4Vs4J3/view?usp=sharing
+
+ Rotating between landscape and portrait:
+ https://drive.google.com/file/d/1OD5aKT9LCE5w950-6AaHfWXU4sLyW3Qe/view?usp=sharing
+
+ Fixes: 154964045
+ Change-Id: I594057e3b5df58c5a907b6ca14daa700d5011b7b
+
+commit b8b3e957a6049ba0cd3ed48623a1666bae80b25e
+Author: Tony Wickham <twickham@google.com>
+Date: Wed Aug 5 18:43:53 2020 -0700
+
+ Fix TaskViewTouchController success progress to match haptic
+
+ We use the interpolated progress of the animation contoller target
+ to determine success, but only the child animation had the
+ interpolator set. Updating the parent to use the same interpolator
+ ensures getInterpolatedProgress() returns the same one used to
+ play the haptic.
+
+ Fixes: 161536946
+ Change-Id: Ibc2aef67f53efa01f2b185cf03140bad4bb5c421
+
+commit 3af714f052d183aa31f22eee3afeecb94ec552db
+Author: Tony Wickham <twickham@google.com>
+Date: Wed Aug 5 13:32:37 2020 -0700
+
+ Remove overscroll on running task when it's not attached to RecentsView
+
+ This allows the running task to follow the finger freely until motion
+ pause is detected (or when trying to quick switch in a direciton that
+ has no tasks, as RecentsView is still attached until you swipe up).
+
+ Bug: 149934536
+ Change-Id: If68166e962af9f28c56017838f720e15ddb96560
+
+commit 7f28b8814bbd8c5b09068eeba44026ff3da10551
+Merge: e7c1769e3 77ca1e4c4
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Wed Aug 5 19:44:57 2020 +0000
+
+ Merge "Moving data sanitization to the end, as it need not block the loading" into ub-launcher3-master
+
+commit e7c1769e30bfed7caa33816a5cd9d61447d75745
+Merge: c226adb38 f8e9b467a
+Author: Tracy Zhou <tracyzhou@google.com>
+Date: Wed Aug 5 17:42:43 2020 +0000
+
+ Merge "Revert "Finish recents animation when launching another task in Overview"" into ub-launcher3-master
+
+commit c226adb384d11bf88cf60efdd54d324bd4d1f762
+Merge: b3d7ecc15 3f8d86811
+Author: Winson Chung <winsonc@google.com>
+Date: Wed Aug 5 06:02:28 2020 +0000
+
+ Defer recreation until resumed am: 3f8d868110
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12309024
+
+ Change-Id: I814a6cab9046b82d66426fbe19636087cfd3e2b6
+
+commit b3d7ecc15b3be086b67d2e0b1a8360ab2d2ab74b
+Merge: 8aaafc918 dd15acea8
+Author: Winson Chung <winsonc@google.com>
+Date: Wed Aug 5 05:49:31 2020 +0000
+
+ Merge "Close system dialogs when opening all apps from system action" into ub-launcher3-master
+
+commit dd15acea87875d6d7a0d388e7ddfb283c8fd2a71
+Author: Winson Chung <winsonc@google.com>
+Date: Tue Aug 4 15:52:01 2020 -0700
+
+ Close system dialogs when opening all apps from system action
+
+ Bug: 161685099
+ Change-Id: I67313340102816828a95e8f9e7d8fa19b4ca3c55
+
+commit 8aaafc9186039181ad753020e8c668e7457ce453
+Merge: 60096e990 f66f2f66c
+Author: Jason Chang <jasonsfchang@google.com>
+Date: Wed Aug 5 04:28:29 2020 +0000
+
+ Merge "Refactoring One-Handed feature flag and others" into ub-launcher3-master
+
+commit 77ca1e4c40a98b048905e021d94eab154a637455
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Tue Aug 4 17:28:46 2020 -0700
+
+ Moving data sanitization to the end, as it need not block
+ the loading
+
+ Change-Id: If1a966e546127efafd0afd7e3ca771f63a1fa544
+
+commit f8e9b467ae11de1d307f5d77c36ff8002e66255d
+Author: Tracy Zhou <tracyzhou@google.com>
+Date: Tue Aug 4 21:57:14 2020 +0000
+
+ Revert "Finish recents animation when launching another task in Overview"
+
+ This reverts commit e62eaa16b360433e35b4e4655e16c312a7bfd110.
+
+ Reason for revert: No longer necessary
+
+ Change-Id: I9ed533147ac5546b7da6c9e3a51f5a7e6c8ef8e6
+
+commit 3f8d868110b426e40e09ece8b305fd84c1dde60c
+Author: Winson Chung <winsonc@google.com>
+Date: Tue Aug 4 14:01:27 2020 -0700
+
+ Defer recreation until resumed
+
+ - Temporarily work around issue with activity recreation while started
+ but not resumed by deferring recreating the activity on theme
+ change until after launcher has resumed.
+
+ Bug: 162812884
+ Test: Switch dark mode via QuickSettings, Settings
+ Test: Change system theme
+ Change-Id: Ifbc0d538907a30d6b23176cd67353a81b6f8c617
+
+commit 60096e990aba5dd2daf88a31a78c185df19fe111
+Author: Samuel Fufa <sfufa@google.com>
+Date: Tue Aug 4 11:19:21 2020 -0700
+
+ Remove mFilteredApps
+
+ Currently, we are maintaining a list of appInfos to report the number of Accessibility recycler-view items. This could be done by maintaining an int.
+
+ Bug: 162480567
+ Test: Manual
+ Change-Id: I9de8e1d4ac6e1a674d1e19b591dedad0dd4cc536
+
+commit e8bea3ea7a7a2370f1effc75a674e7510264b999
+Author: Samuel Fufa <sfufa@google.com>
+Date: Thu Jul 30 02:12:10 2020 -0700
+
+ Allow search results decoration [part 2/3]
+
+ [Video attached to bug report]
+
+ Bug: 162480567
+ Test: Manual
+ Change-Id: Iff285abde5b2a3f3f3a63e7318020cfe7572af49
+
+commit f66f2f66cf130d48a0c8897628655fd2310a1358
+Author: Jason Chang <jasonsfchang@google.com>
+Date: Tue Aug 4 19:56:39 2020 +0800
+
+ Refactoring One-Handed feature flag and others
+
+ Purify some conditions for reducing redundancy codes.
+
+ Test: manual
+ Change-Id: I2f39207424f9db3fb6b12bc08bee525f3dfab0aa
+
+commit ab98166c36f2955359ccdf31defe0678f66bdd99
+Author: Raman Tenneti <rtenneti@google.com>
+Date: Mon Aug 3 12:54:21 2020 -0700
+
+ AOSP/Launcher3 - Update language to comply with Android's inclusive language guidance.
+
+ See https://source.android.com/setup/contribute/respectful-code for reference
+
+ BUG=161896447
+
+ Test: make and Presubmit verify.
+
+ Change-Id: I44e903046dd4cd9c7c07872fc56a8d552eb09522
+
+commit 12e59e9a66882d67687739cfd5be81e9beae790e
+Merge: cb89edcbc ffc06198f
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 3 23:04:08 2020 +0000
+
+ [automerger skipped] Merge "Rewrite long swipe resistance ("pullback") logic" into ub-launcher3-rvc-qpr-dev am: ffc06198ff -s ours
+
+ am skip reason: Change-Id Ib0f9da18e10cc9ddf1a2f82ed767f237c89d3a41 with SHA-1 03c38c5c66 is in history
+
+ Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12174362
+
+ Change-Id: Ie0fc8684a14ce7ea9730e7160551adbc2bc4b97c
+
+commit cb89edcbcc8fbbee1ddd074500fe26db01b06789
+Merge: 03c38c5c6 eaf7a9554
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 3 22:24:14 2020 +0000
+
+ Merge "Changing minimum supported Launcher version to 26" into ub-launcher3-master
+
+commit ffc06198ff041bd1496ba59b1a5c12922d630fc1
+Merge: bf8472585 354a436f4
+Author: TreeHugger Robot <treehugger-gerrit@google.com>
+Date: Mon Aug 3 22:11:30 2020 +0000
+
+ Merge "Rewrite long swipe resistance ("pullback") logic" into ub-launcher3-rvc-qpr-dev
+
+commit 354a436f4e96d2ae12740cb1af16b97c37166321
+Author: Tony Wickham <twickham@google.com>
+Date: Thu Jun 25 15:51:33 2020 -0700
+
+ Rewrite long swipe resistance ("pullback") logic
+
+ - Rename "pullback" to "resistance" to reduce confusion.
+ - Remove mDragLengthFactorStartPullback & mDragLengthFactorMaxPullback
+ - Add AnimatorControllerWithResistance, which has 2 controllers, one
+ for the normal shift to overview, then one to apply the resistance
+ when swiping beyond that.
+ - Don't hack animator interpolators/progress; insteaad, allow progress
+ to go > 1 (which will run the separate resistance animator).
+ - Don't start launcher controller separately from window controller;
+ instead, both are controlled by mCurrentShift in updateFinalShift().
+ - The resistance animation logic is shared by both the active window
+ and launcher (RecentsView).
+
+ Bug: 149934536
+ Change-Id: Ib0f9da18e10cc9ddf1a2f82ed767f237c89d3a41
+ Merged-In: Ib0f9da18e10cc9ddf1a2f82ed767f237c89d3a41
+
+commit 03c38c5c665b08acb8d817bedc3ff78120f879da
+Author: Tony Wickham <twickham@google.com>
+Date: Thu Jun 25 15:51:33 2020 -0700
+
+ Rewrite long swipe resistance ("pullback") logic
+
+ - Rename "pullback" to "resistance" to reduce confusion.
+ - Remove mDragLengthFactorStartPullback & mDragLengthFactorMaxPullback
+ - Add AnimatorControllerWithResistance, which has 2 controllers, one
+ for the normal shift to overview, then one to apply the resistance
+ when swiping beyond that.
+ - Don't hack animator interpolators/progress; insteaad, allow progress
+ to go > 1 (which will run the separate resistance animator).
+ - Don't start launcher controller separately from window controller;
+ instead, both are controlled by mCurrentShift in updateFinalShift().
+ - The resistance animation logic is shared by both the active window
+ and launcher (RecentsView).
+
+ Bug: 149934536
+ Change-Id: Ib0f9da18e10cc9ddf1a2f82ed767f237c89d3a41
+
+commit eaf7a955467a5d189b982ee436a8eefaa30e3006
+Author: Sunny Goyal <sunnygoyal@google.com>
+Date: Wed Jul 29 16:54:20 2020 -0700
+
+ Changing minimum supported Launcher version to 26
+
+ Change-Id: I49fcf874430ac53c3246371e179fbd828e14e4da
diff --git a/go/res/values/dimens.xml b/go/res/values/dimens.xml
deleted file mode 100644
index f1b1053..0000000
--- a/go/res/values/dimens.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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>
- <!-- Dynamic Grid -->
- <dimen name="dynamic_grid_hotseat_size">60dp</dimen>
-</resources>
\ No newline at end of file
diff --git a/go/src/com/android/launcher3/model/LoaderResults.java b/go/src/com/android/launcher3/model/LoaderResults.java
index 7130531..5f71061 100644
--- a/go/src/com/android/launcher3/model/LoaderResults.java
+++ b/go/src/com/android/launcher3/model/LoaderResults.java
@@ -20,7 +20,6 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.model.BgDataModel.Callbacks;
-import com.android.launcher3.util.LooperExecutor;
/**
* Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}.
@@ -29,12 +28,7 @@
public LoaderResults(LauncherAppState app, BgDataModel dataModel,
AllAppsList allAppsList, Callbacks[] callbacks) {
- this(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR);
- }
-
- public LoaderResults(LauncherAppState app, BgDataModel dataModel,
- AllAppsList allAppsList, Callbacks[] callbacks, LooperExecutor executor) {
- super(app, dataModel, allAppsList, callbacks, executor);
+ super(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR);
}
@Override
diff --git a/quickstep/recents_ui_overrides/res/values/colors.xml b/quickstep/recents_ui_overrides/res/values/colors.xml
deleted file mode 100644
index f03f118..0000000
--- a/quickstep/recents_ui_overrides/res/values/colors.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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>
- <color name="chip_hint_foreground_color">#fff</color>
- <color name="chip_scrim_start_color">#39000000</color>
-
- <color name="all_apps_label_text">#61000000</color>
- <color name="all_apps_label_text_dark">#61FFFFFF</color>
- <color name="all_apps_prediction_row_separator">#3c000000</color>
- <color name="all_apps_prediction_row_separator_dark">#3cffffff</color>
-</resources>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/res/values/config.xml b/quickstep/recents_ui_overrides/res/values/config.xml
deleted file mode 100644
index 120e034..0000000
--- a/quickstep/recents_ui_overrides/res/values/config.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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>
- <integer name="max_depth_blur_radius">150</integer>
-</resources>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml
deleted file mode 100644
index 9266b06..0000000
--- a/quickstep/recents_ui_overrides/res/values/dimens.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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>
- <dimen name="chip_hint_border_width">1dp</dimen>
- <dimen name="chip_hint_corner_radius">20dp</dimen>
- <dimen name="chip_hint_outer_padding">20dp</dimen>
- <dimen name="chip_hint_start_padding">10dp</dimen>
- <dimen name="chip_hint_end_padding">12dp</dimen>
- <dimen name="chip_hint_horizontal_margin">20dp</dimen>
- <dimen name="chip_hint_vertical_offset">16dp</dimen>
- <dimen name="chip_hint_elevation">2dp</dimen>
- <dimen name="chip_icon_size">16dp</dimen>
- <dimen name="chip_text_height">26dp</dimen>
- <dimen name="chip_text_top_padding">4dp</dimen>
- <dimen name="chip_text_start_padding">10dp</dimen>
- <dimen name="chip_text_size">14sp</dimen>
-
- <dimen name="all_apps_prediction_row_divider_height">17dp</dimen>
- <dimen name="all_apps_label_top_padding">16dp</dimen>
- <dimen name="all_apps_label_bottom_padding">8dp</dimen>
- <dimen name="all_apps_label_text_size">14sp</dimen>
-
- <!-- Minimum distance to swipe to trigger accessibility gesture -->
- <dimen name="accessibility_gesture_min_swipe_distance">80dp</dimen>
-</resources>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/REMOVED.txt b/quickstep/recents_ui_overrides/src/REMOVED.txt
new file mode 100644
index 0000000..c3a3eaf
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/REMOVED.txt
@@ -0,0 +1,2 @@
+Temp file to prevent build breakage.
+Will be removed in followup cl.
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java
deleted file mode 100644
index b516469..0000000
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2020 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.launcher3.model;
-
-import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_GRID;
-import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
-
-import android.app.prediction.AppPredictionContext;
-import android.app.prediction.AppPredictionManager;
-import android.app.prediction.AppPredictor;
-import android.app.prediction.AppTarget;
-import android.app.prediction.AppTargetEvent;
-import android.content.Context;
-
-import androidx.annotation.WorkerThread;
-
-import com.android.launcher3.InvariantDeviceProfile;
-import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener;
-import com.android.launcher3.model.BgDataModel.FixedContainerItems;
-import com.android.launcher3.util.Executors;
-import com.android.quickstep.logging.StatsLogCompatManager;
-
-import java.util.List;
-
-/**
- * Model delegate which loads prediction items
- */
-public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChangeListener {
-
- public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state";
-
- private final InvariantDeviceProfile mIDP;
- private final AppEventProducer mAppEventProducer;
-
- private AppPredictor mAllAppsPredictor;
- private boolean mActive = false;
-
- public QuickstepModelDelegate(Context context) {
- mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent);
-
- mIDP = InvariantDeviceProfile.INSTANCE.get(context);
- mIDP.addOnChangeListener(this);
- StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer);
- }
-
- @Override
- public void loadItems() {
- // TODO: Implement caching and preloading
- super.loadItems();
- mDataModel.extraItems.put(
- CONTAINER_PREDICTION, new FixedContainerItems(CONTAINER_PREDICTION));
-
- mActive = true;
- recreatePredictors();
- }
-
- @Override
- public void validateData() {
- super.validateData();
- if (mAllAppsPredictor != null) {
- mAllAppsPredictor.requestPredictionUpdate();
- }
- }
-
- @Override
- public void destroy() {
- super.destroy();
- mActive = false;
- StatsLogCompatManager.LOGS_CONSUMER.remove(mAppEventProducer);
-
- destroyPredictors();
- mIDP.removeOnChangeListener(this);
- }
-
- private void destroyPredictors() {
- if (mAllAppsPredictor != null) {
- mAllAppsPredictor.destroy();
- mAllAppsPredictor = null;
- }
- }
-
- @WorkerThread
- private void recreatePredictors() {
- destroyPredictors();
- if (!mActive) {
- return;
- }
-
- Context context = mApp.getContext();
- AppPredictionManager apm = context.getSystemService(AppPredictionManager.class);
- if (apm == null) {
- return;
- }
-
- int count = mIDP.numAllAppsColumns;
-
- mAllAppsPredictor = apm.createAppPredictionSession(
- new AppPredictionContext.Builder(context)
- .setUiSurface("home")
- .setPredictedTargetCount(count)
- .build());
- mAllAppsPredictor.registerPredictionUpdates(
- Executors.MODEL_EXECUTOR, this::onAllAppsPredictionChanged);
- mAllAppsPredictor.requestPredictionUpdate();
- }
-
- private void onAllAppsPredictionChanged(List<AppTarget> targets) {
- mApp.getModel().enqueueModelUpdateTask(
- new PredictionUpdateTask(CONTAINER_PREDICTION, targets));
- }
-
- @Override
- public void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) {
- if ((changeFlags & CHANGE_FLAG_GRID) != 0) {
- // Reinitialize everything
- Executors.MODEL_EXECUTOR.execute(this::recreatePredictors);
- }
- }
-
- private void onAppTargetEvent(AppTargetEvent event) {
- if (mAllAppsPredictor != null) {
- mAllAppsPredictor.notifyAppTargetEvent(event);
- }
- }
-}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java
deleted file mode 100644
index fc9a11b..0000000
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 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.launcher3.uioverrides.states;
-
-import com.android.launcher3.Launcher;
-
-public class OverviewPeekState extends OverviewState {
- private static final float OVERVIEW_OFFSET = 0.7f;
-
- public OverviewPeekState(int id) {
- super(id);
- }
-
- @Override
- public float[] getOverviewScaleAndOffset(Launcher launcher) {
- return new float[] {NO_SCALE, OVERVIEW_OFFSET};
- }
-}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
deleted file mode 100644
index fac478e..0000000
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2019 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.launcher3.uioverrides.touchcontrollers;
-
-import static com.android.launcher3.LauncherState.ALL_APPS;
-import static com.android.launcher3.LauncherState.NORMAL;
-import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.LauncherState.OVERVIEW_PEEK;
-import static com.android.launcher3.anim.Interpolators.ACCEL;
-import static com.android.launcher3.anim.Interpolators.DEACCEL;
-import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_HEADER_FADE;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
-import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK;
-import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
-import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_PAUSE_TO_OVERVIEW_ANIM;
-import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherState;
-import com.android.launcher3.anim.AnimationSuccessListener;
-import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.states.StateAnimationConfig;
-import com.android.launcher3.states.StateAnimationConfig.AnimationFlags;
-import com.android.launcher3.testing.TestProtocol;
-import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory;
-import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
-import com.android.launcher3.util.VibratorWrapper;
-import com.android.quickstep.SystemUiProxy;
-import com.android.quickstep.util.MotionPauseDetector;
-import com.android.quickstep.views.RecentsView;
-
-/**
- * Touch controller which handles swipe and hold to go to Overview
- */
-public class FlingAndHoldTouchController extends PortraitStatesTouchController {
-
- private static final long PEEK_IN_ANIM_DURATION = 240;
- private static final long PEEK_OUT_ANIM_DURATION = 100;
- private static final float MAX_DISPLACEMENT_PERCENT = 0.75f;
-
- protected final MotionPauseDetector mMotionPauseDetector;
- private final float mMotionPauseMinDisplacement;
- private final float mMotionPauseMaxDisplacement;
-
- private AnimatorSet mPeekAnim;
-
- public FlingAndHoldTouchController(Launcher l) {
- super(l, false /* allowDragToOverview */);
- mMotionPauseDetector = new MotionPauseDetector(l);
- mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop();
- mMotionPauseMaxDisplacement = getMotionPauseMaxDisplacement();
- }
-
- protected float getMotionPauseMaxDisplacement() {
- return getShiftRange() * MAX_DISPLACEMENT_PERCENT;
- }
-
- @Override
- protected long getAtomicDuration() {
- return QuickstepAtomicAnimationFactory.ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW;
- }
-
- @Override
- public void onDragStart(boolean start, float startDisplacement) {
- mMotionPauseDetector.clear();
-
- super.onDragStart(start, startDisplacement);
-
- if (handlingOverviewAnim()) {
- mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseChanged);
- }
-
- if (mAtomicAnim != null) {
- mAtomicAnim.cancel();
- }
- }
-
- protected void onMotionPauseChanged(boolean isPaused) {
- RecentsView recentsView = mLauncher.getOverviewPanel();
- recentsView.setOverviewStateEnabled(isPaused);
- if (mPeekAnim != null) {
- mPeekAnim.cancel();
- }
- LauncherState fromState = isPaused ? NORMAL : OVERVIEW_PEEK;
- LauncherState toState = isPaused ? OVERVIEW_PEEK : NORMAL;
- long peekDuration = isPaused ? PEEK_IN_ANIM_DURATION : PEEK_OUT_ANIM_DURATION;
-
- StateAnimationConfig config = new StateAnimationConfig();
- config.duration = peekDuration;
- config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK;
- mPeekAnim = mLauncher.getStateManager().createAtomicAnimation(
- fromState, toState, config);
- mPeekAnim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mPeekAnim = null;
- }
- });
- mPeekAnim.start();
- VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC);
-
- mLauncher.getDragLayer().getScrim().createSysuiMultiplierAnim(isPaused ? 0 : 1)
- .setDuration(peekDuration).start();
- }
-
- /**
- * @return Whether we are handling the overview animation, rather than
- * having it as part of the existing animation to the target state.
- */
- protected boolean handlingOverviewAnim() {
- int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags();
- return mStartState == NORMAL && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0;
- }
-
- @Override
- protected StateAnimationConfig getConfigForStates(
- LauncherState fromState, LauncherState toState) {
- if (fromState == NORMAL && toState == ALL_APPS) {
- StateAnimationConfig builder = new StateAnimationConfig();
- // Fade in prediction icons quickly, then rest of all apps after reaching overview.
- float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher)
- - OVERVIEW.getVerticalProgress(mLauncher);
- builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
- ACCEL,
- 0,
- ALL_APPS_CONTENT_FADE_THRESHOLD));
- builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
- ACCEL,
- progressToReachOverview,
- progressToReachOverview + ALL_APPS_CONTENT_FADE_THRESHOLD));
-
- // Get workspace out of the way quickly, to prepare for potential pause.
- builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3);
- builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, DEACCEL_3);
- builder.setInterpolator(ANIM_WORKSPACE_FADE, DEACCEL_3);
- return builder;
- } else if (fromState == ALL_APPS && toState == NORMAL) {
- StateAnimationConfig builder = new StateAnimationConfig();
- // Keep all apps/predictions opaque until the very end of the transition.
- float progressToReachOverview = OVERVIEW.getVerticalProgress(mLauncher);
- builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
- DEACCEL,
- progressToReachOverview - ALL_APPS_CONTENT_FADE_THRESHOLD,
- progressToReachOverview));
- builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
- DEACCEL,
- 1 - ALL_APPS_CONTENT_FADE_THRESHOLD,
- 1));
- return builder;
- }
- return super.getConfigForStates(fromState, toState);
- }
-
- @Override
- public boolean onDrag(float displacement, MotionEvent event) {
- if (TestProtocol.sDebugTracing) {
- Log.d(TestProtocol.PAUSE_NOT_DETECTED, "FlingAndHoldTouchController");
- }
- float upDisplacement = -displacement;
- mMotionPauseDetector.setDisallowPause(!handlingOverviewAnim()
- || upDisplacement < mMotionPauseMinDisplacement
- || upDisplacement > mMotionPauseMaxDisplacement);
- mMotionPauseDetector.addPosition(event);
- return super.onDrag(displacement, event);
- }
-
- @Override
- public void onDragEnd(float velocity) {
- if (mMotionPauseDetector.isPaused() && handlingOverviewAnim()) {
- goToOverviewOnDragEnd(velocity);
- } else {
- super.onDragEnd(velocity);
- }
-
- View searchView = mLauncher.getAppsView().getSearchView();
- if (searchView instanceof FeedbackHandler) {
- ((FeedbackHandler) searchView).resetFeedback();
- }
- mMotionPauseDetector.clear();
- }
-
- protected void goToOverviewOnDragEnd(float velocity) {
- if (mPeekAnim != null) {
- mPeekAnim.cancel();
- }
-
- Animator overviewAnim = mLauncher.createAtomicAnimationFactory()
- .createStateElementAnimation(INDEX_PAUSE_TO_OVERVIEW_ANIM);
- mAtomicAnim = new AnimatorSet();
- mAtomicAnim.addListener(new AnimationSuccessListener() {
- @Override
- public void onAnimationSuccess(Animator animator) {
- onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE);
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- if (mCancelled) {
- StateAnimationConfig config = new StateAnimationConfig();
- config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK;
- config.duration = PEEK_OUT_ANIM_DURATION;
- mPeekAnim = mLauncher.getStateManager().createAtomicAnimation(
- mFromState, mToState, config);
- mPeekAnim.start();
- }
- mAtomicAnim = null;
- }
- });
- mAtomicAnim.play(overviewAnim);
- mAtomicAnim.start();
- }
-
- @Override
- protected void goToTargetState(LauncherState targetState, int logAction) {
- if (mPeekAnim != null && mPeekAnim.isStarted()) {
- // Don't jump to the target state until overview is no longer peeking.
- mPeekAnim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- FlingAndHoldTouchController.super.goToTargetState(targetState, logAction);
- }
- });
- } else {
- super.goToTargetState(targetState, logAction);
- }
- }
-
- @Override
- @AnimationFlags
- protected int updateAnimComponentsOnReinit(@AnimationFlags int animComponents) {
- if (handlingOverviewAnim()) {
- // We don't want the state transition to all apps to animate overview,
- // as that will cause a jump after our atomic animation.
- return animComponents | SKIP_OVERVIEW;
- } else {
- return animComponents;
- }
- }
-
- /**
- * Interface for views with feedback animation requiring reset
- */
- public interface FeedbackHandler {
-
- /**
- * reset searchWidget feedback
- */
- void resetFeedback();
- }
-
-}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
deleted file mode 100644
index 9316938..0000000
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (C) 2020 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.launcher3.uioverrides.touchcontrollers;
-
-import static com.android.launcher3.LauncherState.HINT_STATE;
-import static com.android.launcher3.LauncherState.NORMAL;
-import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
-import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
-import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK;
-import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
-
-import android.animation.Animator;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
-import android.graphics.PointF;
-import android.util.Log;
-import android.view.MotionEvent;
-
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherState;
-import com.android.launcher3.Utilities;
-import com.android.launcher3.anim.AnimationSuccessListener;
-import com.android.launcher3.graphics.OverviewScrim;
-import com.android.launcher3.statemanager.StateManager;
-import com.android.launcher3.states.StateAnimationConfig;
-import com.android.launcher3.testing.TestProtocol;
-import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
-import com.android.launcher3.util.VibratorWrapper;
-import com.android.quickstep.util.StaggeredWorkspaceAnim;
-import com.android.quickstep.views.RecentsView;
-
-/**
- * Touch controller which handles swipe and hold from the nav bar to go to Overview. Swiping above
- * the nav bar falls back to go to All Apps. Swiping from the nav bar without holding goes to the
- * first home screen instead of to Overview.
- */
-public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchController {
-
-
- // How much of the movement to use for translating overview after swipe and hold.
- private static final float OVERVIEW_MOVEMENT_FACTOR = 0.25f;
- private static final long TRANSLATION_ANIM_MIN_DURATION_MS = 80;
- private static final float TRANSLATION_ANIM_VELOCITY_DP_PER_MS = 0.8f;
-
- private final RecentsView mRecentsView;
-
- private boolean mDidTouchStartInNavBar;
- private boolean mReachedOverview;
- private boolean mIsOverviewRehidden;
- private boolean mIsHomeStaggeredAnimFinished;
- // The last recorded displacement before we reached overview.
- private PointF mStartDisplacement = new PointF();
-
- // Normal to Hint animation has flag SKIP_OVERVIEW, so we update this scrim with this animator.
- private ObjectAnimator mNormalToHintOverviewScrimAnimator;
-
- public NoButtonNavbarToOverviewTouchController(Launcher l) {
- super(l);
- mRecentsView = l.getOverviewPanel();
- if (TestProtocol.sDebugTracing) {
- Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController.ctor");
- }
- }
-
- @Override
- protected float getMotionPauseMaxDisplacement() {
- // No need to disallow pause when swiping up all the way up the screen (unlike
- // FlingAndHoldTouchController where user is probably intending to go to all apps).
- return Float.MAX_VALUE;
- }
-
- @Override
- protected boolean canInterceptTouch(MotionEvent ev) {
- mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0;
- return super.canInterceptTouch(ev);
- }
-
- @Override
- protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
- if (fromState == NORMAL && mDidTouchStartInNavBar) {
- return HINT_STATE;
- } else if (fromState == OVERVIEW && isDragTowardPositive) {
- // Don't allow swiping up to all apps.
- return OVERVIEW;
- }
- return super.getTargetState(fromState, isDragTowardPositive);
- }
-
- @Override
- protected float initCurrentAnimation(int animComponents) {
- float progressMultiplier = super.initCurrentAnimation(animComponents);
- if (mToState == HINT_STATE) {
- // Track the drag across the entire height of the screen.
- progressMultiplier = -1 / getShiftRange();
- }
- return progressMultiplier;
- }
-
- @Override
- public void onDragStart(boolean start, float startDisplacement) {
- super.onDragStart(start, startDisplacement);
- if (mFromState == NORMAL && mToState == HINT_STATE) {
- mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat(
- mLauncher.getDragLayer().getOverviewScrim(),
- OverviewScrim.SCRIM_PROGRESS,
- mFromState.getOverviewScrimAlpha(mLauncher),
- mToState.getOverviewScrimAlpha(mLauncher));
- }
- mReachedOverview = false;
- }
-
- @Override
- protected void updateProgress(float fraction) {
- super.updateProgress(fraction);
- if (mNormalToHintOverviewScrimAnimator != null) {
- mNormalToHintOverviewScrimAnimator.setCurrentFraction(fraction);
- }
- }
-
- @Override
- public void onDragEnd(float velocity) {
- super.onDragEnd(velocity);
- mNormalToHintOverviewScrimAnimator = null;
- }
-
- @Override
- protected void updateSwipeCompleteAnimation(ValueAnimator animator, long expectedDuration,
- LauncherState targetState, float velocity, boolean isFling) {
- super.updateSwipeCompleteAnimation(animator, expectedDuration, targetState, velocity,
- isFling);
- if (targetState == HINT_STATE) {
- // Normally we compute the duration based on the velocity and distance to the given
- // state, but since the hint state tracks the entire screen without a clear endpoint, we
- // need to manually set the duration to a reasonable value.
- animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher));
- }
- }
-
- @Override
- protected void onMotionPauseChanged(boolean isPaused) {
- if (mCurrentAnimation == null) {
- return;
- }
- mNormalToHintOverviewScrimAnimator = null;
- mCurrentAnimation.dispatchOnCancelWithoutCancelRunnable(() -> {
- mLauncher.getStateManager().goToState(OVERVIEW, true, () -> {
- mReachedOverview = true;
- maybeSwipeInteractionToOverviewComplete();
- });
- });
- VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC);
- }
-
- private void maybeSwipeInteractionToOverviewComplete() {
- if (mReachedOverview && mDetector.isSettlingState()) {
- onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE);
- }
- }
-
- // Used if flinging back to home after reaching overview
- private void maybeSwipeInteractionToHomeComplete() {
- if (mIsHomeStaggeredAnimFinished && mIsOverviewRehidden) {
- onSwipeInteractionCompleted(NORMAL, Touch.FLING);
- }
- }
-
- @Override
- protected boolean handlingOverviewAnim() {
- return mDidTouchStartInNavBar && super.handlingOverviewAnim();
- }
-
- @Override
- public boolean onDrag(float yDisplacement, float xDisplacement, MotionEvent event) {
- if (TestProtocol.sDebugTracing) {
- Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController");
- }
- if (mMotionPauseDetector.isPaused()) {
- if (!mReachedOverview) {
- mStartDisplacement.set(xDisplacement, yDisplacement);
- } else {
- mRecentsView.setTranslationX((xDisplacement - mStartDisplacement.x)
- * OVERVIEW_MOVEMENT_FACTOR);
- mRecentsView.setTranslationY((yDisplacement - mStartDisplacement.y)
- * OVERVIEW_MOVEMENT_FACTOR);
- }
- // Stay in Overview.
- return true;
- }
- return super.onDrag(yDisplacement, xDisplacement, event);
- }
-
- @Override
- protected void goToOverviewOnDragEnd(float velocity) {
- float velocityDp = dpiFromPx(velocity);
- boolean isFling = Math.abs(velocityDp) > 1;
- StateManager<LauncherState> stateManager = mLauncher.getStateManager();
- boolean goToHomeInsteadOfOverview = isFling;
- if (goToHomeInsteadOfOverview) {
- if (velocity > 0) {
- stateManager.goToState(NORMAL, true,
- () -> onSwipeInteractionCompleted(NORMAL, Touch.FLING));
- } else {
- mIsHomeStaggeredAnimFinished = mIsOverviewRehidden = false;
-
- StaggeredWorkspaceAnim staggeredWorkspaceAnim = new StaggeredWorkspaceAnim(
- mLauncher, velocity, false /* animateOverviewScrim */);
- staggeredWorkspaceAnim.addAnimatorListener(new AnimationSuccessListener() {
- @Override
- public void onAnimationSuccess(Animator animator) {
- mIsHomeStaggeredAnimFinished = true;
- maybeSwipeInteractionToHomeComplete();
- }
- }).start();
-
- // StaggeredWorkspaceAnim doesn't animate overview, so we handle it here.
- stateManager.cancelAnimation();
- StateAnimationConfig config = new StateAnimationConfig();
- config.duration = OVERVIEW.getTransitionDuration(mLauncher);
- config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK;
- AnimatorSet anim = stateManager.createAtomicAnimation(
- stateManager.getState(), NORMAL, config);
- anim.addListener(AnimationSuccessListener.forRunnable(() -> {
- mIsOverviewRehidden = true;
- maybeSwipeInteractionToHomeComplete();
- }));
- anim.start();
- }
- }
- if (mReachedOverview) {
- float distanceDp = dpiFromPx(Math.max(
- Math.abs(mRecentsView.getTranslationX()),
- Math.abs(mRecentsView.getTranslationY())));
- long duration = (long) Math.max(TRANSLATION_ANIM_MIN_DURATION_MS,
- distanceDp / TRANSLATION_ANIM_VELOCITY_DP_PER_MS);
- mRecentsView.animate()
- .translationX(0)
- .translationY(0)
- .setInterpolator(ACCEL_DEACCEL)
- .setDuration(duration)
- .withEndAction(goToHomeInsteadOfOverview
- ? null
- : this::maybeSwipeInteractionToOverviewComplete);
- }
- }
-
- private float dpiFromPx(float pixels) {
- return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics());
- }
-}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ShelfPeekAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ShelfPeekAnim.java
deleted file mode 100644
index 85006da..0000000
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ShelfPeekAnim.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2019 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.quickstep.util;
-
-import static com.android.launcher3.LauncherState.BACKGROUND_APP;
-import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
-import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_SHELF_ANIM;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.view.animation.Interpolator;
-
-import com.android.launcher3.Launcher;
-import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.uioverrides.states.OverviewState;
-
-/**
- * Animates the shelf between states HIDE, PEEK, and OVERVIEW.
- */
-public class ShelfPeekAnim {
-
- public static final Interpolator INTERPOLATOR = OVERSHOOT_1_2;
- public static final long DURATION = 240;
-
- private final Launcher mLauncher;
-
- private ShelfAnimState mShelfState;
- private boolean mIsPeeking;
-
- public ShelfPeekAnim(Launcher launcher) {
- mLauncher = launcher;
- }
-
- /**
- * Animates to the given state, canceling the previous animation if it was still running.
- */
- public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, long duration) {
- if (mShelfState == shelfState || FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
- return;
- }
- mLauncher.getStateManager().cancelStateElementAnimation(INDEX_SHELF_ANIM);
- mShelfState = shelfState;
- mIsPeeking = mShelfState == ShelfAnimState.PEEK || mShelfState == ShelfAnimState.HIDE;
- if (mShelfState == ShelfAnimState.CANCEL) {
- return;
- }
- float shelfHiddenProgress = BACKGROUND_APP.getVerticalProgress(mLauncher);
- float shelfOverviewProgress = OVERVIEW.getVerticalProgress(mLauncher);
- // Peek based on default overview progress so we can see hotseat if we're showing
- // that instead of predictions in overview.
- float defaultOverviewProgress = OverviewState.getDefaultVerticalProgress(mLauncher);
- float shelfPeekingProgress = shelfHiddenProgress
- - (shelfHiddenProgress - defaultOverviewProgress) * 0.25f;
- float toProgress = mShelfState == ShelfAnimState.HIDE
- ? shelfHiddenProgress
- : mShelfState == ShelfAnimState.PEEK
- ? shelfPeekingProgress
- : shelfOverviewProgress;
- Animator shelfAnim = mLauncher.getStateManager()
- .createStateElementAnimation(INDEX_SHELF_ANIM, toProgress);
- shelfAnim.setInterpolator(interpolator);
- shelfAnim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationCancel(Animator animation) {
- mShelfState = ShelfAnimState.CANCEL;
- }
-
- @Override
- public void onAnimationEnd(Animator animator) {
- mIsPeeking = mShelfState == ShelfAnimState.PEEK;
- }
- });
- shelfAnim.setDuration(duration).start();
- }
-
- /** @return Whether the shelf is currently peeking or animating to or from peeking. */
- public boolean isPeeking() {
- return mIsPeeking;
- }
-
- /** The various shelf states we can animate to. */
- public enum ShelfAnimState {
- HIDE(true), PEEK(true), OVERVIEW(false), CANCEL(false);
-
- ShelfAnimState(boolean shouldPreformHaptic) {
- this.shouldPreformHaptic = shouldPreformHaptic;
- }
-
- public final boolean shouldPreformHaptic;
- }
-}
diff --git a/quickstep/recents_ui_overrides/res/drawable/all_apps_edu_circle.xml b/quickstep/res/drawable/all_apps_edu_circle.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/drawable/all_apps_edu_circle.xml
rename to quickstep/res/drawable/all_apps_edu_circle.xml
diff --git a/quickstep/recents_ui_overrides/res/drawable/chip_hint_background_light.xml b/quickstep/res/drawable/chip_hint_background_light.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/drawable/chip_hint_background_light.xml
rename to quickstep/res/drawable/chip_hint_background_light.xml
diff --git a/quickstep/recents_ui_overrides/res/drawable/chip_scrim_gradient.xml b/quickstep/res/drawable/chip_scrim_gradient.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/drawable/chip_scrim_gradient.xml
rename to quickstep/res/drawable/chip_scrim_gradient.xml
diff --git a/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml b/quickstep/res/drawable/hotseat_edu_notification_icon.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml
rename to quickstep/res/drawable/hotseat_edu_notification_icon.xml
diff --git a/quickstep/recents_ui_overrides/res/layout/all_apps_edu_view.xml b/quickstep/res/layout/all_apps_edu_view.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/layout/all_apps_edu_view.xml
rename to quickstep/res/layout/all_apps_edu_view.xml
diff --git a/quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml b/quickstep/res/layout/fallback_recents_activity.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml
rename to quickstep/res/layout/fallback_recents_activity.xml
diff --git a/quickstep/recents_ui_overrides/res/layout/floating_header_content.xml b/quickstep/res/layout/floating_header_content.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/layout/floating_header_content.xml
rename to quickstep/res/layout/floating_header_content.xml
diff --git a/quickstep/res/layout/overview_clear_all_button.xml b/quickstep/res/layout/overview_clear_all_button.xml
index fc06ba0..34ff91d 100644
--- a/quickstep/res/layout/overview_clear_all_button.xml
+++ b/quickstep/res/layout/overview_clear_all_button.xml
@@ -23,5 +23,4 @@
android:text="@string/recents_clear_all"
android:textColor="?attr/workspaceTextColor"
android:textSize="14sp"
- android:translationY="@dimen/task_thumbnail_half_top_margin"
- />
\ No newline at end of file
+ android:translationY="@dimen/task_thumbnail_half_top_margin" />
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/res/layout/overview_panel.xml b/quickstep/res/layout/overview_panel.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/layout/overview_panel.xml
rename to quickstep/res/layout/overview_panel.xml
diff --git a/quickstep/recents_ui_overrides/res/layout/predicted_app_icon.xml b/quickstep/res/layout/predicted_app_icon.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/layout/predicted_app_icon.xml
rename to quickstep/res/layout/predicted_app_icon.xml
diff --git a/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml b/quickstep/res/layout/predicted_hotseat_edu.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml
rename to quickstep/res/layout/predicted_hotseat_edu.xml
diff --git a/quickstep/res/values/colors.xml b/quickstep/res/values/colors.xml
index 40da136..449fe10 100644
--- a/quickstep/res/values/colors.xml
+++ b/quickstep/res/values/colors.xml
@@ -16,4 +16,12 @@
<resources>
<color name="back_arrow_color_light">#FFFFFFFF</color>
<color name="back_arrow_color_dark">#99000000</color>
+
+ <color name="chip_hint_foreground_color">#fff</color>
+ <color name="chip_scrim_start_color">#39000000</color>
+
+ <color name="all_apps_label_text">#61000000</color>
+ <color name="all_apps_label_text_dark">#61FFFFFF</color>
+ <color name="all_apps_prediction_row_separator">#3c000000</color>
+ <color name="all_apps_prediction_row_separator_dark">#3cffffff</color>
</resources>
\ No newline at end of file
diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml
index 0f2955b..9ec303a 100644
--- a/quickstep/res/values/config.xml
+++ b/quickstep/res/values/config.xml
@@ -16,6 +16,8 @@
<resources>
<string name="task_overlay_factory_class" translatable="false"/>
+ <string name="overscroll_plugin_factory_class" translatable="false" />
+
<!-- Activities which block home gesture -->
<string-array name="gesture_blocking_activities" translatable="false">
<item>com.android.launcher3/com.android.quickstep.interaction.GestureSandboxActivity</item>
@@ -35,4 +37,6 @@
<integer name="assistant_gesture_corner_deg_threshold">20</integer>
<string name="wellbeing_provider_pkg" translatable="false"/>
+
+ <integer name="max_depth_blur_radius">150</integer>
</resources>
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 6737c5f..313db8c 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -30,7 +30,6 @@
<dimen name="recents_page_spacing">10dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
- <dimen name="overview_peek_distance">96dp</dimen>
<!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
loading full resolution screenshots. -->
@@ -102,4 +101,26 @@
<dimen name="swipe_edu_circle_size">64dp</dimen>
<dimen name="swipe_edu_width">80dp</dimen>
<dimen name="swipe_edu_max_height">184dp</dimen>
+
+ <dimen name="chip_hint_border_width">1dp</dimen>
+ <dimen name="chip_hint_corner_radius">20dp</dimen>
+ <dimen name="chip_hint_outer_padding">20dp</dimen>
+ <dimen name="chip_hint_start_padding">10dp</dimen>
+ <dimen name="chip_hint_end_padding">12dp</dimen>
+ <dimen name="chip_hint_horizontal_margin">20dp</dimen>
+ <dimen name="chip_hint_vertical_offset">16dp</dimen>
+ <dimen name="chip_hint_elevation">2dp</dimen>
+ <dimen name="chip_icon_size">16dp</dimen>
+ <dimen name="chip_text_height">26dp</dimen>
+ <dimen name="chip_text_top_padding">4dp</dimen>
+ <dimen name="chip_text_start_padding">10dp</dimen>
+ <dimen name="chip_text_size">14sp</dimen>
+
+ <dimen name="all_apps_prediction_row_divider_height">17dp</dimen>
+ <dimen name="all_apps_label_top_padding">16dp</dimen>
+ <dimen name="all_apps_label_bottom_padding">8dp</dimen>
+ <dimen name="all_apps_label_text_size">14sp</dimen>
+
+ <!-- Minimum distance to swipe to trigger accessibility gesture -->
+ <dimen name="accessibility_gesture_min_swipe_distance">80dp</dimen>
</resources>
diff --git a/quickstep/recents_ui_overrides/res/values/override.xml b/quickstep/res/values/override.xml
similarity index 99%
rename from quickstep/recents_ui_overrides/res/values/override.xml
rename to quickstep/res/values/override.xml
index 1937164..397ea82 100644
--- a/quickstep/recents_ui_overrides/res/values/override.xml
+++ b/quickstep/res/values/override.xml
@@ -32,4 +32,3 @@
<string name="model_delegate_class" translatable="false">com.android.launcher3.model.QuickstepModelDelegate</string>
</resources>
-
diff --git a/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java b/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java
index 22d205a..5cb55ec 100644
--- a/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java
+++ b/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java
@@ -32,7 +32,7 @@
import android.view.Surface;
import com.android.launcher3.ResourceUtils;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
import org.junit.Before;
import org.junit.Ignore;
@@ -50,7 +50,7 @@
private OrientationTouchTransformer mTouchTransformer;
Resources mResources;
- private DefaultDisplay.Info mInfo;
+ private DisplayController.Info mInfo;
@Before
@@ -231,12 +231,12 @@
assertTrue(mTouchTransformer.touchInValidSwipeRegions(inRegion2.getX(), inRegion2.getY()));
}
- private DefaultDisplay.Info createDisplayInfo(int rotation) {
+ private DisplayController.Info createDisplayInfo(int rotation) {
Point p = new Point(SIZE_WIDTH, SIZE_HEIGHT);
if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) {
p = new Point(SIZE_HEIGHT, SIZE_WIDTH);
}
- return new DefaultDisplay.Info(0, rotation, 0, p, p, p, null);
+ return new DisplayController.Info(0, rotation, 0, p, p, p, null);
}
private float generateTouchRegionHeight(int rotation) {
diff --git a/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java b/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java
index c148a4b..7049af0 100644
--- a/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java
+++ b/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java
@@ -60,9 +60,9 @@
FallbackRecentsView frv = activity.getOverviewPanel();
- RunningTaskInfo dummyTask = new RunningTaskInfo();
- dummyTask.taskId = 22;
- frv.showCurrentTask(dummyTask);
+ RunningTaskInfo placeholderTask = new RunningTaskInfo();
+ placeholderTask.taskId = 22;
+ frv.showCurrentTask(placeholderTask);
doLayout(activity);
ThumbnailData thumbnailData = new ThumbnailData();
diff --git a/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java b/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java
index a31ba21..5491daa 100644
--- a/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java
+++ b/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java
@@ -27,7 +27,7 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.shadows.LShadowDisplay;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
import com.android.quickstep.LauncherActivityInterface;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
@@ -144,7 +144,7 @@
LauncherActivityInterface.INSTANCE);
tvs.setDp(mDeviceProfile);
- int launcherRotation = DefaultDisplay.INSTANCE.get(mContext).getInfo().rotation;
+ int launcherRotation = DisplayController.INSTANCE.get(mContext).getInfo().rotation;
if (mAppRotation < 0) {
mAppRotation = launcherRotation;
}
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index 235df42..a0016cb 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -50,7 +50,6 @@
import com.android.quickstep.util.QuickstepOnboardingPrefs;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteFadeOutAnimationListener;
-import com.android.quickstep.util.ShelfPeekAnim;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -73,8 +72,6 @@
(context, arg1, arg2) -> SystemUiProxy.INSTANCE.get(context).setBackButtonAlpha(
Float.intBitsToFloat(arg1), arg2 != 0);
- private final ShelfPeekAnim mShelfPeekAnim = new ShelfPeekAnim(this);
-
private OverviewActionsView mActionsView;
protected HotseatPredictionController mHotseatPredictionController;
@@ -196,7 +193,7 @@
}
private boolean isOverviewActionsEnabled() {
- return FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(this);
+ return removeShelfFromOverview(this);
}
public <T extends OverviewActionsView> T getActionsView() {
@@ -317,10 +314,6 @@
Stream.of(WellbeingModel.SHORTCUT_FACTORY));
}
- public ShelfPeekAnim getShelfPeekAnim() {
- return mShelfPeekAnim;
- }
-
/**
* Returns Prediction controller for hybrid hotseat
*/
diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
index 02769c6..b35b33c 100644
--- a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
+++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
@@ -16,7 +16,7 @@
package com.android.launcher3;
import static com.android.launcher3.Utilities.postAsyncCallback;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;
import android.animation.Animator;
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
rename to quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 2d096d1..2543148 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -45,7 +45,6 @@
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
-import android.annotation.TargetApi;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -55,7 +54,6 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.os.CancellationSignal;
import android.os.Handler;
import android.os.Looper;
@@ -94,7 +92,6 @@
* {@link LauncherAppTransitionManager} with Quickstep-specific app transitions for launching from
* home and/or all-apps. Not used for 3p launchers.
*/
-@TargetApi(Build.VERSION_CODES.O)
@SuppressWarnings("unused")
public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTransitionManager
implements OnDeviceProfileChangeListener {
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java b/quickstep/src/com/android/launcher3/appprediction/AllAppsTipView.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java
rename to quickstep/src/com/android/launcher3/appprediction/AllAppsTipView.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
similarity index 95%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java
rename to quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
index 914d9e9..b891120 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,6 +42,7 @@
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.anim.PropertySetter;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager.StateListener;
import com.android.launcher3.util.Themes;
@@ -90,7 +91,8 @@
mLauncher = Launcher.getLauncher(context);
boolean isMainColorDark = Themes.getAttrBoolean(context, R.attr.isMainColorDark);
- mPaint.setStrokeWidth(getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height));
+ mPaint.setStrokeWidth(
+ getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height));
mStrokeColor = ContextCompat.getColor(context, isMainColorDark
? R.color.all_apps_prediction_row_separator_dark
@@ -134,7 +136,7 @@
if (row == this) {
break;
} else if (row.shouldDraw()) {
- sectionCount ++;
+ sectionCount++;
}
}
@@ -181,6 +183,11 @@
}
private void updateViewVisibility() {
+ // hide divider since we have item decoration for prediction row
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ setVisibility(GONE);
+ return;
+ }
setVisibility(mDividerType == DividerType.NONE
? GONE
: (mIsScrolledOut ? INVISIBLE : VISIBLE));
@@ -303,4 +310,9 @@
public Class<AppsDividerView> getTypeClass() {
return AppsDividerView.class;
}
+
+ @Override
+ public View getFocusedChild() {
+ return null;
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java b/quickstep/src/com/android/launcher3/appprediction/ComponentKeyMapper.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java
rename to quickstep/src/com/android/launcher3/appprediction/ComponentKeyMapper.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java b/quickstep/src/com/android/launcher3/appprediction/DynamicItemCache.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java
rename to quickstep/src/com/android/launcher3/appprediction/DynamicItemCache.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java b/quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java
rename to quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
similarity index 93%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java
rename to quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
index 55384af..d3c4c3d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -45,10 +45,12 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
+import com.android.launcher3.allapps.AllAppsSectionDecorator;
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.anim.AlphaUpdateListener;
import com.android.launcher3.anim.PropertySetter;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusIndicatorHelper;
import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper;
import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider;
@@ -110,6 +112,8 @@
private boolean mPredictionsEnabled = false;
+ AllAppsSectionDecorator.SectionDecorationHandler mDecorationHandler;
+
public PredictionRowView(@NonNull Context context) {
this(context, null);
}
@@ -128,6 +132,11 @@
mIconFullTextAlpha = Color.alpha(mIconTextColor);
mIconCurrentTextAlpha = mIconFullTextAlpha;
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ mDecorationHandler = new AllAppsSectionDecorator.SectionDecorationHandler(getContext(),
+ false);
+ }
+
updateVisibility();
}
@@ -153,6 +162,15 @@
@Override
protected void dispatchDraw(Canvas canvas) {
+ if (mDecorationHandler != null) {
+ mDecorationHandler.reset();
+ int childrenCount = getChildCount();
+ for (int i = 0; i < childrenCount; i++) {
+ mDecorationHandler.extendBounds(getChildAt(i));
+ }
+ mDecorationHandler.onDraw(canvas);
+ mDecorationHandler.onFocusDraw(canvas, getFocusedChild());
+ }
mFocusHelper.draw(canvas);
super.dispatchDraw(canvas);
}
@@ -166,7 +184,7 @@
@Override
public boolean shouldDraw() {
- return getVisibility() != GONE;
+ return getVisibility() == VISIBLE;
}
@Override
@@ -347,4 +365,9 @@
public Class<PredictionRowView> getTypeClass() {
return PredictionRowView.class;
}
+
+ @Override
+ public View getFocusedChild() {
+ return getChildAt(0);
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java
rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
similarity index 99%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
index 4f95254..8ebf125 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
+++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
@@ -284,4 +284,3 @@
return new Intent(SETTINGS_ACTION).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
}
-
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java
rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java
rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java
rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java
rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/AppEventProducer.java b/quickstep/src/com/android/launcher3/model/AppEventProducer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/model/AppEventProducer.java
rename to quickstep/src/com/android/launcher3/model/AppEventProducer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java b/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java
similarity index 78%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java
rename to quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java
index 721e2be..b0fba3d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java
+++ b/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java
@@ -21,6 +21,7 @@
import android.app.prediction.AppTarget;
import android.content.ComponentName;
+import android.content.Context;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
import android.content.pm.ShortcutInfo;
@@ -29,6 +30,7 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.Utilities;
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
+import com.android.launcher3.model.QuickstepModelDelegate.PredictorState;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
@@ -43,27 +45,22 @@
public class PredictionUpdateTask extends BaseModelUpdateTask {
private final List<AppTarget> mTargets;
- private final int mContainerId;
+ private final PredictorState mPredictorState;
- PredictionUpdateTask(int containerId, List<AppTarget> targets) {
- mContainerId = containerId;
+ PredictionUpdateTask(PredictorState predictorState, List<AppTarget> targets) {
+ mPredictorState = predictorState;
mTargets = targets;
}
@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
- // TODO: persist the whole list
- Utilities.getDevicePrefs(app.getContext()).edit()
+ Context context = app.getContext();
+
+ // TODO: remove this
+ Utilities.getDevicePrefs(context).edit()
.putBoolean(LAST_PREDICTION_ENABLED_STATE, !mTargets.isEmpty()).apply();
- FixedContainerItems fci;
- synchronized (dataModel) {
- fci = dataModel.extraItems.get(mContainerId);
- if (fci == null) {
- return;
- }
- }
-
+ FixedContainerItems fci = mPredictorState.items;
Set<UserHandle> usersForChangedShortcuts = new HashSet<>(fci.items.stream()
.filter(info -> info.itemType == ITEM_TYPE_DEEP_SHORTCUT)
.map(info -> info.user)
@@ -75,7 +72,7 @@
ShortcutInfo si = target.getShortcutInfo();
if (si != null) {
usersForChangedShortcuts.add(si.getUserHandle());
- itemInfo = new WorkspaceItemInfo(si, app.getContext());
+ itemInfo = new WorkspaceItemInfo(si, context);
app.getIconCache().getShortcutIcon(itemInfo, si);
} else {
String className = target.getClassName();
@@ -87,16 +84,18 @@
UserHandle user = target.getUser();
itemInfo = apps.data.stream()
.filter(info -> user.equals(info.user) && cn.equals(info.componentName))
- .map(AppInfo::makeWorkspaceItem)
+ .map(ai -> {
+ app.getIconCache().getTitleAndIcon(ai, false);
+ return ai.makeWorkspaceItem();
+ })
.findAny()
.orElseGet(() -> {
- LauncherActivityInfo lai = app.getContext()
- .getSystemService(LauncherApps.class)
+ LauncherActivityInfo lai = context.getSystemService(LauncherApps.class)
.resolveActivity(AppInfo.makeLaunchIntent(cn), user);
if (lai == null) {
return null;
}
- AppInfo ai = new AppInfo(app.getContext(), lai, user);
+ AppInfo ai = new AppInfo(context, lai, user);
app.getIconCache().getTitleAndIcon(ai, lai, false);
return ai.makeWorkspaceItem();
});
@@ -106,12 +105,15 @@
}
}
- itemInfo.container = mContainerId;
+ itemInfo.container = fci.containerId;
fci.items.add(itemInfo);
}
bindExtraContainerItems(fci);
usersForChangedShortcuts.forEach(
u -> dataModel.updateShortcutPinnedState(app.getContext(), u));
+
+ // Save to disk
+ mPredictorState.storage.write(context, fci.items);
}
}
diff --git a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java
new file mode 100644
index 0000000..166cb6c
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 2020 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.launcher3.model;
+
+import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_GRID;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
+
+import android.app.prediction.AppPredictionContext;
+import android.app.prediction.AppPredictionManager;
+import android.app.prediction.AppPredictor;
+import android.app.prediction.AppTarget;
+import android.app.prediction.AppTargetEvent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.LauncherActivityInfo;
+import android.content.pm.LauncherApps;
+import android.content.pm.ShortcutInfo;
+import android.os.UserHandle;
+
+import androidx.annotation.Nullable;
+import androidx.annotation.WorkerThread;
+
+import com.android.launcher3.InvariantDeviceProfile;
+import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener;
+import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.model.BgDataModel.FixedContainerItems;
+import com.android.launcher3.model.data.AppInfo;
+import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.shortcuts.ShortcutKey;
+import com.android.launcher3.util.Executors;
+import com.android.launcher3.util.PersistedItemArray;
+import com.android.quickstep.logging.StatsLogCompatManager;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.IntStream;
+
+/**
+ * Model delegate which loads prediction items
+ */
+public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChangeListener {
+
+ public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state";
+
+ private final PredictorState mAllAppsState =
+ new PredictorState(CONTAINER_PREDICTION, "all_apps_predictions");
+
+ private final InvariantDeviceProfile mIDP;
+ private final AppEventProducer mAppEventProducer;
+
+ private boolean mActive = false;
+
+ public QuickstepModelDelegate(Context context) {
+ mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent);
+
+ mIDP = InvariantDeviceProfile.INSTANCE.get(context);
+ mIDP.addOnChangeListener(this);
+ StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer);
+ }
+
+ @Override
+ public void loadItems(UserManagerState ums, Map<ShortcutKey, ShortcutInfo> pinnedShortcuts) {
+ // TODO: Implement caching and preloading
+ super.loadItems(ums, pinnedShortcuts);
+
+ WorkspaceItemFactory factory =
+ new WorkspaceItemFactory(mApp, ums, pinnedShortcuts, mIDP.numAllAppsColumns);
+ mAllAppsState.items.setItems(
+ mAllAppsState.storage.read(mApp.getContext(), factory, ums.allUsers::get));
+ mDataModel.extraItems.put(CONTAINER_PREDICTION, mAllAppsState.items);
+
+ mActive = true;
+ recreatePredictors();
+ }
+
+ @Override
+ public void validateData() {
+ super.validateData();
+ if (mAllAppsState.predictor != null) {
+ mAllAppsState.predictor.requestPredictionUpdate();
+ }
+ }
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ mActive = false;
+ StatsLogCompatManager.LOGS_CONSUMER.remove(mAppEventProducer);
+
+ destroyPredictors();
+ mIDP.removeOnChangeListener(this);
+ }
+
+ private void destroyPredictors() {
+ mAllAppsState.destroyPredictor();
+ }
+
+ @WorkerThread
+ private void recreatePredictors() {
+ destroyPredictors();
+ if (!mActive) {
+ return;
+ }
+ Context context = mApp.getContext();
+ AppPredictionManager apm = context.getSystemService(AppPredictionManager.class);
+ if (apm == null) {
+ return;
+ }
+
+ int count = mIDP.numAllAppsColumns;
+
+ mAllAppsState.predictor = apm.createAppPredictionSession(
+ new AppPredictionContext.Builder(context)
+ .setUiSurface("home")
+ .setPredictedTargetCount(count)
+ .build());
+ mAllAppsState.predictor.registerPredictionUpdates(
+ Executors.MODEL_EXECUTOR, t -> handleUpdate(mAllAppsState, t));
+ mAllAppsState.predictor.requestPredictionUpdate();
+ }
+
+
+ private void handleUpdate(PredictorState state, List<AppTarget> targets) {
+ if (state.setTargets(targets)) {
+ // No diff, skip
+ return;
+ }
+ mApp.getModel().enqueueModelUpdateTask(new PredictionUpdateTask(state, targets));
+ }
+
+ @Override
+ public void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) {
+ if ((changeFlags & CHANGE_FLAG_GRID) != 0) {
+ // Reinitialize everything
+ Executors.MODEL_EXECUTOR.execute(this::recreatePredictors);
+ }
+ }
+
+ private void onAppTargetEvent(AppTargetEvent event) {
+ if (mAllAppsState.predictor != null) {
+ mAllAppsState.predictor.notifyAppTargetEvent(event);
+ }
+ }
+
+ static class PredictorState {
+
+ public final FixedContainerItems items;
+ public final PersistedItemArray storage;
+ public AppPredictor predictor;
+
+ private List<AppTarget> mLastTargets;
+
+ PredictorState(int container, String storageName) {
+ items = new FixedContainerItems(container);
+ storage = new PersistedItemArray(storageName);
+ mLastTargets = Collections.emptyList();
+ }
+
+ public void destroyPredictor() {
+ if (predictor != null) {
+ predictor.destroy();
+ predictor = null;
+ }
+ }
+
+ /**
+ * Sets the new targets and returns true if it was different than before.
+ */
+ boolean setTargets(List<AppTarget> newTargets) {
+ List<AppTarget> oldTargets = mLastTargets;
+ mLastTargets = newTargets;
+
+ int size = oldTargets.size();
+ return size == newTargets.size() && IntStream.range(0, size)
+ .allMatch(i -> areAppTargetsSame(oldTargets.get(i), newTargets.get(i)));
+ }
+ }
+
+ /**
+ * Compares two targets for the properties which we care about
+ */
+ private static boolean areAppTargetsSame(AppTarget t1, AppTarget t2) {
+ if (!Objects.equals(t1.getPackageName(), t2.getPackageName())
+ || !Objects.equals(t1.getUser(), t2.getUser())
+ || !Objects.equals(t1.getClassName(), t2.getClassName())) {
+ return false;
+ }
+
+ ShortcutInfo s1 = t1.getShortcutInfo();
+ ShortcutInfo s2 = t2.getShortcutInfo();
+ if (s1 != null) {
+ if (s2 == null || !Objects.equals(s1.getId(), s2.getId())) {
+ return false;
+ }
+ } else if (s2 != null) {
+ return false;
+ }
+ return true;
+ }
+
+ private static class WorkspaceItemFactory implements PersistedItemArray.ItemFactory {
+
+ private final LauncherAppState mAppState;
+ private final UserManagerState mUMS;
+ private final Map<ShortcutKey, ShortcutInfo> mPinnedShortcuts;
+ private final int mMaxCount;
+
+ private int mReadCount = 0;
+
+ protected WorkspaceItemFactory(LauncherAppState appState, UserManagerState ums,
+ Map<ShortcutKey, ShortcutInfo> pinnedShortcuts, int maxCount) {
+ mAppState = appState;
+ mUMS = ums;
+ mPinnedShortcuts = pinnedShortcuts;
+ mMaxCount = maxCount;
+ }
+
+ @Nullable
+ @Override
+ public ItemInfo createInfo(int itemType, UserHandle user, Intent intent) {
+ if (mReadCount >= mMaxCount) {
+ return null;
+ }
+ switch (itemType) {
+ case ITEM_TYPE_APPLICATION: {
+ LauncherActivityInfo lai = mAppState.getContext()
+ .getSystemService(LauncherApps.class)
+ .resolveActivity(intent, user);
+ if (lai == null) {
+ return null;
+ }
+ AppInfo info = new AppInfo(lai, user, mUMS.isUserQuiet(user));
+ mAppState.getIconCache().getTitleAndIcon(info, lai, false);
+ mReadCount++;
+ return info.makeWorkspaceItem();
+ }
+ case ITEM_TYPE_DEEP_SHORTCUT: {
+ ShortcutKey key = ShortcutKey.fromIntent(intent, user);
+ if (key == null) {
+ return null;
+ }
+ ShortcutInfo si = mPinnedShortcuts.get(key);
+ if (si == null) {
+ return null;
+ }
+ WorkspaceItemInfo wii = new WorkspaceItemInfo(si, mAppState.getContext());
+ mAppState.getIconCache().getShortcutIcon(wii, si);
+ mReadCount++;
+ return wii;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
index 6e120e8..1b8e244 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
@@ -24,11 +24,13 @@
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
+import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
import android.util.FloatProperty;
@@ -63,6 +65,7 @@
float[] scaleAndOffset = state.getOverviewScaleAndOffset(mLauncher);
RECENTS_SCALE_PROPERTY.set(mRecentsView, scaleAndOffset[0]);
ADJACENT_PAGE_OFFSET.set(mRecentsView, scaleAndOffset[1]);
+ TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f);
getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0);
OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
@@ -97,6 +100,8 @@
config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR));
setter.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1],
config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR));
+ setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f,
+ config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0,
config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT));
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
rename to quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
rename to quickstep/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
similarity index 96%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
rename to quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index cf86cd5..d5d6fdd 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -30,6 +30,7 @@
import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
+import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
import android.content.Intent;
import android.content.res.Configuration;
@@ -59,7 +60,6 @@
import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory;
-import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController;
import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.NoButtonNavbarToOverviewTouchController;
@@ -79,6 +79,7 @@
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -171,6 +172,13 @@
}
@Override
+ protected void showAllAppsFromIntent(boolean alreadyOnHome) {
+ ActivityManagerWrapper.getInstance().closeSystemWindows(
+ CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY);
+ super.showAllAppsFromIntent(alreadyOnHome);
+ }
+
+ @Override
public void folderCreatedFromItem(Folder folder, WorkspaceItemInfo itemInfo) {
super.folderCreatedFromItem(folder, itemInfo);
if (mHotseatPredictionController != null) {
@@ -298,14 +306,7 @@
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "createTouchControllers.2");
}
- if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
- if (TestProtocol.sDebugTracing) {
- Log.d(TestProtocol.PAUSE_NOT_DETECTED, "createTouchControllers.3");
- }
- list.add(new NoButtonNavbarToOverviewTouchController(this));
- } else {
- list.add(new FlingAndHoldTouchController(this));
- }
+ list.add(new NoButtonNavbarToOverviewTouchController(this));
} else {
if (getDeviceProfile().isVerticalBarLayout()) {
list.add(new OverviewToAllAppsTouchController(this));
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
similarity index 88%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
rename to quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index 085b9b3..5ccc1e8 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -17,6 +17,7 @@
import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS;
import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
@@ -57,7 +58,7 @@
mRecentsView.updateEmptyMessage();
mRecentsView.resetTaskVisuals();
}
- setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state);
+ setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, new StateAnimationConfig(), state);
mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress());
}
@@ -75,17 +76,19 @@
AnimationSuccessListener.forRunnable(mRecentsView::resetTaskVisuals));
}
- setAlphas(builder, toState);
+ setAlphas(builder, config, toState);
builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS,
toState.getOverviewFullscreenProgress(), LINEAR);
}
- private void setAlphas(PropertySetter propertySetter, LauncherState state) {
+ private void setAlphas(PropertySetter propertySetter, StateAnimationConfig config,
+ LauncherState state) {
float buttonAlpha = (state.getVisibleElements(mLauncher) & OVERVIEW_BUTTONS) != 0 ? 1 : 0;
propertySetter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
buttonAlpha, LINEAR);
propertySetter.setFloat(mLauncher.getActionsView().getVisibilityAlpha(),
- MultiValueAlpha.VALUE, buttonAlpha, LINEAR);
+ MultiValueAlpha.VALUE, buttonAlpha, config.getInterpolator(
+ ANIM_OVERVIEW_ACTIONS_FADE, LINEAR));
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index e7cd393..bce73cd 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -16,8 +16,7 @@
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
-import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
+import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import android.content.Context;
@@ -25,7 +24,6 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
-import com.android.quickstep.SysUINavigationMode;
/**
* Definition for AllApps state
@@ -65,13 +63,7 @@
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
ScaleAndTranslation scaleAndTranslation = LauncherState.OVERVIEW
.getWorkspaceScaleAndTranslation(launcher);
- if (SysUINavigationMode.getMode(launcher) == NO_BUTTON && !ENABLE_OVERVIEW_ACTIONS.get()) {
- float normalScale = 1;
- // Scale down halfway to where we'd be in overview, to prepare for a potential pause.
- scaleAndTranslation.scale = (scaleAndTranslation.scale + normalScale) / 2;
- } else {
- scaleAndTranslation.scale = 1;
- }
+ scaleAndTranslation.scale = 1;
return scaleAndTranslation;
}
@@ -92,7 +84,8 @@
@Override
public float[] getOverviewScaleAndOffset(Launcher launcher) {
- return new float[] {0.9f, 0};
+ float offset = removeShelfFromOverview(launcher) ? 1 : 0;
+ return new float[] {0.9f, offset};
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
rename to quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
rename to quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
similarity index 94%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
rename to quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
index d174bfd..6ec114e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -16,7 +16,6 @@
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape;
@@ -65,7 +64,7 @@
public int getTransitionDuration(Context context) {
// In no-button mode, overview comes in all the way from the left, so give it more time.
boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(context).getMode() == NO_BUTTON;
- return isNoButtonMode && ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250;
+ return isNoButtonMode ? 380 : 250;
}
@Override
@@ -108,8 +107,7 @@
@Override
public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) {
- if (this == OVERVIEW && ENABLE_OVERVIEW_ACTIONS.get()
- && removeShelfFromOverview(launcher)) {
+ if (this == OVERVIEW && removeShelfFromOverview(launcher)) {
// Treat the QSB as part of the hotseat so they move together.
return getHotseatScaleAndTranslation(launcher);
}
@@ -129,7 +127,7 @@
@Override
public int getVisibleElements(Launcher launcher) {
RecentsView recentsView = launcher.getOverviewPanel();
- if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher) ||
+ if (removeShelfFromOverview(launcher) ||
hideShelfInTwoButtonLandscape(launcher, recentsView.getPagedOrientationHandler())) {
return OVERVIEW_BUTTONS;
} else if (launcher.getDeviceProfile().isVerticalBarLayout()) {
@@ -191,10 +189,6 @@
return new BackgroundAppState(id);
}
- public static OverviewState newPeekState(int id) {
- return new OverviewPeekState(id);
- }
-
public static OverviewState newSwitchState(int id) {
return new QuickSwitchState(id);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
rename to quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
similarity index 87%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
rename to quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
index 131fcbf..94af134 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
@@ -22,27 +22,24 @@
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.LauncherState.OVERVIEW_PEEK;
import static com.android.launcher3.WorkspaceStateTransitionAnimation.getSpringScaleAnimator;
import static com.android.launcher3.anim.Interpolators.ACCEL;
+import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
-import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS;
@@ -163,10 +160,15 @@
config.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL);
config.setInterpolator(ANIM_ALL_APPS_FADE, ACCEL);
config.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
- config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL);
- config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
- Workspace workspace = mActivity.getWorkspace();
+ config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL_DEACCEL);
+ if (SysUINavigationMode.getMode(mActivity) == NO_BUTTON) {
+ config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME);
+ } else {
+ config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
+ }
+
+ Workspace workspace = mActivity.getWorkspace();
// Start from a higher workspace scale, but only if we're invisible so we don't jump.
boolean isWorkspaceVisible = workspace.getVisibility() == VISIBLE;
if (isWorkspaceVisible) {
@@ -184,30 +186,23 @@
if (!isHotseatVisible) {
hotseat.setScaleX(0.92f);
hotseat.setScaleY(0.92f);
- if (ENABLE_OVERVIEW_ACTIONS.get()) {
- AllAppsContainerView qsbContainer = mActivity.getAppsView();
- View qsb = qsbContainer.getSearchView();
- boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0;
- if (!qsbVisible) {
- qsbContainer.setScaleX(0.92f);
- qsbContainer.setScaleY(0.92f);
- }
+ AllAppsContainerView qsbContainer = mActivity.getAppsView();
+ View qsb = qsbContainer.getSearchView();
+ boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0;
+ if (!qsbVisible) {
+ qsbContainer.setScaleX(0.92f);
+ qsbContainer.setScaleY(0.92f);
}
}
- } else if (toState == NORMAL && fromState == OVERVIEW_PEEK) {
- // Keep fully visible until the very end (when overview is offscreen) to make invisible.
- config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME);
- } else if (toState == OVERVIEW_PEEK && fromState == NORMAL) {
- config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT);
- config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7);
- config.setInterpolator(ANIM_OVERVIEW_SCRIM_FADE, FAST_OUT_SLOW_IN);
} else if ((fromState == NORMAL || fromState == HINT_STATE) && toState == OVERVIEW) {
if (SysUINavigationMode.getMode(mActivity) == NO_BUTTON) {
config.setInterpolator(ANIM_WORKSPACE_SCALE,
fromState == NORMAL ? ACCEL : OVERSHOOT_1_2);
config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
+ config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT);
} else {
config.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2);
+ config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
// Scale up the recents, if it is not coming from the side
RecentsView overview = mActivity.getOverviewPanel();
@@ -219,13 +214,11 @@
config.setInterpolator(ANIM_ALL_APPS_FADE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_DEPTH, OVERSHOOT_1_2);
- Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get()
- && removeShelfFromOverview(mActivity)
+ Interpolator translationInterpolator = removeShelfFromOverview(mActivity)
? OVERSHOOT_1_2
: OVERSHOOT_1_7;
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, translationInterpolator);
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, translationInterpolator);
- config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
} else if (fromState == HINT_STATE && toState == NORMAL) {
config.setInterpolator(ANIM_DEPTH, DEACCEL_3);
if (mHintToNormalDuration == -1) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
similarity index 89%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index e45fa9d..57fd11a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -19,13 +19,13 @@
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL_APPS_EDU;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
+import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_EDU;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
import static com.android.launcher3.touch.AbstractStateChangeTouchController.SUCCESS_TRANSITION_PROGRESS;
-import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import android.animation.ValueAnimator;
@@ -45,6 +45,7 @@
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.graphics.OverviewScrim;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.testing.TestProtocol;
@@ -52,7 +53,9 @@
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.TouchController;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.AssistantUtilities;
+import com.android.quickstep.util.OverviewToHomeAnim;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -63,6 +66,8 @@
SingleAxisSwipeDetector.Listener {
private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL_3;
+ // How much of the overview scrim we can remove during the transition.
+ private static final float OVERVIEW_TO_HOME_SCRIM_PROGRESS = 0.5f;
private final Launcher mLauncher;
private final SingleAxisSwipeDetector mSwipeDetector;
@@ -156,8 +161,13 @@
final PendingAnimation builder = new PendingAnimation(accuracy);
if (mStartState.overviewUi) {
RecentsView recentsView = mLauncher.getOverviewPanel();
- builder.setFloat(recentsView, ADJACENT_PAGE_OFFSET,
- -mPullbackDistance / recentsView.getPageOffsetScale(), PULLBACK_INTERPOLATOR);
+ AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher,
+ builder);
+ float endScrimAlpha = Utilities.mapRange(OVERVIEW_TO_HOME_SCRIM_PROGRESS,
+ mStartState.getOverviewScrimAlpha(mLauncher),
+ mEndState.getOverviewScrimAlpha(mLauncher));
+ builder.setFloat(mLauncher.getDragLayer().getOverviewScrim(),
+ OverviewScrim.SCRIM_PROGRESS, endScrimAlpha, PULLBACK_INTERPOLATOR);
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
builder.addOnFrameCallback(recentsView::redrawLiveTile);
}
@@ -211,8 +221,13 @@
recentsView.switchToScreenshot(null,
() -> recentsView.finishRecentsAnimation(true /* toRecents */, null));
}
- mLauncher.getStateManager().goToState(mEndState, true,
- () -> onSwipeInteractionCompleted(mEndState));
+ if (mStartState == OVERVIEW) {
+ new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(mEndState))
+ .animateWithVelocity(velocity);
+ } else {
+ mLauncher.getStateManager().goToState(mEndState, true,
+ () -> onSwipeInteractionCompleted(mEndState));
+ }
if (mStartState != mEndState) {
logStateChange(mStartState.containerType, logAction);
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
new file mode 100644
index 0000000..591d3ca
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
@@ -0,0 +1,334 @@
+/*
+ * Copyright (C) 2020 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.launcher3.uioverrides.touchcontrollers;
+
+import static com.android.launcher3.LauncherState.ALL_APPS;
+import static com.android.launcher3.LauncherState.HINT_STATE;
+import static com.android.launcher3.LauncherState.NORMAL;
+import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
+import static com.android.launcher3.anim.Interpolators.ACCEL;
+import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
+import static com.android.launcher3.anim.Interpolators.DEACCEL;
+import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_HEADER_FADE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
+import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
+
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
+import android.graphics.PointF;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.anim.AnimatorPlaybackController;
+import com.android.launcher3.anim.Interpolators;
+import com.android.launcher3.graphics.OverviewScrim;
+import com.android.launcher3.states.StateAnimationConfig;
+import com.android.launcher3.testing.TestProtocol;
+import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
+import com.android.launcher3.util.VibratorWrapper;
+import com.android.quickstep.SystemUiProxy;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
+import com.android.quickstep.util.MotionPauseDetector;
+import com.android.quickstep.util.OverviewToHomeAnim;
+import com.android.quickstep.views.RecentsView;
+
+/**
+ * Touch controller which handles swipe and hold from the nav bar to go to Overview. Swiping above
+ * the nav bar falls back to go to All Apps. Swiping from the nav bar without holding goes to the
+ * first home screen instead of to Overview.
+ */
+public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouchController {
+
+
+ // How much of the movement to use for translating overview after swipe and hold.
+ private static final float OVERVIEW_MOVEMENT_FACTOR = 0.25f;
+ private static final long TRANSLATION_ANIM_MIN_DURATION_MS = 80;
+ private static final float TRANSLATION_ANIM_VELOCITY_DP_PER_MS = 0.8f;
+
+ private final RecentsView mRecentsView;
+ private final MotionPauseDetector mMotionPauseDetector;
+ private final float mMotionPauseMinDisplacement;
+
+ private boolean mDidTouchStartInNavBar;
+ private boolean mReachedOverview;
+ // The last recorded displacement before we reached overview.
+ private PointF mStartDisplacement = new PointF();
+ private float mStartY;
+ private AnimatorPlaybackController mOverviewResistYAnim;
+
+ // Normal to Hint animation has flag SKIP_OVERVIEW, so we update this scrim with this animator.
+ private ObjectAnimator mNormalToHintOverviewScrimAnimator;
+
+ public NoButtonNavbarToOverviewTouchController(Launcher l) {
+ super(l, false /* allowDragToOverview */);
+ mRecentsView = l.getOverviewPanel();
+ mMotionPauseDetector = new MotionPauseDetector(l);
+ mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop();
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController.ctor");
+ }
+ }
+
+ @Override
+ protected boolean canInterceptTouch(MotionEvent ev) {
+ mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0;
+ return super.canInterceptTouch(ev);
+ }
+
+ @Override
+ protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
+ if (fromState == NORMAL && mDidTouchStartInNavBar) {
+ return HINT_STATE;
+ } else if (fromState == OVERVIEW && isDragTowardPositive) {
+ // Don't allow swiping up to all apps.
+ return OVERVIEW;
+ }
+ return super.getTargetState(fromState, isDragTowardPositive);
+ }
+
+ @Override
+ protected float initCurrentAnimation(int animComponents) {
+ float progressMultiplier = super.initCurrentAnimation(animComponents);
+ if (mToState == HINT_STATE) {
+ // Track the drag across the entire height of the screen.
+ progressMultiplier = -1 / getShiftRange();
+ }
+ return progressMultiplier;
+ }
+
+ @Override
+ public void onDragStart(boolean start, float startDisplacement) {
+ super.onDragStart(start, startDisplacement);
+
+ mMotionPauseDetector.clear();
+
+ if (handlingOverviewAnim()) {
+ mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseChanged);
+ }
+
+ if (mFromState == NORMAL && mToState == HINT_STATE) {
+ mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat(
+ mLauncher.getDragLayer().getOverviewScrim(),
+ OverviewScrim.SCRIM_PROGRESS,
+ mFromState.getOverviewScrimAlpha(mLauncher),
+ mToState.getOverviewScrimAlpha(mLauncher));
+ }
+ mReachedOverview = false;
+ mOverviewResistYAnim = null;
+ }
+
+ @Override
+ protected void updateProgress(float fraction) {
+ super.updateProgress(fraction);
+ if (mNormalToHintOverviewScrimAnimator != null) {
+ mNormalToHintOverviewScrimAnimator.setCurrentFraction(fraction);
+ }
+ }
+
+ @Override
+ public void onDragEnd(float velocity) {
+ if (mMotionPauseDetector.isPaused() && handlingOverviewAnim()) {
+ goToOverviewOrHomeOnDragEnd(velocity);
+ } else {
+ super.onDragEnd(velocity);
+ }
+
+ View searchView = mLauncher.getAppsView().getSearchView();
+ if (searchView instanceof FeedbackHandler) {
+ ((FeedbackHandler) searchView).resetFeedback();
+ }
+
+ mMotionPauseDetector.clear();
+ mNormalToHintOverviewScrimAnimator = null;
+ if (mLauncher.isInState(OVERVIEW)) {
+ // Normally we would cleanup the state based on mCurrentAnimation, but since we stop
+ // using that when we pause to go to Overview, we need to clean up ourselves.
+ clearState();
+ }
+ }
+
+ @Override
+ protected void updateSwipeCompleteAnimation(ValueAnimator animator, long expectedDuration,
+ LauncherState targetState, float velocity, boolean isFling) {
+ super.updateSwipeCompleteAnimation(animator, expectedDuration, targetState, velocity,
+ isFling);
+ if (targetState == HINT_STATE) {
+ // Normally we compute the duration based on the velocity and distance to the given
+ // state, but since the hint state tracks the entire screen without a clear endpoint, we
+ // need to manually set the duration to a reasonable value.
+ animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher));
+ }
+ }
+
+ private void onMotionPauseChanged(boolean isPaused) {
+ if (mCurrentAnimation == null) {
+ return;
+ }
+ mNormalToHintOverviewScrimAnimator = null;
+ mCurrentAnimation.dispatchOnCancelWithoutCancelRunnable(() -> {
+ mLauncher.getStateManager().goToState(OVERVIEW, true, () -> {
+ mOverviewResistYAnim = AnimatorControllerWithResistance
+ .createRecentsResistanceFromOverviewAnim(mLauncher, null)
+ .createPlaybackController();
+ mReachedOverview = true;
+ maybeSwipeInteractionToOverviewComplete();
+ });
+ });
+ VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC);
+ }
+
+ private void maybeSwipeInteractionToOverviewComplete() {
+ if (mReachedOverview && mDetector.isSettlingState()) {
+ onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE);
+ }
+ }
+
+ private boolean handlingOverviewAnim() {
+ int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags();
+ return mDidTouchStartInNavBar && mStartState == NORMAL
+ && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0;
+ }
+
+ @Override
+ public boolean onDrag(float yDisplacement, float xDisplacement, MotionEvent event) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController");
+ }
+ if (mMotionPauseDetector.isPaused()) {
+ if (!mReachedOverview) {
+ mStartDisplacement.set(xDisplacement, yDisplacement);
+ mStartY = event.getY();
+ } else {
+ mRecentsView.setTranslationX((xDisplacement - mStartDisplacement.x)
+ * OVERVIEW_MOVEMENT_FACTOR);
+ float yProgress = (mStartDisplacement.y - yDisplacement) / mStartY;
+ if (yProgress > 0 && mOverviewResistYAnim != null) {
+ mOverviewResistYAnim.setPlayFraction(yProgress);
+ } else {
+ mRecentsView.setTranslationY((yDisplacement - mStartDisplacement.y)
+ * OVERVIEW_MOVEMENT_FACTOR);
+ }
+ }
+ // Stay in Overview.
+ return true;
+ }
+
+ float upDisplacement = -yDisplacement;
+ mMotionPauseDetector.setDisallowPause(!handlingOverviewAnim()
+ || upDisplacement < mMotionPauseMinDisplacement);
+ mMotionPauseDetector.addPosition(event);
+
+ return super.onDrag(yDisplacement, xDisplacement, event);
+ }
+
+ private void goToOverviewOrHomeOnDragEnd(float velocity) {
+ float velocityDp = dpiFromPx(velocity);
+ boolean isFling = Math.abs(velocityDp) > 1;
+ boolean goToHomeInsteadOfOverview = isFling;
+ if (goToHomeInsteadOfOverview) {
+ new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL, Touch.FLING))
+ .animateWithVelocity(velocity);
+ }
+ if (mReachedOverview) {
+ float distanceDp = dpiFromPx(Math.max(
+ Math.abs(mRecentsView.getTranslationX()),
+ Math.abs(mRecentsView.getTranslationY())));
+ long duration = (long) Math.max(TRANSLATION_ANIM_MIN_DURATION_MS,
+ distanceDp / TRANSLATION_ANIM_VELOCITY_DP_PER_MS);
+ mRecentsView.animate()
+ .translationX(0)
+ .translationY(0)
+ .setInterpolator(ACCEL_DEACCEL)
+ .setDuration(duration)
+ .withEndAction(goToHomeInsteadOfOverview
+ ? null
+ : this::maybeSwipeInteractionToOverviewComplete);
+ if (!goToHomeInsteadOfOverview) {
+ // Return to normal properties for the overview state.
+ StateAnimationConfig config = new StateAnimationConfig();
+ config.duration = duration;
+ LauncherState state = mLauncher.getStateManager().getState();
+ mLauncher.getStateManager().createAtomicAnimation(state, state, config).start();
+ }
+ }
+ }
+
+ private float dpiFromPx(float pixels) {
+ return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics());
+ }
+
+ @Override
+ protected StateAnimationConfig getConfigForStates(
+ LauncherState fromState, LauncherState toState) {
+ if (fromState == NORMAL && toState == ALL_APPS) {
+ StateAnimationConfig builder = new StateAnimationConfig();
+ // Fade in prediction icons quickly, then rest of all apps after reaching overview.
+ float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher)
+ - OVERVIEW.getVerticalProgress(mLauncher);
+ builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
+ ACCEL,
+ 0,
+ ALL_APPS_CONTENT_FADE_THRESHOLD));
+ builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
+ ACCEL,
+ progressToReachOverview,
+ progressToReachOverview + ALL_APPS_CONTENT_FADE_THRESHOLD));
+
+ // Get workspace out of the way quickly, to prepare for potential pause.
+ builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3);
+ builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, DEACCEL_3);
+ builder.setInterpolator(ANIM_WORKSPACE_FADE, DEACCEL_3);
+ return builder;
+ } else if (fromState == ALL_APPS && toState == NORMAL) {
+ StateAnimationConfig builder = new StateAnimationConfig();
+ // Keep all apps/predictions opaque until the very end of the transition.
+ float progressToReachOverview = OVERVIEW.getVerticalProgress(mLauncher);
+ builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
+ DEACCEL,
+ progressToReachOverview - ALL_APPS_CONTENT_FADE_THRESHOLD,
+ progressToReachOverview));
+ builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
+ DEACCEL,
+ 1 - ALL_APPS_CONTENT_FADE_THRESHOLD,
+ 1));
+ return builder;
+ }
+ return super.getConfigForStates(fromState, toState);
+ }
+
+ /**
+ * Interface for views with feedback animation requiring reset
+ */
+ public interface FeedbackHandler {
+
+ /**
+ * reset searchWidget feedback
+ */
+ void resetFeedback();
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
similarity index 86%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
index 821ada4..4b0642f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
@@ -15,18 +15,15 @@
*/
package com.android.launcher3.uioverrides.touchcontrollers;
-import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS;
import static com.android.launcher3.LauncherState.QUICK_SWITCH;
import static com.android.launcher3.anim.AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD;
import static com.android.launcher3.anim.Interpolators.ACCEL_0_75;
-import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL_5;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
-import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEDOWN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEUP;
@@ -39,14 +36,12 @@
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT;
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP;
import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_PAUSE_TO_OVERVIEW_ANIM;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
-import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.CANCEL;
-import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE;
-import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
+import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import android.animation.Animator;
@@ -60,10 +55,8 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
-import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.OverviewScrim;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.states.StateAnimationConfig;
@@ -74,11 +67,11 @@
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.util.VibratorWrapper;
+import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.SystemUiProxy;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.MotionPauseDetector;
-import com.android.quickstep.util.ShelfPeekAnim;
-import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState;
import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.views.LauncherRecentsView;
@@ -90,16 +83,16 @@
BothAxesSwipeDetector.Listener, MotionPauseDetector.OnMotionPauseListener {
/** The minimum progress of the scale/translationY animation until drag end. */
- private static final float Y_ANIM_MIN_PROGRESS = 0.15f;
+ private static final float Y_ANIM_MIN_PROGRESS = 0.25f;
private static final Interpolator FADE_OUT_INTERPOLATOR = DEACCEL_5;
private static final Interpolator TRANSLATE_OUT_INTERPOLATOR = ACCEL_0_75;
- private static final Interpolator SCALE_DOWN_INTERPOLATOR = DEACCEL;
+ private static final Interpolator SCALE_DOWN_INTERPOLATOR = LINEAR;
private final BaseQuickstepLauncher mLauncher;
private final BothAxesSwipeDetector mSwipeDetector;
- private final ShelfPeekAnim mShelfPeekAnim;
private final float mXRange;
private final float mYRange;
+ private final float mMaxYProgress;
private final MotionPauseDetector mMotionPauseDetector;
private final float mMotionPauseMinDisplacement;
private final LauncherRecentsView mRecentsView;
@@ -113,16 +106,16 @@
// and the other two to set overview properties based on x and y progress.
private AnimatorPlaybackController mNonOverviewAnim;
private AnimatorPlaybackController mXOverviewAnim;
- private AnimatorPlaybackController mYOverviewAnim;
+ private AnimatedFloat mYOverviewAnim;
public NoButtonQuickSwitchTouchController(BaseQuickstepLauncher launcher) {
mLauncher = launcher;
mSwipeDetector = new BothAxesSwipeDetector(mLauncher, this);
- mShelfPeekAnim = mLauncher.getShelfPeekAnim();
mRecentsView = mLauncher.getOverviewPanel();
mXRange = mLauncher.getDeviceProfile().widthPx / 2f;
mYRange = LayoutUtils.getShelfTrackingDistance(
mLauncher, mLauncher.getDeviceProfile(), mRecentsView.getPagedOrientationHandler());
+ mMaxYProgress = mLauncher.getDeviceProfile().heightPx / mYRange;
mMotionPauseDetector = new MotionPauseDetector(mLauncher);
mMotionPauseMinDisplacement = mLauncher.getResources().getDimension(
R.dimen.motion_pause_detector_min_displacement_from_app);
@@ -187,25 +180,6 @@
@Override
public void onMotionPauseChanged(boolean isPaused) {
VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC);
-
- if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
- return;
- }
-
- ShelfAnimState shelfState = isPaused ? PEEK : HIDE;
- if (shelfState == PEEK) {
- // Some shelf elements (e.g. qsb) were hidden, but we need them visible when peeking.
- AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
- allAppsController.setAlphas(
- NORMAL, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER);
-
- if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) {
- // Hotseat was hidden, but we need it visible when peeking.
- mLauncher.getHotseat().setAlpha(1);
- }
- }
- mShelfPeekAnim.setShelfState(shelfState, ShelfPeekAnim.INTERPOLATOR,
- ShelfPeekAnim.DURATION);
}
private void setupAnimators() {
@@ -270,8 +244,18 @@
SCALE_DOWN_INTERPOLATOR);
yAnim.setFloat(mRecentsView, FULLSCREEN_PROGRESS,
toState.getOverviewFullscreenProgress(), SCALE_DOWN_INTERPOLATOR);
- mYOverviewAnim = yAnim.createPlaybackController();
- mYOverviewAnim.dispatchOnStart();
+ AnimatorPlaybackController yNormalController = yAnim.createPlaybackController();
+ AnimatorControllerWithResistance yAnimWithResistance = AnimatorControllerWithResistance
+ .createForRecents(yNormalController, mLauncher,
+ mRecentsView.getPagedViewOrientedState(), mLauncher.getDeviceProfile(),
+ mRecentsView, RECENTS_SCALE_PROPERTY, mRecentsView,
+ TASK_SECONDARY_TRANSLATION);
+ mYOverviewAnim = new AnimatedFloat(() -> {
+ if (mYOverviewAnim != null) {
+ yAnimWithResistance.setProgress(mYOverviewAnim.value, mMaxYProgress);
+ }
+ });
+ yNormalController.dispatchOnStart();
}
@Override
@@ -287,10 +271,6 @@
mIsHomeScreenVisible = FADE_OUT_INTERPOLATOR.getInterpolation(xProgress)
<= 1 - ALPHA_CUTOFF_THRESHOLD;
- if (wasHomeScreenVisible && !mIsHomeScreenVisible) {
- // Get the shelf all the way offscreen so it pops up when we decide to peek it.
- mShelfPeekAnim.setShelfState(HIDE, LINEAR, 0);
- }
// Only allow motion pause if the home screen is invisible, since some
// home screen elements will appear in the shelf on motion pause.
@@ -298,16 +278,11 @@
|| -displacement.y < mMotionPauseMinDisplacement);
mMotionPauseDetector.addPosition(ev);
- if (mIsHomeScreenVisible) {
- // Cancel the shelf anim so it doesn't clobber mNonOverviewAnim.
- mShelfPeekAnim.setShelfState(CANCEL, LINEAR, 0);
- }
-
if (mXOverviewAnim != null) {
mXOverviewAnim.setPlayFraction(xProgress);
}
if (mYOverviewAnim != null) {
- mYOverviewAnim.setPlayFraction(yProgress);
+ mYOverviewAnim.updateValue(yProgress);
}
return true;
}
@@ -354,9 +329,11 @@
} else if (verticalFling) {
targetState = velocity.y > 0 ? QUICK_SWITCH : NORMAL;
} else {
- // If user isn't flinging, just snap to the closest state based on x progress.
+ // If user isn't flinging, just snap to the closest state.
boolean passedHorizontalThreshold = mXOverviewAnim.getInterpolatedProgress() > 0.5f;
- targetState = passedHorizontalThreshold ? QUICK_SWITCH : NORMAL;
+ boolean passedVerticalThreshold = mYOverviewAnim.value > 1f;
+ targetState = passedHorizontalThreshold && !passedVerticalThreshold
+ ? QUICK_SWITCH : NORMAL;
}
// Animate the various components to the target state.
@@ -375,9 +352,9 @@
boolean flingUpToNormal = verticalFling && velocity.y < 0 && targetState == NORMAL;
- float yProgress = mYOverviewAnim.getProgressFraction();
+ float yProgress = mYOverviewAnim.value;
float startYProgress = Utilities.boundToRange(yProgress
- - velocity.y * getSingleFrameMs(mLauncher) / mYRange, 0f, 1f);
+ - velocity.y * getSingleFrameMs(mLauncher) / mYRange, 0f, mMaxYProgress);
final float endYProgress;
if (flingUpToNormal) {
endYProgress = 1;
@@ -387,12 +364,11 @@
} else {
endYProgress = 0;
}
- long yDuration = BaseSwipeDetector.calculateDuration(velocity.y,
- Math.abs(endYProgress - startYProgress));
- ValueAnimator yOverviewAnim = mYOverviewAnim.getAnimationPlayer();
- yOverviewAnim.setFloatValues(startYProgress, endYProgress);
+ float yDistanceToCover = Math.abs(endYProgress - startYProgress) * mYRange;
+ long yDuration = (long) (yDistanceToCover / Math.max(1f, Math.abs(velocity.y)));
+ ValueAnimator yOverviewAnim = mYOverviewAnim.animateToValue(startYProgress, endYProgress);
yOverviewAnim.setDuration(yDuration);
- mYOverviewAnim.dispatchOnStart();
+ mYOverviewAnim.updateValue(startYProgress);
ValueAnimator nonOverviewAnim = mNonOverviewAnim.getAnimationPlayer();
if (flingUpToNormal && !mIsHomeScreenVisible) {
@@ -457,9 +433,8 @@
mXOverviewAnim.getAnimationPlayer().cancel();
}
if (mYOverviewAnim != null) {
- mYOverviewAnim.getAnimationPlayer().cancel();
+ mYOverviewAnim.cancelAnimation();
}
- mShelfPeekAnim.setShelfState(ShelfAnimState.CANCEL, LINEAR, 0);
mMotionPauseDetector.clear();
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java
rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
index 20ee61d..1208c6c 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
@@ -24,7 +24,6 @@
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.LINEAR;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
@@ -142,6 +141,10 @@
Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS,
"PortraitStatesTouchController.getTargetState 1");
}
+ if (removeShelfFromOverview(mLauncher)) {
+ // Don't allow swiping down to overview.
+ return NORMAL;
+ }
return TouchInteractionService.isConnected() ?
mLauncher.getStateManager().getLastState() : NORMAL;
} else if (fromState == OVERVIEW) {
@@ -150,7 +153,7 @@
"PortraitStatesTouchController.getTargetState 2");
}
LauncherState positiveDragTarget = ALL_APPS;
- if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(mLauncher)) {
+ if (removeShelfFromOverview(mLauncher)) {
// Don't allow swiping up to all apps.
positiveDragTarget = OVERVIEW;
}
@@ -245,7 +248,7 @@
final StateAnimationConfig config = totalShift == 0 ? new StateAnimationConfig()
: getConfigForStates(mFromState, mToState);
- config.animFlags = updateAnimComponentsOnReinit(animFlags);
+ config.animFlags = animFlags;
config.duration = maxAccuracy;
cancelPendingAnim();
@@ -279,14 +282,6 @@
return 1 / totalShift;
}
- /**
- * Give subclasses the chance to update the animation when we re-initialize towards a new state.
- */
- @AnimationFlags
- protected int updateAnimComponentsOnReinit(@AnimationFlags int animComponents) {
- return animComponents;
- }
-
private void cancelPendingAnim() {
if (mPendingAnimation != null) {
mPendingAnimation.finish(false, Touch.SWIPE);
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
similarity index 94%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index fce019b..3586b4f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -24,6 +24,7 @@
import android.animation.AnimatorListenerAdapter;
import android.view.MotionEvent;
import android.view.View;
+import android.view.animation.Interpolator;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
@@ -205,14 +206,19 @@
long maxDuration = 2 * secondaryLayerDimension;
int verticalFactor = orientationHandler.getTaskDragDisplacementFactor(mIsRtl);
int secondaryTaskDimension = orientationHandler.getSecondaryDimension(mTaskBeingDragged);
+ // The interpolator controlling the most prominent visual movement. We use this to determine
+ // whether we passed SUCCESS_TRANSITION_PROGRESS.
+ final Interpolator currentInterpolator;
if (goingUp) {
+ currentInterpolator = Interpolators.LINEAR;
mPendingAnimation = mRecentsView.createTaskDismissAnimation(mTaskBeingDragged,
true /* animateTaskView */, true /* removeTask */, maxDuration);
mEndDisplacement = -secondaryTaskDimension;
} else {
+ currentInterpolator = Interpolators.ZOOM_IN;
mPendingAnimation = mRecentsView.createTaskLaunchAnimation(
- mTaskBeingDragged, maxDuration, Interpolators.ZOOM_IN);
+ mTaskBeingDragged, maxDuration, currentInterpolator);
// Since the thumbnail is what is filling the screen, based the end displacement on it.
View thumbnailView = mTaskBeingDragged.getThumbnail();
@@ -227,6 +233,9 @@
}
mCurrentAnimation = mPendingAnimation.createPlaybackController()
.setOnCancelRunnable(this::clearState);
+ // Setting this interpolator doesn't affect the visual motion, but is used to determine
+ // whether we successfully reached the target state in onDragEnd().
+ mCurrentAnimation.getTarget().setInterpolator(currentInterpolator);
onUserControlledAnimationCreated(mCurrentAnimation);
mCurrentAnimation.getTarget().addListener(this);
mCurrentAnimation.dispatchOnStart();
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
similarity index 94%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java
rename to quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 3a5c027..aaa2720 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -20,17 +20,15 @@
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
-import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
-import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_GESTURE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
@@ -42,13 +40,10 @@
import static com.android.quickstep.GestureState.STATE_END_TARGET_SET;
import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
-import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE;
-import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
import android.animation.Animator;
-import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.app.ActivityManager;
@@ -75,7 +70,6 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
-import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
@@ -93,10 +87,9 @@
import com.android.quickstep.inputconsumers.OverviewInputConsumer;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.ActivityInitListener;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.InputConsumerProxy;
import com.android.quickstep.util.RectFSpringAnim;
-import com.android.quickstep.util.ShelfPeekAnim;
-import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState;
import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.views.LiveTileOverlay;
@@ -207,15 +200,14 @@
// Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise
private RunningWindowAnim mRunningWindowAnim;
- private boolean mIsShelfPeeking;
+ private boolean mIsMotionPaused;
private boolean mContinuingLastGesture;
private ThumbnailData mTaskSnapshot;
// Used to control launcher components throughout the swipe gesture.
- private AnimatorPlaybackController mLauncherTransitionController;
- private boolean mHasLauncherTransitionControllerStarted;
+ private AnimatorControllerWithResistance mLauncherTransitionController;
private AnimationFactory mAnimationFactory = (t) -> { };
@@ -494,7 +486,9 @@
* Called when motion pause is detected
*/
public void onMotionPauseChanged(boolean isPaused) {
- setShelfState(isPaused ? PEEK : HIDE, ShelfPeekAnim.INTERPOLATOR, ShelfPeekAnim.DURATION);
+ mIsMotionPaused = isPaused;
+ maybeUpdateRecentsAttachedState();
+ performHapticFeedback();
}
public void maybeUpdateRecentsAttachedState() {
@@ -525,9 +519,23 @@
// The window is going away so make sure recents is always visible in this case.
recentsAttachedToAppWindow = true;
} else {
- recentsAttachedToAppWindow = mIsShelfPeeking || mIsLikelyToStartNewTask;
+ recentsAttachedToAppWindow = mIsMotionPaused || mIsLikelyToStartNewTask;
}
mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate);
+
+ // Reapply window transform throughout the attach animation, as the animation affects how
+ // much the window is bound by overscroll (vs moving freely).
+ if (animate) {
+ ValueAnimator reapplyWindowTransformAnim = ValueAnimator.ofFloat(0, 1);
+ reapplyWindowTransformAnim.addUpdateListener(anim -> {
+ if (mRunningWindowAnim == null) {
+ applyWindowTransform();
+ }
+ });
+ reapplyWindowTransformAnim.setDuration(RECENTS_ATTACH_DURATION).start();
+ } else {
+ applyWindowTransform();
+ }
}
public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) {
@@ -541,19 +549,6 @@
}
}
- @UiThread
- public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, long duration) {
- mAnimationFactory.setShelfState(shelfState, interpolator, duration);
- boolean wasShelfPeeking = mIsShelfPeeking;
- mIsShelfPeeking = shelfState == PEEK;
- if (mIsShelfPeeking != wasShelfPeeking) {
- maybeUpdateRecentsAttachedState();
- }
- if (shelfState.shouldPreformHaptic) {
- performHapticFeedback();
- }
- }
-
private void buildAnimationController() {
if (!canCreateNewOrUpdateExistingLauncherTransitionController()) {
return;
@@ -564,11 +559,11 @@
/**
* We don't want to change mLauncherTransitionController if mGestureState.getEndTarget() == HOME
- * (it has its own animation) or if we're already animating the current controller.
+ * (it has its own animation).
* @return Whether we can create the launcher controller or update its progress.
*/
private boolean canCreateNewOrUpdateExistingLauncherTransitionController() {
- return mGestureState.getEndTarget() != HOME && !mHasLauncherTransitionControllerStarted;
+ return mGestureState.getEndTarget() != HOME;
}
@Override
@@ -578,10 +573,9 @@
return result;
}
- private void onAnimatorPlaybackControllerCreated(AnimatorPlaybackController anim) {
+ private void onAnimatorPlaybackControllerCreated(AnimatorControllerWithResistance anim) {
mLauncherTransitionController = anim;
- mLauncherTransitionController.dispatchSetInterpolator(t -> t * mDragLengthFactor);
- mLauncherTransitionController.dispatchOnStart();
+ mLauncherTransitionController.getNormalController().dispatchOnStart();
updateLauncherTransitionProgress();
}
@@ -621,10 +615,7 @@
|| !canCreateNewOrUpdateExistingLauncherTransitionController()) {
return;
}
- // Normalize the progress to 0 to 1, as the animation controller will clamp it to that
- // anyway. The controller mimics the drag length factor by applying it to its interpolators.
- float progress = mCurrentShift.value / mDragLengthFactor;
- mLauncherTransitionController.setPlayFraction(progress);
+ mLauncherTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor);
}
/**
@@ -845,7 +836,7 @@
if (isCancel) {
endTarget = LAST_TASK;
} else if (mDeviceState.isFullyGesturalNavMode()) {
- if (mIsShelfPeeking) {
+ if (mIsMotionPaused) {
endTarget = RECENTS;
} else if (goingToNewTask) {
endTarget = NEW_TASK;
@@ -867,7 +858,7 @@
if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !willGoToNewTaskOnSwipeUp) {
endTarget = HOME;
- } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !mIsShelfPeeking) {
+ } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !mIsMotionPaused) {
// If swiping at a diagonal, base end target on the faster velocity.
endTarget = NEW_TASK;
} else if (isSwipeUp) {
@@ -935,7 +926,6 @@
mInputConsumerProxy.enable();
}
if (endTarget == HOME) {
- setShelfState(ShelfAnimState.CANCEL, LINEAR, 0);
duration = Math.max(MIN_OVERSHOOT_DURATION, duration);
} else if (endTarget == RECENTS) {
LiveTileOverlay.INSTANCE.startIconAnimation();
@@ -951,9 +941,6 @@
}
duration = Math.max(duration, mRecentsView.getScroller().getDuration());
}
- if (mDeviceState.isFullyGesturalNavMode()) {
- setShelfState(ShelfAnimState.OVERVIEW, interpolator, duration);
- }
}
// Let RecentsView handle the scrolling to the task, which we launch in startNewTask()
@@ -1052,6 +1039,7 @@
}
if (mGestureState.getEndTarget() == HOME) {
+ mTaskViewSimulator.setDrawsBelowRecents(false);
HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(duration);
RectFSpringAnim windowAnim = createWindowAnimationToHome(start, homeAnimFactory);
windowAnim.addAnimatorListener(new AnimationSuccessListener() {
@@ -1112,31 +1100,6 @@
windowAnim.start();
mRunningWindowAnim = RunningWindowAnim.wrap(windowAnim);
}
- // Always play the entire launcher animation when going home, since it is separate from
- // the animation that has been controlled thus far.
- if (mGestureState.getEndTarget() == HOME) {
- start = 0;
- }
-
- // We want to use the same interpolator as the window, but need to adjust it to
- // interpolate over the remaining progress (end - start).
- TimeInterpolator adjustedInterpolator = Interpolators.mapToProgress(
- interpolator, start, end);
- if (mLauncherTransitionController == null) {
- return;
- }
- if (start == end || duration <= 0) {
- mLauncherTransitionController.dispatchSetInterpolator(t -> end);
- } else {
- mLauncherTransitionController.dispatchSetInterpolator(adjustedInterpolator);
- }
- mLauncherTransitionController.getAnimationPlayer().setDuration(Math.max(0, duration));
-
- if (UNSTABLE_SPRINGS.get()) {
- mLauncherTransitionController.dispatchOnStart();
- }
- mLauncherTransitionController.getAnimationPlayer().start();
- mHasLauncherTransitionControllerStarted = true;
}
private void computeRecentsScrollIfInvisible() {
@@ -1261,10 +1224,6 @@
private void cancelCurrentAnimation() {
mCanceled = true;
mCurrentShift.cancelAnimation();
- if (mLauncherTransitionController != null && mLauncherTransitionController
- .getAnimationPlayer().isStarted()) {
- mLauncherTransitionController.getAnimationPlayer().cancel();
- }
}
private void invalidateHandler() {
@@ -1288,9 +1247,11 @@
}
private void endLauncherTransitionController() {
- setShelfState(ShelfAnimState.CANCEL, LINEAR, 0);
if (mLauncherTransitionController != null) {
- mLauncherTransitionController.getAnimationPlayer().end();
+ // End the animation, but stay at the same visual progress.
+ mLauncherTransitionController.getNormalController().dispatchSetInterpolator(
+ t -> Utilities.boundToRange(mCurrentShift.value, 0, 1));
+ mLauncherTransitionController.getNormalController().getAnimationPlayer().end();
mLauncherTransitionController = null;
}
}
@@ -1572,8 +1533,7 @@
*/
protected void applyWindowTransform() {
if (mWindowTransitionController != null) {
- float progress = mCurrentShift.value / mDragLengthFactor;
- mWindowTransitionController.setPlayFraction(progress);
+ mWindowTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor);
}
if (mRecentsAnimationTargets != null) {
if (mRecentsViewScrollLinked) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
similarity index 97%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
rename to quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index 9310685..55f5424 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -79,8 +79,8 @@
BaseActivityInterface.AnimationFactory factory = mActivityInterface.prepareRecentsUI(
mDeviceState,
wasVisible, (controller) -> {
- controller.dispatchOnStart();
- controller.getAnimationPlayer().end();
+ controller.getNormalController().dispatchOnStart();
+ controller.getNormalController().getAnimationPlayer().end();
});
factory.createActivityInterface(RECENTS_LAUNCH_DURATION);
factory.setRecentsAttachedToAppWindow(true, false);
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 9dc2132..8b108ac 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -18,7 +18,6 @@
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION;
import static com.android.quickstep.SysUINavigationMode.getMode;
import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape;
@@ -28,6 +27,7 @@
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
+import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
import android.animation.Animator;
import android.annotation.TargetApi;
@@ -36,7 +36,6 @@
import android.graphics.Rect;
import android.os.Build;
import android.view.MotionEvent;
-import android.view.animation.Interpolator;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
@@ -52,7 +51,7 @@
import com.android.launcher3.util.WindowBounds;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.util.ActivityInitListener;
-import com.android.quickstep.util.ShelfPeekAnim;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.SplitScreenBounds;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -106,7 +105,7 @@
public abstract void onAssistantVisibilityChanged(float visibility);
public abstract AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
- boolean activityVisible, Consumer<AnimatorPlaybackController> callback);
+ boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback);
public abstract ActivityInitListener createActivityInitListener(
Predicate<Boolean> onInitListener);
@@ -297,9 +296,6 @@
default void onTransitionCancelled() { }
- default void setShelfState(ShelfPeekAnim.ShelfAnimState animState,
- Interpolator interpolator, long duration) { }
-
/**
* @param attached Whether to show RecentsView alongside the app window. If false, recents
* will be hidden by some property we can animate, e.g. alpha.
@@ -312,11 +308,11 @@
protected final ACTIVITY_TYPE mActivity;
private final STATE_TYPE mStartState;
- private final Consumer<AnimatorPlaybackController> mCallback;
+ private final Consumer<AnimatorControllerWithResistance> mCallback;
private boolean mIsAttachedToWindow;
- DefaultAnimationFactory(Consumer<AnimatorPlaybackController> callback) {
+ DefaultAnimationFactory(Consumer<AnimatorControllerWithResistance> callback) {
mCallback = callback;
mActivity = getCreatedActivity();
@@ -344,7 +340,14 @@
controller.setEndAction(() -> mActivity.getStateManager().goToState(
controller.getInterpolatedProgress() > 0.5 ? mOverviewState : mBackgroundState,
false));
- mCallback.accept(controller);
+
+ RecentsView recentsView = mActivity.getOverviewPanel();
+ AnimatorControllerWithResistance controllerWithResistance =
+ AnimatorControllerWithResistance.createForRecents(controller, mActivity,
+ recentsView.getPagedViewOrientedState(), mActivity.getDeviceProfile(),
+ recentsView, RECENTS_SCALE_PROPERTY, recentsView,
+ TASK_SECONDARY_TRANSLATION);
+ mCallback.accept(controllerWithResistance);
// Creating the activity controller animation sometimes reapplies the launcher state
// (because we set the animation as the current state animation), so we reapply the
@@ -400,6 +403,6 @@
}
protected static boolean showOverviewActions(Context context) {
- return ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context);
+ return removeShelfFromOverview(context);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
similarity index 97%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
rename to quickstep/src/com/android/quickstep/FallbackActivityInterface.java
index d1da0c1..3898f0b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
@@ -27,11 +27,11 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
-import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.ActivityInitListener;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -84,7 +84,7 @@
/** 6 */
@Override
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
- boolean activityVisible, Consumer<AnimatorPlaybackController> callback) {
+ boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
DefaultAnimationFactory factory = new DefaultAnimationFactory(callback);
factory.initUI();
return factory;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java
rename to quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/ImageActionsApi.java b/quickstep/src/com/android/quickstep/ImageActionsApi.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/ImageActionsApi.java
rename to quickstep/src/com/android/quickstep/ImageActionsApi.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
similarity index 95%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
rename to quickstep/src/com/android/quickstep/LauncherActivityInterface.java
index 5a35eb5..036d473 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
@@ -27,7 +27,6 @@
import android.content.res.Resources;
import android.graphics.Rect;
import android.util.Log;
-import android.view.animation.Interpolator;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
@@ -39,7 +38,6 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.allapps.DiscoveryBounce;
-import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty;
@@ -49,8 +47,8 @@
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.util.ActivityInitListener;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.LayoutUtils;
-import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.plugins.shared.LauncherOverlayManager;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -118,16 +116,10 @@
@Override
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
- boolean activityVisible, Consumer<AnimatorPlaybackController> callback) {
+ boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
DefaultAnimationFactory factory = new DefaultAnimationFactory(callback) {
@Override
- public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator,
- long duration) {
- mActivity.getShelfPeekAnim().setShelfState(shelfState, interpolator, duration);
- }
-
- @Override
protected void createBackgroundToOverviewAnim(BaseQuickstepLauncher activity,
PendingAnimation pa) {
super.createBackgroundToOverviewAnim(activity, pa);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandlerV2.java
rename to quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
index b2bce0c..eb33f98 100644
--- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
+++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
@@ -37,7 +37,7 @@
import com.android.launcher3.R;
import com.android.launcher3.ResourceUtils;
import com.android.launcher3.testing.TestProtocol;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController.Info;
import java.io.PrintWriter;
@@ -85,7 +85,7 @@
* QUICKSTEP_ROTATION_UNINITIALIZED, then user has not tapped on an active nav region.
* Otherwise it will be the rotation of the display when the user first interacted with the
* active nav bar region.
- * The "session" ends when {@link #enableMultipleRegions(boolean, DefaultDisplay.Info)} is
+ * The "session" ends when {@link #enableMultipleRegions(boolean, Info)} is
* called - usually from a timeout or if user starts interacting w/ the foreground app.
*
* This is different than {@link #mLastRectTouched} as it can get reset by the system whereas
@@ -108,7 +108,7 @@
mNavBarGesturalHeight = getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE);
}
- private void refreshTouchRegion(DefaultDisplay.Info info, Resources newRes) {
+ private void refreshTouchRegion(Info info, Resources newRes) {
// Swipe touch regions are independent of nav mode, so we have to clear them explicitly
// here to avoid, for ex, a nav region for 2-button rotation 0 being used for 3-button mode
// It tries to cache and reuse swipe regions whenever possible based only on rotation
@@ -117,7 +117,7 @@
resetSwipeRegions(info);
}
- void setNavigationMode(SysUINavigationMode.Mode newMode, DefaultDisplay.Info info,
+ void setNavigationMode(SysUINavigationMode.Mode newMode, Info info,
Resources newRes) {
if (mMode == newMode) {
return;
@@ -126,7 +126,7 @@
refreshTouchRegion(info, newRes);
}
- void setGesturalHeight(int newGesturalHeight, DefaultDisplay.Info info, Resources newRes) {
+ void setGesturalHeight(int newGesturalHeight, Info info, Resources newRes) {
if (mNavBarGesturalHeight == newGesturalHeight) {
return;
}
@@ -140,9 +140,9 @@
* alongside other regions.
* Ok to call multiple times
*
- * @see #enableMultipleRegions(boolean, DefaultDisplay.Info)
+ * @see #enableMultipleRegions(boolean, Info)
*/
- void createOrAddTouchRegion(DefaultDisplay.Info info) {
+ void createOrAddTouchRegion(Info info) {
mCurrentDisplayRotation = info.rotation;
if (mQuickStepStartingRotation > QUICKSTEP_ROTATION_UNINITIALIZED
&& mCurrentDisplayRotation == mQuickStepStartingRotation) {
@@ -170,7 +170,7 @@
* @param enableMultipleRegions Set to true to start tracking multiple nav bar regions
* @param info The current displayInfo which will be the start of the quickswitch gesture
*/
- void enableMultipleRegions(boolean enableMultipleRegions, DefaultDisplay.Info info) {
+ void enableMultipleRegions(boolean enableMultipleRegions, Info info) {
mEnableMultipleRegions = enableMultipleRegions &&
mMode != SysUINavigationMode.Mode.TWO_BUTTONS;
if (mEnableMultipleRegions) {
@@ -191,7 +191,7 @@
*
* @param displayInfo The display whos rotation will be used as the current active rotation
*/
- void setSingleActiveRegion(DefaultDisplay.Info displayInfo) {
+ void setSingleActiveRegion(Info displayInfo) {
mActiveTouchRotation = displayInfo.rotation;
resetSwipeRegions(displayInfo);
}
@@ -202,7 +202,7 @@
* To be called whenever we want to stop tracking more than one swipe region.
* Ok to call multiple times.
*/
- private void resetSwipeRegions(DefaultDisplay.Info region) {
+ private void resetSwipeRegions(Info region) {
if (DEBUG) {
Log.d(TAG, "clearing all regions except rotation: " + mCurrentDisplayRotation);
}
@@ -226,7 +226,7 @@
}
}
- private OrientationRectF createRegionForDisplay(DefaultDisplay.Info display) {
+ private OrientationRectF createRegionForDisplay(Info display) {
if (DEBUG) {
Log.d(TAG, "creating rotation region for: " + mCurrentDisplayRotation);
}
diff --git a/quickstep/src/com/android/quickstep/OverscrollPluginFactory.java b/quickstep/src/com/android/quickstep/OverscrollPluginFactory.java
new file mode 100644
index 0000000..4c261ab
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/OverscrollPluginFactory.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 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.quickstep;
+
+import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
+
+import com.android.launcher3.R;
+import com.android.launcher3.util.MainThreadInitializedObject;
+import com.android.launcher3.util.ResourceBasedOverride;
+import com.android.systemui.plugins.OverscrollPlugin;
+
+/**
+ * Resource overrideable factory for forcing a local overscroll plugin.
+ * Override {@link R.string#overscroll_plugin_factory_class} to set a different class.
+ */
+public class OverscrollPluginFactory implements ResourceBasedOverride {
+ public static final MainThreadInitializedObject<OverscrollPluginFactory> INSTANCE = forOverride(
+ OverscrollPluginFactory.class,
+ R.string.overscroll_plugin_factory_class);
+
+ /**
+ * Get the plugin that is defined locally in launcher, as opposed to a dynamic side loaded one.
+ */
+ public OverscrollPlugin getLocalOverscrollPlugin() {
+ return null;
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java
rename to quickstep/src/com/android/quickstep/OverviewCommandHelper.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
similarity index 92%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
rename to quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index 5026f36..e4b8ce2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -53,12 +53,6 @@
Bundle::putInt, PortraitStatesTouchController::getHotseatTop);
}
- case TestProtocol.REQUEST_OVERVIEW_ACTIONS_ENABLED: {
- response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get());
- return response;
- }
-
case TestProtocol.REQUEST_OVERVIEW_SHARE_ENABLED: {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
FeatureFlags.ENABLE_OVERVIEW_SHARE.get());
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
rename to quickstep/src/com/android/quickstep/RecentsActivity.java
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 7168875..e9fc423 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -17,8 +17,8 @@
import static android.content.Intent.ACTION_USER_UNLOCKED;
-import static com.android.launcher3.util.DefaultDisplay.CHANGE_ALL;
-import static com.android.launcher3.util.DefaultDisplay.CHANGE_FRAME_DELAY;
+import static com.android.launcher3.util.DisplayController.DisplayHolder.CHANGE_ALL;
+import static com.android.launcher3.util.DisplayController.DisplayHolder.CHANGE_FRAME_DELAY;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS;
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
@@ -56,7 +56,10 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
+import com.android.launcher3.util.DisplayController.DisplayHolder;
+import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
+import com.android.launcher3.util.DisplayController.Info;
import com.android.launcher3.util.SecureSettingsObserver;
import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener;
import com.android.quickstep.SysUINavigationMode.OneHandedModeChangeListener;
@@ -76,14 +79,14 @@
*/
public class RecentsAnimationDeviceState implements
NavigationModeChangeListener,
- DefaultDisplay.DisplayInfoChangeListener,
+ DisplayInfoChangeListener,
OneHandedModeChangeListener {
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
private final Context mContext;
private final SysUINavigationMode mSysUiNavMode;
- private final DefaultDisplay mDefaultDisplay;
+ private final DisplayHolder mDisplayHolder;
private final int mDisplayId;
private final RotationTouchHelper mRotationTouchHelper;
@@ -98,6 +101,7 @@
private float mAssistantVisibility;
private boolean mIsOneHandedModeEnabled;
private boolean mIsSwipeToNotificationEnabled;
+ private final boolean mIsOneHandedModeSupported;
private boolean mIsUserUnlocked;
private final ArrayList<Runnable> mUserUnlockedActions = new ArrayList<>();
@@ -119,12 +123,17 @@
private boolean mIsUserSetupComplete;
public RecentsAnimationDeviceState(Context context) {
+ this(context, DisplayController.getDefaultDisplay(context));
+ }
+
+ public RecentsAnimationDeviceState(Context context, DisplayHolder displayHolder) {
mContext = context;
+ mDisplayHolder = displayHolder;
mSysUiNavMode = SysUINavigationMode.INSTANCE.get(context);
- mDefaultDisplay = DefaultDisplay.INSTANCE.get(context);
- mDisplayId = mDefaultDisplay.getInfo().id;
- runOnDestroy(() -> mDefaultDisplay.removeChangeListener(this));
- mRotationTouchHelper = new RotationTouchHelper(context);
+ mDisplayId = mDisplayHolder.getInfo().id;
+ mIsOneHandedModeSupported = SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false);
+ runOnDestroy(() -> mDisplayHolder.removeChangeListener(this));
+ mRotationTouchHelper = new RotationTouchHelper(context, mDisplayHolder);
runOnDestroy(mRotationTouchHelper::destroy);
// Register for user unlocked if necessary
@@ -167,7 +176,7 @@
}
}
- if (SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) {
+ if (mIsOneHandedModeSupported) {
SecureSettingsObserver oneHandedEnabledObserver =
SecureSettingsObserver.newOneHandedSettingsObserver(
mContext, enabled -> mIsOneHandedModeEnabled = enabled);
@@ -230,9 +239,9 @@
@Override
public void onNavigationModeChanged(SysUINavigationMode.Mode newMode) {
- mDefaultDisplay.removeChangeListener(this);
- mDefaultDisplay.addChangeListener(this);
- onDisplayInfoChanged(mDefaultDisplay.getInfo(), CHANGE_ALL);
+ mDisplayHolder.removeChangeListener(this);
+ mDisplayHolder.addChangeListener(this);
+ onDisplayInfoChanged(mDisplayHolder.getInfo(), CHANGE_ALL);
if (newMode == NO_BUTTON) {
mExclusionListener.register();
@@ -240,12 +249,12 @@
mExclusionListener.unregister();
}
- mNavBarPosition = new NavBarPosition(newMode, mDefaultDisplay.getInfo());
+ mNavBarPosition = new NavBarPosition(newMode, mDisplayHolder.getInfo());
mMode = newMode;
}
@Override
- public void onDisplayInfoChanged(DefaultDisplay.Info info, int flags) {
+ public void onDisplayInfoChanged(Info info, int flags) {
if (info.id != getDisplayId() || flags == CHANGE_FRAME_DELAY) {
// ignore displays that aren't running launcher and frame refresh rate changes
return;
@@ -522,19 +531,18 @@
* @return whether the given motion event can trigger the one handed mode.
*/
public boolean canTriggerOneHandedAction(MotionEvent ev) {
- if (!SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) {
+ if (!mIsOneHandedModeSupported) {
return false;
}
- if (!mIsOneHandedModeEnabled && !mIsSwipeToNotificationEnabled) {
- return false;
+ if (mIsOneHandedModeEnabled || mIsSwipeToNotificationEnabled) {
+ final Info displayInfo = mDisplayHolder.getInfo();
+ return (mRotationTouchHelper.touchInOneHandedModeRegion(ev)
+ && displayInfo.rotation != Surface.ROTATION_90
+ && displayInfo.rotation != Surface.ROTATION_270
+ && displayInfo.metrics.densityDpi < DisplayMetrics.DENSITY_600);
}
-
- final DefaultDisplay.Info displayInfo = mDefaultDisplay.getInfo();
- return (mRotationTouchHelper.touchInOneHandedModeRegion(ev)
- && displayInfo.rotation != Surface.ROTATION_90
- && displayInfo.rotation != Surface.ROTATION_270
- && displayInfo.metrics.densityDpi < DisplayMetrics.DENSITY_600);
+ return false;
}
public boolean isOneHandedModeEnabled() {
diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java
index 6f54ba2..6c302ae 100644
--- a/quickstep/src/com/android/quickstep/RecentsModel.java
+++ b/quickstep/src/com/android/quickstep/RecentsModel.java
@@ -160,9 +160,9 @@
@Override
public void onTaskRemoved(int taskId) {
- Task.TaskKey dummyKey = new Task.TaskKey(taskId, 0, null, null, 0, 0);
- mThumbnailCache.remove(dummyKey);
- mIconCache.onTaskRemoved(dummyKey);
+ Task.TaskKey stubKey = new Task.TaskKey(taskId, 0, null, null, 0, 0);
+ mThumbnailCache.remove(stubKey);
+ mIconCache.onTaskRemoved(stubKey);
}
public void onTrimMemory(int level) {
diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
index 2b5e42a..2cf3212 100644
--- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java
+++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
@@ -17,8 +17,8 @@
import static android.view.Surface.ROTATION_0;
-import static com.android.launcher3.util.DefaultDisplay.CHANGE_ALL;
-import static com.android.launcher3.util.DefaultDisplay.CHANGE_FRAME_DELAY;
+import static com.android.launcher3.util.DisplayController.DisplayHolder.CHANGE_ALL;
+import static com.android.launcher3.util.DisplayController.DisplayHolder.CHANGE_FRAME_DELAY;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS;
@@ -28,8 +28,9 @@
import android.view.OrientationEventListener;
import com.android.launcher3.testing.TestProtocol;
-import com.android.launcher3.util.DefaultDisplay;
-import com.android.launcher3.util.MainThreadInitializedObject;
+import com.android.launcher3.util.DisplayController.DisplayHolder;
+import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
+import com.android.launcher3.util.DisplayController.Info;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
@@ -40,10 +41,10 @@
public class RotationTouchHelper implements
SysUINavigationMode.NavigationModeChangeListener,
- DefaultDisplay.DisplayInfoChangeListener {
+ DisplayInfoChangeListener {
private final OrientationTouchTransformer mOrientationTouchTransformer;
- private final DefaultDisplay mDefaultDisplay;
+ private final DisplayHolder mDisplayHolder;
private final SysUINavigationMode mSysUiNavMode;
private final int mDisplayId;
private int mDisplayRotation;
@@ -120,12 +121,12 @@
private final Context mContext;
- public RotationTouchHelper(Context context) {
+ public RotationTouchHelper(Context context, DisplayHolder displayHolder) {
mContext = context;
+ mDisplayHolder = displayHolder;
Resources resources = mContext.getResources();
mSysUiNavMode = SysUINavigationMode.INSTANCE.get(context);
- mDefaultDisplay = DefaultDisplay.INSTANCE.get(context);
- mDisplayId = mDefaultDisplay.getInfo().id;
+ mDisplayId = mDisplayHolder.getInfo().id;
mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode,
() -> QuickStepContract.getWindowCornerRadius(resources));
@@ -200,7 +201,7 @@
return;
}
- mOrientationTouchTransformer.createOrAddTouchRegion(mDefaultDisplay.getInfo());
+ mOrientationTouchTransformer.createOrAddTouchRegion(mDisplayHolder.getInfo());
}
/**
@@ -222,11 +223,11 @@
@Override
public void onNavigationModeChanged(SysUINavigationMode.Mode newMode) {
- mDefaultDisplay.removeChangeListener(this);
- mDefaultDisplay.addChangeListener(this);
- onDisplayInfoChanged(mDefaultDisplay.getInfo(), CHANGE_ALL);
+ mDisplayHolder.removeChangeListener(this);
+ mDisplayHolder.addChangeListener(this);
+ onDisplayInfoChanged(mDisplayHolder.getInfo(), CHANGE_ALL);
- mOrientationTouchTransformer.setNavigationMode(newMode, mDefaultDisplay.getInfo(),
+ mOrientationTouchTransformer.setNavigationMode(newMode, mDisplayHolder.getInfo(),
mContext.getResources());
if (!mMode.hasGestures && newMode.hasGestures) {
setupOrientationSwipeHandler();
@@ -242,7 +243,7 @@
}
@Override
- public void onDisplayInfoChanged(DefaultDisplay.Info info, int flags) {
+ public void onDisplayInfoChanged(Info info, int flags) {
if (info.id != mDisplayId|| flags == CHANGE_FRAME_DELAY) {
// ignore displays that aren't running launcher and frame refresh rate changes
return;
@@ -275,7 +276,7 @@
* Sets the gestural height.
*/
void setGesturalHeight(int newGesturalHeight) {
- mOrientationTouchTransformer.setGesturalHeight(newGesturalHeight, mDefaultDisplay.getInfo(),
+ mOrientationTouchTransformer.setGesturalHeight(newGesturalHeight, mDisplayHolder.getInfo(),
mContext.getResources());
}
@@ -292,7 +293,7 @@
}
private void enableMultipleRegions(boolean enable) {
- mOrientationTouchTransformer.enableMultipleRegions(enable, mDefaultDisplay.getInfo());
+ mOrientationTouchTransformer.enableMultipleRegions(enable, mDisplayHolder.getInfo());
notifySysuiOfCurrentRotation(mOrientationTouchTransformer.getQuickStepStartingRotation());
if (enable && !mInOverview && !TestProtocol.sDisableSensorRotation) {
// Clear any previous state from sensor manager
@@ -355,7 +356,7 @@
* notifies system UI of the primary rotation the user is interacting with
*/
private void toggleSecondaryNavBarsForRotation() {
- mOrientationTouchTransformer.setSingleActiveRegion(mDefaultDisplay.getInfo());
+ mOrientationTouchTransformer.setSingleActiveRegion(mDisplayHolder.getInfo());
notifySysuiOfCurrentRotation(mOrientationTouchTransformer.getCurrentActiveRotation());
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java
similarity index 87%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java
rename to quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java
index e54a21c..b6eaa1c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java
+++ b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java
@@ -16,7 +16,7 @@
package com.android.quickstep;
import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
-import static com.android.launcher3.anim.Interpolators.DEACCEL;
+import static com.android.launcher3.anim.Interpolators.LINEAR;
import android.animation.Animator;
import android.content.Context;
@@ -24,7 +24,6 @@
import android.graphics.Matrix.ScaleToFit;
import android.graphics.Rect;
import android.graphics.RectF;
-import android.view.animation.Interpolator;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
@@ -35,6 +34,7 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.touch.PagedOrientationHandler;
+import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.TaskViewSimulator;
import com.android.quickstep.util.TransformParams;
@@ -45,7 +45,6 @@
public abstract class SwipeUpAnimationLogic {
protected static final Rect TEMP_RECT = new Rect();
- private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL;
protected DeviceProfile mDp;
@@ -66,12 +65,8 @@
protected int mTransitionDragLength;
// How much further we can drag past recents, as a factor of mTransitionDragLength.
protected float mDragLengthFactor = 1;
- // Start resisting when swiping past this factor of mTransitionDragLength.
- private float mDragLengthFactorStartPullback = 1f;
- // This is how far down we can scale down, where 0f is full screen and 1f is recents.
- private float mDragLengthFactorMaxPullback = 1f;
- protected AnimatorPlaybackController mWindowTransitionController;
+ protected AnimatorControllerWithResistance mWindowTransitionController;
public SwipeUpAnimationLogic(Context context, RecentsAnimationDeviceState deviceState,
GestureState gestureState, TransformParams transformParams) {
@@ -84,6 +79,7 @@
mTaskViewSimulator.setLayoutRotation(
mDeviceState.getRotationTouchHelper().getCurrentActiveRotation(),
mDeviceState.getRotationTouchHelper().getDisplayRotation());
+ mTaskViewSimulator.setDrawsBelowRecents(true);
}
protected void initTransitionEndpoints(DeviceProfile dp) {
@@ -97,19 +93,17 @@
if (mDeviceState.isFullyGesturalNavMode()) {
// We can drag all the way to the top of the screen.
mDragLengthFactor = (float) dp.heightPx / mTransitionDragLength;
-
- float startScale = mTaskViewSimulator.getFullScreenScale();
- // Start pulling back when RecentsView scale is 0.75f, and let it go down to 0.5f.
- mDragLengthFactorStartPullback = (0.75f - startScale) / (1 - startScale);
- mDragLengthFactorMaxPullback = (0.5f - startScale) / (1 - startScale);
} else {
- mDragLengthFactor = 1;
- mDragLengthFactorStartPullback = mDragLengthFactorMaxPullback = 1;
+ mDragLengthFactor = 1 + AnimatorControllerWithResistance.TWO_BUTTON_EXTRA_DRAG_FACTOR;
}
PendingAnimation pa = new PendingAnimation(mTransitionDragLength * 2);
- mTaskViewSimulator.addAppToOverviewAnim(pa, t -> t * mDragLengthFactor);
- mWindowTransitionController = pa.createPlaybackController();
+ mTaskViewSimulator.addAppToOverviewAnim(pa, LINEAR);
+ AnimatorPlaybackController normalController = pa.createPlaybackController();
+ mWindowTransitionController = AnimatorControllerWithResistance.createForRecents(
+ normalController, mContext, mTaskViewSimulator.getOrientationState(),
+ mDp, mTaskViewSimulator.recentsViewScale, AnimatedFloat.VALUE,
+ mTaskViewSimulator.recentsViewSecondaryTranslation, AnimatedFloat.VALUE);
}
@UiThread
@@ -122,13 +116,6 @@
} else {
float translation = Math.max(displacement, 0);
shift = mTransitionDragLength == 0 ? 0 : translation / mTransitionDragLength;
- if (shift > mDragLengthFactorStartPullback) {
- float pullbackProgress = Utilities.getProgress(shift,
- mDragLengthFactorStartPullback, mDragLengthFactor);
- pullbackProgress = PULLBACK_INTERPOLATOR.getInterpolation(pullbackProgress);
- shift = mDragLengthFactorStartPullback + pullbackProgress
- * (mDragLengthFactorMaxPullback - mDragLengthFactorStartPullback);
- }
}
mCurrentShift.updateValue(shift);
@@ -183,7 +170,7 @@
HomeAnimationFactory homeAnimationFactory) {
final RectF targetRect = homeAnimationFactory.getWindowTargetRect();
- mWindowTransitionController.setPlayFraction(startProgress / mDragLengthFactor);
+ mCurrentShift.updateValue(startProgress);
mTaskViewSimulator.apply(mTransformParams.setProgress(startProgress));
RectF cropRectF = new RectF(mTaskViewSimulator.getCurrentCropRect());
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
similarity index 87%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
rename to quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index db512fa..3a47024 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -18,7 +18,7 @@
import static android.view.Surface.ROTATION_0;
-import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.quickstep.views.OverviewActionsView.DISABLED_NO_THUMBNAIL;
import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED;
@@ -39,13 +39,12 @@
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
-import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.ResourceBasedOverride;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.views.OverviewActionsView;
+import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskThumbnailView;
import com.android.quickstep.views.TaskView;
-import com.android.systemui.plugins.OverscrollPlugin;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -91,20 +90,22 @@
return shortcuts;
}
- public static final MainThreadInitializedObject<TaskOverlayFactory> INSTANCE =
- forOverride(TaskOverlayFactory.class, R.string.task_overlay_factory_class);
-
- /**
- * @return a launcher-provided OverscrollPlugin if available, otherwise null
- */
- public OverscrollPlugin getLocalOverscrollPlugin() {
- return null;
- }
-
public TaskOverlay createOverlay(TaskThumbnailView thumbnailView) {
return new TaskOverlay(thumbnailView);
}
+ /**
+ * Subclasses can attach any system listeners in this method, must be paired with
+ * {@link #removeListeners()}
+ */
+ public void initListeners() { }
+
+ /**
+ * Subclasses should remove any system listeners in this method, must be paired with
+ * {@link #initListeners()}
+ */
+ public void removeListeners() { }
+
/** Note that these will be shown in order from top to bottom, if available for the task. */
private static final TaskShortcutFactory[] MENU_OPTIONS = new TaskShortcutFactory[]{
TaskShortcutFactory.APP_INFO,
@@ -156,6 +157,7 @@
getActionsView().setCallbacks(new OverlayUICallbacks() {
@Override
public void onShare() {
+ endLiveTileMode(isAllowedByPolicy);
if (isAllowedByPolicy) {
mImageApi.startShareActivity();
} else {
@@ -166,6 +168,7 @@
@SuppressLint("NewApi")
@Override
public void onScreenshot() {
+ endLiveTileMode(isAllowedByPolicy);
saveScreenshot(task);
}
});
@@ -173,6 +176,23 @@
}
/**
+ * End rendering live tile in Overview.
+ *
+ * @param showScreenshot if it's true, we take a screenshot and switch to it.
+ */
+ public void endLiveTileMode(boolean showScreenshot) {
+ if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
+ RecentsView recentsView = mThumbnailView.getTaskView().getRecentsView();
+ if (showScreenshot) {
+ recentsView.switchToScreenshot(
+ () -> recentsView.finishRecentsAnimation(true /* toRecents */, null));
+ } else {
+ recentsView.finishRecentsAnimation(true /* toRecents */, null);
+ }
+ }
+ }
+
+ /**
* Called to save screenshot of the task thumbnail.
*/
@SuppressLint("NewApi")
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
similarity index 96%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java
rename to quickstep/src/com/android/quickstep/TaskShortcutFactory.java
index ff051b6..3b245b3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
@@ -18,7 +18,6 @@
import static android.view.Display.DEFAULT_DISPLAY;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SELECTIONS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP;
@@ -310,16 +309,11 @@
TaskShortcutFactory WELLBEING = (activity, view) ->
WellbeingModel.SHORTCUT_FACTORY.getShortcut(activity, view.getItemInfo());
- TaskShortcutFactory SCREENSHOT = (activity, tv) -> {
- if (ENABLE_OVERVIEW_ACTIONS.get()) {
- return tv.getThumbnail().getTaskOverlay()
- .getScreenshotShortcut(activity, tv.getItemInfo());
- }
- return null;
- };
+ TaskShortcutFactory SCREENSHOT = (activity, tv) -> tv.getThumbnail().getTaskOverlay()
+ .getScreenshotShortcut(activity, tv.getItemInfo());
TaskShortcutFactory MODAL = (activity, tv) -> {
- if (ENABLE_OVERVIEW_ACTIONS.get() && ENABLE_OVERVIEW_SELECTIONS.get()) {
+ if (ENABLE_OVERVIEW_SELECTIONS.get()) {
return tv.getThumbnail().getTaskOverlay().getModalStateSystemShortcut(tv.getItemInfo());
}
return null;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
similarity index 98%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java
rename to quickstep/src/com/android/quickstep/TaskViewUtils.java
index e2e25f3..a5af181 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -41,7 +41,7 @@
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.statehandlers.DepthController;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.util.TaskViewSimulator;
import com.android.quickstep.util.TransformParams;
@@ -146,7 +146,7 @@
DeviceProfile dp = BaseActivity.fromContext(context).getDeviceProfile();
// RecentsView never updates the display rotation until swipe-up so the value may be stale.
// Use the display value instead.
- int displayRotation = DefaultDisplay.INSTANCE.get(context).getInfo().rotation;
+ int displayRotation = DisplayController.getDefaultDisplay(context).getInfo().rotation;
TaskViewSimulator topMostSimulator = null;
if (targets.apps.length > 0) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
similarity index 96%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
rename to quickstep/src/com/android/quickstep/TouchInteractionService.java
index 9d16f0e..f0e78b9 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -101,24 +101,6 @@
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Wrapper around a list for processing arguments.
- */
-class ArgList extends LinkedList<String> {
- public ArgList(List<String> l) {
- super(l);
- }
-
- public String peekArg() {
- return peekFirst();
- }
-
- public String nextArg() {
- return pollFirst().toLowerCase();
- }
-}
/**
* Service connected by system-UI for handling touch interaction.
@@ -238,23 +220,6 @@
WindowBounds wb = new WindowBounds(bounds, insets);
MAIN_EXECUTOR.execute(() -> SplitScreenBounds.INSTANCE.setSecondaryWindowBounds(wb));
}
-
- /** Deprecated methods **/
- public void onQuickStep(MotionEvent motionEvent) { }
-
- public void onQuickScrubEnd() { }
-
- public void onQuickScrubProgress(float progress) { }
-
- public void onQuickScrubStart() { }
-
- public void onPreMotionEvent(int downHitTarget) { }
-
- public void onMotionEvent(MotionEvent ev) {
- ev.recycle();
- }
-
- public void onBind(ISystemUiProxy iSystemUiProxy) { }
};
private static boolean sConnected = false;
@@ -616,9 +581,8 @@
if (FeatureFlags.ENABLE_QUICK_CAPTURE_GESTURE.get()) {
OverscrollPlugin plugin = null;
if (FeatureFlags.FORCE_LOCAL_OVERSCROLL_PLUGIN.get()) {
- TaskOverlayFactory factory =
- TaskOverlayFactory.INSTANCE.get(getApplicationContext());
- plugin = factory.getLocalOverscrollPlugin(); // may be null
+ plugin = OverscrollPluginFactory.INSTANCE.get(
+ getApplicationContext()).getLocalOverscrollPlugin();
}
// If not local plugin was forced, use the actual overscroll plugin if available.
@@ -842,10 +806,10 @@
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] rawArgs) {
if (rawArgs.length > 0 && Utilities.IS_DEBUG_DEVICE) {
- ArgList args = new ArgList(Arrays.asList(rawArgs));
- switch (args.nextArg()) {
+ LinkedList<String> args = new LinkedList(Arrays.asList(rawArgs));
+ switch (args.pollFirst()) {
case "cmd":
- if (args.peekArg() == null) {
+ if (args.peekFirst() == null) {
printAvailableCommands(pw);
} else {
onCommand(pw, args);
@@ -886,8 +850,8 @@
pw.println(" clear-touch-log: Clears the touch interaction log");
}
- private void onCommand(PrintWriter pw, ArgList args) {
- switch (args.nextArg()) {
+ private void onCommand(PrintWriter pw, LinkedList<String> args) {
+ switch (args.pollFirst()) {
case "clear-touch-log":
ActiveGestureLog.INSTANCE.clear();
break;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/ViewUtils.java b/quickstep/src/com/android/quickstep/ViewUtils.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/ViewUtils.java
rename to quickstep/src/com/android/quickstep/ViewUtils.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java b/quickstep/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java
similarity index 95%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java
rename to quickstep/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java
index be3fdde..a4a7bd3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java
@@ -21,7 +21,7 @@
import androidx.annotation.Nullable;
import com.android.launcher3.Utilities;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.SysUINavigationMode;
@@ -43,7 +43,7 @@
SysUINavigationMode.Mode sysUINavigationMode = SysUINavigationMode.getMode(mActivity);
if (sysUINavigationMode == SysUINavigationMode.Mode.NO_BUTTON) {
NavBarPosition navBarPosition = new NavBarPosition(sysUINavigationMode,
- DefaultDisplay.INSTANCE.get(mActivity).getInfo());
+ DisplayController.getDefaultDisplay(mActivity).getInfo());
mTriggerSwipeUpTracker = new TriggerSwipeUpTouchTracker(mActivity,
true /* disableHorizontalSwipe */, navBarPosition,
null /* onInterceptTouch */, this);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
similarity index 92%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
rename to quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
index 163c232..24a7610 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
@@ -19,6 +19,7 @@
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
@@ -26,6 +27,7 @@
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
+import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
@@ -86,6 +88,8 @@
config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR));
setter.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1],
config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR));
+ setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f,
+ config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
setter.setFloat(mRecentsView, TASK_MODALNESS, state.getOverviewModalness(),
config.getInterpolator(ANIM_OVERVIEW_MODAL, LINEAR));
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
similarity index 94%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
rename to quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
index a946304..f5f5259 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -101,20 +101,20 @@
}
@Override
- protected boolean shouldAddDummyTaskView(RunningTaskInfo runningTaskInfo) {
+ protected boolean shouldAddStubTaskView(RunningTaskInfo runningTaskInfo) {
if (mHomeTaskInfo != null && runningTaskInfo != null &&
mHomeTaskInfo.taskId == runningTaskInfo.taskId
&& getTaskViewCount() == 0) {
- // Do not add a dummy task if we are running over home with empty recents, so that we
- // show the empty recents message instead of showing a dummy task and later removing it.
+ // Do not add a stub task if we are running over home with empty recents, so that we
+ // show the empty recents message instead of showing a stub task and later removing it.
return false;
}
- return super.shouldAddDummyTaskView(runningTaskInfo);
+ return super.shouldAddStubTaskView(runningTaskInfo);
}
@Override
protected void applyLoadPlan(ArrayList<Task> tasks) {
- // When quick-switching on 3p-launcher, we add a "dummy" tile corresponding to Launcher
+ // When quick-switching on 3p-launcher, we add a "stub" tile corresponding to Launcher
// as well. This tile is never shown as we have setCurrentTaskHidden, but allows use to
// track the index of the next task appropriately, as if we are switching on any other app.
if (mHomeTaskInfo != null && mHomeTaskInfo.taskId == mRunningTaskId && !tasks.isEmpty()) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsDragLayer.java b/quickstep/src/com/android/quickstep/fallback/RecentsDragLayer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsDragLayer.java
rename to quickstep/src/com/android/quickstep/fallback/RecentsDragLayer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsState.java b/quickstep/src/com/android/quickstep/fallback/RecentsState.java
similarity index 99%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsState.java
rename to quickstep/src/com/android/quickstep/fallback/RecentsState.java
index 211a30c..f15a9de 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsState.java
+++ b/quickstep/src/com/android/quickstep/fallback/RecentsState.java
@@ -90,7 +90,6 @@
return new float[] { NO_SCALE, NO_OFFSET };
}
-
private static class ModalState extends RecentsState {
public ModalState(int id, int flags) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsTaskController.java b/quickstep/src/com/android/quickstep/fallback/RecentsTaskController.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsTaskController.java
rename to quickstep/src/com/android/quickstep/fallback/RecentsTaskController.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AccessibilityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/AccessibilityInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AccessibilityInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/AccessibilityInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
similarity index 97%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
index db1948b..584ff28 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
@@ -41,7 +41,7 @@
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
@@ -60,7 +60,7 @@
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams.Builder;
/**
- * A dummy input consumer used when the device is still locked, e.g. from secure camera.
+ * A placeholder input consumer used when the device is still locked, e.g. from secure camera.
*/
public class DeviceLockedInputConsumer implements InputConsumer,
RecentsAnimationCallbacks.RecentsAnimationListener, BuilderProxy {
@@ -115,7 +115,7 @@
R.dimen.device_locked_y_offset);
// Do not use DeviceProfile as the user data might be locked
- mDisplaySize = DefaultDisplay.INSTANCE.get(context).getInfo().realSize;
+ mDisplaySize = DisplayController.getDefaultDisplay(context).getInfo().realSize;
// Init states
mStateCallback = new MultiStateCallback(STATE_NAMES);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/SysUiOverlayInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/SysUiOverlayInputConsumer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/SysUiOverlayInputConsumer.java
rename to quickstep/src/com/android/quickstep/inputconsumers/SysUiOverlayInputConsumer.java
diff --git a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
index 044e010..865b66e 100644
--- a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
@@ -16,7 +16,7 @@
package com.android.quickstep.interaction;
import static com.android.launcher3.anim.Interpolators.ACCEL;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.quickstep.AbsSwipeUpHandler.MAX_SWIPE_DURATION;
import static com.android.quickstep.interaction.TutorialController.TutorialType.HOME_NAVIGATION_COMPLETE;
@@ -184,8 +184,7 @@
@Override
public void updateFinalShift() {
- float progress = mCurrentShift.value / mDragLengthFactor;
- mWindowTransitionController.setPlayFraction(progress);
+ mWindowTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor);
mTaskViewSimulator.apply(mTransformParams);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ActiveGestureLog.java b/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/ActiveGestureLog.java
rename to quickstep/src/com/android/quickstep/util/ActiveGestureLog.java
diff --git a/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java
new file mode 100644
index 0000000..a19a67c
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2020 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.quickstep.util;
+
+import static com.android.launcher3.anim.Interpolators.DEACCEL;
+import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
+import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
+import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
+
+import android.animation.TimeInterpolator;
+import android.content.Context;
+import android.graphics.Matrix;
+import android.graphics.PointF;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.util.FloatProperty;
+
+import androidx.annotation.Nullable;
+
+import com.android.launcher3.BaseDraggingActivity;
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.anim.AnimatorPlaybackController;
+import com.android.launcher3.anim.PendingAnimation;
+import com.android.quickstep.LauncherActivityInterface;
+import com.android.quickstep.SysUINavigationMode;
+import com.android.quickstep.views.RecentsView;
+
+/**
+ * Controls an animation that can go beyond progress = 1, at which point resistance should be
+ * applied. Internally, this is a wrapper around 2 {@link AnimatorPlaybackController}s, one that
+ * runs from progress 0 to 1 like normal, then one that seamlessly continues that animation but
+ * starts applying resistance as well.
+ */
+public class AnimatorControllerWithResistance {
+
+ /**
+ * How much farther we can drag past overview in 2-button mode, as a factor of the distance
+ * it takes to drag from an app to overview.
+ */
+ public static final float TWO_BUTTON_EXTRA_DRAG_FACTOR = 0.25f;
+
+ private enum RecentsParams {
+ FROM_APP(0.75f, 0.5f, 1f),
+ FROM_OVERVIEW(1f, 0.75f, 0.5f);
+
+ RecentsParams(float scaleStartResist, float scaleMaxResist, float translationFactor) {
+ this.scaleStartResist = scaleStartResist;
+ this.scaleMaxResist = scaleMaxResist;
+ this.translationFactor = translationFactor;
+ }
+
+ /**
+ * Start slowing down the rate of scaling down when recents view is smaller than this scale.
+ */
+ public final float scaleStartResist;
+
+ /**
+ * Recents view will reach this scale at the very end of the drag.
+ */
+ public final float scaleMaxResist;
+
+ /**
+ * How much translation to apply to RecentsView when the drag reaches the top of the screen,
+ * where 0 will keep it centered and 1 will have it barely touch the top of the screen.
+ */
+ public final float translationFactor;
+ }
+
+ private static final TimeInterpolator RECENTS_SCALE_RESIST_INTERPOLATOR = DEACCEL;
+ private static final TimeInterpolator RECENTS_TRANSLATE_RESIST_INTERPOLATOR = LINEAR;
+
+ private final AnimatorPlaybackController mNormalController;
+ private final AnimatorPlaybackController mResistanceController;
+
+ // Initialize to -1 so the first 0 gets applied.
+ private float mLastNormalProgress = -1;
+ private float mLastResistProgress;
+
+ public AnimatorControllerWithResistance(AnimatorPlaybackController normalController,
+ AnimatorPlaybackController resistanceController) {
+ mNormalController = normalController;
+ mResistanceController = resistanceController;
+ }
+
+ public AnimatorPlaybackController getNormalController() {
+ return mNormalController;
+ }
+
+ /**
+ * Applies the current progress of the animation.
+ * @param progress From 0 to maxProgress, where 1 is the target we are animating towards.
+ * @param maxProgress > 1, this is where the resistance will be applied.
+ */
+ public void setProgress(float progress, float maxProgress) {
+ float normalProgress = Utilities.boundToRange(progress, 0, 1);
+ if (normalProgress != mLastNormalProgress) {
+ mLastNormalProgress = normalProgress;
+ mNormalController.setPlayFraction(normalProgress);
+ }
+ if (maxProgress <= 1) {
+ return;
+ }
+ float resistProgress = progress <= 1 ? 0 : Utilities.getProgress(progress, 1, maxProgress);
+ if (resistProgress != mLastResistProgress) {
+ mLastResistProgress = resistProgress;
+ mResistanceController.setPlayFraction(resistProgress);
+ }
+ }
+
+ /**
+ * Applies resistance to recents when swiping up past its target position.
+ * @param normalController The controller to run from 0 to 1 before this resistance applies.
+ * @param context Used to compute start and end values.
+ * @param recentsOrientedState Used to compute start and end values.
+ * @param dp Used to compute start and end values.
+ * @param scaleTarget The target for the scaleProperty.
+ * @param scaleProperty Animate the value to change the scale of the window/recents view.
+ * @param translationTarget The target for the translationProperty.
+ * @param translationProperty Animate the value to change the translation of the recents view.
+ */
+ public static <SCALE, TRANSLATION> AnimatorControllerWithResistance createForRecents(
+ AnimatorPlaybackController normalController, Context context,
+ RecentsOrientedState recentsOrientedState, DeviceProfile dp, SCALE scaleTarget,
+ FloatProperty<SCALE> scaleProperty, TRANSLATION translationTarget,
+ FloatProperty<TRANSLATION> translationProperty) {
+
+ PendingAnimation resistAnim = createRecentsResistanceAnim(null, context,
+ recentsOrientedState, dp, scaleTarget, scaleProperty, translationTarget,
+ translationProperty, RecentsParams.FROM_APP);
+
+ AnimatorPlaybackController resistanceController = resistAnim.createPlaybackController();
+ return new AnimatorControllerWithResistance(normalController, resistanceController);
+ }
+
+ /**
+ * Creates the resistance animation for {@link #createForRecents}, or can be used separately
+ * when starting from recents, i.e. {@link #createRecentsResistanceFromOverviewAnim}.
+ */
+ public static <SCALE, TRANSLATION> PendingAnimation createRecentsResistanceAnim(
+ @Nullable PendingAnimation resistAnim, Context context,
+ RecentsOrientedState recentsOrientedState, DeviceProfile dp, SCALE scaleTarget,
+ FloatProperty<SCALE> scaleProperty, TRANSLATION translationTarget,
+ FloatProperty<TRANSLATION> translationProperty, RecentsParams params) {
+ Rect startRect = new Rect();
+ LauncherActivityInterface.INSTANCE.calculateTaskSize(context, dp, startRect,
+ recentsOrientedState.getOrientationHandler());
+ long distanceToCover = startRect.bottom;
+ boolean isTwoButtonMode = SysUINavigationMode.getMode(context) == TWO_BUTTONS;
+ if (isTwoButtonMode) {
+ // We can only drag a small distance past overview, not to the top of the screen.
+ distanceToCover = (long)
+ ((dp.heightPx - startRect.bottom) * TWO_BUTTON_EXTRA_DRAG_FACTOR);
+ }
+ if (resistAnim == null) {
+ resistAnim = new PendingAnimation(distanceToCover * 2);
+ }
+
+ PointF pivot = new PointF();
+ float fullscreenScale = recentsOrientedState.getFullScreenScaleAndPivot(
+ startRect, dp, pivot);
+ float startScale = 1;
+ float prevScaleRate = (fullscreenScale - startScale) / (dp.heightPx - startRect.bottom);
+ // This is what the scale would be at the end of the drag if we didn't apply resistance.
+ float endScale = startScale - prevScaleRate * distanceToCover;
+ final TimeInterpolator scaleInterpolator;
+ if (isTwoButtonMode) {
+ // We are bounded by the distance of the drag, so we don't need to apply resistance.
+ scaleInterpolator = LINEAR;
+ } else {
+ // Create an interpolator that resists the scale so the scale doesn't get smaller than
+ // RECENTS_SCALE_MAX_RESIST.
+ float startResist = Utilities.getProgress(params.scaleStartResist , startScale,
+ endScale);
+ float maxResist = Utilities.getProgress(params.scaleMaxResist, startScale, endScale);
+ scaleInterpolator = t -> {
+ if (t < startResist) {
+ return t;
+ }
+ float resistProgress = Utilities.getProgress(t, startResist, 1);
+ resistProgress = RECENTS_SCALE_RESIST_INTERPOLATOR.getInterpolation(resistProgress);
+ return startResist + resistProgress * (maxResist - startResist);
+ };
+ }
+ resistAnim.addFloat(scaleTarget, scaleProperty, startScale, endScale,
+ scaleInterpolator);
+
+ if (!isTwoButtonMode) {
+ // Compute where the task view would be based on the end scale, if we didn't translate.
+ RectF endRectF = new RectF(startRect);
+ Matrix temp = new Matrix();
+ temp.setScale(params.scaleMaxResist, params.scaleMaxResist, pivot.x, pivot.y);
+ temp.mapRect(endRectF);
+ // Translate such that the task view touches the top of the screen when drag does.
+ float endTranslation = endRectF.top * recentsOrientedState.getOrientationHandler()
+ .getSecondaryTranslationDirectionFactor() * params.translationFactor;
+ resistAnim.addFloat(translationTarget, translationProperty, 0, endTranslation,
+ RECENTS_TRANSLATE_RESIST_INTERPOLATOR);
+ }
+
+ return resistAnim;
+ }
+
+ /**
+ * Helper method to update or create a PendingAnimation suitable for animating
+ * a RecentsView interaction that started from the overview state.
+ */
+ public static PendingAnimation createRecentsResistanceFromOverviewAnim(
+ BaseDraggingActivity activity, @Nullable PendingAnimation resistanceAnim) {
+ RecentsView recentsView = activity.getOverviewPanel();
+ return createRecentsResistanceAnim(resistanceAnim, activity,
+ recentsView.getPagedViewOrientedState(), activity.getDeviceProfile(),
+ recentsView, RECENTS_SCALE_PROPERTY, recentsView, TASK_SECONDARY_TRANSLATION,
+ RecentsParams.FROM_OVERVIEW);
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/AssistantUtilities.java b/quickstep/src/com/android/quickstep/util/AssistantUtilities.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/AssistantUtilities.java
rename to quickstep/src/com/android/quickstep/util/AssistantUtilities.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/InputConsumerProxy.java b/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/InputConsumerProxy.java
rename to quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index f7bd1e2..b88a195 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -15,7 +15,6 @@
*/
package com.android.quickstep.util;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import android.content.Context;
@@ -45,7 +44,7 @@
public static int getShelfTrackingDistance(Context context, DeviceProfile dp,
PagedOrientationHandler orientationHandler) {
// Track the bottom of the window.
- if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) {
+ if (removeShelfFromOverview(context)) {
Rect taskSize = new Rect();
LauncherActivityInterface.INSTANCE.calculateTaskSize(context, dp, taskSize,
orientationHandler);
diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
index f60f7ad..b862936 100644
--- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
+++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
@@ -15,12 +15,13 @@
*/
package com.android.quickstep.util;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_LSQ_VELOCITY_PROVIDER;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_SYSTEM_VELOCITY_PROVIDER;
import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
import android.view.MotionEvent;
+import android.view.VelocityTracker;
import com.android.launcher3.Alarm;
import com.android.launcher3.R;
@@ -92,8 +93,8 @@
mForcePauseTimeout = new Alarm();
mForcePauseTimeout.setOnAlarmListener(alarm -> updatePaused(true /* isPaused */));
mMakePauseHarderToTrigger = makePauseHarderToTrigger;
- mVelocityProvider = ENABLE_LSQ_VELOCITY_PROVIDER.get()
- ? new LSqVelocityProvider(axis) : new LinearVelocityProvider(axis);
+ mVelocityProvider = ENABLE_SYSTEM_VELOCITY_PROVIDER.get()
+ ? new SystemVelocityProvider(axis) : new LinearVelocityProvider(axis);
}
/**
@@ -264,141 +265,28 @@
}
}
- /**
- * Java implementation of {@link android.view.VelocityTracker} using the Least Square (deg 2)
- * algorithm.
- */
- private static class LSqVelocityProvider implements VelocityProvider {
+ private static class SystemVelocityProvider implements VelocityProvider {
- // Maximum age of a motion event to be considered when calculating the velocity.
- private static final long HORIZON_MS = 100;
- // Number of samples to keep.
- private static final int HISTORY_SIZE = 20;
-
- // Position history are stored in a circular array
- private final long[] mHistoricTimes = new long[HISTORY_SIZE];
- private final float[] mHistoricPos = new float[HISTORY_SIZE];
- private int mHistoryCount = 0;
- private int mHistoryStart = 0;
-
+ private final VelocityTracker mVelocityTracker;
private final int mAxis;
- LSqVelocityProvider(int axis) {
+ SystemVelocityProvider(int axis) {
+ mVelocityTracker = VelocityTracker.obtain();
mAxis = axis;
}
@Override
- public void clear() {
- mHistoryCount = mHistoryStart = 0;
- }
-
- private void addPositionAndTime(long eventTime, float eventPosition) {
- mHistoricTimes[mHistoryStart] = eventTime;
- mHistoricPos[mHistoryStart] = eventPosition;
- mHistoryStart++;
- if (mHistoryStart >= HISTORY_SIZE) {
- mHistoryStart = 0;
- }
- mHistoryCount = Math.min(HISTORY_SIZE, mHistoryCount + 1);
+ public Float addMotionEvent(MotionEvent ev, int pointer) {
+ mVelocityTracker.addMovement(ev);
+ mVelocityTracker.computeCurrentVelocity(1); // px / ms
+ return mAxis == MotionEvent.AXIS_X
+ ? mVelocityTracker.getXVelocity(pointer)
+ : mVelocityTracker.getYVelocity(pointer);
}
@Override
- public Float addMotionEvent(MotionEvent ev, int pointer) {
- // Add all historic points
- int historyCount = ev.getHistorySize();
- for (int i = 0; i < historyCount; i++) {
- addPositionAndTime(
- ev.getHistoricalEventTime(i), ev.getHistoricalAxisValue(mAxis, pointer, i));
- }
-
- // Start index for the last position (about to be added)
- int eventStartIndex = mHistoryStart;
- addPositionAndTime(ev.getEventTime(), ev.getAxisValue(mAxis, pointer));
- return solveUnweightedLeastSquaresDeg2(eventStartIndex);
- }
-
- /**
- * Solves the instantaneous velocity.
- * Based on solveUnweightedLeastSquaresDeg2 in VelocityTracker.cpp
- */
- private Float solveUnweightedLeastSquaresDeg2(final int pointPos) {
- final long eventTime = mHistoricTimes[pointPos];
-
- float sxi = 0, sxiyi = 0, syi = 0, sxi2 = 0, sxi3 = 0, sxi2yi = 0, sxi4 = 0;
- int count = 0;
- for (int i = 0; i < mHistoryCount; i++) {
- int index = pointPos - i;
- if (index < 0) {
- index += HISTORY_SIZE;
- }
-
- long time = mHistoricTimes[index];
- long age = eventTime - time;
- if (age > HORIZON_MS) {
- break;
- }
- count++;
- float xi = -age;
-
- float yi = mHistoricPos[index];
- float xi2 = xi * xi;
- float xi3 = xi2 * xi;
- float xi4 = xi3 * xi;
- float xiyi = xi * yi;
- float xi2yi = xi2 * yi;
-
- sxi += xi;
- sxi2 += xi2;
- sxiyi += xiyi;
- sxi2yi += xi2yi;
- syi += yi;
- sxi3 += xi3;
- sxi4 += xi4;
- }
-
- if (count < 3) {
- // Too few samples
- switch (count) {
- case 2: {
- int endPos = pointPos - 1;
- if (endPos < 0) {
- endPos += HISTORY_SIZE;
- }
- long denominator = eventTime - mHistoricTimes[endPos];
- if (denominator != 0) {
- return (mHistoricPos[pointPos] - mHistoricPos[endPos]) / denominator;
- }
- }
- // fall through
- case 1:
- return 0f;
- default:
- return null;
- }
- }
-
- float Sxx = sxi2 - sxi * sxi / count;
- float Sxy = sxiyi - sxi * syi / count;
- float Sxx2 = sxi3 - sxi * sxi2 / count;
- float Sx2y = sxi2yi - sxi2 * syi / count;
- float Sx2x2 = sxi4 - sxi2 * sxi2 / count;
-
- float denominator = Sxx * Sx2x2 - Sxx2 * Sxx2;
- if (denominator == 0) {
- // division by 0 when computing velocity
- return null;
- }
- // Compute a
- // float numerator = Sx2y*Sxx - Sxy*Sxx2;
-
- // Compute b
- float numerator = Sxy * Sx2x2 - Sx2y * Sxx2;
- float b = numerator / denominator;
-
- // Compute c
- // float c = syi/count - b * sxi/count - a * sxi2/count;
-
- return b;
+ public void clear() {
+ mVelocityTracker.clear();
}
}
}
diff --git a/quickstep/src/com/android/quickstep/util/NavBarPosition.java b/quickstep/src/com/android/quickstep/util/NavBarPosition.java
index 0a98e1b..449dba8 100644
--- a/quickstep/src/com/android/quickstep/util/NavBarPosition.java
+++ b/quickstep/src/com/android/quickstep/util/NavBarPosition.java
@@ -19,7 +19,7 @@
import android.view.Surface;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController.Info;
import com.android.quickstep.SysUINavigationMode;
/**
@@ -30,7 +30,7 @@
private final SysUINavigationMode.Mode mMode;
private final int mDisplayRotation;
- public NavBarPosition(SysUINavigationMode.Mode mode, DefaultDisplay.Info info) {
+ public NavBarPosition(SysUINavigationMode.Mode mode, Info info) {
mMode = mode;
mDisplayRotation = info.rotation;
}
diff --git a/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java b/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java
new file mode 100644
index 0000000..6278e14
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2020 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.quickstep.util;
+
+import static com.android.launcher3.LauncherState.NORMAL;
+import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.launcher3.anim.Interpolators.DEACCEL;
+import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
+import static com.android.launcher3.anim.Interpolators.INSTANT;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_COMPONENTS;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
+import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.util.Log;
+import android.view.animation.Interpolator;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.anim.AnimationSuccessListener;
+import com.android.launcher3.statemanager.StateManager;
+import com.android.launcher3.states.StateAnimationConfig;
+import com.android.quickstep.views.RecentsView;
+
+/**
+ * Runs an animation from overview to home. Currently, this animation is just a wrapper around the
+ * normal state transition, in order to keep RecentsView at the same scale and translationY that
+ * it started out at as it translates offscreen. It also scrolls RecentsView to page 0 and may play
+ * a {@link StaggeredWorkspaceAnim} if we're starting from an upward fling.
+ */
+public class OverviewToHomeAnim {
+
+ private static final String TAG = "OverviewToHomeAnim";
+
+ // Constants to specify how to scroll RecentsView to the default page if it's not already there.
+ private static final int DEFAULT_PAGE = 0;
+ private static final int PER_PAGE_SCROLL_DURATION = 150;
+ private static final int MAX_PAGE_SCROLL_DURATION = 750;
+
+ private final Launcher mLauncher;
+ private final Runnable mOnReachedHome;
+
+ // Only run mOnReachedHome when both of these are true.
+ private boolean mIsHomeStaggeredAnimFinished;
+ private boolean mIsOverviewHidden;
+
+ public OverviewToHomeAnim(Launcher launcher, Runnable onReachedHome) {
+ mLauncher = launcher;
+ mOnReachedHome = onReachedHome;
+ }
+
+ /**
+ * Starts the animation. If velocity < 0 (i.e. upwards), also plays a
+ * {@link StaggeredWorkspaceAnim}.
+ */
+ public void animateWithVelocity(float velocity) {
+ StateManager<LauncherState> stateManager = mLauncher.getStateManager();
+ LauncherState startState = stateManager.getState();
+ if (startState != OVERVIEW) {
+ Log.e(TAG, "animateFromOverviewToHome: unexpected start state " + startState);
+ }
+ AnimatorSet anim = new AnimatorSet();
+
+ boolean playStaggeredWorkspaceAnim = velocity < 0;
+ if (playStaggeredWorkspaceAnim) {
+ StaggeredWorkspaceAnim staggeredWorkspaceAnim = new StaggeredWorkspaceAnim(
+ mLauncher, velocity, false /* animateOverviewScrim */);
+ staggeredWorkspaceAnim.addAnimatorListener(new AnimationSuccessListener() {
+ @Override
+ public void onAnimationSuccess(Animator animator) {
+ mIsHomeStaggeredAnimFinished = true;
+ maybeOverviewToHomeAnimComplete();
+ }
+ });
+ anim.play(staggeredWorkspaceAnim.getAnimators());
+ } else {
+ mIsHomeStaggeredAnimFinished = true;
+ }
+
+ RecentsView recentsView = mLauncher.getOverviewPanel();
+ int numPagesToScroll = recentsView.getNextPage() - DEFAULT_PAGE;
+ int scrollDuration = Math.min(MAX_PAGE_SCROLL_DURATION,
+ numPagesToScroll * PER_PAGE_SCROLL_DURATION);
+ int duration = Math.max(scrollDuration, startState.getTransitionDuration(mLauncher));
+
+ StateAnimationConfig config = new UseFirstInterpolatorStateAnimConfig();
+ config.duration = duration;
+ config.animFlags = playStaggeredWorkspaceAnim
+ // StaggeredWorkspaceAnim doesn't animate overview, so we handle it here.
+ ? PLAY_ATOMIC_OVERVIEW_PEEK
+ : ANIM_ALL_COMPONENTS;
+ config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, DEACCEL);
+ config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, FINAL_FRAME);
+ config.setInterpolator(ANIM_OVERVIEW_SCALE, FINAL_FRAME);
+ config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, INSTANT);
+ AnimatorSet stateAnim = stateManager.createAtomicAnimation(
+ startState, NORMAL, config);
+ stateAnim.addListener(new AnimationSuccessListener() {
+ @Override
+ public void onAnimationSuccess(Animator animator) {
+ mIsOverviewHidden = true;
+ maybeOverviewToHomeAnimComplete();
+ }
+ });
+ anim.play(stateAnim);
+ stateManager.setCurrentAnimation(anim, NORMAL);
+ anim.start();
+ recentsView.snapToPage(DEFAULT_PAGE, duration);
+ }
+
+ private void maybeOverviewToHomeAnimComplete() {
+ if (mIsHomeStaggeredAnimFinished && mIsOverviewHidden) {
+ mOnReachedHome.run();
+ }
+ }
+
+ /**
+ * Wrapper around StateAnimationConfig that doesn't allow interpolators to be set if they are
+ * already set. This ensures they aren't overridden before being used.
+ */
+ private static class UseFirstInterpolatorStateAnimConfig extends StateAnimationConfig {
+ @Override
+ public void setInterpolator(int animId, Interpolator interpolator) {
+ if (mInterpolators[animId] == null || interpolator == null) {
+ super.setInterpolator(animId, interpolator);
+ }
+ }
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ProtoTracer.java b/quickstep/src/com/android/quickstep/util/ProtoTracer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/ProtoTracer.java
rename to quickstep/src/com/android/quickstep/util/ProtoTracer.java
diff --git a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java
index c2e67c1..7eda627 100644
--- a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java
+++ b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java
@@ -21,7 +21,6 @@
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
@@ -66,8 +65,7 @@
}
boolean shelfBounceSeen = getBoolean(SHELF_BOUNCE_SEEN);
- if (!shelfBounceSeen && ENABLE_OVERVIEW_ACTIONS.get()
- && removeShelfFromOverview(launcher)) {
+ if (!shelfBounceSeen && removeShelfFromOverview(launcher)) {
// There's no shelf in overview, so don't bounce it (can't get to all apps anyway).
shelfBounceSeen = true;
mSharedPrefs.edit().putBoolean(SHELF_BOUNCE_SEEN, shelfBounceSeen).apply();
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java b/quickstep/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java
rename to quickstep/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 81d24d7..df9b0cf 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -71,7 +71,7 @@
public final class RecentsOrientedState implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = "RecentsOrientedState";
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private ContentObserver mSystemAutoRotateObserver = new ContentObserver(new Handler()) {
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java b/quickstep/src/com/android/quickstep/util/RectFSpringAnim.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
rename to quickstep/src/com/android/quickstep/util/RectFSpringAnim.java
diff --git a/quickstep/src/com/android/quickstep/util/SplitScreenBounds.java b/quickstep/src/com/android/quickstep/util/SplitScreenBounds.java
index a770e8e..176478f 100644
--- a/quickstep/src/com/android/quickstep/util/SplitScreenBounds.java
+++ b/quickstep/src/com/android/quickstep/util/SplitScreenBounds.java
@@ -32,7 +32,7 @@
import androidx.annotation.UiThread;
import com.android.launcher3.R;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.WindowBounds;
import java.util.ArrayList;
@@ -77,7 +77,7 @@
WindowBounds bounds = new WindowBounds(wm.getBounds(),
new Rect(insets.left, insets.top, insets.right, insets.bottom));
- int rotation = DefaultDisplay.INSTANCE.get(context).getInfo().rotation;
+ int rotation = DisplayController.getDefaultDisplay(context).getInfo().rotation;
int halfDividerSize = context.getResources()
.getDimensionPixelSize(R.dimen.multi_window_task_divider_size) / 2;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
rename to quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SurfaceTransactionApplier.java b/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/SurfaceTransactionApplier.java
rename to quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskCornerRadius.java b/quickstep/src/com/android/quickstep/util/TaskCornerRadius.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskCornerRadius.java
rename to quickstep/src/com/android/quickstep/util/TaskCornerRadius.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
similarity index 95%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
rename to quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
index 94e496d..903e87a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -73,6 +73,7 @@
private final Rect mTaskRect = new Rect();
private float mOffsetY;
+ private boolean mDrawsBelowRecents;
private final PointF mPivot = new PointF();
private DeviceProfile mDp;
@@ -92,6 +93,7 @@
// RecentsView properties
public final AnimatedFloat recentsViewScale = new AnimatedFloat();
public final AnimatedFloat fullScreenProgress = new AnimatedFloat();
+ public final AnimatedFloat recentsViewSecondaryTranslation = new AnimatedFloat();
private final ScrollState mScrollState = new ScrollState();
// Cached calculations
@@ -180,6 +182,10 @@
mOffsetY = offsetY;
}
+ public void setDrawsBelowRecents(boolean drawsBelowRecents) {
+ mDrawsBelowRecents = drawsBelowRecents;
+ }
+
/**
* Adds animation for all the components corresponding to transition from an app to overview.
*/
@@ -297,8 +303,10 @@
mOrientationState.getOrientationHandler().set(
mMatrix, MATRIX_POST_TRANSLATE, mScrollState.scroll);
- // Apply recensView matrix
+ // Apply RecentsView matrix
mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
+ mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
+ recentsViewSecondaryTranslation.value);
applyWindowToHomeRotation(mMatrix);
// Crop rect is the inverse of thumbnail matrix
@@ -318,7 +326,9 @@
.withCornerRadius(getCurrentCornerRadius());
if (ENABLE_QUICKSTEP_LIVE_TILE.get() && params.getRecentsSurface() != null) {
- builder.withRelativeLayerTo(params.getRecentsSurface(), Integer.MIN_VALUE);
+ // When relativeLayer = 0, it reverts the surfaces back to the original order.
+ builder.withRelativeLayerTo(params.getRecentsSurface(),
+ mDrawsBelowRecents ? Integer.MIN_VALUE : 0);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TransformParams.java b/quickstep/src/com/android/quickstep/util/TransformParams.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/TransformParams.java
rename to quickstep/src/com/android/quickstep/util/TransformParams.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TriggerSwipeUpTouchTracker.java b/quickstep/src/com/android/quickstep/util/TriggerSwipeUpTouchTracker.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/util/TriggerSwipeUpTouchTracker.java
rename to quickstep/src/com/android/quickstep/util/TriggerSwipeUpTouchTracker.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/AllAppsEduView.java b/quickstep/src/com/android/quickstep/views/AllAppsEduView.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/AllAppsEduView.java
rename to quickstep/src/com/android/quickstep/views/AllAppsEduView.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java b/quickstep/src/com/android/quickstep/views/ClearAllButton.java
similarity index 93%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java
rename to quickstep/src/com/android/quickstep/views/ClearAllButton.java
index fd74357..0837300 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java
+++ b/quickstep/src/com/android/quickstep/views/ClearAllButton.java
@@ -45,12 +45,15 @@
private float mVisibilityAlpha = 1;
private boolean mIsRtl;
+ private final float mOriginalTranslationX, mOriginalTranslationY;
private int mScrollOffset;
public ClearAllButton(Context context, AttributeSet attrs) {
super(context, attrs);
mIsRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
+ mOriginalTranslationX = getTranslationX();
+ mOriginalTranslationY = getTranslationY();
}
@Override
@@ -99,7 +102,8 @@
float shift = Math.min(scrollState.scrollFromEdge, orientationSize);
float translation = mIsRtl ? (mScrollOffset - shift) : (mScrollOffset + shift);
- orientationHandler.setPrimaryAndResetSecondaryTranslate(this, translation);
+ orientationHandler.setPrimaryAndResetSecondaryTranslate(
+ this, translation, mOriginalTranslationX, mOriginalTranslationY);
mScrollAlpha = 1 - shift / orientationSize;
updateAlpha();
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
rename to quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/IconView.java b/quickstep/src/com/android/quickstep/views/IconView.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/IconView.java
rename to quickstep/src/com/android/quickstep/views/IconView.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
similarity index 96%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
rename to quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index f31bc19..b338bd0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -43,6 +43,7 @@
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.SysUINavigationMode;
+import com.android.quickstep.util.OverviewToHomeAnim;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.RecentsExtraCard;
@@ -93,12 +94,14 @@
@Override
public void startHome() {
+ Runnable onReachedHome = () -> mActivity.getStateManager().goToState(NORMAL, false);
+ OverviewToHomeAnim overviewToHomeAnim = new OverviewToHomeAnim(mActivity, onReachedHome);
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
switchToScreenshot(null,
() -> finishRecentsAnimation(true /* toRecents */,
- () -> mActivity.getStateManager().goToState(NORMAL)));
+ () -> overviewToHomeAnim.animateWithVelocity(0)));
} else {
- mActivity.getStateManager().goToState(NORMAL);
+ overviewToHomeAnim.animateWithVelocity(0);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LiveTileOverlay.java b/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/LiveTileOverlay.java
rename to quickstep/src/com/android/quickstep/views/LiveTileOverlay.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
similarity index 92%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
rename to quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index 79d57c5..8f60991 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -16,7 +16,6 @@
package com.android.quickstep.views;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SHARE;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
@@ -53,7 +52,6 @@
@IntDef(flag = true, value = {
HIDDEN_UNSUPPORTED_NAVIGATION,
- HIDDEN_DISABLED_FEATURE,
HIDDEN_NON_ZERO_ROTATION,
HIDDEN_NO_TASKS,
HIDDEN_GESTURE_RUNNING,
@@ -62,11 +60,10 @@
public @interface ActionsHiddenFlags { }
public static final int HIDDEN_UNSUPPORTED_NAVIGATION = 1 << 0;
- public static final int HIDDEN_DISABLED_FEATURE = 1 << 1;
- public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 2;
- public static final int HIDDEN_NO_TASKS = 1 << 3;
- public static final int HIDDEN_GESTURE_RUNNING = 1 << 4;
- public static final int HIDDEN_NO_RECENTS = 1 << 5;
+ public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 1;
+ public static final int HIDDEN_NO_TASKS = 1 << 2;
+ public static final int HIDDEN_GESTURE_RUNNING = 1 << 3;
+ public static final int HIDDEN_NO_RECENTS = 1 << 4;
@IntDef(flag = true, value = {
DISABLED_SCROLLING,
@@ -105,6 +102,7 @@
public OverviewActionsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr, 0);
mMultiValueAlpha = new MultiValueAlpha(this, 4);
+ mMultiValueAlpha.setUpdateVisibility(true);
}
@Override
@@ -144,7 +142,6 @@
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
- updateHiddenFlags(HIDDEN_DISABLED_FEATURE, !ENABLE_OVERVIEW_ACTIONS.get());
updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION, !removeShelfFromOverview(getContext()));
}
@@ -168,7 +165,6 @@
}
boolean isHidden = mHiddenFlags != 0;
mMultiValueAlpha.getProperty(INDEX_HIDDEN_FLAGS_ALPHA).setValue(isHidden ? 0 : 1);
- setVisibility(isHidden ? INVISIBLE : VISIBLE);
}
/**
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsExtraViewContainer.java b/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsExtraViewContainer.java
rename to quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
similarity index 95%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
rename to quickstep/src/com/android/quickstep/views/RecentsView.java
index 0335ee7..a9b5bf3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -24,6 +24,7 @@
import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS;
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
+import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
import static com.android.launcher3.Utilities.mapToRange;
import static com.android.launcher3.Utilities.squaredHypot;
@@ -93,6 +94,7 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.InvariantDeviceProfile;
+import com.android.launcher3.LauncherState;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -115,6 +117,7 @@
import com.android.launcher3.util.DynamicResource;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.OverScroller;
+import com.android.launcher3.util.ResourceBasedOverride.Overrides;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.ViewPool;
import com.android.quickstep.BaseActivityInterface;
@@ -123,6 +126,7 @@
import com.android.quickstep.RecentsModel;
import com.android.quickstep.RecentsModel.TaskVisualsChangeListener;
import com.android.quickstep.SystemUiProxy;
+import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.ViewUtils;
@@ -211,6 +215,19 @@
}
};
+ public static final FloatProperty<RecentsView> TASK_SECONDARY_TRANSLATION =
+ new FloatProperty<RecentsView>("taskSecondaryTranslation") {
+ @Override
+ public void setValue(RecentsView recentsView, float v) {
+ recentsView.setTaskViewsSecondaryTranslation(v);
+ }
+
+ @Override
+ public Float get(RecentsView recentsView) {
+ return recentsView.mTaskViewsSecondaryTranslation;
+ }
+ };
+
/** Same as normal SCALE_PROPERTY, but also updates page offsets that depend on this scale. */
public static final FloatProperty<RecentsView> RECENTS_SCALE_PROPERTY =
new FloatProperty<RecentsView>("recentsScale") {
@@ -220,6 +237,7 @@
view.setScaleY(scale);
view.mLastComputedTaskPushOutDistance = null;
view.updatePageOffsets();
+ view.setTaskViewsSecondaryTranslation(view.mTaskViewsSecondaryTranslation);
}
@Override
@@ -265,12 +283,15 @@
private final ViewPool<TaskView> mTaskViewPool;
+ private final TaskOverlayFactory mTaskOverlayFactory;
+
private boolean mDwbToastShown;
protected boolean mDisallowScrollToClearAll;
private boolean mOverlayEnabled;
protected boolean mFreezeViewVisibility;
private float mAdjacentPageOffset = 0;
+ private float mTaskViewsSecondaryTranslation = 0;
/**
* TODO: Call reloadIdNeeded in onTaskStackChanged.
@@ -452,6 +473,11 @@
updateEmptyMessage();
mOrientationHandler = mOrientationState.getOrientationHandler();
+ mTaskOverlayFactory = Overrides.getObject(
+ TaskOverlayFactory.class,
+ context.getApplicationContext(),
+ R.string.task_overlay_factory_class);
+
// Initialize quickstep specific cache params here, as this is constructed only once
mActivity.getViewCache().setCacheSize(R.layout.digital_wellbeing_toast, 5);
@@ -460,6 +486,7 @@
mLiveTileTaskViewSimulator.setLayoutRotation(getPagedViewOrientedState().getTouchRotation(),
getPagedViewOrientedState().getDisplayRotation());
mLiveTileTaskViewSimulator.setRecentsRotation(rotation);
+ mLiveTileTaskViewSimulator.setDrawsBelowRecents(true);
}
public OverScroller getScroller() {
@@ -552,6 +579,7 @@
mIPinnedStackAnimationListener);
mOrientationState.initListeners();
SplitScreenBounds.INSTANCE.addOnChangeListener(this);
+ mTaskOverlayFactory.initListeners();
}
@Override
@@ -569,6 +597,7 @@
SplitScreenBounds.INSTANCE.removeOnChangeListener(this);
mIPinnedStackAnimationListener.setActivity(null);
mOrientationState.destroyListeners();
+ mTaskOverlayFactory.removeListeners();
}
@Override
@@ -1183,9 +1212,9 @@
}
/**
- * Returns true if we should add a dummy taskView for the running task id
+ * Returns true if we should add a stub taskView for the running task id
*/
- protected boolean shouldAddDummyTaskView(RunningTaskInfo runningTaskInfo) {
+ protected boolean shouldAddStubTaskView(RunningTaskInfo runningTaskInfo) {
return runningTaskInfo != null && getTaskView(runningTaskInfo.taskId) == null;
}
@@ -1196,7 +1225,7 @@
* is called. Also scrolls the view to this task.
*/
public void showCurrentTask(RunningTaskInfo runningTaskInfo) {
- if (shouldAddDummyTaskView(runningTaskInfo)) {
+ if (shouldAddStubTaskView(runningTaskInfo)) {
boolean wasEmpty = getChildCount() == 0;
// Add an empty view for now until the task plan is loaded and applied
final TaskView taskView = mTaskViewPool.getView();
@@ -1417,7 +1446,7 @@
FloatProperty<View> secondaryViewTranslate =
mOrientationHandler.getSecondaryViewTranslate();
int secondaryTaskDimension = mOrientationHandler.getSecondaryDimension(taskView);
- int verticalFactor = mOrientationHandler.getTaskDismissDirectionFactor();
+ int verticalFactor = mOrientationHandler.getSecondaryTranslationDirectionFactor();
ResourceProvider rp = DynamicResource.provider(mActivity);
SpringProperty sp = new SpringProperty(SpringProperty.FLAG_CAN_SPRING_ON_START)
@@ -1732,6 +1761,12 @@
updateOrientationHandler();
}
mLiveTileTaskViewSimulator.setRecentsRotation(rotation);
+ // If overview is in modal state when rotate, reset it to overview state without running
+ // animation.
+ if (mActivity.isInState(OVERVIEW_MODAL_TASK)) {
+ mActivity.getStateManager().goToState(LauncherState.OVERVIEW, false);
+ resetModalVisuals();
+ }
}
public void setLayoutRotation(int touchRotation, int displayRotation) {
@@ -1890,7 +1925,9 @@
: i < modalMidpoint
? modalLeftOffsetSize
: modalRightOffsetSize;
- getChildAt(i).setTranslationX(translation + modalTranslation);
+ float totalTranslation = translation + modalTranslation;
+ mOrientationHandler.getPrimaryViewTranslate().set(getChildAt(i),
+ totalTranslation * mOrientationHandler.getPrimaryTranslationDirectionFactor());
}
updateCurveProperties();
}
@@ -1943,6 +1980,14 @@
return distanceToOffscreen * offsetProgress;
}
+ private void setTaskViewsSecondaryTranslation(float translation) {
+ mTaskViewsSecondaryTranslation = translation;
+ for (int i = 0; i < getTaskViewCount(); i++) {
+ TaskView task = getTaskViewAt(i);
+ mOrientationHandler.getSecondaryViewTranslate().set(task, translation / getScaleY());
+ }
+ }
+
/**
* TODO: Do not assume motion across X axis for adjacent page
*/
@@ -2249,13 +2294,13 @@
mRecentsAnimationController.finish(toRecents, () -> {
if (onFinishComplete != null) {
onFinishComplete.run();
- // After we finish the recents animation, the current task id should be correctly
- // reset so that when the task is launched from Overview later, it goes through the
- // flow of starting a new task instead of finishing recents animation to app. A
- // typical example of this is (1) user swipes up from app to Overview (2) user
- // taps on QSB (3) user goes back to Overview and launch the most recent task.
- setCurrentTask(-1);
}
+ // After we finish the recents animation, the current task id should be correctly
+ // reset so that when the task is launched from Overview later, it goes through the
+ // flow of starting a new task instead of finishing recents animation to app. A
+ // typical example of this is (1) user swipes up from app to Overview (2) user
+ // taps on QSB (3) user goes back to Overview and launch the most recent task.
+ setCurrentTask(-1);
});
}
@@ -2329,7 +2374,14 @@
if (pageIndex == -1) {
return 0;
}
- return getScrollForPage(pageIndex) - mOrientationHandler.getPrimaryScroll(this);
+ // Unbound the scroll (due to overscroll) if the adjacent tasks are offset away from it.
+ // This allows the page to move freely, given there's no visual indication why it shouldn't.
+ int boundedScroll = mOrientationHandler.getPrimaryScroll(this);
+ int unboundedScroll = getUnboundedScroll();
+ float unboundedProgress = mAdjacentPageOffset;
+ int scroll = Math.round(unboundedScroll * unboundedProgress
+ + boundedScroll * (1 - unboundedProgress));
+ return getScrollForPage(pageIndex) - scroll;
}
public Consumer<MotionEvent> getEventDispatcher(float navbarRotation) {
@@ -2376,7 +2428,19 @@
}
}
- /** If it's in the live tile mode, switch the running task into screenshot mode. */
+ /**
+ * Switch the current running task view to static snapshot mode,
+ * capturing the snapshot at the same time.
+ */
+ public void switchToScreenshot(Runnable onFinishRunnable) {
+ switchToScreenshot(mRunningTaskId == -1 ? null
+ : mRecentsAnimationController.screenshotTask(mRunningTaskId), onFinishRunnable);
+ }
+
+ /**
+ * Switch the current running task view to static snapshot mode, using the
+ * provided thumbnail data as the snapshot.
+ */
public void switchToScreenshot(ThumbnailData thumbnailData, Runnable onFinishRunnable) {
TaskView taskView = getRunningTaskView();
if (taskView != null) {
@@ -2426,6 +2490,10 @@
*/
public void setModalStateEnabled(boolean isModalState) { }
+ public TaskOverlayFactory getTaskOverlayFactory() {
+ return mTaskOverlayFactory;
+ }
+
public BaseActivityInterface getSizeStrategy() {
return mSizeStrategy;
}
diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
index f1ac6a5..e6613eb 100644
--- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
+++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
@@ -16,9 +16,7 @@
package com.android.quickstep.views;
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
-import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.LauncherState.QUICK_SWITCH;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.LINEAR;
@@ -38,11 +36,9 @@
import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ScrimView;
@@ -155,8 +151,7 @@
Context context = getContext();
if ((OVERVIEW.getVisibleElements(mLauncher) & ALL_APPS_HEADER_EXTRA) == 0) {
- if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()
- && SysUINavigationMode.removeShelfFromOverview(context)) {
+ if (SysUINavigationMode.removeShelfFromOverview(context)) {
// Fade in all apps background quickly to distinguish from swiping from nav bar.
mMidAlpha = Themes.getAttrInteger(context, R.attr.allAppsInterimScrimAlpha);
mMidProgress = OverviewState.getDefaultVerticalProgress(mLauncher);
@@ -198,13 +193,6 @@
if (mProgress >= 1) {
mRemainingScreenColor = 0;
mShelfColor = 0;
- LauncherState state = mLauncher.getStateManager().getState();
- if (mSysUINavigationMode == Mode.NO_BUTTON
- && (state == BACKGROUND_APP || state == QUICK_SWITCH)
- && mLauncher.getShelfPeekAnim().isPeeking()) {
- // Show the shelf background when peeking during swipe up.
- mShelfColor = setColorAlphaBound(mEndScrim, mMidAlpha);
- }
} else if (mProgress >= mMidProgress) {
mRemainingScreenColor = 0;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java
rename to quickstep/src/com/android/quickstep/views/TaskMenuView.java
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
similarity index 81%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
rename to quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index a8d6442..dfb3860 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -52,7 +52,6 @@
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
-import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.quickstep.views.TaskView.FullscreenDrawParams;
import com.android.systemui.plugins.OverviewScreenshotActions;
@@ -85,7 +84,7 @@
};
private final BaseActivity mActivity;
- private final TaskOverlay mOverlay;
+ private TaskOverlay mOverlay;
private final boolean mIsDarkTextTheme;
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@@ -118,14 +117,13 @@
public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mOverlay = TaskOverlayFactory.INSTANCE.get(context).createOverlay(this);
mPaint.setFilterBitmap(true);
mBackgroundPaint.setColor(Color.WHITE);
mClearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
mDimmingPaintAfterClearing.setColor(Color.BLACK);
mActivity = BaseActivity.fromContext(context);
mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
- // Initialize with dummy value. It is overridden later by TaskView
+ // Initialize with placeholder value. It is overridden later by TaskView
mFullscreenParams = TEMP_PARAMS.get(context);
}
@@ -134,7 +132,7 @@
* @param task
*/
public void bind(Task task) {
- mOverlay.reset();
+ getTaskOverlay().reset();
mTask = task;
int color = task == null ? Color.BLACK : task.colorBackground | 0xFF000000;
mPaint.setColor(color);
@@ -176,7 +174,7 @@
mBitmapShader = null;
mThumbnailData = null;
mPaint.setShader(null);
- mOverlay.reset();
+ getTaskOverlay().reset();
}
if (mOverviewScreenshotActionsPlugin != null) {
mOverviewScreenshotActionsPlugin.setupActions(getTaskView(), getThumbnail(), mActivity);
@@ -200,6 +198,9 @@
}
public TaskOverlay getTaskOverlay() {
+ if (mOverlay == null) {
+ mOverlay = getTaskView().getRecentsView().getTaskOverlayFactory().createOverlay(this);
+ }
return mOverlay;
}
@@ -326,22 +327,14 @@
// Draw the background in all cases, except when the thumbnail data is opaque
final boolean drawBackgroundOnly = mTask == null || mTask.isLocked || mBitmapShader == null
|| mThumbnailData == null;
- if (drawBackgroundOnly || mPreviewPositionHelper.mClipBottom > 0
- || mThumbnailData.isTranslucent) {
+ if (drawBackgroundOnly || mThumbnailData.isTranslucent) {
canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mBackgroundPaint);
if (drawBackgroundOnly) {
return;
}
}
- if (mPreviewPositionHelper.mClipBottom > 0) {
- canvas.save();
- canvas.clipRect(x, y, width, mPreviewPositionHelper.mClipBottom);
- canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
- canvas.restore();
- } else {
- canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
- }
+ canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
}
public TaskView getTaskView() {
@@ -357,10 +350,10 @@
private void updateOverlay() {
if (mOverlayEnabled) {
- mOverlay.initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.mMatrix,
+ getTaskOverlay().initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.mMatrix,
mPreviewPositionHelper.mIsOrientationChanged);
} else {
- mOverlay.reset();
+ getTaskOverlay().reset();
}
}
@@ -379,7 +372,6 @@
}
private void updateThumbnailMatrix() {
- mPreviewPositionHelper.mClipBottom = -1;
mPreviewPositionHelper.mIsOrientationChanged = false;
if (mBitmapShader != null && mThumbnailData != null) {
mPreviewRect.set(0, 0, mThumbnailData.thumbnail.getWidth(),
@@ -473,40 +465,97 @@
/**
* Updates the matrix based on the provided parameters
*/
- public void updateThumbnailMatrix(Rect thumbnailPosition, ThumbnailData thumbnailData,
+ public void updateThumbnailMatrix(Rect thumbnailBounds, ThumbnailData thumbnailData,
int canvasWidth, int canvasHeight, DeviceProfile dp, int currentRotation) {
boolean isRotated = false;
boolean isOrientationDifferent;
- mClipBottom = -1;
- float scale = thumbnailData.scale;
- Rect activityInsets = dp.getInsets();
- Rect thumbnailInsets = getBoundedInsets(activityInsets, thumbnailData.insets);
- final float thumbnailWidth = thumbnailPosition.width()
- - (thumbnailInsets.left + thumbnailInsets.right) * scale;
- final float thumbnailHeight = thumbnailPosition.height()
- - (thumbnailInsets.top + thumbnailInsets.bottom) * scale;
-
- final float thumbnailScale;
int thumbnailRotation = thumbnailData.rotation;
int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
+ RectF thumbnailClipHint = new RectF(thumbnailData.insets);
+
+ float scale = thumbnailData.scale;
+ final float thumbnailScale;
// Landscape vs portrait change
boolean windowingModeSupportsRotation = !dp.isMultiWindowMode
&& thumbnailData.windowingMode == WINDOWING_MODE_FULLSCREEN;
isOrientationDifferent = isOrientationChange(deltaRotate)
&& windowingModeSupportsRotation;
- if (canvasWidth == 0) {
+ if (canvasWidth == 0 || canvasHeight == 0 || scale == 0) {
// If we haven't measured , skip the thumbnail drawing and only draw the background
// color
thumbnailScale = 0f;
} else {
// Rotate the screenshot if not in multi-window mode
isRotated = deltaRotate > 0 && windowingModeSupportsRotation;
- // Scale the screenshot to always fit the width of the card.
- thumbnailScale = isOrientationDifferent
- ? canvasWidth / thumbnailHeight
- : canvasWidth / thumbnailWidth;
+
+ float surfaceWidth = thumbnailBounds.width() / scale;
+ float surfaceHeight = thumbnailBounds.height() / scale;
+ float availableWidth = surfaceWidth
+ - (thumbnailClipHint.left + thumbnailClipHint.right);
+ float availableHeight = surfaceHeight
+ - (thumbnailClipHint.top + thumbnailClipHint.bottom);
+
+ final float targetW, targetH;
+ if (isOrientationDifferent) {
+ targetW = canvasHeight;
+ targetH = canvasWidth;
+ } else {
+ targetW = canvasWidth;
+ targetH = canvasHeight;
+ }
+ float canvasAspect = targetW / targetH;
+
+ // Update the clipHint such that
+ // > the final clipped position has same aspect ratio as requested by canvas
+ // > the clipped region is within the task insets if possible
+ // > the clipped region is not scaled up when drawing. If that is not possible
+ // while staying within the taskInsets, move outside the insets.
+ float croppedWidth = availableWidth;
+ if (croppedWidth < targetW) {
+ croppedWidth = Math.min(targetW, surfaceWidth);
+ }
+
+ float croppedHeight = croppedWidth / canvasAspect;
+ if (croppedHeight > availableHeight) {
+ croppedHeight = availableHeight;
+ if (croppedHeight < targetH) {
+ croppedHeight = Math.min(targetH, surfaceHeight);
+ }
+ croppedWidth = croppedHeight * canvasAspect;
+
+ // One last check in case the task aspect radio messed up something
+ if (croppedWidth > surfaceWidth) {
+ croppedWidth = surfaceWidth;
+ croppedHeight = croppedWidth / canvasAspect;
+ }
+ }
+
+ // Update the clip hints
+ float halfExtraW = (availableWidth - croppedWidth) / 2;
+ thumbnailClipHint.left += halfExtraW;
+ thumbnailClipHint.right += halfExtraW;
+ if (thumbnailClipHint.left < 0) {
+ thumbnailClipHint.right += thumbnailClipHint.left;
+ thumbnailClipHint.left = 0;
+ } else if (thumbnailClipHint.right < 0) {
+ thumbnailClipHint.left += thumbnailClipHint.right;
+ thumbnailClipHint.right = 0;
+ }
+
+ float halfExtraH = (availableHeight - croppedHeight) / 2;
+ thumbnailClipHint.top += halfExtraH;
+ thumbnailClipHint.bottom += halfExtraH;
+ if (thumbnailClipHint.top < 0) {
+ thumbnailClipHint.bottom += thumbnailClipHint.top;
+ thumbnailClipHint.top = 0;
+ } else if (thumbnailClipHint.bottom < 0) {
+ thumbnailClipHint.top += thumbnailClipHint.bottom;
+ thumbnailClipHint.bottom = 0;
+ }
+
+ thumbnailScale = targetW / (croppedWidth * scale);
}
Rect splitScreenInsets = dp.getInsets();
@@ -516,24 +565,24 @@
mClippedInsets.offsetTo(splitScreenInsets.left * scale,
splitScreenInsets.top * scale);
} else {
- mClippedInsets.offsetTo(thumbnailInsets.left * scale,
- thumbnailInsets.top * scale);
+ mClippedInsets.offsetTo(thumbnailClipHint.left * scale,
+ thumbnailClipHint.top * scale);
}
mMatrix.setTranslate(
- -thumbnailInsets.left * scale,
- -thumbnailInsets.top * scale);
+ -thumbnailClipHint.left * scale,
+ -thumbnailClipHint.top * scale);
} else {
- setThumbnailRotation(deltaRotate, thumbnailInsets, scale, thumbnailPosition);
+ setThumbnailRotation(deltaRotate, thumbnailClipHint, scale, thumbnailBounds);
}
final float widthWithInsets;
final float heightWithInsets;
if (isOrientationDifferent) {
- widthWithInsets = thumbnailPosition.height() * thumbnailScale;
- heightWithInsets = thumbnailPosition.width() * thumbnailScale;
+ widthWithInsets = thumbnailBounds.height() * thumbnailScale;
+ heightWithInsets = thumbnailBounds.width() * thumbnailScale;
} else {
- widthWithInsets = thumbnailPosition.width() * thumbnailScale;
- heightWithInsets = thumbnailPosition.height() * thumbnailScale;
+ widthWithInsets = thumbnailBounds.width() * thumbnailScale;
+ heightWithInsets = thumbnailBounds.height() * thumbnailScale;
}
mClippedInsets.left *= thumbnailScale;
mClippedInsets.top *= thumbnailScale;
@@ -549,22 +598,9 @@
}
mMatrix.postScale(thumbnailScale, thumbnailScale);
-
- float bitmapHeight = Math.max(0,
- (isOrientationDifferent ? thumbnailWidth : thumbnailHeight) * thumbnailScale);
- if (Math.round(bitmapHeight) < canvasHeight) {
- mClipBottom = bitmapHeight;
- }
mIsOrientationChanged = isOrientationDifferent;
}
- private Rect getBoundedInsets(Rect activityInsets, Rect insets) {
- return new Rect(Math.min(insets.left, activityInsets.left),
- Math.min(insets.top, activityInsets.top),
- Math.min(insets.right, activityInsets.right),
- Math.min(insets.bottom, activityInsets.bottom));
- }
-
private int getRotationDelta(int oldRotation, int newRotation) {
int delta = newRotation - oldRotation;
if (delta < 0) delta += 4;
@@ -580,12 +616,12 @@
return deltaRotation == Surface.ROTATION_90 || deltaRotation == Surface.ROTATION_270;
}
- private void setThumbnailRotation(int deltaRotate, Rect thumbnailInsets, float scale,
+ private void setThumbnailRotation(int deltaRotate, RectF thumbnailInsets, float scale,
Rect thumbnailPosition) {
- int newLeftInset = 0;
- int newTopInset = 0;
- int translateX = 0;
- int translateY = 0;
+ float newLeftInset = 0;
+ float newTopInset = 0;
+ float translateX = 0;
+ float translateY = 0;
mMatrix.setRotate(90 * deltaRotate);
switch (deltaRotate) { /* Counter-clockwise */
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
similarity index 96%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
rename to quickstep/src/com/android/quickstep/views/TaskView.java
index 27d84e6..3a359f0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -245,14 +245,14 @@
*/
public WorkspaceItemInfo getItemInfo() {
ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(getTask().key);
- WorkspaceItemInfo dummyInfo = new WorkspaceItemInfo();
- dummyInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_TASK;
- dummyInfo.container = LauncherSettings.Favorites.CONTAINER_TASKSWITCHER;
- dummyInfo.user = componentKey.user;
- dummyInfo.intent = new Intent().setComponent(componentKey.componentName);
- dummyInfo.title = TaskUtils.getTitle(getContext(), getTask());
- dummyInfo.screenId = getRecentsView().indexOfChild(this);
- return dummyInfo;
+ WorkspaceItemInfo stubInfo = new WorkspaceItemInfo();
+ stubInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_TASK;
+ stubInfo.container = LauncherSettings.Favorites.CONTAINER_TASKSWITCHER;
+ stubInfo.user = componentKey.user;
+ stubInfo.intent = new Intent().setComponent(componentKey.componentName);
+ stubInfo.title = TaskUtils.getTitle(getContext(), getTask());
+ stubInfo.screenId = getRecentsView().indexOfChild(this);
+ return stubInfo;
}
@Override
@@ -366,19 +366,11 @@
public void launchTask(boolean animate, boolean freezeTaskList, Consumer<Boolean> resultCallback,
Handler resultCallbackHandler) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
- RecentsView recentsView = getRecentsView();
if (isRunningTask()) {
- recentsView.finishRecentsAnimation(false /* toRecents */,
+ getRecentsView().finishRecentsAnimation(false /* toRecents */,
() -> resultCallbackHandler.post(() -> resultCallback.accept(true)));
} else {
- // This is a workaround against the WM issue that app open is not correctly animated
- // when recents animation is being cleaned up (b/143774568). When that's possible,
- // we should rely on the framework side to cancel the recents animation, and we will
- // clean up the screenshot on the launcher side while we launch the next task.
- recentsView.switchToScreenshot(null,
- () -> recentsView.finishRecentsAnimation(true /* toRecents */,
- () -> launchTaskInternal(animate, freezeTaskList, resultCallback,
- resultCallbackHandler)));
+ launchTaskInternal(animate, freezeTaskList, resultCallback, resultCallbackHandler);
}
} else {
launchTaskInternal(animate, freezeTaskList, resultCallback, resultCallbackHandler);
diff --git a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
index 115294a..72116eb 100644
--- a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
+++ b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
@@ -71,7 +71,7 @@
/**
* Test to verify view inflation does not happen during swipe up.
- * To verify view inflation, we setup a dummy ViewConfiguration and check if any call to that class
+ * To verify view inflation, we setup a stub ViewConfiguration and check if any call to that class
* does from a View.init method or not.
*
* Alternative approaches considered:
@@ -138,13 +138,13 @@
@Test
@NavigationModeSwitch(mode = ZERO_BUTTON)
public void testSwipeUpFromApp_widget_update() {
- String dummyText = "Some random dummy text";
+ String stubText = "Some random stub text";
executeSwipeUpTestWithWidget(
widgetId -> { },
widgetId -> AppWidgetManager.getInstance(getContext())
- .updateAppWidget(widgetId, createMainWidgetViews(dummyText)),
- dummyText);
+ .updateAppWidget(widgetId, createMainWidgetViews(stubText)),
+ stubText);
}
@Test
diff --git a/res/animator-v23/discovery_bounce.xml b/res/animator-v23/discovery_bounce.xml
deleted file mode 100644
index f554853..0000000
--- a/res/animator-v23/discovery_bounce.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2017, 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.
-*/
--->
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
- android:duration="2166"
- android:repeatCount="5">
- <propertyValuesHolder
- android:propertyName="progress"
- android:valueType="floatType">
- <keyframe
- android:fraction="0"
- android:value="1f" />
- <keyframe
- android:fraction="0.246"
- android:value="1f" />
- <keyframe
- android:fraction=".423"
- android:interpolator="@interpolator/disco_bounce"
- android:value="0.9738f" />
- <keyframe
- android:fraction="0.754"
- android:interpolator="@interpolator/disco_bounce"
- android:value="1f" />
- <keyframe
- android:fraction="1"
- android:value="1f" />
- </propertyValuesHolder>
-</objectAnimator>
diff --git a/res/animator/discovery_bounce.xml b/res/animator/discovery_bounce.xml
index f02ebdb..f554853 100644
--- a/res/animator/discovery_bounce.xml
+++ b/res/animator/discovery_bounce.xml
@@ -16,20 +16,28 @@
** limitations under the License.
*/
-->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:ordering="sequentially">
- <objectAnimator
- android:duration="166"
- android:interpolator="@interpolator/disco_bounce"
+<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="2166"
+ android:repeatCount="5">
+ <propertyValuesHolder
android:propertyName="progress"
- android:startOffset="750"
- android:valueFrom="1f"
- android:valueTo="0.9438f"
- android:valueType="floatType" />
- <objectAnimator
- android:duration="500"
- android:interpolator="@interpolator/disco_bounce"
- android:propertyName="progress"
- android:valueTo="1f"
- android:valueType="floatType" />
-</set>
+ android:valueType="floatType">
+ <keyframe
+ android:fraction="0"
+ android:value="1f" />
+ <keyframe
+ android:fraction="0.246"
+ android:value="1f" />
+ <keyframe
+ android:fraction=".423"
+ android:interpolator="@interpolator/disco_bounce"
+ android:value="0.9738f" />
+ <keyframe
+ android:fraction="0.754"
+ android:interpolator="@interpolator/disco_bounce"
+ android:value="1f" />
+ <keyframe
+ android:fraction="1"
+ android:value="1f" />
+ </propertyValuesHolder>
+</objectAnimator>
diff --git a/res/color-v24/all_apps_bg_hand_fill.xml b/res/color/all_apps_bg_hand_fill.xml
similarity index 100%
rename from res/color-v24/all_apps_bg_hand_fill.xml
rename to res/color/all_apps_bg_hand_fill.xml
diff --git a/res/color-v24/all_apps_bg_hand_fill_dark.xml b/res/color/all_apps_bg_hand_fill_dark.xml
similarity index 100%
rename from res/color-v24/all_apps_bg_hand_fill_dark.xml
rename to res/color/all_apps_bg_hand_fill_dark.xml
diff --git a/res/drawable-v26/ic_deepshortcut_placeholder.xml b/res/drawable-v26/ic_deepshortcut_placeholder.xml
deleted file mode 100644
index 3fa8506..0000000
--- a/res/drawable-v26/ic_deepshortcut_placeholder.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 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.
--->
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="?attr/popupColorSecondary"/>
- <foreground android:drawable="?attr/popupColorSecondary"/>
-</adaptive-icon>
diff --git a/res/drawable-v26/ic_launcher_home.xml b/res/drawable-v26/ic_launcher_home.xml
deleted file mode 100644
index 7038775..0000000
--- a/res/drawable-v26/ic_launcher_home.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@color/icon_background" />
- <foreground>
- <bitmap android:src="@mipmap/ic_launcher_home_foreground"/>
- </foreground>
-</adaptive-icon>
diff --git a/res/drawable-v24/ic_block_shadow.xml b/res/drawable/ic_block_shadow.xml
similarity index 100%
rename from res/drawable-v24/ic_block_shadow.xml
rename to res/drawable/ic_block_shadow.xml
diff --git a/res/drawable/ic_deepshortcut_placeholder.xml b/res/drawable/ic_deepshortcut_placeholder.xml
index 85a9694..3fa8506 100644
--- a/res/drawable/ic_deepshortcut_placeholder.xml
+++ b/res/drawable/ic_deepshortcut_placeholder.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!--
+ Copyright (C) 2017 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.
@@ -13,10 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval">
- <solid android:color="?attr/popupColorSecondary" />
- <size
- android:height="32dp"
- android:width="32dp" />
-</shape>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="?attr/popupColorSecondary"/>
+ <foreground android:drawable="?attr/popupColorSecondary"/>
+</adaptive-icon>
diff --git a/res/drawable/ic_launcher_home.xml b/res/drawable/ic_launcher_home.xml
index a6f2519..7038775 100644
--- a/res/drawable/ic_launcher_home.xml
+++ b/res/drawable/ic_launcher_home.xml
@@ -13,6 +13,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<bitmap
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@mipmap/ic_launcher_home" />
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@color/icon_background" />
+ <foreground>
+ <bitmap android:src="@mipmap/ic_launcher_home_foreground"/>
+ </foreground>
+</adaptive-icon>
diff --git a/res/drawable-v24/ic_remove_shadow.xml b/res/drawable/ic_remove_shadow.xml
similarity index 100%
rename from res/drawable-v24/ic_remove_shadow.xml
rename to res/drawable/ic_remove_shadow.xml
diff --git a/res/drawable-v24/ic_setup_shadow.xml b/res/drawable/ic_setup_shadow.xml
similarity index 100%
rename from res/drawable-v24/ic_setup_shadow.xml
rename to res/drawable/ic_setup_shadow.xml
diff --git a/res/drawable-v24/ic_uninstall_shadow.xml b/res/drawable/ic_uninstall_shadow.xml
similarity index 100%
rename from res/drawable-v24/ic_uninstall_shadow.xml
rename to res/drawable/ic_uninstall_shadow.xml
diff --git a/res/layout/search_result_hero_app.xml b/res/layout/search_result_hero_app.xml
new file mode 100644
index 0000000..bd0e42b
--- /dev/null
+++ b/res/layout/search_result_hero_app.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+<com.android.launcher3.views.HeroSearchResultView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:padding="@dimen/dynamic_grid_edge_margin">
+
+ <FrameLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <com.android.launcher3.BubbleTextView
+ android:id="@+id/bubble_text"
+ style="@style/BaseIcon"
+ android:drawablePadding="@dimen/dynamic_grid_icon_drawable_padding"
+ android:gravity="start|center_vertical"
+ android:textAlignment="viewStart"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="16sp"
+ android:layout_height="wrap_content"
+ launcher:iconDisplay="hero_app"
+ launcher:layoutHorizontal="true"/>
+
+ <View
+ android:id="@+id/icon"
+ android:layout_width="@dimen/deep_shortcut_icon_size"
+ android:layout_height="@dimen/deep_shortcut_icon_size"
+ android:layout_gravity="start|center_vertical"
+ android:background="@drawable/ic_deepshortcut_placeholder"/>
+ </FrameLayout>
+
+ <com.android.launcher3.BubbleTextView
+ android:id="@+id/shortcut_0"
+ style="@style/BaseIcon"
+ android:layout_width="@dimen/deep_shortcut_icon_size"
+ android:layout_height="match_parent"
+ android:gravity="start|center_vertical"
+ android:textAlignment="center"
+ launcher:iconDisplay="shortcut_popup"
+ android:textSize="12sp"
+ launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size"
+ launcher:layoutHorizontal="false"/>
+
+ <com.android.launcher3.BubbleTextView
+ android:id="@+id/shortcut_1"
+ style="@style/BaseIcon"
+ android:layout_width="@dimen/deep_shortcut_icon_size"
+ android:layout_height="match_parent"
+ android:gravity="start|center_vertical"
+ android:textAlignment="center"
+ launcher:iconDisplay="shortcut_popup"
+ android:textSize="12sp"
+ launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size"
+ launcher:layoutHorizontal="false"/>
+
+</com.android.launcher3.views.HeroSearchResultView>
\ No newline at end of file
diff --git a/res/layout/search_section_title.xml b/res/layout/search_section_title.xml
index 9ab27c1..c39a641 100644
--- a/res/layout/search_section_title.xml
+++ b/res/layout/search_section_title.xml
@@ -19,7 +19,5 @@
android:fontFamily="@style/TextHeadline"
android:layout_width="wrap_content"
android:textColor="?android:attr/textColorPrimary"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- android:paddingTop="8dp"
+ android:padding="4dp"
android:layout_height="wrap_content"/>
\ No newline at end of file
diff --git a/res/mipmap-hdpi/ic_launcher_home.png b/res/mipmap-hdpi/ic_launcher_home.png
deleted file mode 100644
index d068d92..0000000
--- a/res/mipmap-hdpi/ic_launcher_home.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_home.png b/res/mipmap-mdpi/ic_launcher_home.png
deleted file mode 100644
index 16c8ec2..0000000
--- a/res/mipmap-mdpi/ic_launcher_home.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_home.png b/res/mipmap-xhdpi/ic_launcher_home.png
deleted file mode 100644
index 8b2671b..0000000
--- a/res/mipmap-xhdpi/ic_launcher_home.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_launcher_home.png b/res/mipmap-xxhdpi/ic_launcher_home.png
deleted file mode 100644
index 43d8b7d..0000000
--- a/res/mipmap-xxhdpi/ic_launcher_home.png
+++ /dev/null
Binary files differ
diff --git a/res/values-night-v26/styles.xml b/res/values-night/styles.xml
similarity index 100%
rename from res/values-night-v26/styles.xml
rename to res/values-night/styles.xml
diff --git a/res/values-v22/styles.xml b/res/values-v22/styles.xml
deleted file mode 100644
index f86db7a..0000000
--- a/res/values-v22/styles.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright (C) 2018 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>
-
- <style name="AppItemActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
- <item name="widgetsTheme">@style/WidgetContainerTheme</item>
- </style>
-
-</resources>
\ No newline at end of file
diff --git a/res/values-v26/bools.xml b/res/values-v26/bools.xml
deleted file mode 100644
index ad8c7a1..0000000
--- a/res/values-v26/bools.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* Copyright 2017, 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>
- <bool name="notification_dots_enabled">true</bool>
-
- <bool name="enable_install_shortcut_api">false</bool>
-</resources>
\ No newline at end of file
diff --git a/res/values-v26/styles.xml b/res/values-v26/styles.xml
deleted file mode 100644
index d2f0802..0000000
--- a/res/values-v26/styles.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright (C) 2017 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>
- <!-- Theme for the widget container. -->
- <style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
- <item name="android:colorPrimaryDark">#E8EAED</item>
- <item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
- <item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
- </style>
- <style name="WidgetContainerTheme.Dark" parent="AppTheme.Dark">
- <item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
- <item name="android:colorPrimaryDark">#616161</item> <!-- Gray 700 -->
- </style>
-
-</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 26e6cba..acb8221 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -57,6 +57,7 @@
<enum name="folder" value="2" />
<enum name="widget_section" value="3" />
<enum name="shortcut_popup" value="4" />
+ <enum name="hero_app" value="5" />
</attr>
<attr name="centerVertically" format="boolean" />
</declare-styleable>
diff --git a/res/values/bools.xml b/res/values/bools.xml
deleted file mode 100644
index bc2c678..0000000
--- a/res/values/bools.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* Copyright 2017, 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>
- <bool name="notification_dots_enabled">false</bool>
-
- <bool name="enable_install_shortcut_api">true</bool>
-</resources>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 043ad9a..fe9717c 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -35,8 +35,8 @@
<color name="icon_background">#E0E0E0</color> <!-- Gray 300 -->
- <color name="all_apps_bg_hand_fill">#E5E5E5</color>
- <color name="all_apps_bg_hand_fill_dark">#9AA0A6</color>
+ <color name="all_apps_section_fill">#32c0c0c0</color>
+ <color name="all_apps_section_focused_item">#40c0c0c0</color>
<color name="gesture_tutorial_ripple_color">#A0C2F9</color> <!-- Light Blue -->
<color name="gesture_tutorial_fake_task_view_color">#6DA1FF</color> <!-- Light Blue -->
diff --git a/res/values/drawables.xml b/res/values/drawables.xml
deleted file mode 100644
index 9c57ec1..0000000
--- a/res/values/drawables.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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>
- <drawable name="ic_setup_shadow">@drawable/ic_setting</drawable>
- <drawable name="ic_remove_shadow">@drawable/ic_remove_no_shadow</drawable>
- <drawable name="ic_uninstall_shadow">@drawable/ic_uninstall_no_shadow</drawable>
- <drawable name="ic_block_shadow">@drawable/ic_block_no_shadow</drawable>
-</resources>
\ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 3b9532e..fd3d873 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -143,7 +143,7 @@
<style name="AppTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark.DarkMainColor" />
<style name="AppTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark.DarkText" />
- <style name="AppItemActivityTheme" parent="@android:style/Theme.Material.Light.Dialog.Alert">
+ <style name="AppItemActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
</style>
@@ -171,14 +171,16 @@
<item name="android:textColorSecondary">?attr/workspaceTextColor</item>
</style>
- <!-- Theme for the widget container. Overridden on API 26. -->
+ <!-- Theme for the widget container. -->
<style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
- <item name="android:colorEdgeEffect">?android:attr/textColorSecondaryInverse</item>
- <item name="android:textColorPrimary">?android:attr/textColorPrimaryInverse</item>
- <item name="android:textColorSecondary">?android:attr/textColorSecondaryInverse</item>
+ <item name="android:colorPrimaryDark">#E8EAED</item>
+ <item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
+ <item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
</style>
-
- <style name="WidgetContainerTheme.Dark" />
+ <style name="WidgetContainerTheme.Dark" parent="AppTheme.Dark">
+ <item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
+ <item name="android:colorPrimaryDark">#616161</item> <!-- Gray 700 -->
+ </style>
<style name="FastScrollerPopup" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle">
<item name="android:layout_width">wrap_content</item>
diff --git a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java
index 5610b0e..9ac3fe7 100644
--- a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java
@@ -53,10 +53,10 @@
mModelHelper = new LauncherModelHelper();
mModelHelper.initializeData("/cache_data_updated_task_data.txt");
- // Add dummy entries in the cache to simulate update
+ // Add placeholder entries in the cache to simulate update
Context context = RuntimeEnvironment.application;
IconCache iconCache = LauncherAppState.getInstance(context).getIconCache();
- CachingLogic<ItemInfo> dummyLogic = new CachingLogic<ItemInfo>() {
+ CachingLogic<ItemInfo> placeholderLogic = new CachingLogic<ItemInfo>() {
@Override
public ComponentName getComponent(ItemInfo info) {
return info.getTargetComponent();
@@ -81,7 +81,7 @@
UserManager um = context.getSystemService(UserManager.class);
for (ItemInfo info : mModelHelper.getBgDataModel().itemsIdMap) {
- iconCache.addIconToDBAndMemCache(info, dummyLogic, new PackageInfo(),
+ iconCache.addIconToDBAndMemCache(info, placeholderLogic, new PackageInfo(),
um.getSerialNumberForUser(info.user), true);
}
}
diff --git a/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java b/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java
index bbbe21e..be03c7d 100644
--- a/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java
@@ -165,7 +165,7 @@
@Override
public void onOpen(SQLiteDatabase db) { }
};
- // Insert dummy data
+ // Insert mock data
for (int i = 0; i < 10; i++) {
ContentValues values = new ContentValues();
values.put(Favorites._ID, i);
diff --git a/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java b/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java
index 8f3a83e..655237d 100644
--- a/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java
@@ -109,7 +109,7 @@
public void testCustomProfileLoaded_with_widget() throws Exception {
String pendingAppPkg = "com.test.pending";
- // Add a dummy session info so that the widget exists
+ // Add a placeholder session info so that the widget exists
SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
params.setAppPackageName(pendingAppPkg);
@@ -120,7 +120,7 @@
setField(sessionInfo, "appIcon", BitmapInfo.LOW_RES_ICON);
writeLayoutAndLoad(new LauncherLayoutBuilder().atWorkspace(0, 1, 0)
- .putWidget(pendingAppPkg, "DummyWidget", 2, 2));
+ .putWidget(pendingAppPkg, "PlaceholderWidget", 2, 2));
// Verify widget
assertEquals(1, mModelHelper.getBgDataModel().appWidgets.size());
diff --git a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java
index 3a252dc..fb08c56 100644
--- a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java
@@ -51,7 +51,7 @@
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.LauncherSettings;
+import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.Executors;
@@ -92,9 +92,9 @@
SCREEN, CELLX, CELLY, RESTORED, INTENT
});
- mLoaderCursor = new LoaderCursor(mCursor, LauncherSettings.Favorites.CONTENT_URI, mApp,
- new UserManagerState());
- mLoaderCursor.allUsers.put(0, Process.myUserHandle());
+ UserManagerState ums = new UserManagerState();
+ mLoaderCursor = new LoaderCursor(mCursor, Favorites.CONTENT_URI, mApp, ums);
+ ums.allUsers.put(0, Process.myUserHandle());
}
private void initCursor(int itemType, String title) {
@@ -110,7 +110,7 @@
public void getAppShortcutInfo_dontAllowMissing_invalidComponent() {
initCursor(ITEM_TYPE_APPLICATION, "");
assertTrue(mLoaderCursor.moveToNext());
- ComponentName cn = new ComponentName(mContext.getPackageName(), "dummy-do");
+ ComponentName cn = new ComponentName(mContext.getPackageName(), "placeholder-do");
assertNull(mLoaderCursor.getAppShortcutInfo(
new Intent().setComponent(cn), false /* allowMissingTarget */, true));
}
@@ -136,7 +136,7 @@
initCursor(ITEM_TYPE_APPLICATION, "");
assertTrue(mLoaderCursor.moveToNext());
- ComponentName cn = new ComponentName(mContext.getPackageName(), "dummy-do");
+ ComponentName cn = new ComponentName(mContext.getPackageName(), "placeholder-do");
WorkspaceItemInfo info = Executors.MODEL_EXECUTOR.submit(() ->
mLoaderCursor.getAppShortcutInfo(
new Intent().setComponent(cn), true /* allowMissingTarget */, true))
diff --git a/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java b/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java
index ee73b82..4184d33 100644
--- a/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java
+++ b/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java
@@ -44,7 +44,7 @@
@Test
public void testMigrateProfileId() throws Exception {
SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase();
- // Add some dummy data
+ // Add some mock data
for (int i = 0; i < 5; i++) {
ContentValues values = new ContentValues();
values.put(Favorites._ID, i);
@@ -64,7 +64,7 @@
@Test
public void testChangeDefaultColumn() throws Exception {
SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase();
- // Add some dummy data
+ // Add some mock data
for (int i = 0; i < 5; i++) {
ContentValues values = new ContentValues();
values.put(Favorites._ID, i);
diff --git a/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java b/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java
index 0388087..f2b3071 100644
--- a/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java
+++ b/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java
@@ -81,7 +81,7 @@
public static final int NO__ICON = -1;
public static final String TEST_PACKAGE = "com.android.launcher3.validpackage";
- // Authority for providing a dummy default-workspace-layout data.
+ // Authority for providing a test default-workspace-layout data.
private static final String TEST_PROVIDER_AUTHORITY =
LauncherModelHelper.class.getName().toLowerCase();
private static final int DEFAULT_BITMAP_SIZE = 10;
@@ -252,7 +252,7 @@
}
/**
- * Adds a dummy item in the DB.
+ * Adds a mock item in the DB.
* @param type {@link #APP_ICON} or {@link #SHORTCUT} or >= 2 for
* folder (where the type represents the number of items in the folder).
*/
@@ -310,7 +310,7 @@
}
/**
- * Initializes the DB with dummy elements to represent the provided grid structure.
+ * Initializes the DB with mock elements to represent the provided grid structure.
* @param typeArray A 3d array of item types. {@see #addItem(int, long, long, int, int)} for
* type definitions. The first dimension represents the screens and the next
* two represent the workspace grid.
@@ -347,7 +347,7 @@
}
/**
- * Sets up a dummy provider to load the provided layout by default, next time the layout loads
+ * Sets up a mock provider to load the provided layout by default, next time the layout loads
*/
public LauncherModelHelper setupDefaultLayoutProvider(LauncherLayoutBuilder builder)
throws Exception {
@@ -360,7 +360,7 @@
"launcher3.layout.provider", TEST_PROVIDER_AUTHORITY);
shadowOf(context.getPackageManager())
- .addProviderIfNotPresent(new ComponentName("com.test", "Dummy")).authority =
+ .addProviderIfNotPresent(new ComponentName("com.test", "Mock")).authority =
TEST_PROVIDER_AUTHORITY;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
diff --git a/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java b/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java
index 84c65b1..5ab3106 100644
--- a/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java
+++ b/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java
@@ -129,7 +129,7 @@
ShadowPackageManager spm = shadowOf(mContext.getPackageManager());
for (int i = 0; i < num; i++) {
- ComponentName cn = new ComponentName("com.dummy.apk" + i, "DummyWidet");
+ ComponentName cn = new ComponentName("com.placeholder.apk" + i, "PlaceholderWidet");
AppWidgetProviderInfo widgetInfo = new AppWidgetProviderInfo();
widgetInfo.provider = cn;
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index ce37a30..3bfe379 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -16,6 +16,7 @@
package com.android.launcher3;
+import static android.animation.ValueAnimator.areAnimatorsEnabled;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
@@ -126,7 +127,7 @@
}
public final void close(boolean animate) {
- animate &= Utilities.areAnimationsEnabled(getContext());
+ animate &= areAnimatorsEnabled();
if (mIsOpen) {
BaseActivity.fromContext(getContext()).getUserEventDispatcher()
.resetElapsedContainerMillis("container closed");
diff --git a/src/com/android/launcher3/AutoInstallsLayout.java b/src/com/android/launcher3/AutoInstallsLayout.java
index 432073e..f61bc05 100644
--- a/src/com/android/launcher3/AutoInstallsLayout.java
+++ b/src/com/android/launcher3/AutoInstallsLayout.java
@@ -658,7 +658,7 @@
}
}
- protected static void beginDocument(XmlPullParser parser, String firstElementName)
+ public static void beginDocument(XmlPullParser parser, String firstElementName)
throws XmlPullParserException, IOException {
int type;
while ((type = parser.next()) != XmlPullParser.START_TAG
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index 112126b..cbc3abc 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -17,7 +17,7 @@
package com.android.launcher3;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
-import static com.android.launcher3.util.DefaultDisplay.CHANGE_ROTATION;
+import static com.android.launcher3.util.DisplayController.DisplayHolder.CHANGE_ROTATION;
import android.app.ActivityOptions;
import android.content.ActivityNotFoundException;
@@ -42,6 +42,7 @@
import androidx.annotation.Nullable;
+import com.android.launcher3.Launcher.OnResumeCallback;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.InstanceIdSequence;
@@ -49,9 +50,9 @@
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.uioverrides.WallpaperColorInfo;
-import com.android.launcher3.util.DefaultDisplay;
-import com.android.launcher3.util.DefaultDisplay.DisplayInfoChangeListener;
-import com.android.launcher3.util.DefaultDisplay.Info;
+import com.android.launcher3.util.DisplayController;
+import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
+import com.android.launcher3.util.DisplayController.Info;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.TraceHelper;
@@ -83,7 +84,7 @@
mIsSafeModeEnabled = TraceHelper.allowIpcs("isSafeMode",
() -> getPackageManager().isSafeMode());
- DefaultDisplay.INSTANCE.get(this).addChangeListener(this);
+ DisplayController.getDefaultDisplay(this).addChangeListener(this);
// Update theme
WallpaperColorInfo.INSTANCE.get(this).addOnChangeListener(this);
@@ -107,10 +108,20 @@
private void updateTheme() {
if (mThemeRes != Themes.getActivityThemeRes(this)) {
- recreate();
+ // Workaround (b/162812884): The system currently doesn't allow recreating an activity
+ // when it is not resumed, in such a case defer recreation until it is possible
+ if (hasBeenResumed()) {
+ recreate();
+ } else {
+ addOnResumeCallback(this::recreate);
+ }
}
}
+ protected void addOnResumeCallback(OnResumeCallback callback) {
+ // To be overridden
+ }
+
@Override
public void onActionModeStarted(ActionMode mode) {
super.onActionModeStarted(mode);
@@ -246,7 +257,7 @@
protected void onDestroy() {
super.onDestroy();
WallpaperColorInfo.INSTANCE.get(this).removeOnChangeListener(this);
- DefaultDisplay.INSTANCE.get(this).removeChangeListener(this);
+ DisplayController.getDefaultDisplay(this).removeChangeListener(this);
}
public void runOnceOnStart(Runnable action) {
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 198f13d..55d5de7 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -77,6 +77,7 @@
private static final int DISPLAY_WORKSPACE = 0;
private static final int DISPLAY_ALL_APPS = 1;
private static final int DISPLAY_FOLDER = 2;
+ private static final int DISPLAY_HERO_APP = 5;
private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed};
@@ -178,6 +179,8 @@
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.folderChildTextSizePx);
setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx);
defaultIconSize = grid.folderChildIconSizePx;
+ } else if (mDisplay == DISPLAY_HERO_APP) {
+ defaultIconSize = grid.allAppsIconSizePx;
} else {
// widget_selection or shortcut_popup
defaultIconSize = grid.iconSizePx;
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 89d768c..1cd201f 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -16,6 +16,8 @@
package com.android.launcher3;
+import static android.animation.ValueAnimator.areAnimatorsEnabled;
+
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_5;
import android.animation.Animator;
@@ -2009,7 +2011,7 @@
// Animations are disabled in power save mode, causing the repeated animation to jump
// spastically between beginning and end states. Since this looks bad, we don't repeat
// the animation in power save mode.
- if (Utilities.areAnimationsEnabled(getContext())) {
+ if (areAnimatorsEnabled()) {
va.setRepeatMode(ValueAnimator.REVERSE);
va.setRepeatCount(ValueAnimator.INFINITE);
}
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 49caa93..12ce9f3 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -28,7 +28,8 @@
import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
+import com.android.launcher3.util.DisplayController.Info;
import com.android.launcher3.util.WindowBounds;
public class DeviceProfile {
@@ -38,7 +39,7 @@
public final InvariantDeviceProfile inv;
- private final DefaultDisplay.Info mInfo;
+ private final Info mInfo;
// Device properties
public final boolean isTablet;
@@ -140,7 +141,7 @@
public DotRenderer mDotRendererWorkSpace;
public DotRenderer mDotRendererAllApps;
- DeviceProfile(Context context, InvariantDeviceProfile inv, DefaultDisplay.Info info,
+ DeviceProfile(Context context, InvariantDeviceProfile inv, Info info,
Point minSize, Point maxSize, int width, int height, boolean isLandscape,
boolean isMultiWindowMode, boolean transposeLayoutWithOrientation,
Point windowPosition) {
@@ -606,7 +607,7 @@
*/
public boolean updateIsSeascape(Context context) {
if (isVerticalBarLayout()) {
- boolean isSeascape = DefaultDisplay.INSTANCE.get(context).getInfo().rotation
+ boolean isSeascape = DisplayController.getDefaultDisplay(context).getInfo().rotation
== Surface.ROTATION_270;
if (mIsSeascape != isSeascape) {
mIsSeascape = isSeascape;
@@ -638,7 +639,7 @@
}
}
- private static Context getContext(Context c, DefaultDisplay.Info info, int orientation) {
+ private static Context getContext(Context c, Info info, int orientation) {
Configuration config = new Configuration(c.getResources().getConfiguration());
config.orientation = orientation;
config.densityDpi = info.metrics.densityDpi;
@@ -662,7 +663,7 @@
public static class Builder {
private Context mContext;
private InvariantDeviceProfile mInv;
- private DefaultDisplay.Info mInfo;
+ private Info mInfo;
private final Point mWindowPosition = new Point();
private Point mMinSize, mMaxSize;
@@ -672,7 +673,7 @@
private boolean mIsMultiWindowMode = false;
private boolean mTransposeLayoutWithOrientation;
- public Builder(Context context, InvariantDeviceProfile inv, DefaultDisplay.Info info) {
+ public Builder(Context context, InvariantDeviceProfile inv, Info info) {
mContext = context;
mInv = inv;
mInfo = info;
diff --git a/src/com/android/launcher3/FirstFrameAnimatorHelper.java b/src/com/android/launcher3/FirstFrameAnimatorHelper.java
index 6c5bc40..a199a57 100644
--- a/src/com/android/launcher3/FirstFrameAnimatorHelper.java
+++ b/src/com/android/launcher3/FirstFrameAnimatorHelper.java
@@ -15,7 +15,7 @@
*/
package com.android.launcher3;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java
index 62c9b4d..d2b05c5 100644
--- a/src/com/android/launcher3/InstallShortcutReceiver.java
+++ b/src/com/android/launcher3/InstallShortcutReceiver.java
@@ -16,46 +16,40 @@
package com.android.launcher3;
+import static android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID;
+
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
+import static com.android.launcher3.LauncherSettings.Favorites.PROFILE_ID;
+import static com.android.launcher3.model.data.AppInfo.makeLaunchIntent;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
-import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.pm.ActivityInfo;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
-import android.content.pm.PackageManager;
import android.content.pm.ShortcutInfo;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.os.Parcelable;
import android.os.Process;
import android.os.UserHandle;
-import android.text.TextUtils;
-import android.util.Base64;
import android.util.Log;
import android.util.Pair;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
-import com.android.launcher3.icons.BitmapInfo;
-import com.android.launcher3.icons.GraphicsUtils;
-import com.android.launcher3.icons.LauncherIcons;
-import com.android.launcher3.model.data.AppInfo;
+import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
-import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.Preconditions;
-import com.android.launcher3.util.Thunk;
import org.json.JSONException;
import org.json.JSONObject;
@@ -69,7 +63,7 @@
import java.util.List;
import java.util.Set;
-public class InstallShortcutReceiver extends BroadcastReceiver {
+public class InstallShortcutReceiver {
public static final int FLAG_ACTIVITY_PAUSED = 1;
public static final int FLAG_LOADER_RUNNING = 2;
@@ -82,20 +76,6 @@
private static final String TAG = "InstallShortcutReceiver";
private static final boolean DBG = false;
- private static final String ACTION_INSTALL_SHORTCUT =
- "com.android.launcher.action.INSTALL_SHORTCUT";
-
- private static final String LAUNCH_INTENT_KEY = "intent.launch";
- private static final String NAME_KEY = "name";
- private static final String ICON_KEY = "icon";
- private static final String ICON_RESOURCE_NAME_KEY = "iconResource";
- private static final String ICON_RESOURCE_PACKAGE_NAME_KEY = "iconResourcePackage";
-
- private static final String APP_SHORTCUT_TYPE_KEY = "isAppShortcut";
- private static final String DEEPSHORTCUT_TYPE_KEY = "isDeepShortcut";
- private static final String APP_WIDGET_TYPE_KEY = "isAppWidget";
- private static final String USER_HANDLE_KEY = "userHandle";
-
// The set of shortcuts that are pending install
private static final String APPS_PENDING_INSTALL = "apps_to_install";
@@ -104,7 +84,7 @@
@WorkerThread
private static void addToQueue(Context context, PendingInstallShortcutInfo info) {
- String encoded = info.encodeToString();
+ String encoded = info.encodeToString(context);
SharedPreferences prefs = Utilities.getPrefs(context);
Set<String> strings = prefs.getStringSet(APPS_PENDING_INSTALL, null);
strings = (strings != null) ? new HashSet<>(strings) : new HashSet<>(1);
@@ -127,25 +107,14 @@
return;
}
- LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
for (String encoded : strings) {
PendingInstallShortcutInfo info = decode(encoded, context);
if (info == null) {
continue;
}
- String pkg = getIntentPackage(info.launchIntent);
- if (!TextUtils.isEmpty(pkg)
- && !launcherApps.isPackageEnabled(pkg, info.user)
- && !info.isActivity) {
- if (DBG) {
- Log.d(TAG, "Ignoring shortcut for absent package: " + info.launchIntent);
- }
- continue;
- }
-
// Generate a shortcut info to add into the model
- installQueue.add(info.getItemInfo());
+ installQueue.add(info.getItemInfo(context));
}
prefs.edit().remove(APPS_PENDING_INSTALL).apply();
if (!installQueue.isEmpty()) {
@@ -176,8 +145,8 @@
String encoded = newStringsIter.next();
try {
Decoder decoder = new Decoder(encoded, context);
- if (packageNames.contains(getIntentPackage(decoder.launcherIntent)) &&
- user.equals(decoder.user)) {
+ if (packageNames.contains(getIntentPackage(decoder.intent))
+ && user.equals(decoder.user)) {
newStringsIter.remove();
}
} catch (JSONException | URISyntaxException e) {
@@ -188,72 +157,17 @@
sp.edit().putStringSet(APPS_PENDING_INSTALL, newStrings).apply();
}
- public void onReceive(Context context, Intent data) {
- if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) {
- return;
- }
- PendingInstallShortcutInfo info = createPendingInfo(context, data);
- if (info != null) {
- if (!info.isLauncherActivity()) {
- // Since its a custom shortcut, verify that it is safe to launch.
- if (!new PackageManagerHelper(context).hasPermissionForActivity(
- info.launchIntent, null)) {
- // Target cannot be launched, or requires some special permission to launch
- Log.e(TAG, "Ignoring malicious intent " + info.launchIntent.toUri(0));
- return;
- }
- }
- queuePendingShortcutInfo(info, context);
- }
- }
-
- /**
- * @return true is the extra is either null or is of type {@param type}
- */
- private static boolean isValidExtraType(Intent intent, String key, Class type) {
- Object extra = intent.getParcelableExtra(key);
- return extra == null || type.isInstance(extra);
- }
-
- /**
- * Verifies the intent and creates a {@link PendingInstallShortcutInfo}
- */
- private static PendingInstallShortcutInfo createPendingInfo(Context context, Intent data) {
- if (!isValidExtraType(data, Intent.EXTRA_SHORTCUT_INTENT, Intent.class) ||
- !(isValidExtraType(data, Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
- Intent.ShortcutIconResource.class)) ||
- !(isValidExtraType(data, Intent.EXTRA_SHORTCUT_ICON, Bitmap.class))) {
-
- if (DBG) Log.e(TAG, "Invalid install shortcut intent");
- return null;
- }
-
- PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(
- data, Process.myUserHandle(), context);
- if (info.launchIntent == null || info.label == null) {
- if (DBG) Log.e(TAG, "Invalid install shortcut intent");
- return null;
- }
-
- return convertToLauncherActivityIfPossible(info);
- }
-
- public static WorkspaceItemInfo fromShortcutIntent(Context context, Intent data) {
- PendingInstallShortcutInfo info = createPendingInfo(context, data);
- return info == null ? null : (WorkspaceItemInfo) info.getItemInfo().first;
- }
-
public static void queueShortcut(ShortcutInfo info, Context context) {
- queuePendingShortcutInfo(new PendingInstallShortcutInfo(info, context), context);
+ queuePendingShortcutInfo(new PendingInstallShortcutInfo(info), context);
}
public static void queueWidget(AppWidgetProviderInfo info, int widgetId, Context context) {
- queuePendingShortcutInfo(new PendingInstallShortcutInfo(info, widgetId, context), context);
+ queuePendingShortcutInfo(new PendingInstallShortcutInfo(info, widgetId), context);
}
- public static void queueApplication(Intent data, UserHandle user, Context context) {
- queuePendingShortcutInfo(new PendingInstallShortcutInfo(data, context, user),
- context);
+ public static void queueApplication(
+ String packageName, UserHandle userHandle, Context context) {
+ queuePendingShortcutInfo(new PendingInstallShortcutInfo(packageName, userHandle), context);
}
public static HashSet<ShortcutKey> getPendingShortcuts(Context context) {
@@ -267,8 +181,8 @@
for (String encoded : strings) {
try {
Decoder decoder = new Decoder(encoded, context);
- if (decoder.optBoolean(DEEPSHORTCUT_TYPE_KEY)) {
- result.add(ShortcutKey.fromIntent(decoder.launcherIntent, decoder.user));
+ if (decoder.optInt(Favorites.ITEM_TYPE, -1) == ITEM_TYPE_DEEP_SHORTCUT) {
+ result.add(ShortcutKey.fromIntent(decoder.intent, decoder.user));
}
} catch (JSONException | URISyntaxException e) {
Log.d(TAG, "Exception reading shortcut to add: " + e);
@@ -298,224 +212,111 @@
MODEL_EXECUTOR.post(() -> flushQueueInBackground(context));
}
- /**
- * Ensures that we have a valid, non-null name. If the provided name is null, we will return
- * the application name instead.
- */
- @Thunk static CharSequence ensureValidName(Context context, Intent intent, CharSequence name) {
- if (name == null) {
- try {
- PackageManager pm = context.getPackageManager();
- ActivityInfo info = pm.getActivityInfo(intent.getComponent(), 0);
- name = info.loadLabel(pm);
- } catch (PackageManager.NameNotFoundException nnfe) {
- return "";
- }
- }
- return name;
- }
- private static class PendingInstallShortcutInfo {
+ private static class PendingInstallShortcutInfo extends ItemInfo {
- final boolean isActivity;
- @Nullable final ShortcutInfo shortcutInfo;
- @Nullable final AppWidgetProviderInfo providerInfo;
+ final Intent intent;
- @Nullable final Intent data;
- final Context mContext;
- final Intent launchIntent;
- final String label;
- final UserHandle user;
+ @Nullable ShortcutInfo shortcutInfo;
+ @Nullable AppWidgetProviderInfo providerInfo;
/**
- * Initializes a PendingInstallShortcutInfo received from a different app.
+ * Initializes a PendingInstallShortcutInfo to represent a pending launcher target.
*/
- public PendingInstallShortcutInfo(Intent data, UserHandle user, Context context) {
- isActivity = false;
- shortcutInfo = null;
- providerInfo = null;
-
- this.data = data;
- this.user = user;
- mContext = context;
-
- launchIntent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
- label = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
+ public PendingInstallShortcutInfo(String packageName, UserHandle userHandle) {
+ itemType = Favorites.ITEM_TYPE_APPLICATION;
+ intent = new Intent().setPackage(packageName);
+ user = userHandle;
}
/**
- * Initializes a PendingInstallShortcutInfo to represent a launcher target.
+ * Initializes a PendingInstallShortcutInfo to represent a deep shortcut.
*/
- public PendingInstallShortcutInfo(LauncherActivityInfo info, Context context) {
- isActivity = true;
- shortcutInfo = null;
- providerInfo = null;
-
- String packageName = info.getComponentName().getPackageName();
- data = new Intent();
- data.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent().setComponent(
- new ComponentName(packageName, "")).setPackage(packageName));
- data.putExtra(Intent.EXTRA_SHORTCUT_NAME, info.getLabel());
-
- user = info.getUser();
- mContext = context;
-
- launchIntent = AppInfo.makeLaunchIntent(info);
- label = info.getLabel().toString();
- }
-
- /**
- * Initializes a PendingInstallShortcutInfo to represent a launcher target.
- */
- public PendingInstallShortcutInfo(Intent data, Context context, UserHandle user) {
- isActivity = true;
- shortcutInfo = null;
- providerInfo = null;
-
- this.data = data;
- this.user = user;
- mContext = context;
-
- launchIntent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
- label = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
- }
-
- /**
- * Initializes a PendingInstallShortcutInfo to represent a launcher target.
- */
- public PendingInstallShortcutInfo(ShortcutInfo info, Context context) {
- isActivity = false;
- shortcutInfo = info;
- providerInfo = null;
-
- data = null;
- mContext = context;
+ public PendingInstallShortcutInfo(ShortcutInfo info) {
+ itemType = Favorites.ITEM_TYPE_DEEP_SHORTCUT;
+ intent = ShortcutKey.makeIntent(info);
user = info.getUserHandle();
- launchIntent = ShortcutKey.makeIntent(info);
- label = info.getShortLabel().toString();
+ shortcutInfo = info;
}
/**
- * Initializes a PendingInstallShortcutInfo to represent a launcher target.
+ * Initializes a PendingInstallShortcutInfo to represent an app widget.
*/
- public PendingInstallShortcutInfo(
- AppWidgetProviderInfo info, int widgetId, Context context) {
- isActivity = false;
- shortcutInfo = null;
- providerInfo = info;
-
- data = null;
- mContext = context;
+ public PendingInstallShortcutInfo(AppWidgetProviderInfo info, int widgetId) {
+ itemType = Favorites.ITEM_TYPE_APPWIDGET;
+ intent = new Intent()
+ .setComponent(info.provider)
+ .putExtra(EXTRA_APPWIDGET_ID, widgetId);
user = info.getProfile();
- launchIntent = new Intent().setComponent(info.provider)
- .putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
- label = info.label;
+ providerInfo = info;
}
- public String encodeToString() {
+ public String encodeToString(Context context) {
try {
- if (shortcutInfo != null) {
- // If it a launcher target, we only need component name, and user to
- // recreate this.
- return new JSONStringer()
- .object()
- .key(LAUNCH_INTENT_KEY).value(launchIntent.toUri(0))
- .key(DEEPSHORTCUT_TYPE_KEY).value(true)
- .key(USER_HANDLE_KEY).value(UserCache.INSTANCE.get(mContext)
- .getSerialNumberForUser(user))
- .endObject().toString();
- } else if (providerInfo != null) {
- // If it a launcher target, we only need component name, and user to
- // recreate this.
- return new JSONStringer()
- .object()
- .key(LAUNCH_INTENT_KEY).value(launchIntent.toUri(0))
- .key(APP_WIDGET_TYPE_KEY).value(true)
- .key(USER_HANDLE_KEY).value(UserCache.INSTANCE.get(mContext)
- .getSerialNumberForUser(user))
- .endObject().toString();
- }
-
- if (launchIntent.getAction() == null) {
- launchIntent.setAction(Intent.ACTION_VIEW);
- } else if (launchIntent.getAction().equals(Intent.ACTION_MAIN) &&
- launchIntent.getCategories() != null &&
- launchIntent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) {
- launchIntent.addFlags(
- Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
- }
-
- // This name is only used for comparisons and notifications, so fall back to activity
- // name if not supplied
- String name = ensureValidName(mContext, launchIntent, label).toString();
- Bitmap icon = data == null ? null
- : data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
- Intent.ShortcutIconResource iconResource = data == null ? null
- : data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
-
- // Only encode the parameters which are supported by the API.
- JSONStringer json = new JSONStringer()
- .object()
- .key(LAUNCH_INTENT_KEY).value(launchIntent.toUri(0))
- .key(NAME_KEY).value(name)
- .key(USER_HANDLE_KEY).value(
- UserCache.INSTANCE.get(mContext).getSerialNumberForUser(user))
- .key(APP_SHORTCUT_TYPE_KEY).value(isActivity);
- if (icon != null) {
- byte[] iconByteArray = GraphicsUtils.flattenBitmap(icon);
- if (iconByteArray != null) {
- json = json.key(ICON_KEY).value(
- Base64.encodeToString(
- iconByteArray, 0, iconByteArray.length, Base64.DEFAULT));
- }
- }
- if (iconResource != null) {
- json = json.key(ICON_RESOURCE_NAME_KEY).value(iconResource.resourceName);
- json = json.key(ICON_RESOURCE_PACKAGE_NAME_KEY)
- .value(iconResource.packageName);
- }
- return json.endObject().toString();
+ return new JSONStringer()
+ .object()
+ .key(Favorites.ITEM_TYPE).value(itemType)
+ .key(Favorites.INTENT).value(intent.toUri(0))
+ .key(PROFILE_ID).value(
+ UserCache.INSTANCE.get(context).getSerialNumberForUser(user))
+ .endObject().toString();
} catch (JSONException e) {
Log.d(TAG, "Exception when adding shortcut: " + e);
return null;
}
}
- public Pair<ItemInfo, Object> getItemInfo() {
- if (isActivity) {
- WorkspaceItemInfo si = createWorkspaceItemInfo(data, user,
- LauncherAppState.getInstance(mContext));
- si.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
- si.status |= WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
- return Pair.create(si, null);
- } else if (shortcutInfo != null) {
- WorkspaceItemInfo itemInfo = new WorkspaceItemInfo(shortcutInfo, mContext);
- LauncherAppState.getInstance(mContext).getIconCache().getShortcutIcon(
- itemInfo, shortcutInfo);
- return Pair.create(itemInfo, shortcutInfo);
- } else if (providerInfo != null) {
- LauncherAppWidgetProviderInfo info = LauncherAppWidgetProviderInfo
- .fromProviderInfo(mContext, providerInfo);
- LauncherAppWidgetInfo widgetInfo = new LauncherAppWidgetInfo(
- launchIntent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0),
- info.provider);
- InvariantDeviceProfile idp = LauncherAppState.getIDP(mContext);
- widgetInfo.minSpanX = info.minSpanX;
- widgetInfo.minSpanY = info.minSpanY;
- widgetInfo.spanX = Math.min(info.spanX, idp.numColumns);
- widgetInfo.spanY = Math.min(info.spanY, idp.numRows);
- return Pair.create(widgetInfo, providerInfo);
- } else {
- WorkspaceItemInfo itemInfo =
- createWorkspaceItemInfo(data, user, LauncherAppState.getInstance(mContext));
- return Pair.create(itemInfo, null);
- }
- }
+ public Pair<ItemInfo, Object> getItemInfo(Context context) {
+ switch (itemType) {
+ case ITEM_TYPE_APPLICATION: {
+ String packageName = intent.getPackage();
+ List<LauncherActivityInfo> laiList =
+ context.getSystemService(LauncherApps.class)
+ .getActivityList(packageName, user);
- public boolean isLauncherActivity() {
- return isActivity;
+ final WorkspaceItemInfo si = new WorkspaceItemInfo();
+ si.user = user;
+ si.itemType = ITEM_TYPE_APPLICATION;
+
+ LauncherActivityInfo lai;
+ boolean usePackageIcon = laiList.isEmpty();
+ if (usePackageIcon) {
+ lai = null;
+ si.intent = makeLaunchIntent(new ComponentName(packageName, ""))
+ .setPackage(packageName);
+ si.status |= WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
+ } else {
+ lai = laiList.get(0);
+ si.intent = makeLaunchIntent(lai);
+ }
+ LauncherAppState.getInstance(context).getIconCache()
+ .getTitleAndIcon(si, () -> lai, usePackageIcon, false);
+ return Pair.create(si, null);
+ }
+ case ITEM_TYPE_DEEP_SHORTCUT: {
+ WorkspaceItemInfo itemInfo = new WorkspaceItemInfo(shortcutInfo, context);
+ LauncherAppState.getInstance(context).getIconCache()
+ .getShortcutIcon(itemInfo, shortcutInfo);
+ return Pair.create(itemInfo, shortcutInfo);
+ }
+ case ITEM_TYPE_APPWIDGET: {
+ LauncherAppWidgetProviderInfo info = LauncherAppWidgetProviderInfo
+ .fromProviderInfo(context, providerInfo);
+ LauncherAppWidgetInfo widgetInfo = new LauncherAppWidgetInfo(
+ intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0),
+ info.provider);
+ InvariantDeviceProfile idp = LauncherAppState.getIDP(context);
+ widgetInfo.minSpanX = info.minSpanX;
+ widgetInfo.minSpanY = info.minSpanY;
+ widgetInfo.spanX = Math.min(info.spanX, idp.numColumns);
+ widgetInfo.spanY = Math.min(info.spanY, idp.numRows);
+ widgetInfo.user = user;
+ return Pair.create(widgetInfo, providerInfo);
+ }
+ }
+ return null;
}
}
@@ -527,56 +328,32 @@
private static PendingInstallShortcutInfo decode(String encoded, Context context) {
try {
Decoder decoder = new Decoder(encoded, context);
- if (decoder.optBoolean(APP_SHORTCUT_TYPE_KEY)) {
- LauncherActivityInfo info = context.getSystemService(LauncherApps.class)
- .resolveActivity(decoder.launcherIntent, decoder.user);
- if (info != null) {
- return new PendingInstallShortcutInfo(info, context);
+ switch (decoder.optInt(Favorites.ITEM_TYPE, -1)) {
+ case Favorites.ITEM_TYPE_APPLICATION:
+ return new PendingInstallShortcutInfo(
+ decoder.intent.getPackage(), decoder.user);
+ case Favorites.ITEM_TYPE_DEEP_SHORTCUT: {
+ List<ShortcutInfo> si = ShortcutKey.fromIntent(decoder.intent, decoder.user)
+ .buildRequest(context)
+ .query(ShortcutRequest.ALL);
+ if (si.isEmpty()) {
+ return null;
+ } else {
+ return new PendingInstallShortcutInfo(si.get(0));
+ }
}
- } else if (decoder.optBoolean(DEEPSHORTCUT_TYPE_KEY)) {
- List<ShortcutInfo> si = ShortcutKey.fromIntent(decoder.launcherIntent, decoder.user)
- .buildRequest(context)
- .query(ShortcutRequest.ALL);
- if (si.isEmpty()) {
- return null;
- } else {
- return new PendingInstallShortcutInfo(si.get(0), context);
+ case Favorites.ITEM_TYPE_APPWIDGET: {
+ int widgetId = decoder.intent.getIntExtra(EXTRA_APPWIDGET_ID, 0);
+ AppWidgetProviderInfo info =
+ AppWidgetManager.getInstance(context).getAppWidgetInfo(widgetId);
+ if (info == null || !info.provider.equals(decoder.intent.getComponent())
+ || !info.getProfile().equals(decoder.user)) {
+ return null;
+ }
+ return new PendingInstallShortcutInfo(info, widgetId);
}
- } else if (decoder.optBoolean(APP_WIDGET_TYPE_KEY)) {
- int widgetId = decoder.launcherIntent
- .getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0);
- AppWidgetProviderInfo info = AppWidgetManager.getInstance(context)
- .getAppWidgetInfo(widgetId);
- if (info == null || !info.provider.equals(decoder.launcherIntent.getComponent()) ||
- !info.getProfile().equals(decoder.user)) {
- return null;
- }
- return new PendingInstallShortcutInfo(info, widgetId, context);
- }
-
- Intent data = new Intent();
- data.putExtra(Intent.EXTRA_SHORTCUT_INTENT, decoder.launcherIntent);
- data.putExtra(Intent.EXTRA_SHORTCUT_NAME, decoder.getString(NAME_KEY));
-
- String iconBase64 = decoder.optString(ICON_KEY);
- String iconResourceName = decoder.optString(ICON_RESOURCE_NAME_KEY);
- String iconResourcePackageName = decoder.optString(ICON_RESOURCE_PACKAGE_NAME_KEY);
- if (iconBase64 != null && !iconBase64.isEmpty()) {
- byte[] iconArray = Base64.decode(iconBase64, Base64.DEFAULT);
- Bitmap b = BitmapFactory.decodeByteArray(iconArray, 0, iconArray.length);
- data.putExtra(Intent.EXTRA_SHORTCUT_ICON, b);
- } else if (iconResourceName != null && !iconResourceName.isEmpty()) {
- Intent.ShortcutIconResource iconResource =
- new Intent.ShortcutIconResource();
- iconResource.resourceName = iconResourceName;
- iconResource.packageName = iconResourcePackageName;
- data.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
- }
-
- if (decoder.optBoolean(APP_SHORTCUT_TYPE_KEY)) {
- return new PendingInstallShortcutInfo(data, context, decoder.user);
- } else {
- return new PendingInstallShortcutInfo(data, decoder.user, context);
+ default:
+ Log.e(TAG, "Unknown item type");
}
} catch (JSONException | URISyntaxException e) {
Log.d(TAG, "Exception reading shortcut to add: " + e);
@@ -585,88 +362,18 @@
}
private static class Decoder extends JSONObject {
- public final Intent launcherIntent;
+ public final Intent intent;
public final UserHandle user;
private Decoder(String encoded, Context context) throws JSONException, URISyntaxException {
super(encoded);
- launcherIntent = Intent.parseUri(getString(LAUNCH_INTENT_KEY), 0);
- user = has(USER_HANDLE_KEY) ? UserCache.INSTANCE.get(context)
- .getUserForSerialNumber(getLong(USER_HANDLE_KEY))
+ intent = Intent.parseUri(getString(Favorites.INTENT), 0);
+ user = has(PROFILE_ID)
+ ? UserCache.INSTANCE.get(context).getUserForSerialNumber(getLong(PROFILE_ID))
: Process.myUserHandle();
- if (user == null) {
- throw new JSONException("Invalid user");
+ if (user == null || intent == null) {
+ throw new JSONException("Invalid data");
}
}
}
-
- /**
- * Tries to create a new PendingInstallShortcutInfo which represents the same target,
- * but is an app target and not a shortcut.
- * @return the newly created info or the original one.
- */
- private static PendingInstallShortcutInfo convertToLauncherActivityIfPossible(
- PendingInstallShortcutInfo original) {
- if (original.isLauncherActivity()) {
- // Already an activity target
- return original;
- }
- if (!PackageManagerHelper.isLauncherAppTarget(original.launchIntent)) {
- return original;
- }
-
- LauncherActivityInfo info = original.mContext.getSystemService(LauncherApps.class)
- .resolveActivity(original.launchIntent, original.user);
- if (info == null) {
- return original;
- }
- // Ignore any conflicts in the label name, as that can change based on locale.
- return new PendingInstallShortcutInfo(info, original.mContext);
- }
-
- private static WorkspaceItemInfo createWorkspaceItemInfo(Intent data, UserHandle user,
- LauncherAppState app) {
- if (data == null) {
- Log.e(TAG, "Can't construct WorkspaceItemInfo with null data");
- return null;
- }
-
- Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
- String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
- Parcelable bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
-
- if (intent == null) {
- // If the intent is null, return null as we can't construct a valid WorkspaceItemInfo
- Log.e(TAG, "Can't construct WorkspaceItemInfo with null intent");
- return null;
- }
-
- final WorkspaceItemInfo info = new WorkspaceItemInfo();
- info.user = user;
-
- BitmapInfo iconInfo = null;
- LauncherIcons li = LauncherIcons.obtain(app.getContext());
- if (bitmap instanceof Bitmap) {
- iconInfo = li.createIconBitmap((Bitmap) bitmap);
- } else {
- Parcelable extra = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
- if (extra instanceof Intent.ShortcutIconResource) {
- info.iconResource = (Intent.ShortcutIconResource) extra;
- iconInfo = li.createIconBitmap(info.iconResource);
- }
- }
- li.recycle();
-
- if (iconInfo == null) {
- iconInfo = app.getIconCache().getDefaultIcon(info.user);
- }
- info.bitmap = iconInfo;
-
- info.title = Utilities.trim(name);
- info.contentDescription = app.getContext().getPackageManager()
- .getUserBadgedLabel(info.title, info.user);
- info.intent = intent;
- return info;
- }
-
}
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index e39e89c..370bd6f 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -48,8 +48,8 @@
import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.util.ConfigMonitor;
-import com.android.launcher3.util.DefaultDisplay;
-import com.android.launcher3.util.DefaultDisplay.Info;
+import com.android.launcher3.util.DisplayController;
+import com.android.launcher3.util.DisplayController.Info;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.Themes;
@@ -198,7 +198,7 @@
// Get the display info based on default display and interpolate it to existing display
DisplayOption defaultDisplayOption = invDistWeightedInterpolate(
- DefaultDisplay.INSTANCE.get(context).getInfo(),
+ DisplayController.getDefaultDisplay(context).getInfo(),
getPredefinedDeviceProfiles(context, gridName));
Info myInfo = new Info(context, display);
@@ -231,7 +231,7 @@
}
private String initGrid(Context context, String gridName) {
- DefaultDisplay.Info displayInfo = DefaultDisplay.INSTANCE.get(context).getInfo();
+ Info displayInfo = DisplayController.getDefaultDisplay(context).getInfo();
ArrayList<DisplayOption> allOptions = getPredefinedDeviceProfiles(context, gridName);
DisplayOption displayOption = invDistWeightedInterpolate(displayInfo, allOptions);
@@ -240,7 +240,7 @@
}
private void initGrid(
- Context context, DefaultDisplay.Info displayInfo, DisplayOption displayOption) {
+ Context context, Info displayInfo, DisplayOption displayOption) {
GridOption closestProfile = displayOption.grid;
numRows = closestProfile.numRows;
numColumns = closestProfile.numColumns;
@@ -466,7 +466,7 @@
@VisibleForTesting
static DisplayOption invDistWeightedInterpolate(
- DefaultDisplay.Info displayInfo, ArrayList<DisplayOption> points) {
+ Info displayInfo, ArrayList<DisplayOption> points) {
Point smallestSize = new Point(displayInfo.smallestSize);
Point largestSize = new Point(displayInfo.largestSize);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index db1f1b0..53b65e8 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -34,7 +34,6 @@
import static com.android.launcher3.LauncherState.NO_OFFSET;
import static com.android.launcher3.LauncherState.NO_SCALE;
import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.LauncherState.OVERVIEW_PEEK;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD;
@@ -120,6 +119,7 @@
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.BgDataModel.Callbacks;
+import com.android.launcher3.model.ModelUtils;
import com.android.launcher3.model.ModelWriter;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo;
@@ -450,7 +450,7 @@
float alpha = 1f - mCurrentAssistantVisibility;
if (finalState == NORMAL) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
- } else if (finalState == OVERVIEW || finalState == OVERVIEW_PEEK) {
+ } else if (finalState == OVERVIEW) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
mScrimView.setAlpha(alpha);
} else {
@@ -550,7 +550,7 @@
LauncherState state = mStateManager.getState();
if (state == NORMAL) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
- } else if (state == OVERVIEW || state == OVERVIEW_PEEK) {
+ } else if (state == OVERVIEW) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
mScrimView.setAlpha(alpha);
}
@@ -1196,16 +1196,13 @@
int[] cellXY = mTmpAddItemCellCoordinates;
CellLayout layout = getCellLayout(container, screenId);
- WorkspaceItemInfo info = null;
- if (Utilities.ATLEAST_OREO) {
- info = PinRequestHelper.createWorkspaceItemFromPinItemRequest(
+ WorkspaceItemInfo info = PinRequestHelper.createWorkspaceItemFromPinItemRequest(
this, PinRequestHelper.getPinItemRequest(data), 0);
- }
if (info == null) {
// Legacy shortcuts are only supported for primary profile.
info = Process.myUserHandle().equals(args.user)
- ? InstallShortcutReceiver.fromShortcutIntent(this, data) : null;
+ ? ModelUtils.fromLegacyShortcutIntent(this, data) : null;
if (info == null) {
Log.e(TAG, "Unable to parse a valid custom shortcut result");
@@ -1452,12 +1449,17 @@
mOverlayManager.hideOverlay(isStarted() && !isForceInvisible());
handleGestureContract(intent);
} else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) {
- getStateManager().goToState(ALL_APPS, alreadyOnHome);
+ showAllAppsFromIntent(alreadyOnHome);
}
TraceHelper.INSTANCE.endSection(traceToken);
}
+ protected void showAllAppsFromIntent(boolean alreadyOnHome) {
+ AbstractFloatingView.closeAllOpenViews(this);
+ getStateManager().goToState(ALL_APPS, alreadyOnHome);
+ }
+
/**
* Handles gesture nav contract
*/
@@ -1938,6 +1940,7 @@
return result;
}
+ @Override
public void addOnResumeCallback(OnResumeCallback callback) {
mOnResumeCallbacks.add(callback);
}
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index e3fe87d..782a869 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -109,15 +109,11 @@
mInstallSessionTracker = InstallSessionHelper.INSTANCE.get(context)
.registerInstallTracker(mModel, MODEL_EXECUTOR);
- if (!mContext.getResources().getBoolean(R.bool.notification_dots_enabled)) {
- mNotificationDotsObserver = null;
- } else {
- // Register an observer to rebind the notification listener when dots are re-enabled.
- mNotificationDotsObserver =
- newNotificationSettingsObserver(mContext, this::onNotificationSettingsChanged);
- mNotificationDotsObserver.register();
- mNotificationDotsObserver.dispatchOnChange();
- }
+ // Register an observer to rebind the notification listener when dots are re-enabled.
+ mNotificationDotsObserver =
+ newNotificationSettingsObserver(mContext, this::onNotificationSettingsChanged);
+ mNotificationDotsObserver.register();
+ mNotificationDotsObserver.dispatchOnChange();
}
public LauncherAppState(Context context, @Nullable String iconCacheFileName) {
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index e2568d5..f58e0b4 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -60,7 +60,6 @@
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.ItemInfoMatcher;
-import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.Preconditions;
@@ -85,7 +84,6 @@
private final LauncherAppState mApp;
private final Object mLock = new Object();
- private final LooperExecutor mMainExecutor = MAIN_EXECUTOR;
private LoaderTask mLoaderTask;
private boolean mIsLoaderTaskRunning;
@@ -337,13 +335,13 @@
if (callbacksList.length > 0) {
// Clear any pending bind-runnables from the synchronized load process.
for (Callbacks cb : callbacksList) {
- mMainExecutor.execute(cb::clearPendingBinds);
+ MAIN_EXECUTOR.execute(cb::clearPendingBinds);
}
// If there is already one running, tell it to stop.
stopLoader();
LoaderResults loaderResults = new LoaderResults(
- mApp, mBgDataModel, mBgAllAppsList, callbacksList, mMainExecutor);
+ mApp, mBgDataModel, mBgAllAppsList, callbacksList);
if (mModelLoaded && !mIsLoaderTaskRunning) {
// Divide the set of loaded items into those that we are binding synchronously,
// and everything else that is to be bound normally (asynchronously).
@@ -530,7 +528,7 @@
}
public void enqueueModelUpdateTask(ModelUpdateTask task) {
- task.init(mApp, this, mBgDataModel, mBgAllAppsList, mMainExecutor);
+ task.init(mApp, this, mBgDataModel, mBgAllAppsList, MAIN_EXECUTOR);
MODEL_EXECUTOR.execute(task);
}
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index e8b5568..fdbbf4e 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -872,7 +872,6 @@
* Removes widgets which are registered to the Launcher's host, but are not present
* in our model.
*/
- @TargetApi(Build.VERSION_CODES.O)
public void removeGhostWidgets(SQLiteDatabase db) {
// Get all existing widget ids.
final AppWidgetHost host = newLauncherWidgetHost();
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 39b0f2f..b6bc500 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -21,7 +21,6 @@
import static com.android.launcher3.testing.TestProtocol.HINT_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.OVERVIEW_MODAL_TASK_STATE_ORDINAL;
-import static com.android.launcher3.testing.TestProtocol.OVERVIEW_PEEK_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.SPRING_LOADED_STATE_ORDINAL;
@@ -117,8 +116,6 @@
public static final LauncherState HINT_STATE = new HintState(HINT_STATE_ORDINAL);
public static final LauncherState OVERVIEW = new OverviewState(OVERVIEW_STATE_ORDINAL);
- public static final LauncherState OVERVIEW_PEEK =
- OverviewState.newPeekState(OVERVIEW_PEEK_STATE_ORDINAL);
public static final LauncherState OVERVIEW_MODAL_TASK = OverviewState.newModalTaskState(
OVERVIEW_MODAL_TASK_STATE_ORDINAL);
public static final LauncherState QUICK_SWITCH =
diff --git a/src/com/android/launcher3/MainProcessInitializer.java b/src/com/android/launcher3/MainProcessInitializer.java
index 5f6ecb5..f2a3de7 100644
--- a/src/com/android/launcher3/MainProcessInitializer.java
+++ b/src/com/android/launcher3/MainProcessInitializer.java
@@ -38,7 +38,6 @@
protected void init(Context context) {
FileLog.setDir(context.getApplicationContext().getFilesDir());
FeatureFlags.initialize(context);
- SessionCommitReceiver.applyDefaultUserPrefs(context);
IconShape.init(context);
if (BitmapCreationCheck.ENABLED) {
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index e13d89f..4303dee 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -195,9 +195,7 @@
mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * density);
mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * density);
- if (Utilities.ATLEAST_OREO) {
- setDefaultFocusHighlightEnabled(false);
- }
+ setDefaultFocusHighlightEnabled(false);
}
protected void setDefaultInterpolator(Interpolator interpolator) {
diff --git a/src/com/android/launcher3/SessionCommitReceiver.java b/src/com/android/launcher3/SessionCommitReceiver.java
index 89f0a3d..e48ffb9 100644
--- a/src/com/android/launcher3/SessionCommitReceiver.java
+++ b/src/com/android/launcher3/SessionCommitReceiver.java
@@ -16,55 +16,28 @@
package com.android.launcher3;
-import static com.android.launcher3.pm.InstallSessionHelper.getUserHandle;
-
-import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.LauncherActivityInfo;
-import android.content.pm.LauncherApps;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageInstaller.SessionInfo;
import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.Build;
import android.os.UserHandle;
-import android.provider.Settings;
import android.text.TextUtils;
-import android.util.Log;
import com.android.launcher3.pm.InstallSessionHelper;
-import com.android.launcher3.util.Executors;
-
-import java.util.List;
/**
* BroadcastReceiver to handle session commit intent.
*/
-@TargetApi(Build.VERSION_CODES.O)
public class SessionCommitReceiver extends BroadcastReceiver {
- private static final String TAG = "SessionCommitReceiver";
-
- // The content provider for the add to home screen setting. It should be of the format:
- // <package name>.addtohomescreen
- private static final String MARKER_PROVIDER_PREFIX = ".addtohomescreen";
-
// Preference key for automatically adding icon to homescreen.
public static final String ADD_ICON_PREFERENCE_KEY = "pref_add_icon_to_home";
- public static final String ADD_ICON_PREFERENCE_INITIALIZED_KEY =
- "pref_add_icon_to_home_initialized";
@Override
public void onReceive(Context context, Intent intent) {
- if (!isEnabled(context) || !Utilities.ATLEAST_OREO) {
+ if (!isEnabled(context)) {
// User has decided to not add icons on homescreen.
return;
}
@@ -86,105 +59,10 @@
return;
}
- queueAppIconAddition(context, info.getAppPackageName(), user);
- }
-
- public static void queuePromiseAppIconAddition(Context context, SessionInfo sessionInfo) {
- String packageName = sessionInfo.getAppPackageName();
- if (context.getSystemService(LauncherApps.class)
- .getActivityList(packageName, getUserHandle(sessionInfo)).isEmpty()) {
- // Ensure application isn't already installed.
- queueAppIconAddition(context, packageName, sessionInfo.getAppLabel(),
- sessionInfo.getAppIcon(), getUserHandle(sessionInfo));
- }
- }
-
- public static void queueAppIconAddition(Context context, String packageName, UserHandle user) {
- List<LauncherActivityInfo> activities = context.getSystemService(LauncherApps.class)
- .getActivityList(packageName, user);
- if (activities.isEmpty()) {
- // no activity found
- return;
- }
- queueAppIconAddition(context, packageName, activities.get(0).getLabel(), null, user);
- }
-
- private static void queueAppIconAddition(Context context, String packageName,
- CharSequence label, Bitmap icon, UserHandle user) {
- Intent data = new Intent();
- data.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent().setComponent(
- new ComponentName(packageName, "")).setPackage(packageName));
- data.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
- data.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
-
- InstallShortcutReceiver.queueApplication(data, user, context);
+ InstallShortcutReceiver.queueApplication(info.getAppPackageName(), user, context);
}
public static boolean isEnabled(Context context) {
return Utilities.getPrefs(context).getBoolean(ADD_ICON_PREFERENCE_KEY, true);
}
-
- public static void applyDefaultUserPrefs(final Context context) {
- if (!Utilities.ATLEAST_OREO) {
- return;
- }
- SharedPreferences prefs = Utilities.getPrefs(context);
- if (prefs.getAll().isEmpty()) {
- // This logic assumes that the code is the first thing that is executed (before any
- // shared preference is written).
- // TODO: Move this logic to DB upgrade once we have proper support for db downgrade
- // If it is a fresh start, just apply the default value. We use prefs.isEmpty() to infer
- // a fresh start as put preferences always contain some values corresponding to current
- // grid.
- prefs.edit().putBoolean(ADD_ICON_PREFERENCE_KEY, true).apply();
- } else if (!prefs.contains(ADD_ICON_PREFERENCE_INITIALIZED_KEY)) {
- new PrefInitTask(context).executeOnExecutor(Executors.THREAD_POOL_EXECUTOR);
- }
- }
-
- private static class PrefInitTask extends AsyncTask<Void, Void, Void> {
- private final Context mContext;
-
- PrefInitTask(Context context) {
- mContext = context;
- }
-
- @Override
- protected Void doInBackground(Void... voids) {
- boolean addIconToHomeScreenEnabled = readValueFromMarketApp();
- Utilities.getPrefs(mContext).edit()
- .putBoolean(ADD_ICON_PREFERENCE_KEY, addIconToHomeScreenEnabled)
- .putBoolean(ADD_ICON_PREFERENCE_INITIALIZED_KEY, true)
- .apply();
- return null;
- }
-
- public boolean readValueFromMarketApp() {
- // Get the marget package
- ResolveInfo ri = mContext.getPackageManager().resolveActivity(
- new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_MARKET),
- PackageManager.MATCH_DEFAULT_ONLY | PackageManager.MATCH_SYSTEM_ONLY);
- if (ri == null) {
- return true;
- }
-
- Cursor c = null;
- try {
- c = mContext.getContentResolver().query(
- Uri.parse("content://" + ri.activityInfo.packageName
- + MARKER_PROVIDER_PREFIX),
- null, null, null, null);
- if (c.moveToNext()) {
- return c.getInt(c.getColumnIndexOrThrow(Settings.NameValueTable.VALUE)) != 0;
- }
- } catch (Exception e) {
- Log.d(TAG, "Error reading add to homescreen preference", e);
- } finally {
- if (c != null) {
- c.close();
- }
- }
- return true;
- }
- }
}
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index bf63788..dea2a8d 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -18,7 +18,6 @@
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ICON_BADGED;
-import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.Person;
@@ -26,6 +25,7 @@
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
@@ -48,7 +48,6 @@
import android.os.DeadObjectException;
import android.os.Handler;
import android.os.Message;
-import android.os.PowerManager;
import android.os.TransactionTooLargeException;
import android.provider.Settings;
import android.text.Spannable;
@@ -65,7 +64,6 @@
import androidx.core.os.BuildCompat;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
import com.android.launcher3.graphics.GridOptionsProvider;
import com.android.launcher3.graphics.TintedDrawableSpan;
@@ -113,12 +111,6 @@
public static final boolean ATLEAST_P =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
- public static final boolean ATLEAST_OREO_MR1 =
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1;
-
- public static final boolean ATLEAST_OREO =
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
-
/**
* Set on a motion event dispatched from the nav bar. See {@link MotionEvent#setEdgeFlags(int)}.
*/
@@ -494,21 +486,6 @@
LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE);
}
- /**
- * @return {@link SharedPreferences} that backs {@link FeatureFlags}
- */
- public static SharedPreferences getFeatureFlagsPrefs(Context context) {
- // Use application context for shared preferences, so that we use a single cached instance
- return context.getApplicationContext().getSharedPreferences(
- FeatureFlags.FLAGS_PREF_NAME, Context.MODE_PRIVATE);
- }
-
- public static boolean areAnimationsEnabled(Context context) {
- return ATLEAST_OREO
- ? ValueAnimator.areAnimatorsEnabled()
- : !context.getSystemService(PowerManager.class).isPowerSaveMode();
- }
-
public static boolean isWallpaperAllowed(Context context) {
return context.getSystemService(WallpaperManager.class).isSetWallpaperAllowed();
}
@@ -663,6 +640,14 @@
}
}
+ /**
+ * @return true is the extra is either null or is of type {@param type}
+ */
+ public static boolean isValidExtraType(Intent intent, String key, Class type) {
+ Object extra = intent.getParcelableExtra(key);
+ return extra == null || type.isInstance(extra);
+ }
+
public static float squaredHypot(float x, float y) {
return x * x + y * y;
}
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 77b8a32..af3722a 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -55,6 +55,7 @@
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusedItemDecorator;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
@@ -486,7 +487,7 @@
if (mWorkModeSwitch != null) {
mWorkModeSwitch.setWorkTabVisible(pos == AdapterHolder.WORK
&& mAllAppsStore.hasModelFlag(
- FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION));
+ FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION));
}
}
@@ -526,6 +527,22 @@
return mViewPager == null ? getActiveRecyclerView() : mViewPager;
}
+ /**
+ * Returns the ItemInfo of a view that is in focus, ready to be launched by an IME.
+ */
+ public ItemInfo getHighlightedItemInfo() {
+ View view = getFloatingHeaderView().getFocusedChild();
+ if (view != null && view.getTag() instanceof ItemInfo) {
+ return ((ItemInfo) view.getTag());
+ }
+ if (getActiveRecyclerView().getApps().getFocusedChild() != null) {
+ // TODO: when new pipelines are included, getSearchResults
+ // should be supported at recycler view level and not apps list level.
+ return getActiveRecyclerView().getApps().getFocusedChild().appInfo;
+ }
+ return null;
+ }
+
public RecyclerViewFastScroller getScrollBar() {
AllAppsRecyclerView rv = getActiveRecyclerView();
return rv == null ? null : rv.getScrollbar();
@@ -538,6 +555,10 @@
int padding = mHeader.getMaxTranslation();
for (int i = 0; i < mAH.length; i++) {
mAH[i].padding.top = padding;
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && mUsingTabs) {
+ //add extra space between tabs and recycler view
+ mAH[i].padding.top += mLauncher.getDeviceProfile().edgeMarginPx;
+ }
mAH[i].applyPadding();
}
}
@@ -652,6 +673,10 @@
applyVerticalFadingEdgeEnabled(verticalFadingEdge);
applyPadding();
setupOverlay();
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ recyclerView.addItemDecoration(new AllAppsSectionDecorator(
+ AllAppsContainerView.this));
+ }
}
void setupOverlay() {
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index dec92df..2cec797 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -43,6 +43,7 @@
import com.android.launcher3.allapps.AlphabeticalAppsList.AdapterItem;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.util.PackageManagerHelper;
+import com.android.launcher3.views.HeroSearchResultView;
import java.util.List;
@@ -66,7 +67,9 @@
// A divider that separates the apps list and the search market button
public static final int VIEW_TYPE_ALL_APPS_DIVIDER = 1 << 4;
- public static final int VIEW_TYPE_SEARCH_CORPUS_TITLE = 1 << 5;
+ public static final int VIEW_TYPE_SEARCH_CORPUS_TITLE = 1 << 5;
+
+ public static final int VIEW_TYPE_SEARCH_HERO_APP = 1 << 6;
// Common view type masks
public static final int VIEW_TYPE_MASK_DIVIDER = VIEW_TYPE_ALL_APPS_DIVIDER;
@@ -279,6 +282,10 @@
case VIEW_TYPE_SEARCH_CORPUS_TITLE:
return new ViewHolder(
mLayoutInflater.inflate(R.layout.search_section_title, parent, false));
+
+ case VIEW_TYPE_SEARCH_HERO_APP:
+ return new ViewHolder(mLayoutInflater.inflate(
+ R.layout.search_result_hero_app, parent, false));
default:
throw new RuntimeException("Unexpected view type");
}
@@ -311,6 +318,13 @@
TextView titleView = (TextView) holder.itemView;
titleView.setText(mApps.getAdapterItems().get(position).searchSectionInfo.getTitle(
titleView.getContext()));
+ break;
+ case VIEW_TYPE_SEARCH_HERO_APP:
+ HeroSearchResultView heroView = (HeroSearchResultView) holder.itemView;
+ heroView.prepareUsingAdapterItem(
+ (AlphabeticalAppsList.HeroAppAdapterItem) mApps.getAdapterItems().get(
+ position));
+ break;
case VIEW_TYPE_ALL_APPS_DIVIDER:
// nothing to do
break;
diff --git a/src/com/android/launcher3/allapps/AllAppsSectionDecorator.java b/src/com/android/launcher3/allapps/AllAppsSectionDecorator.java
new file mode 100644
index 0000000..a168c06
--- /dev/null
+++ b/src/com/android/launcher3/allapps/AllAppsSectionDecorator.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2020 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.launcher3.allapps;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.launcher3.R;
+import com.android.launcher3.allapps.search.SearchSectionInfo;
+import com.android.launcher3.util.Themes;
+
+import java.util.List;
+
+/**
+ * ItemDecoration class that groups items in {@link AllAppsRecyclerView}
+ */
+public class AllAppsSectionDecorator extends RecyclerView.ItemDecoration {
+
+ private final AllAppsContainerView mAppsView;
+
+ AllAppsSectionDecorator(AllAppsContainerView appsContainerView) {
+ mAppsView = appsContainerView;
+ }
+
+ @Override
+ public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
+ // Iterate through views in recylerview and draw bounds around views in the same section.
+ // Since views in the same section will follow each other, we can skip to a last view in
+ // a section to get the bounds of the section without having to iterate on every item.
+ int itemCount = parent.getChildCount();
+ List<AlphabeticalAppsList.AdapterItem> adapterItems = mAppsView.getApps().getAdapterItems();
+ SectionDecorationHandler lastDecorationHandler = null;
+ int i = 0;
+ while (i < itemCount) {
+ View view = parent.getChildAt(i);
+ int position = parent.getChildAdapterPosition(view);
+ AlphabeticalAppsList.AdapterItem adapterItem = adapterItems.get(position);
+ if (adapterItem.searchSectionInfo != null) {
+ SearchSectionInfo sectionInfo = adapterItem.searchSectionInfo;
+ int endIndex = Math.min(i + sectionInfo.getPosEnd() - position, itemCount - 1);
+ SectionDecorationHandler decorationHandler = sectionInfo.getDecorationHandler();
+ if (decorationHandler != lastDecorationHandler && lastDecorationHandler != null) {
+ drawDecoration(c, lastDecorationHandler, parent);
+ }
+ lastDecorationHandler = decorationHandler;
+ if (decorationHandler != null) {
+ decorationHandler.extendBounds(view);
+ }
+
+ if (endIndex > i) {
+ i = endIndex;
+ continue;
+ }
+ }
+ i++;
+ }
+ if (lastDecorationHandler != null) {
+ drawDecoration(c, lastDecorationHandler, parent);
+ }
+ }
+
+ private void drawDecoration(Canvas c, SectionDecorationHandler decorationHandler,
+ RecyclerView parent) {
+ if (decorationHandler == null) return;
+ if (decorationHandler.mIsFullWidth) {
+ decorationHandler.mBounds.left = parent.getPaddingLeft();
+ decorationHandler.mBounds.right = parent.getWidth() - parent.getPaddingRight();
+ }
+ decorationHandler.onDraw(c);
+ if (mAppsView.getFloatingHeaderView().getFocusedChild() == null
+ && mAppsView.getApps().getFocusedChild() != null) {
+ int index = mAppsView.getApps().getFocusedChildIndex();
+ if (index >= 0 && index < parent.getChildCount()) {
+ decorationHandler.onFocusDraw(c, parent.getChildAt(index));
+ }
+ }
+ decorationHandler.reset();
+ }
+
+ /**
+ * Handles grouping and drawing of items in the same all apps sections.
+ */
+ public static class SectionDecorationHandler {
+ protected RectF mBounds = new RectF();
+ private final boolean mIsFullWidth;
+ private final float mRadius;
+
+ private final int mFocusColor;
+ private final int mFillcolor;
+ private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+
+
+ public SectionDecorationHandler(Context context, boolean isFullWidth) {
+ mIsFullWidth = isFullWidth;
+ mFillcolor = context.getColor(R.color.all_apps_section_fill);
+ mFocusColor = context.getColor(R.color.all_apps_section_focused_item);
+ mRadius = Themes.getDialogCornerRadius(context);
+ }
+
+ /**
+ * Extends current bounds to include the view.
+ */
+ public void extendBounds(View view) {
+ if (mBounds.isEmpty()) {
+ mBounds.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
+ } else {
+ mBounds.set(
+ Math.min(mBounds.left, view.getLeft()),
+ Math.min(mBounds.top, view.getTop()),
+ Math.max(mBounds.right, view.getRight()),
+ Math.max(mBounds.bottom, view.getBottom())
+ );
+ }
+ }
+
+ /**
+ * Draw bounds onto canvas.
+ */
+ public void onDraw(Canvas canvas) {
+ mPaint.setColor(mFillcolor);
+ canvas.drawRoundRect(mBounds, mRadius, mRadius, mPaint);
+ }
+
+ /**
+ * Draw the bound of the view to the canvas.
+ */
+ public void onFocusDraw(Canvas canvas, @Nullable View view) {
+ if (view == null) {
+ return;
+ }
+ mPaint.setColor(mFocusColor);
+ canvas.drawRoundRect(view.getLeft(), view.getTop(),
+ view.getRight(), view.getBottom(), mRadius, mRadius, mPaint);
+ }
+
+ /**
+ * Reset view bounds to empty.
+ */
+ public void reset() {
+ mBounds.setEmpty();
+ }
+ }
+
+}
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 266bfa2..7379dbed 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -22,6 +22,7 @@
import com.android.launcher3.allapps.search.SearchSectionInfo;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.AppInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.LabelComparator;
@@ -31,7 +32,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
-import java.util.stream.Collectors;
/**
* The alphabetically sorted list of applications.
@@ -129,16 +129,43 @@
item.searchSectionInfo = sectionInfo;
return item;
}
+
+ boolean isCountedForAccessibility() {
+ return viewType == AllAppsGridAdapter.VIEW_TYPE_ICON
+ || viewType == AllAppsGridAdapter.VIEW_TYPE_SEARCH_HERO_APP;
+ }
}
+ /**
+ * Extension of AdapterItem that contains shortcut workspace items
+ */
+ public static class HeroAppAdapterItem extends AdapterItem {
+ private ArrayList<WorkspaceItemInfo> mShortcutInfos;
+
+ public HeroAppAdapterItem(AppInfo info, ArrayList<WorkspaceItemInfo> shortcutInfos) {
+ viewType = AllAppsGridAdapter.VIEW_TYPE_SEARCH_HERO_APP;
+ mShortcutInfos = shortcutInfos;
+ appInfo = info;
+ }
+
+ /**
+ * Returns list of shortcuts for appInfo
+ */
+ public ArrayList<WorkspaceItemInfo> getShortcutInfos() {
+ return mShortcutInfos;
+ }
+
+ }
+
+
private final BaseDraggingActivity mLauncher;
// The set of apps from the system
private final List<AppInfo> mApps = new ArrayList<>();
private final AllAppsStore mAllAppsStore;
- // The set of filtered apps with the current filter
- private final List<AppInfo> mFilteredApps = new ArrayList<>();
+ // The number of results in current adapter
+ private int mAccessibilityResultsCount = 0;
// The current set of adapter items
private final ArrayList<AdapterItem> mAdapterItems = new ArrayList<>();
// The set of sections that we allow fast-scrolling to (includes non-merged sections)
@@ -197,6 +224,25 @@
}
/**
+ * Returns the child adapter item with IME launch focus.
+ */
+ public AdapterItem getFocusedChild() {
+ return mAdapterItems.get(getFocusedChildIndex());
+ }
+
+ /**
+ * Returns the index of the child with IME launch focus.
+ */
+ public int getFocusedChildIndex() {
+ for (AdapterItem item : mAdapterItems) {
+ if (item.isCountedForAccessibility()) {
+ return mAdapterItems.indexOf(item);
+ }
+ }
+ return -1;
+ }
+
+ /**
* Returns the number of rows of applications
*/
public int getNumAppRows() {
@@ -207,7 +253,7 @@
* Returns the number of applications in this list.
*/
public int getNumFilteredApps() {
- return mFilteredApps.size();
+ return mAccessibilityResultsCount;
}
/**
@@ -221,7 +267,7 @@
* Returns whether there are no filtered results.
*/
public boolean hasNoFilteredResults() {
- return (mSearchResults != null) && mFilteredApps.isEmpty();
+ return (mSearchResults != null) && mAccessibilityResultsCount == 0;
}
/**
@@ -307,13 +353,20 @@
int appIndex = 0;
// Prepare to update the list of sections, filtered apps, etc.
- mFilteredApps.clear();
+ mAccessibilityResultsCount = 0;
mFastScrollerSections.clear();
mAdapterItems.clear();
+ SearchSectionInfo appSection = new SearchSectionInfo();
+ appSection.setDecorationHandler(
+ new AllAppsSectionDecorator.SectionDecorationHandler(mLauncher, true));
+
// Recreate the filtered and sectioned apps (for convenience for the grid layout) from the
// ordered set of sections
+
if (!hasFilter()) {
+ mAccessibilityResultsCount = mApps.size();
+ appSection.setPosStart(position);
for (AppInfo info : mApps) {
String sectionName = info.sectionName;
@@ -329,15 +382,33 @@
if (lastFastScrollerSectionInfo.fastScrollToItem == null) {
lastFastScrollerSectionInfo.fastScrollToItem = appItem;
}
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ appItem.searchSectionInfo = appSection;
+ }
mAdapterItems.add(appItem);
- mFilteredApps.add(info);
}
+ appSection.setPosEnd(mApps.isEmpty() ? appSection.getPosStart() : position - 1);
} else {
- mAdapterItems.addAll(mSearchResults);
- List<AppInfo> appInfos = mSearchResults.stream().filter(
- i -> AllAppsGridAdapter.isIconViewType(i.viewType)).map(i -> i.appInfo).collect(
- Collectors.toList());
- mFilteredApps.addAll(appInfos);
+ List<AppInfo> appInfos = new ArrayList<>();
+ SearchSectionInfo lastSection = null;
+ for (int i = 0; i < mSearchResults.size(); i++) {
+ AdapterItem adapterItem = mSearchResults.get(i);
+ adapterItem.position = i;
+ mAdapterItems.add(adapterItem);
+ if (adapterItem.searchSectionInfo != lastSection) {
+ adapterItem.searchSectionInfo.setPosStart(i);
+ if (lastSection != null) {
+ lastSection.setPosEnd(i - 1);
+ }
+ lastSection = adapterItem.searchSectionInfo;
+ }
+ if (AllAppsGridAdapter.isIconViewType(adapterItem.viewType)) {
+ appInfos.add(adapterItem.appInfo);
+ }
+ if (adapterItem.isCountedForAccessibility()) {
+ mAccessibilityResultsCount++;
+ }
+ }
if (!FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
// Append the search market item
if (hasNoFilteredResults()) {
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderRow.java b/src/com/android/launcher3/allapps/FloatingHeaderRow.java
index f899587..e357f61 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderRow.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderRow.java
@@ -16,6 +16,7 @@
package com.android.launcher3.allapps;
import android.graphics.Rect;
+import android.view.View;
import android.view.animation.Interpolator;
import com.android.launcher3.DeviceProfile;
@@ -55,4 +56,9 @@
void setVerticalScroll(int scroll, boolean isScrolledOut);
Class<? extends FloatingHeaderRow> getTypeClass();
+
+ /**
+ * Returns a child that has focus to be launched by the IME.
+ */
+ View getFocusedChild();
}
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index 81e1b94..11d3fb9 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -38,6 +38,7 @@
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.anim.PropertySetter;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.systemui.plugins.AllAppsRow;
import com.android.systemui.plugins.AllAppsRow.OnHeightUpdatedListener;
@@ -194,6 +195,19 @@
onHeightUpdated();
}
+ @Override
+ public View getFocusedChild() {
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ for (FloatingHeaderRow row : mAllRows) {
+ if (row.hasVisibleContent() && row.shouldDraw()) {
+ return row.getFocusedChild();
+ }
+ }
+ return null;
+ }
+ return super.getFocusedChild();
+ }
+
public void setup(AllAppsContainerView.AdapterHolder[] mAH, boolean tabsHidden) {
for (FloatingHeaderRow row : mAllRows) {
row.setup(this, mAllRows, tabsHidden);
diff --git a/src/com/android/launcher3/allapps/PluginHeaderRow.java b/src/com/android/launcher3/allapps/PluginHeaderRow.java
index 3089b18..cf7142c 100644
--- a/src/com/android/launcher3/allapps/PluginHeaderRow.java
+++ b/src/com/android/launcher3/allapps/PluginHeaderRow.java
@@ -83,4 +83,9 @@
public Class<PluginHeaderRow> getTypeClass() {
return PluginHeaderRow.class;
}
+
+ @Override
+ public View getFocusedChild() {
+ return null;
+ }
}
\ No newline at end of file
diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
index db94e8b..0d87481 100644
--- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
@@ -15,37 +15,56 @@
*/
package com.android.launcher3.allapps.search;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
+import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnFocusChangeListener;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
+import android.widget.Toast;
+
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.ExtendedEditText;
+import com.android.launcher3.Launcher;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AlphabeticalAppsList;
+import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.PackageManagerHelper;
+import com.android.systemui.plugins.AllAppsSearchPlugin;
+import com.android.systemui.plugins.PluginListener;
import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
/**
* An interface to a search box that AllApps can command.
*/
public class AllAppsSearchBarController
implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener,
- OnFocusChangeListener {
+ OnFocusChangeListener, PluginListener<AllAppsSearchPlugin> {
+ private static final String TAG = "AllAppsSearchBarContoller";
protected BaseDraggingActivity mLauncher;
protected Callbacks mCb;
protected ExtendedEditText mInput;
protected String mQuery;
protected SearchAlgorithm mSearchAlgorithm;
+ private AllAppsSearchPlugin mPlugin;
+ private Consumer mPlubinCb;
public void setVisibility(int visibility) {
mInput.setVisibility(visibility);
@@ -56,7 +75,7 @@
*/
public final void initialize(
SearchAlgorithm searchAlgorithm, ExtendedEditText input,
- BaseDraggingActivity launcher, Callbacks cb) {
+ BaseDraggingActivity launcher, Callbacks cb, Consumer<List<Bundle>> secondaryCb) {
mCb = cb;
mLauncher = launcher;
@@ -66,11 +85,19 @@
mInput.setOnBackKeyListener(this);
mInput.setOnFocusChangeListener(this);
mSearchAlgorithm = searchAlgorithm;
+
+ PluginManagerWrapper.INSTANCE.get(launcher).addPluginListener(this,
+ AllAppsSearchPlugin.class);
+ mPlubinCb = secondaryCb;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- // Do nothing
+ if (mPlugin != null) {
+ if (s.length() == 0) {
+ mPlugin.startedTyping();
+ }
+ }
}
@Override
@@ -87,6 +114,9 @@
} else {
mSearchAlgorithm.cancel(false);
mSearchAlgorithm.doSearch(mQuery, mCb);
+ if (mPlugin != null) {
+ mPlugin.performSearch(mQuery, mPlubinCb);
+ }
}
}
@@ -101,6 +131,16 @@
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ if (actionId == EditorInfo.IME_ACTION_SEARCH) {
+ ItemInfo info = Launcher.getLauncher(mLauncher).getAppsView()
+ .getHighlightedItemInfo();
+ if (info != null) {
+ return mLauncher.startActivitySafely(v, info.getIntent(), info);
+ }
+ }
+ }
+
// Skip if it's not the right action
if (actionId != EditorInfo.IME_ACTION_SEARCH) {
return false;
@@ -157,13 +197,52 @@
return mInput.isFocused();
}
+ @Override
+ public void onPluginConnected(AllAppsSearchPlugin allAppsSearchPlugin, Context context) {
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ mPlugin = allAppsSearchPlugin;
+ checkCallPermission();
+ }
+ }
+
+ /**
+ * Check call permissions.
+ */
+ public void checkCallPermission() {
+ final String[] permission = {"android.permission.CALL_PHONE",
+ "android.permission.READ_CONTACTS"};
+ boolean request = false;
+ for (String p : permission) {
+ int permissionCheck = ContextCompat.checkSelfPermission(mLauncher, p);
+ if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
+ request = true;
+ }
+ }
+
+ if (!request) return;
+ boolean rationale = false;
+ for (String p : permission) {
+ if (mLauncher.shouldShowRequestPermissionRationale(p)) {
+ rationale = true;
+ }
+ if (rationale) {
+ Log.e(TAG, p + " Show rationale");
+ Toast.makeText(mLauncher, "Requesting Permissions", Toast.LENGTH_SHORT).show();
+ } else {
+ ActivityCompat.requestPermissions(mLauncher, permission, 123);
+ Log.e(TAG, p + " request permission");
+ }
+ }
+
+ }
+
/**
* Callback for getting search results.
*/
public interface Callbacks {
/**
- * Called when the search is complete.
+ * Called when the search from primary source is complete.
*
* @param items sorted list of search result adapter items.
*/
@@ -174,5 +253,4 @@
*/
void clearSearchResult();
}
-
}
\ No newline at end of file
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index 16a1efd..e8a0d7a 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -24,6 +24,7 @@
import android.content.Context;
import android.graphics.Rect;
+import android.os.Bundle;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.text.method.TextKeyListener;
@@ -47,13 +48,15 @@
import com.android.launcher3.anim.PropertySetter;
import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
/**
* Layout to contain the All-apps search UI.
*/
public class AppsSearchContainerLayout extends ExtendedEditText
implements SearchUiManager, AllAppsSearchBarController.Callbacks,
- AllAppsStore.OnUpdateListener, Insettable {
+ AllAppsStore.OnUpdateListener, Insettable, Consumer<List<Bundle>> {
private final BaseDraggingActivity mLauncher;
private final AllAppsSearchBarController mSearchBarController;
@@ -136,7 +139,7 @@
mAppsView = appsView;
mSearchBarController.initialize(
new DefaultAppSearchAlgorithm(LauncherAppState.getInstance(mLauncher)), this,
- mLauncher, this);
+ mLauncher, this, this);
}
@Override
@@ -220,4 +223,9 @@
public EditText getEditText() {
return this;
}
+
+ @Override
+ public void accept(List<Bundle> bundles) {
+ // TODO: Render the result on mAppsView object
+ }
}
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchPipeline.java b/src/com/android/launcher3/allapps/search/AppsSearchPipeline.java
index 5beb956..e67e897 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchPipeline.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchPipeline.java
@@ -15,15 +15,25 @@
*/
package com.android.launcher3.allapps.search;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
+
+import android.content.Context;
+import android.content.pm.ShortcutInfo;
+
import androidx.annotation.WorkerThread;
import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.R;
+import com.android.launcher3.allapps.AllAppsSectionDecorator.SectionDecorationHandler;
import com.android.launcher3.allapps.AlphabeticalAppsList.AdapterItem;
+import com.android.launcher3.allapps.AlphabeticalAppsList.HeroAppAdapterItem;
+import com.android.launcher3.icons.IconCache;
import com.android.launcher3.model.AllAppsList;
import com.android.launcher3.model.BaseModelUpdateTask;
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.model.data.AppInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.popup.PopupPopulator;
+import com.android.launcher3.shortcuts.ShortcutRequest;
import java.util.ArrayList;
import java.util.List;
@@ -35,13 +45,23 @@
public class AppsSearchPipeline implements SearchPipeline {
private static final int MAX_RESULTS_COUNT = 5;
+ private static final int MAX_HERO_SECTION_COUNT = 2;
+ private static final int MAX_SHORTCUTS_COUNT = 2;
private final SearchSectionInfo mSearchSectionInfo;
private final LauncherAppState mLauncherAppState;
+ private final boolean mHeroSectionSupported;
public AppsSearchPipeline(LauncherAppState launcherAppState) {
+ this(launcherAppState, true);
+ }
+
+ public AppsSearchPipeline(LauncherAppState launcherAppState, boolean supportsHeroView) {
mLauncherAppState = launcherAppState;
- mSearchSectionInfo = new SearchSectionInfo(R.string.search_corpus_apps);
+ mSearchSectionInfo = new SearchSectionInfo();
+ mSearchSectionInfo.setDecorationHandler(
+ new SectionDecorationHandler(launcherAppState.getContext(), true));
+ mHeroSectionSupported = supportsHeroView;
}
@Override
@@ -50,12 +70,39 @@
mLauncherAppState.getModel().enqueueModelUpdateTask(new BaseModelUpdateTask() {
@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
- callback.accept(getAdapterItems(getTitleMatchResult(apps.data, query)));
+ List<AppInfo> matchingResults = getTitleMatchResult(apps.data, query);
+ if (mHeroSectionSupported && matchingResults.size() <= MAX_HERO_SECTION_COUNT) {
+ callback.accept(getHeroAdapterItems(app.getContext(), matchingResults));
+ } else {
+ callback.accept(getAdapterItems(matchingResults));
+ }
}
});
}
/**
+ * Returns MAX_SHORTCUTS_COUNT shortcuts from local cache
+ * TODO: Shortcuts should be ranked based on relevancy
+ */
+ private ArrayList<WorkspaceItemInfo> getShortcutInfos(Context context, AppInfo appInfo) {
+ List<ShortcutInfo> shortcuts = new ShortcutRequest(context, appInfo.user)
+ .withContainer(appInfo.getTargetComponent())
+ .query(ShortcutRequest.PUBLISHED);
+ shortcuts = PopupPopulator.sortAndFilterShortcuts(shortcuts, null);
+ IconCache cache = LauncherAppState.getInstance(context).getIconCache();
+ ArrayList<WorkspaceItemInfo> shortcutItems = new ArrayList<>();
+ for (int i = 0; i < shortcuts.size() && i < MAX_SHORTCUTS_COUNT; i++) {
+ final ShortcutInfo shortcut = shortcuts.get(i);
+ final WorkspaceItemInfo si = new WorkspaceItemInfo(shortcut, context);
+ cache.getUnbadgedShortcutIcon(si, shortcut);
+ si.rank = i;
+ si.container = CONTAINER_SHORTCUTS;
+ shortcutItems.add(si);
+ }
+ return shortcutItems;
+ }
+
+ /**
* Filters {@link AppInfo}s matching specified query
*/
public static ArrayList<AppInfo> getTitleMatchResult(List<AppInfo> apps, String query) {
@@ -73,16 +120,23 @@
return result;
}
+ private ArrayList<AdapterItem> getHeroAdapterItems(Context context, List<AppInfo> apps) {
+ ArrayList<AdapterItem> adapterItems = new ArrayList<>();
+ for (int i = 0; i < apps.size(); i++) {
+ //hero app
+ AppInfo appInfo = apps.get(i);
+ ArrayList<WorkspaceItemInfo> shortcuts = getShortcutInfos(context, appInfo);
+ AdapterItem adapterItem = new HeroAppAdapterItem(appInfo, shortcuts);
+ adapterItem.searchSectionInfo = mSearchSectionInfo;
+ adapterItems.add(adapterItem);
+ }
+ return adapterItems;
+ }
+
private ArrayList<AdapterItem> getAdapterItems(List<AppInfo> matchingApps) {
ArrayList<AdapterItem> items = new ArrayList<>();
- if (matchingApps.isEmpty()) {
- return items;
- }
- items.add(AdapterItem.asSearchTitle(mSearchSectionInfo, 0));
- int existingItems = items.size();
- int searchResultsCount = Math.min(matchingApps.size(), MAX_RESULTS_COUNT);
- for (int i = 0; i < searchResultsCount; i++) {
- AdapterItem appItem = AdapterItem.asApp(i + existingItems, "", matchingApps.get(i), i);
+ for (int i = 0; i < matchingApps.size() && i < MAX_RESULTS_COUNT; i++) {
+ AdapterItem appItem = AdapterItem.asApp(i, "", matchingApps.get(i), i);
appItem.searchSectionInfo = mSearchSectionInfo;
items.add(appItem);
}
diff --git a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java
index db10311..470191c 100644
--- a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java
+++ b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java
@@ -32,7 +32,7 @@
public DefaultAppSearchAlgorithm(LauncherAppState launcherAppState) {
mResultHandler = new Handler();
- mAppsSearchPipeline = new AppsSearchPipeline(launcherAppState);
+ mAppsSearchPipeline = new AppsSearchPipeline(launcherAppState, false);
}
@Override
diff --git a/src/com/android/launcher3/allapps/search/SearchSectionInfo.java b/src/com/android/launcher3/allapps/search/SearchSectionInfo.java
index 880b246..dee0ffd 100644
--- a/src/com/android/launcher3/allapps/search/SearchSectionInfo.java
+++ b/src/com/android/launcher3/allapps/search/SearchSectionInfo.java
@@ -17,20 +17,59 @@
import android.content.Context;
+import com.android.launcher3.allapps.AllAppsSectionDecorator.SectionDecorationHandler;
+
/**
* Info class for a search section
*/
public class SearchSectionInfo {
+
private final int mTitleResId;
+ private SectionDecorationHandler mDecorationHandler;
+
+ public int getPosStart() {
+ return mPosStart;
+ }
+
+ public void setPosStart(int posStart) {
+ mPosStart = posStart;
+ }
+
+ public int getPosEnd() {
+ return mPosEnd;
+ }
+
+ public void setPosEnd(int posEnd) {
+ mPosEnd = posEnd;
+ }
+
+ private int mPosStart;
+ private int mPosEnd;
+
+ public SearchSectionInfo() {
+ this(-1);
+ }
public SearchSectionInfo(int titleResId) {
mTitleResId = titleResId;
}
+ public void setDecorationHandler(SectionDecorationHandler sectionDecorationHandler) {
+ mDecorationHandler = sectionDecorationHandler;
+ }
+
+
+ public SectionDecorationHandler getDecorationHandler() {
+ return mDecorationHandler;
+ }
+
/**
* Returns the section's title
*/
public String getTitle(Context context) {
+ if (mTitleResId == -1) {
+ return "";
+ }
return context.getString(mTitleResId);
}
}
diff --git a/src/com/android/launcher3/anim/AnimatorPlaybackController.java b/src/com/android/launcher3/anim/AnimatorPlaybackController.java
index ea0ff8b..dcdfb6e 100644
--- a/src/com/android/launcher3/anim/AnimatorPlaybackController.java
+++ b/src/com/android/launcher3/anim/AnimatorPlaybackController.java
@@ -19,7 +19,7 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java
index 860cceb..8016b2d 100644
--- a/src/com/android/launcher3/anim/Interpolators.java
+++ b/src/com/android/launcher3/anim/Interpolators.java
@@ -16,7 +16,7 @@
package com.android.launcher3.anim;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import android.content.Context;
import android.graphics.Path;
@@ -198,6 +198,7 @@
public OvershootParams(float startProgress, float overshootPastProgress,
float endProgress, float velocityPxPerMs, int totalDistancePx, Context context) {
velocityPxPerMs = Math.abs(velocityPxPerMs);
+ overshootPastProgress = Math.max(overshootPastProgress, startProgress);
start = startProgress;
int startPx = (int) (start * totalDistancePx);
// Overshoot by about half a frame.
diff --git a/src/com/android/launcher3/anim/PendingAnimation.java b/src/com/android/launcher3/anim/PendingAnimation.java
index 4195933..5362575 100644
--- a/src/com/android/launcher3/anim/PendingAnimation.java
+++ b/src/com/android/launcher3/anim/PendingAnimation.java
@@ -149,7 +149,7 @@
mProgressAnimator = null;
}
if (mAnimHolders.isEmpty()) {
- // Add a dummy animation to that the duration is respected
+ // Add a placeholder animation to that the duration is respected
add(ValueAnimator.ofFloat(0, 1).setDuration(mDuration));
}
return mAnim;
diff --git a/src/com/android/launcher3/anim/SpringAnimationBuilder.java b/src/com/android/launcher3/anim/SpringAnimationBuilder.java
index a9702b4..bd52158 100644
--- a/src/com/android/launcher3/anim/SpringAnimationBuilder.java
+++ b/src/com/android/launcher3/anim/SpringAnimationBuilder.java
@@ -25,7 +25,7 @@
import androidx.annotation.FloatRange;
import androidx.dynamicanimation.animation.SpringForce;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
/**
* Utility class to build an object animator which follows the same path as a spring animation for
@@ -134,7 +134,7 @@
}
public SpringAnimationBuilder computeParams() {
- int singleFrameMs = DefaultDisplay.getSingleFrameMs(mContext);
+ int singleFrameMs = DisplayController.getSingleFrameMs(mContext);
double naturalFreq = Math.sqrt(mStiffness);
double dampedFreq = naturalFreq * Math.sqrt(1 - mDampingRatio * mDampingRatio);
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 0ab74af..37d2d40 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -92,7 +92,7 @@
// Keep as DeviceFlag to allow remote disable in emergency.
public static final BooleanFlag ENABLE_SUGGESTED_ACTIONS_OVERVIEW = new DeviceFlag(
- "ENABLE_SUGGESTED_ACTIONS_OVERVIEW", false, "Show chip hints on the overview screen");
+ "ENABLE_SUGGESTED_ACTIONS_OVERVIEW", true, "Show chip hints on the overview screen");
public static final BooleanFlag ENABLE_DEVICE_SEARCH = getDebugFlag(
@@ -142,10 +142,6 @@
public static final BooleanFlag ENABLE_LAUNCHER_PREVIEW_IN_GRID_PICKER = getDebugFlag(
"ENABLE_LAUNCHER_PREVIEW_IN_GRID_PICKER", true, "Show launcher preview in grid picker");
- public static final BooleanFlag ENABLE_OVERVIEW_ACTIONS = getDebugFlag(
- "ENABLE_OVERVIEW_ACTIONS", true, "Show app actions instead of the shelf in Overview."
- + " As part of this decoupling, also distinguish swipe up from nav bar vs above it.");
-
// Keep as DeviceFlag for remote disable in emergency.
public static final BooleanFlag ENABLE_OVERVIEW_SELECTIONS = new DeviceFlag(
"ENABLE_OVERVIEW_SELECTIONS", true, "Show Select Mode button in Overview Actions");
@@ -161,9 +157,9 @@
"ENABLE_UNIVERSAL_SMARTSPACE", false,
"Replace Smartspace with a version rendered by System UI.");
- public static final BooleanFlag ENABLE_LSQ_VELOCITY_PROVIDER = getDebugFlag(
- "ENABLE_LSQ_VELOCITY_PROVIDER", true,
- "Use Least Square algorithm for motion pause detection.");
+ public static final BooleanFlag ENABLE_SYSTEM_VELOCITY_PROVIDER = getDebugFlag(
+ "ENABLE_SYSTEM_VELOCITY_PROVIDER", true,
+ "Use system VelocityTracker's algorithm for motion pause detection.");
public static final BooleanFlag ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS =
getDebugFlag(
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index 03028d3..ef666f0 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -463,10 +463,10 @@
}
public void forceTouchMove() {
- int[] dummyCoordinates = mCoordinatesTemp;
- DropTarget dropTarget = findDropTarget(mLastTouch.x, mLastTouch.y, dummyCoordinates);
- mDragObject.x = dummyCoordinates[0];
- mDragObject.y = dummyCoordinates[1];
+ int[] placeholderCoordinates = mCoordinatesTemp;
+ DropTarget dropTarget = findDropTarget(mLastTouch.x, mLastTouch.y, placeholderCoordinates);
+ mDragObject.x = placeholderCoordinates[0];
+ mDragObject.y = placeholderCoordinates[1];
checkTouchMove(dropTarget);
}
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index de0fa1a..86b93d0 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -187,9 +187,6 @@
*/
@TargetApi(Build.VERSION_CODES.O)
public void setItemInfo(final ItemInfo info) {
- if (!Utilities.ATLEAST_OREO) {
- return;
- }
if (info.itemType != LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
info.itemType != LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT &&
info.itemType != LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
diff --git a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
index 9982b39..f543e47 100644
--- a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
+++ b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
@@ -49,14 +49,14 @@
// Class name used in the target component, such that it will never represent an
// actual existing class.
- private static final String DUMMY_COMPONENT_CLASS = "pinned-shortcut";
+ private static final String STUB_COMPONENT_CLASS = "pinned-shortcut";
private final PinItemRequest mRequest;
private final ShortcutInfo mInfo;
private final Context mContext;
public PinShortcutRequestActivityInfo(PinItemRequest request, Context context) {
- super(new ComponentName(request.getShortcutInfo().getPackage(), DUMMY_COMPONENT_CLASS),
+ super(new ComponentName(request.getShortcutInfo().getPackage(), STUB_COMPONENT_CLASS),
request.getShortcutInfo().getUserHandle());
mRequest = request;
mInfo = request.getShortcutInfo();
diff --git a/src/com/android/launcher3/graphics/IconShape.java b/src/com/android/launcher3/graphics/IconShape.java
index 4369385..b208a40 100644
--- a/src/com/android/launcher3/graphics/IconShape.java
+++ b/src/com/android/launcher3/graphics/IconShape.java
@@ -43,8 +43,9 @@
import android.view.View;
import android.view.ViewOutlineProvider;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.icons.IconNormalizer;
@@ -59,8 +60,6 @@
import java.util.ArrayList;
import java.util.List;
-import androidx.annotation.Nullable;
-
/**
* Abstract representation of the shape of an icon shape
*/
@@ -381,9 +380,6 @@
* Initializes the shape which is closest to the {@link AdaptiveIconDrawable}
*/
public static void init(Context context) {
- if (!Utilities.ATLEAST_OREO) {
- return;
- }
pickBestShape(context);
}
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index d8eb838..cca9836 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -117,7 +117,8 @@
* 4) Measure and draw the view on a canvas
*/
@TargetApi(Build.VERSION_CODES.O)
-public class LauncherPreviewRenderer {
+public class LauncherPreviewRenderer extends ContextThemeWrapper
+ implements ActivityContext, WorkspaceLayoutManager, LayoutInflater.Factory2 {
private static final String TAG = "LauncherPreviewRenderer";
@@ -211,10 +212,14 @@
private final DeviceProfile mDp;
private final boolean mMigrated;
private final Rect mInsets;
-
private final WorkspaceItemInfo mWorkspaceItemInfo;
+ private final LayoutInflater mHomeElementInflater;
+ private final InsettableFrameLayout mRootView;
+ private final Hotseat mHotseat;
+ private final CellLayout mWorkspace;
public LauncherPreviewRenderer(Context context, InvariantDeviceProfile idp, boolean migrated) {
+ super(context, R.style.AppTheme);
mUiHandler = new Handler(Looper.getMainLooper());
mContext = context;
mIdp = idp;
@@ -239,291 +244,286 @@
mWorkspaceItemInfo.intent = new Intent();
mWorkspaceItemInfo.contentDescription = mWorkspaceItemInfo.title =
context.getString(R.string.label_application);
+
+ mHomeElementInflater = LayoutInflater.from(
+ new ContextThemeWrapper(this, R.style.HomeScreenElementTheme));
+ mHomeElementInflater.setFactory2(this);
+
+ mRootView = (InsettableFrameLayout) mHomeElementInflater.inflate(
+ R.layout.launcher_preview_layout, null, false);
+ mRootView.setInsets(mInsets);
+ measureView(mRootView, mDp.widthPx, mDp.heightPx);
+
+ mHotseat = mRootView.findViewById(R.id.hotseat);
+ mHotseat.resetLayout(false);
+
+ mWorkspace = mRootView.findViewById(R.id.workspace);
+ mWorkspace.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
+ mDp.workspacePadding.top,
+ mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
+ mDp.workspacePadding.bottom);
}
/** Populate preview and render it. */
public View getRenderedView() {
- MainThreadRenderer renderer = new MainThreadRenderer(mContext);
- renderer.populate();
- return renderer.mRootView;
+ populate();
+ return mRootView;
}
- private class MainThreadRenderer extends ContextThemeWrapper
- implements ActivityContext, WorkspaceLayoutManager, LayoutInflater.Factory2 {
+ public boolean shouldShowRealLauncherPreview() {
+ return ENABLE_LAUNCHER_PREVIEW_IN_GRID_PICKER.get();
+ }
- private final LayoutInflater mHomeElementInflater;
- private final InsettableFrameLayout mRootView;
+ public boolean shouldShowQsb() {
+ return FeatureFlags.QSB_ON_FIRST_SCREEN;
+ }
- private final Hotseat mHotseat;
- private final CellLayout mWorkspace;
+ @Override
+ public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
+ if ("TextClock".equals(name)) {
+ // Workaround for TextClock accessing handler for unregistering ticker.
+ return new TextClock(context, attrs) {
- MainThreadRenderer(Context context) {
- super(context, R.style.AppTheme);
-
- mHomeElementInflater = LayoutInflater.from(
- new ContextThemeWrapper(this, R.style.HomeScreenElementTheme));
- mHomeElementInflater.setFactory2(this);
-
- mRootView = (InsettableFrameLayout) mHomeElementInflater.inflate(
- R.layout.launcher_preview_layout, null, false);
- mRootView.setInsets(mInsets);
- measureView(mRootView, mDp.widthPx, mDp.heightPx);
-
- mHotseat = mRootView.findViewById(R.id.hotseat);
- mHotseat.resetLayout(false);
-
- mWorkspace = mRootView.findViewById(R.id.workspace);
- mWorkspace.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
- mDp.workspacePadding.top,
- mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
- mDp.workspacePadding.bottom);
+ @Override
+ public Handler getHandler() {
+ return mUiHandler;
+ }
+ };
+ } else if (!"fragment".equals(name)) {
+ return null;
}
- @Override
- public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
- if ("TextClock".equals(name)) {
- // Workaround for TextClock accessing handler for unregistering ticker.
- return new TextClock(context, attrs) {
+ TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PreviewFragment);
+ FragmentWithPreview f = (FragmentWithPreview) Fragment.instantiate(
+ context, ta.getString(R.styleable.PreviewFragment_android_name));
+ f.enterPreviewMode(context);
+ f.onInit(null);
- @Override
- public Handler getHandler() {
- return mUiHandler;
- }
- };
- } else if (!"fragment".equals(name)) {
- return null;
- }
+ View view = f.onCreateView(LayoutInflater.from(context), (ViewGroup) parent, null);
+ view.setId(ta.getInt(R.styleable.PreviewFragment_android_id, View.NO_ID));
+ return view;
+ }
- TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PreviewFragment);
- FragmentWithPreview f = (FragmentWithPreview) Fragment.instantiate(
- context, ta.getString(R.styleable.PreviewFragment_android_name));
- f.enterPreviewMode(context);
- f.onInit(null);
+ @Override
+ public View onCreateView(String name, Context context, AttributeSet attrs) {
+ return onCreateView(null, name, context, attrs);
+ }
- View view = f.onCreateView(LayoutInflater.from(context), (ViewGroup) parent, null);
- view.setId(ta.getInt(R.styleable.PreviewFragment_android_id, View.NO_ID));
- return view;
+ @Override
+ public BaseDragLayer getDragLayer() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public DeviceProfile getDeviceProfile() {
+ return mDp;
+ }
+
+ @Override
+ public Hotseat getHotseat() {
+ return mHotseat;
+ }
+
+ @Override
+ public CellLayout getScreenWithId(int screenId) {
+ return mWorkspace;
+ }
+
+ private void inflateAndAddIcon(WorkspaceItemInfo info) {
+ BubbleTextView icon = (BubbleTextView) mHomeElementInflater.inflate(
+ R.layout.app_icon, mWorkspace, false);
+ icon.applyFromWorkspaceItem(info);
+ addInScreenFromBind(icon, info);
+ }
+
+ private void inflateAndAddFolder(FolderInfo info) {
+ FolderIcon folderIcon = FolderIcon.inflateIcon(R.layout.folder_icon, this, mWorkspace,
+ info);
+ addInScreenFromBind(folderIcon, info);
+ }
+
+ private void inflateAndAddWidgets(
+ LauncherAppWidgetInfo info,
+ Map<ComponentKey, AppWidgetProviderInfo> widgetProviderInfoMap) {
+ if (widgetProviderInfoMap == null) {
+ return;
}
-
- @Override
- public View onCreateView(String name, Context context, AttributeSet attrs) {
- return onCreateView(null, name, context, attrs);
+ AppWidgetProviderInfo providerInfo = widgetProviderInfoMap.get(
+ new ComponentKey(info.providerName, info.user));
+ if (providerInfo == null) {
+ return;
}
+ inflateAndAddWidgets(info, LauncherAppWidgetProviderInfo.fromProviderInfo(
+ getApplicationContext(), providerInfo));
+ }
- @Override
- public BaseDragLayer getDragLayer() {
- throw new UnsupportedOperationException();
+ private void inflateAndAddWidgets(LauncherAppWidgetInfo info, WidgetsModel widgetsModel) {
+ WidgetItem widgetItem = widgetsModel.getWidgetProviderInfoByProviderName(
+ info.providerName);
+ if (widgetItem == null) {
+ return;
}
+ inflateAndAddWidgets(info, widgetItem.widgetInfo);
+ }
- @Override
- public DeviceProfile getDeviceProfile() {
- return mDp;
- }
+ private void inflateAndAddWidgets(
+ LauncherAppWidgetInfo info, LauncherAppWidgetProviderInfo providerInfo) {
+ AppWidgetHostView view = new AppWidgetHostView(mContext);
+ view.setAppWidget(-1, providerInfo);
+ view.updateAppWidget(null);
+ view.setTag(info);
+ addInScreenFromBind(view, info);
+ }
- @Override
- public Hotseat getHotseat() {
- return mHotseat;
- }
-
- @Override
- public CellLayout getScreenWithId(int screenId) {
- return mWorkspace;
- }
-
- private void inflateAndAddIcon(WorkspaceItemInfo info) {
- BubbleTextView icon = (BubbleTextView) mHomeElementInflater.inflate(
- R.layout.app_icon, mWorkspace, false);
- icon.applyFromWorkspaceItem(info);
- addInScreenFromBind(icon, info);
- }
-
- private void inflateAndAddFolder(FolderInfo info) {
- FolderIcon folderIcon = FolderIcon.inflateIcon(R.layout.folder_icon, this, mWorkspace,
- info);
- addInScreenFromBind(folderIcon, info);
- }
-
- private void inflateAndAddWidgets(LauncherAppWidgetInfo info,
- Map<ComponentKey, AppWidgetProviderInfo> widgetProviderInfoMap) {
- if (widgetProviderInfoMap == null) {
- return;
- }
- AppWidgetProviderInfo providerInfo = widgetProviderInfoMap.get(
- new ComponentKey(info.providerName, info.user));
- if (providerInfo == null) {
- return;
- }
- inflateAndAddWidgets(info, LauncherAppWidgetProviderInfo.fromProviderInfo(
- getApplicationContext(), providerInfo));
- }
-
- private void inflateAndAddWidgets(LauncherAppWidgetInfo info, WidgetsModel widgetsModel) {
- WidgetItem widgetItem = widgetsModel.getWidgetProviderInfoByProviderName(
- info.providerName);
- if (widgetItem == null) {
- return;
- }
- inflateAndAddWidgets(info, widgetItem.widgetInfo);
- }
-
- private void inflateAndAddWidgets(LauncherAppWidgetInfo info,
- LauncherAppWidgetProviderInfo providerInfo) {
- AppWidgetHostView view = new AppWidgetHostView(mContext);
- view.setAppWidget(-1, providerInfo);
- view.updateAppWidget(null);
- view.setTag(info);
+ private void inflateAndAddPredictedIcon(WorkspaceItemInfo info) {
+ View view = PredictedAppIconInflater.inflate(mHomeElementInflater, mWorkspace, info);
+ if (view != null) {
addInScreenFromBind(view, info);
}
+ }
- private void inflateAndAddPredictedIcon(WorkspaceItemInfo info) {
- View view = PredictedAppIconInflater.inflate(mHomeElementInflater, mWorkspace, info);
- if (view != null) {
- addInScreenFromBind(view, info);
- }
+ private void dispatchVisibilityAggregated(View view, boolean isVisible) {
+ // Similar to View.dispatchVisibilityAggregated implementation.
+ final boolean thisVisible = view.getVisibility() == VISIBLE;
+ if (thisVisible || !isVisible) {
+ view.onVisibilityAggregated(isVisible);
}
- private void dispatchVisibilityAggregated(View view, boolean isVisible) {
- // Similar to View.dispatchVisibilityAggregated implementation.
- final boolean thisVisible = view.getVisibility() == VISIBLE;
- if (thisVisible || !isVisible) {
- view.onVisibilityAggregated(isVisible);
- }
+ if (view instanceof ViewGroup) {
+ isVisible = thisVisible && isVisible;
+ ViewGroup vg = (ViewGroup) view;
+ int count = vg.getChildCount();
- if (view instanceof ViewGroup) {
- isVisible = thisVisible && isVisible;
- ViewGroup vg = (ViewGroup) view;
- int count = vg.getChildCount();
-
- for (int i = 0; i < count; i++) {
- dispatchVisibilityAggregated(vg.getChildAt(i), isVisible);
- }
+ for (int i = 0; i < count; i++) {
+ dispatchVisibilityAggregated(vg.getChildAt(i), isVisible);
}
}
+ }
- private void populate() {
- if (ENABLE_LAUNCHER_PREVIEW_IN_GRID_PICKER.get()) {
- WorkspaceFetcher fetcher;
- PreviewContext previewContext = null;
- if (mMigrated) {
- previewContext = new PreviewContext(mContext, mIdp);
- LauncherAppState appForPreview = new LauncherAppState(
- previewContext, null /* iconCacheFileName */);
- fetcher = new WorkspaceItemsInfoFromPreviewFetcher(appForPreview);
- MODEL_EXECUTOR.execute(fetcher);
- } else {
- fetcher = new WorkspaceItemsInfoFetcher();
- LauncherAppState.getInstance(mContext).getModel().enqueueModelUpdateTask(
- (LauncherModel.ModelUpdateTask) fetcher);
- }
- WorkspaceResult workspaceResult = fetcher.get();
- if (previewContext != null) {
- previewContext.onDestroy();
- }
-
- if (workspaceResult == null) {
- return;
- }
-
- // Separate the items that are on the current screen, and all the other remaining
- // items
- ArrayList<ItemInfo> currentWorkspaceItems = new ArrayList<>();
- ArrayList<ItemInfo> otherWorkspaceItems = new ArrayList<>();
- ArrayList<LauncherAppWidgetInfo> currentAppWidgets = new ArrayList<>();
- ArrayList<LauncherAppWidgetInfo> otherAppWidgets = new ArrayList<>();
-
- filterCurrentWorkspaceItems(0 /* currentScreenId */,
- workspaceResult.mWorkspaceItems, currentWorkspaceItems,
- otherWorkspaceItems);
- filterCurrentWorkspaceItems(0 /* currentScreenId */, workspaceResult.mAppWidgets,
- currentAppWidgets, otherAppWidgets);
- sortWorkspaceItemsSpatially(mIdp, currentWorkspaceItems);
-
- for (ItemInfo itemInfo : currentWorkspaceItems) {
- switch (itemInfo.itemType) {
- case Favorites.ITEM_TYPE_APPLICATION:
- case Favorites.ITEM_TYPE_SHORTCUT:
- case Favorites.ITEM_TYPE_DEEP_SHORTCUT:
- inflateAndAddIcon((WorkspaceItemInfo) itemInfo);
- break;
- case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
- inflateAndAddFolder((FolderInfo) itemInfo);
- break;
- default:
- break;
- }
- }
- for (ItemInfo itemInfo : currentAppWidgets) {
- switch (itemInfo.itemType) {
- case Favorites.ITEM_TYPE_APPWIDGET:
- case Favorites.ITEM_TYPE_CUSTOM_APPWIDGET:
- if (mMigrated) {
- inflateAndAddWidgets((LauncherAppWidgetInfo) itemInfo,
- workspaceResult.mWidgetProvidersMap);
- } else {
- inflateAndAddWidgets((LauncherAppWidgetInfo) itemInfo,
- workspaceResult.mWidgetsModel);
- }
- break;
- default:
- break;
- }
- }
-
- IntArray ranks = getMissingHotseatRanks(currentWorkspaceItems,
- mIdp.numHotseatIcons);
- int count = Math.min(ranks.size(), workspaceResult.mCachedPredictedItems.size());
- for (int i = 0; i < count; i++) {
- AppInfo appInfo = workspaceResult.mCachedPredictedItems.get(i);
- int rank = ranks.get(i);
- WorkspaceItemInfo itemInfo = new WorkspaceItemInfo(appInfo);
- itemInfo.container = LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
- itemInfo.rank = rank;
- itemInfo.cellX = mHotseat.getCellXFromOrder(rank);
- itemInfo.cellY = mHotseat.getCellYFromOrder(rank);
- itemInfo.screenId = rank;
- inflateAndAddPredictedIcon(itemInfo);
- }
+ private void populate() {
+ if (shouldShowRealLauncherPreview()) {
+ WorkspaceFetcher fetcher;
+ PreviewContext previewContext = null;
+ if (mMigrated) {
+ previewContext = new PreviewContext(mContext, mIdp);
+ LauncherAppState appForPreview = new LauncherAppState(
+ previewContext, null /* iconCacheFileName */);
+ fetcher = new WorkspaceItemsInfoFromPreviewFetcher(appForPreview);
+ MODEL_EXECUTOR.execute(fetcher);
} else {
- // Add hotseat icons
- for (int i = 0; i < mIdp.numHotseatIcons; i++) {
- WorkspaceItemInfo info = new WorkspaceItemInfo(mWorkspaceItemInfo);
- info.container = Favorites.CONTAINER_HOTSEAT;
- info.screenId = i;
- inflateAndAddIcon(info);
- }
- // Add workspace icons
- for (int i = 0; i < mIdp.numColumns; i++) {
- WorkspaceItemInfo info = new WorkspaceItemInfo(mWorkspaceItemInfo);
- info.container = Favorites.CONTAINER_DESKTOP;
- info.screenId = 0;
- info.cellX = i;
- info.cellY = mIdp.numRows - 1;
- inflateAndAddIcon(info);
- }
+ fetcher = new WorkspaceItemsInfoFetcher();
+ LauncherAppState.getInstance(mContext).getModel().enqueueModelUpdateTask(
+ (LauncherModel.ModelUpdateTask) fetcher);
+ }
+ WorkspaceResult workspaceResult = fetcher.get();
+ if (previewContext != null) {
+ previewContext.onDestroy();
}
- // Add first page QSB
- if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
- View qsb = mHomeElementInflater.inflate(
- R.layout.search_container_workspace, mWorkspace, false);
- CellLayout.LayoutParams lp =
- new CellLayout.LayoutParams(0, 0, mWorkspace.getCountX(), 1);
- lp.canReorder = false;
- mWorkspace.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
+ if (workspaceResult == null) {
+ return;
}
- // Setup search view
- SearchUiManager searchUiManager =
- mRootView.findViewById(R.id.search_container_all_apps);
- mRootView.findViewById(R.id.apps_view).setTranslationY(
- mDp.heightPx - searchUiManager.getScrollRangeDelta(mInsets));
-
- measureView(mRootView, mDp.widthPx, mDp.heightPx);
- dispatchVisibilityAggregated(mRootView, true);
- measureView(mRootView, mDp.widthPx, mDp.heightPx);
- // Additional measure for views which use auto text size API
- measureView(mRootView, mDp.widthPx, mDp.heightPx);
+ // Separate the items that are on the current screen, and the other remaining items.
+ ArrayList<ItemInfo> currentWorkspaceItems = new ArrayList<>();
+ ArrayList<ItemInfo> otherWorkspaceItems = new ArrayList<>();
+ ArrayList<LauncherAppWidgetInfo> currentAppWidgets = new ArrayList<>();
+ ArrayList<LauncherAppWidgetInfo> otherAppWidgets = new ArrayList<>();
+ filterCurrentWorkspaceItems(0 /* currentScreenId */,
+ workspaceResult.mWorkspaceItems, currentWorkspaceItems,
+ otherWorkspaceItems);
+ filterCurrentWorkspaceItems(0 /* currentScreenId */, workspaceResult.mAppWidgets,
+ currentAppWidgets, otherAppWidgets);
+ sortWorkspaceItemsSpatially(mIdp, currentWorkspaceItems);
+ for (ItemInfo itemInfo : currentWorkspaceItems) {
+ switch (itemInfo.itemType) {
+ case Favorites.ITEM_TYPE_APPLICATION:
+ case Favorites.ITEM_TYPE_SHORTCUT:
+ case Favorites.ITEM_TYPE_DEEP_SHORTCUT:
+ inflateAndAddIcon((WorkspaceItemInfo) itemInfo);
+ break;
+ case Favorites.ITEM_TYPE_FOLDER:
+ inflateAndAddFolder((FolderInfo) itemInfo);
+ break;
+ default:
+ break;
+ }
+ }
+ for (ItemInfo itemInfo : currentAppWidgets) {
+ switch (itemInfo.itemType) {
+ case Favorites.ITEM_TYPE_APPWIDGET:
+ case Favorites.ITEM_TYPE_CUSTOM_APPWIDGET:
+ if (mMigrated) {
+ inflateAndAddWidgets((LauncherAppWidgetInfo) itemInfo,
+ workspaceResult.mWidgetProvidersMap);
+ } else {
+ inflateAndAddWidgets((LauncherAppWidgetInfo) itemInfo,
+ workspaceResult.mWidgetsModel);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ IntArray ranks = getMissingHotseatRanks(currentWorkspaceItems,
+ mIdp.numHotseatIcons);
+ int count = Math.min(ranks.size(), workspaceResult.mCachedPredictedItems.size());
+ for (int i = 0; i < count; i++) {
+ AppInfo appInfo = workspaceResult.mCachedPredictedItems.get(i);
+ int rank = ranks.get(i);
+ WorkspaceItemInfo itemInfo = new WorkspaceItemInfo(appInfo);
+ itemInfo.container = Favorites.CONTAINER_HOTSEAT_PREDICTION;
+ itemInfo.rank = rank;
+ itemInfo.cellX = mHotseat.getCellXFromOrder(rank);
+ itemInfo.cellY = mHotseat.getCellYFromOrder(rank);
+ itemInfo.screenId = rank;
+ inflateAndAddPredictedIcon(itemInfo);
+ }
+ } else {
+ // Add hotseat icons
+ for (int i = 0; i < mIdp.numHotseatIcons; i++) {
+ WorkspaceItemInfo info = new WorkspaceItemInfo(mWorkspaceItemInfo);
+ info.container = Favorites.CONTAINER_HOTSEAT;
+ info.screenId = i;
+ inflateAndAddIcon(info);
+ }
+ // Add workspace icons
+ for (int i = 0; i < mIdp.numColumns; i++) {
+ WorkspaceItemInfo info = new WorkspaceItemInfo(mWorkspaceItemInfo);
+ info.container = Favorites.CONTAINER_DESKTOP;
+ info.screenId = 0;
+ info.cellX = i;
+ info.cellY = mIdp.numRows - 1;
+ inflateAndAddIcon(info);
+ }
}
+
+ // Add first page QSB
+ if (shouldShowQsb()) {
+ View qsb = mHomeElementInflater.inflate(
+ R.layout.search_container_workspace, mWorkspace, false);
+ CellLayout.LayoutParams lp =
+ new CellLayout.LayoutParams(0, 0, mWorkspace.getCountX(), 1);
+ lp.canReorder = false;
+ mWorkspace.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
+ }
+
+ // Setup search view
+ SearchUiManager searchUiManager =
+ mRootView.findViewById(R.id.search_container_all_apps);
+ mRootView.findViewById(R.id.apps_view).setTranslationY(
+ mDp.heightPx - searchUiManager.getScrollRangeDelta(mInsets));
+ ViewGroup searchView = (ViewGroup) searchUiManager;
+ searchView.setEnabled(false);
+ for (int i = 0; i < searchView.getChildCount(); i++) {
+ searchView.getChildAt(i).setEnabled(false);
+ }
+
+ measureView(mRootView, mDp.widthPx, mDp.heightPx);
+ dispatchVisibilityAggregated(mRootView, true);
+ measureView(mRootView, mDp.widthPx, mDp.heightPx);
+ // Additional measure for views which use auto text size API
+ measureView(mRootView, mDp.widthPx, mDp.heightPx);
}
private static void measureView(View view, int width, int height) {
diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java
index ff0f773..444c2da 100644
--- a/src/com/android/launcher3/icons/IconCache.java
+++ b/src/com/android/launcher3/icons/IconCache.java
@@ -260,14 +260,6 @@
}
/**
- * Fill in info with the icon and label for deep shortcut.
- */
- public synchronized CacheEntry getDeepShortcutTitleAndIcon(ShortcutInfo info) {
- return cacheLocked(ShortcutKey.fromInfo(info).componentName, info.getUserHandle(),
- () -> info, mShortcutCachingLogic, false, false);
- }
-
- /**
* Fill in {@param info} with the icon and label. If the
* corresponding activity is not found, it reverts to the package icon.
*/
@@ -295,7 +287,7 @@
/**
* Fill in {@param mWorkspaceItemInfo} with the icon and label for {@param info}
*/
- private synchronized void getTitleAndIcon(
+ public synchronized void getTitleAndIcon(
@NonNull ItemInfoWithIcon infoInOut,
@NonNull Supplier<LauncherActivityInfo> activityInfoProvider,
boolean usePkgIcon, boolean useLowResIcon) {
diff --git a/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java b/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java
index c50189c..ae7ad10 100644
--- a/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java
+++ b/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java
@@ -32,6 +32,8 @@
import android.view.View.OnFocusChangeListener;
import com.android.launcher3.R;
+import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.util.Themes;
/**
* A helper class to draw background of a focused view.
@@ -93,6 +95,7 @@
private ObjectAnimator mCurrentAnimation;
private float mAlpha;
+ private float mRadius;
public FocusIndicatorHelper(View container) {
mContainer = container;
@@ -104,6 +107,9 @@
setAlpha(0);
mShift = 0;
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ mRadius = Themes.getDialogCornerRadius(container.getContext());
+ }
}
protected void setAlpha(float alpha) {
@@ -129,13 +135,15 @@
}
public void draw(Canvas c) {
- if (mAlpha > 0) {
- Rect newRect = getDrawRect();
- if (newRect != null) {
- mDirtyRect.set(newRect);
- c.drawRect(mDirtyRect, mPaint);
- mIsDirty = true;
- }
+ if (mAlpha <= 0) return;
+
+ Rect newRect = getDrawRect();
+ if (newRect != null) {
+ mDirtyRect.set(newRect);
+ c.drawRoundRect((float) mDirtyRect.left, (float) mDirtyRect.top,
+ (float) mDirtyRect.right, (float) mDirtyRect.bottom,
+ mRadius, mRadius, mPaint);
+ mIsDirty = true;
}
}
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index de72534..2282339 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -37,7 +37,7 @@
*
* <pre>
* All of the event ids are defined here.
- * Most of the methods are dummy methods for Launcher3
+ * Most of the methods are placeholder methods for Launcher3
* Actual call happens only for Launcher variant that implements QuickStep.
* </pre>
*/
@@ -313,7 +313,10 @@
LAUNCHER_NAVIGATION_MODE_2_BUTTON(624),
@UiEvent(doc = "System navigation mode is 0 button mode/gesture navigation mode .")
- LAUNCHER_NAVIGATION_MODE_GESTURE_BUTTON(625);
+ LAUNCHER_NAVIGATION_MODE_GESTURE_BUTTON(625),
+
+ @UiEvent(doc = "User tapped on image content in Overview Select mode.")
+ LAUNCHER_SELECT_MODE_IMAGE(627);
// ADD MORE
diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java
index e094cab..31a81b8 100644
--- a/src/com/android/launcher3/logging/UserEventDispatcher.java
+++ b/src/com/android/launcher3/logging/UserEventDispatcher.java
@@ -147,7 +147,7 @@
}
/**
- * Dummy method.
+ * Placeholder method.
*/
public void logActionTip(int actionType, int viewType) {
}
diff --git a/src/com/android/launcher3/model/BaseLoaderResults.java b/src/com/android/launcher3/model/BaseLoaderResults.java
index 8b0ef7b..586333f 100644
--- a/src/com/android/launcher3/model/BaseLoaderResults.java
+++ b/src/com/android/launcher3/model/BaseLoaderResults.java
@@ -27,6 +27,7 @@
import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.PagedView;
import com.android.launcher3.model.BgDataModel.Callbacks;
+import com.android.launcher3.model.BgDataModel.FixedContainerItems;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
@@ -76,18 +77,20 @@
ArrayList<ItemInfo> workspaceItems = new ArrayList<>();
ArrayList<LauncherAppWidgetInfo> appWidgets = new ArrayList<>();
final IntArray orderedScreenIds = new IntArray();
+ ArrayList<FixedContainerItems> extraItems = new ArrayList<>();
synchronized (mBgDataModel) {
workspaceItems.addAll(mBgDataModel.workspaceItems);
appWidgets.addAll(mBgDataModel.appWidgets);
orderedScreenIds.addAll(mBgDataModel.collectWorkspaceScreens());
+ mBgDataModel.extraItems.forEach(extraItems::add);
mBgDataModel.lastBindId++;
mMyBindingId = mBgDataModel.lastBindId;
}
for (Callbacks cb : mCallbacksList) {
new WorkspaceBinder(cb, mUiExecutor, mApp, mBgDataModel, mMyBindingId,
- workspaceItems, appWidgets, orderedScreenIds).bind();
+ workspaceItems, appWidgets, extraItems, orderedScreenIds).bind();
}
}
@@ -135,7 +138,7 @@
private final ArrayList<ItemInfo> mWorkspaceItems;
private final ArrayList<LauncherAppWidgetInfo> mAppWidgets;
private final IntArray mOrderedScreenIds;
-
+ private final ArrayList<FixedContainerItems> mExtraItems;
WorkspaceBinder(Callbacks callbacks,
Executor uiExecutor,
@@ -144,6 +147,7 @@
int myBindingId,
ArrayList<ItemInfo> workspaceItems,
ArrayList<LauncherAppWidgetInfo> appWidgets,
+ ArrayList<FixedContainerItems> extraItems,
IntArray orderedScreenIds) {
mCallbacks = callbacks;
mUiExecutor = uiExecutor;
@@ -152,6 +156,7 @@
mMyBindingId = myBindingId;
mWorkspaceItems = workspaceItems;
mAppWidgets = appWidgets;
+ mExtraItems = extraItems;
mOrderedScreenIds = orderedScreenIds;
}
@@ -198,6 +203,8 @@
// Load items on the current page.
bindWorkspaceItems(currentWorkspaceItems, mainExecutor);
bindAppWidgets(currentAppWidgets, mainExecutor);
+ mExtraItems.forEach(item ->
+ executeCallbacksTask(c -> c.bindExtraContainerItems(item), mainExecutor));
// Locate available spots for prediction using currentWorkspaceItems
IntArray gaps = getMissingHotseatRanks(currentWorkspaceItems, idp.numHotseatIcons);
@@ -207,6 +214,7 @@
// happens later).
// This ensures that the first screen is immediately visible (eg. during rotation)
// In case of !validFirstPage, bind all pages one after other.
+
final Executor deferredExecutor =
validFirstPage ? new ViewOnDrawExecutor() : mainExecutor;
diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java
index fd8520d..140342f 100644
--- a/src/com/android/launcher3/model/BgDataModel.java
+++ b/src/com/android/launcher3/model/BgDataModel.java
@@ -424,6 +424,14 @@
public FixedContainerItems clone() {
return new FixedContainerItems(containerId, new ArrayList<>(items));
}
+
+ public void setItems(List<ItemInfo> newItems) {
+ items.clear();
+ newItems.forEach(item -> {
+ item.container = containerId;
+ items.add(item);
+ });
+ }
}
diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java
index 165d1ea..a27ac23 100644
--- a/src/com/android/launcher3/model/LoaderCursor.java
+++ b/src/com/android/launcher3/model/LoaderCursor.java
@@ -65,7 +65,7 @@
private static final String TAG = "LoaderCursor";
- public final LongSparseArray<UserHandle> allUsers;
+ private final LongSparseArray<UserHandle> allUsers;
private final Uri mContentUri;
private final Context mContext;
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index b067909..1dd8c11 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -128,6 +128,8 @@
private boolean mStopped;
+ private boolean mItemsDeleted = false;
+
public LoaderTask(LauncherAppState app, AllAppsList bgAllAppsList, BgDataModel dataModel,
ModelDelegate modelDelegate, LoaderResults results) {
mApp = app;
@@ -271,6 +273,7 @@
if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
loadFolderNames();
}
+ sanitizeData();
verifyNotStopped();
updateHandler.finish();
@@ -357,15 +360,12 @@
final int optionsIndex = c.getColumnIndexOrThrow(
LauncherSettings.Favorites.OPTIONS);
- final LongSparseArray<UserHandle> allUsers = c.allUsers;
final LongSparseArray<Boolean> unlockedUsers = new LongSparseArray<>();
mUserManagerState.init(mUserCache, mUserManager);
for (UserHandle user : mUserCache.getUserProfiles()) {
long serialNo = mUserCache.getSerialNumberForUser(user);
- allUsers.put(serialNo, user);
-
boolean userUnlocked = mUserManager.isUserUnlocked(user);
// We can only query for shortcuts when the user is unlocked.
@@ -416,16 +416,6 @@
ComponentName cn = intent.getComponent();
targetPkg = cn == null ? intent.getPackage() : cn.getPackageName();
- if (allUsers.indexOfValue(c.user) < 0) {
- if (c.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
- c.markDeleted("Legacy shortcuts are only allowed for current users");
- continue;
- } else if (c.restoreFlag != 0) {
- // Don't restore items for other profiles.
- c.markDeleted("Restore from other profiles not supported");
- continue;
- }
- }
if (TextUtils.isEmpty(targetPkg) &&
c.itemType != LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
c.markDeleted("Only legacy shortcuts can have null package");
@@ -770,7 +760,7 @@
}
// Load delegate items
- mModelDelegate.loadItems();
+ mModelDelegate.loadItems(mUserManagerState, shortcutKeyToPinnedShortcuts);
// Break early if we've stopped loading
if (mStopped) {
@@ -791,14 +781,9 @@
mBgDataModel.itemsIdMap.remove(folderId);
}
- // Remove any ghost widgets
- LauncherSettings.Settings.call(contentResolver,
- LauncherSettings.Settings.METHOD_REMOVE_GHOST_WIDGETS);
+ mItemsDeleted = true;
}
- // Update pinned state of model shortcuts
- mBgDataModel.updateShortcutPinnedState(context);
-
// Sort the folder items, update ranks, and make sure all preview items are high res.
FolderGridOrganizer verifier =
new FolderGridOrganizer(mApp.getInvariantDeviceProfile());
@@ -872,6 +857,18 @@
}
}
+ private void sanitizeData() {
+ Context context = mApp.getContext();
+ if (mItemsDeleted) {
+ // Remove any ghost widgets
+ LauncherSettings.Settings.call(context.getContentResolver(),
+ LauncherSettings.Settings.METHOD_REMOVE_GHOST_WIDGETS);
+ }
+
+ // Update pinned state of model shortcuts
+ mBgDataModel.updateShortcutPinnedState(context);
+ }
+
private List<LauncherActivityInfo> loadAllApps() {
final List<UserHandle> profiles = mUserCache.getUserProfiles();
List<LauncherActivityInfo> allActivityList = new ArrayList<>();
diff --git a/src/com/android/launcher3/model/ModelDelegate.java b/src/com/android/launcher3/model/ModelDelegate.java
index ce4eed5..53e8a86 100644
--- a/src/com/android/launcher3/model/ModelDelegate.java
+++ b/src/com/android/launcher3/model/ModelDelegate.java
@@ -18,13 +18,17 @@
import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission;
import android.content.Context;
+import android.content.pm.ShortcutInfo;
import androidx.annotation.WorkerThread;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
+import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.util.ResourceBasedOverride;
+import java.util.Map;
+
/**
* Class to extend LauncherModel functionality to provide extra data
*/
@@ -65,11 +69,12 @@
* Load delegate items if any in the data model
*/
@WorkerThread
- public void loadItems() { }
+ public void loadItems(UserManagerState ums, Map<ShortcutKey, ShortcutInfo> pinnedShortcuts) { }
/**
* Called when the delegate is no loner needed
*/
@WorkerThread
public void destroy() { }
+
}
diff --git a/src/com/android/launcher3/model/ModelUtils.java b/src/com/android/launcher3/model/ModelUtils.java
index 4efeba5..a8cc9ad 100644
--- a/src/com/android/launcher3/model/ModelUtils.java
+++ b/src/com/android/launcher3/model/ModelUtils.java
@@ -15,10 +15,22 @@
*/
package com.android.launcher3.model;
+import static com.android.launcher3.Utilities.isValidExtraType;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.os.Process;
+import android.util.Log;
+
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherSettings;
+import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.icons.BitmapInfo;
+import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
@@ -33,6 +45,8 @@
*/
public class ModelUtils {
+ private static final String TAG = "ModelUtils";
+
/**
* Filters the set of items who are directly or indirectly (via another container) on the
* specified screen.
@@ -125,4 +139,52 @@
IntStream.range(0, len).filter(i -> !seen.contains(i)).forEach(result::add);
return result;
}
+
+
+ /**
+ * Creates a workspace item info for the legacy shortcut intent
+ */
+ @SuppressWarnings("deprecation")
+ public static WorkspaceItemInfo fromLegacyShortcutIntent(Context context, Intent data) {
+ if (!isValidExtraType(data, Intent.EXTRA_SHORTCUT_INTENT, Intent.class)
+ || !(isValidExtraType(data, Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
+ Intent.ShortcutIconResource.class))
+ || !(isValidExtraType(data, Intent.EXTRA_SHORTCUT_ICON, Bitmap.class))) {
+
+ Log.e(TAG, "Invalid install shortcut intent");
+ return null;
+ }
+
+ Intent launchIntent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
+ String label = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
+ if (launchIntent == null || label == null) {
+ Log.e(TAG, "Invalid install shortcut intent");
+ return null;
+ }
+
+ final WorkspaceItemInfo info = new WorkspaceItemInfo();
+ info.user = Process.myUserHandle();
+
+ BitmapInfo iconInfo = null;
+ try (LauncherIcons li = LauncherIcons.obtain(context)) {
+ Bitmap bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
+ if (bitmap != null) {
+ iconInfo = li.createIconBitmap(bitmap);
+ } else {
+ info.iconResource = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
+ if (info.iconResource != null) {
+ iconInfo = li.createIconBitmap(info.iconResource);
+ }
+ }
+ }
+
+ if (iconInfo == null) {
+ Log.e(TAG, "Invalid icon by the app");
+ return null;
+ }
+ info.bitmap = iconInfo;
+ info.contentDescription = info.title = Utilities.trim(label);
+ info.intent = launchIntent;
+ return info;
+ }
}
diff --git a/src/com/android/launcher3/model/PackageUpdatedTask.java b/src/com/android/launcher3/model/PackageUpdatedTask.java
index dca4ec0..c0ae6f9 100644
--- a/src/com/android/launcher3/model/PackageUpdatedTask.java
+++ b/src/com/android/launcher3/model/PackageUpdatedTask.java
@@ -24,7 +24,6 @@
import android.content.Intent;
import android.content.pm.LauncherApps;
import android.content.pm.ShortcutInfo;
-import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
@@ -32,8 +31,6 @@
import com.android.launcher3.InstallShortcutReceiver;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.SessionCommitReceiver;
-import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.IconCache;
@@ -108,11 +105,6 @@
appsList.removePackage(packages[i], mUser);
}
appsList.addPackage(context, packages[i], mUser);
-
- // Automatically add homescreen icon for work profile apps for below O device.
- if (!Utilities.ATLEAST_OREO && !Process.myUserHandle().equals(mUser)) {
- SessionCommitReceiver.queueAppIconAddition(context, packages[i], mUser);
- }
}
flagOp = FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
break;
@@ -331,7 +323,7 @@
InstallShortcutReceiver.removeFromInstallQueue(context, removedPackages, mUser);
}
- if (Utilities.ATLEAST_OREO && mOp == OP_ADD) {
+ if (mOp == OP_ADD) {
// Load widgets for the new package. Changes due to app updates are handled through
// AppWidgetHost events, this is just to initialize the long-press options.
for (int i = 0; i < N; i++) {
diff --git a/src/com/android/launcher3/model/data/AppInfo.java b/src/com/android/launcher3/model/data/AppInfo.java
index b17b062..aee1f2a 100644
--- a/src/com/android/launcher3/model/data/AppInfo.java
+++ b/src/com/android/launcher3/model/data/AppInfo.java
@@ -138,8 +138,7 @@
info.runtimeStatusFlags |= (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0
? FLAG_SYSTEM_NO : FLAG_SYSTEM_YES;
- if (Utilities.ATLEAST_OREO
- && appInfo.targetSdkVersion >= Build.VERSION_CODES.O
+ if (appInfo.targetSdkVersion >= Build.VERSION_CODES.O
&& Process.myUserHandle().equals(lai.getUser())) {
// The icon for a non-primary user is badged, hence it's not exactly an adaptive icon.
info.runtimeStatusFlags |= FLAG_ADAPTIVE_ICON;
diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java
index 59233cd..e03fd72 100644
--- a/src/com/android/launcher3/model/data/ItemInfo.java
+++ b/src/com/android/launcher3/model/data/ItemInfo.java
@@ -258,12 +258,6 @@
}
/**
- * Can be overridden by inherited classes to fill in {@link LauncherAtom.ItemInfo}
- */
- public void setItemBuilder(LauncherAtom.ItemInfo.Builder builder) {
- }
-
- /**
* Creates {@link LauncherAtom.ItemInfo} with important fields and parent container info.
*/
public LauncherAtom.ItemInfo buildProto() {
diff --git a/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java
index b0d19a6..c04b7f0 100644
--- a/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java
@@ -26,7 +26,6 @@
import com.android.launcher3.AppWidgetResizeFrame;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.util.ContentWriter;
/**
@@ -195,13 +194,4 @@
public final boolean hasOptionFlag(int option) {
return (options & option) != 0;
}
-
- @Override
- public void setItemBuilder(LauncherAtom.ItemInfo.Builder builder) {
- builder.setWidget(LauncherAtom.Widget.newBuilder()
- .setSpanX(spanX)
- .setSpanY(spanY)
- .setComponentName(providerName.toString())
- .setPackageName(providerName.getPackageName()));
- }
}
diff --git a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
index a7bf1f3..1e1d093 100644
--- a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
+++ b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
@@ -216,7 +216,7 @@
if (cn == null && (itemType == Favorites.ITEM_TYPE_SHORTCUT || hasStatusFlag(
FLAG_SUPPORTS_WEB_UI | FLAG_AUTOINSTALL_ICON | FLAG_RESTORED_ICON))) {
// Legacy shortcuts and promise icons with web UI may not have a componentName but just
- // a packageName. In that case create a dummy componentName instead of adding additional
+ // a packageName. In that case create a empty componentName instead of adding additional
// check everywhere.
String pkg = intent.getPackage();
return pkg == null ? null : new ComponentName(pkg, IconCache.EMPTY_CLASS_NAME);
diff --git a/src/com/android/launcher3/notification/NotificationKeyData.java b/src/com/android/launcher3/notification/NotificationKeyData.java
index a1917ec..1dda3df 100644
--- a/src/com/android/launcher3/notification/NotificationKeyData.java
+++ b/src/com/android/launcher3/notification/NotificationKeyData.java
@@ -30,9 +30,9 @@
/**
* The key data associated with the notification, used to determine what to include
- * in dots and dummy popup views before they are populated.
+ * in dots and stub popup views before they are populated.
*
- * @see NotificationInfo for the full data used when populating the dummy views.
+ * @see NotificationInfo for the full data used when populating the stub views.
*/
public class NotificationKeyData {
public final String notificationKey;
diff --git a/src/com/android/launcher3/notification/NotificationMainView.java b/src/com/android/launcher3/notification/NotificationMainView.java
index b03aa9c..32f060b 100644
--- a/src/com/android/launcher3/notification/NotificationMainView.java
+++ b/src/com/android/launcher3/notification/NotificationMainView.java
@@ -137,7 +137,7 @@
setOnClickListener(mNotificationInfo);
}
setContentTranslation(0);
- // Add a dummy ItemInfo so that logging populates the correct container and item types
+ // Add a stub ItemInfo so that logging populates the correct container and item types
// instead of DEFAULT_CONTAINERTYPE and DEFAULT_ITEMTYPE, respectively.
setTag(NOTIFICATION_ITEM_INFO);
if (animate) {
diff --git a/src/com/android/launcher3/pm/InstallSessionHelper.java b/src/com/android/launcher3/pm/InstallSessionHelper.java
index 901d27f..d546013 100644
--- a/src/com/android/launcher3/pm/InstallSessionHelper.java
+++ b/src/com/android/launcher3/pm/InstallSessionHelper.java
@@ -32,6 +32,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
+import com.android.launcher3.InstallShortcutReceiver;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.SessionCommitReceiver;
import com.android.launcher3.Utilities;
@@ -167,7 +168,7 @@
* Attempt to restore workspace layout if the session is triggered due to device restore.
*/
public boolean restoreDbIfApplicable(@NonNull final SessionInfo info) {
- if (!Utilities.ATLEAST_OREO || !FeatureFlags.ENABLE_DATABASE_RESTORE.get()) {
+ if (!FeatureFlags.ENABLE_DATABASE_RESTORE.get()) {
return false;
}
if (isRestore(info)) {
@@ -203,7 +204,7 @@
* - A promise icon for the session has not already been created
*/
void tryQueuePromiseAppIcon(PackageInstaller.SessionInfo sessionInfo) {
- if (Utilities.ATLEAST_OREO && FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
+ if (FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
&& SessionCommitReceiver.isEnabled(mAppContext)
&& verify(sessionInfo) != null
&& sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER
@@ -212,7 +213,9 @@
&& !mPromiseIconIds.contains(sessionInfo.getSessionId())
&& new PackageManagerHelper(mAppContext).getApplicationInfo(
sessionInfo.getAppPackageName(), getUserHandle(sessionInfo), 0) == null) {
- SessionCommitReceiver.queuePromiseAppIconAddition(mAppContext, sessionInfo);
+ InstallShortcutReceiver.queueApplication(
+ sessionInfo.getAppPackageName(), getUserHandle(sessionInfo), mAppContext);
+
mPromiseIconIds.add(sessionInfo.getSessionId());
updatePromiseIconPrefs();
}
diff --git a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java
index 40d7031..7af14c6 100644
--- a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java
+++ b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java
@@ -27,7 +27,6 @@
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Process;
@@ -39,13 +38,13 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
import com.android.launcher3.icons.ComponentWithLabelAndIcon;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.PackageUserKey;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -175,37 +174,23 @@
List<ShortcutConfigActivityInfo> result = new ArrayList<>();
UserHandle myUser = Process.myUserHandle();
- if (Utilities.ATLEAST_OREO) {
- final List<UserHandle> users;
- final String packageName;
- if (packageUser == null) {
- users = UserCache.INSTANCE.get(context).getUserProfiles();
- packageName = null;
- } else {
- users = new ArrayList<>(1);
- users.add(packageUser.mUser);
- packageName = packageUser.mPackageName;
- }
- LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
- for (UserHandle user : users) {
- boolean ignoreTargetSdk = myUser.equals(user);
- for (LauncherActivityInfo activityInfo :
- launcherApps.getShortcutConfigActivityList(packageName, user)) {
- if (ignoreTargetSdk || activityInfo.getApplicationInfo().targetSdkVersion
- >= Build.VERSION_CODES.O) {
- result.add(new ShortcutConfigActivityInfoVO(activityInfo));
- }
- }
- }
+ final List<UserHandle> users;
+ final String packageName;
+ if (packageUser == null) {
+ users = UserCache.INSTANCE.get(context).getUserProfiles();
+ packageName = null;
} else {
- if (packageUser == null || packageUser.mUser.equals(myUser)) {
- Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
- if (packageUser != null) {
- intent.setPackage(packageUser.mPackageName);
- }
- for (ResolveInfo info :
- context.getPackageManager().queryIntentActivities(intent, 0)) {
- result.add(new ShortcutConfigActivityInfoVL(info.activityInfo));
+ users = Collections.singletonList(packageUser.mUser);
+ packageName = packageUser.mPackageName;
+ }
+ LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
+ for (UserHandle user : users) {
+ boolean ignoreTargetSdk = myUser.equals(user);
+ for (LauncherActivityInfo activityInfo :
+ launcherApps.getShortcutConfigActivityList(packageName, user)) {
+ if (ignoreTargetSdk || activityInfo.getApplicationInfo().targetSdkVersion
+ >= Build.VERSION_CODES.O) {
+ result.add(new ShortcutConfigActivityInfoVO(activityInfo));
}
}
}
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 614cf14..896fb18 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -52,7 +52,6 @@
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
import com.android.launcher3.dot.DotInfo;
@@ -400,9 +399,7 @@
} else if (view instanceof ImageView) {
// Only the system shortcut icon shows on a gray background header.
info.setIconAndContentDescriptionFor((ImageView) view);
- if (Utilities.ATLEAST_OREO) {
- view.setTooltipText(view.getContentDescription());
- }
+ view.setTooltipText(view.getContentDescription());
}
view.setTag(info);
view.setOnClickListener(info);
diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java
index d3213a1..ec3a467 100644
--- a/src/com/android/launcher3/settings/SettingsActivity.java
+++ b/src/com/android/launcher3/settings/SettingsActivity.java
@@ -18,7 +18,6 @@
import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS;
-import static com.android.launcher3.SessionCommitReceiver.ADD_ICON_PREFERENCE_KEY;
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
import static com.android.launcher3.states.RotationHelper.getAllowRotationDefaultValue;
import static com.android.launcher3.util.SecureSettingsObserver.newNotificationSettingsObserver;
@@ -172,11 +171,6 @@
protected boolean initPreference(Preference preference) {
switch (preference.getKey()) {
case NOTIFICATION_DOTS_PREFERENCE_KEY:
- if (!Utilities.ATLEAST_OREO ||
- !getResources().getBoolean(R.bool.notification_dots_enabled)) {
- return false;
- }
-
// Listen to system notification dot settings while this UI is active.
mNotificationDotsObserver = newNotificationSettingsObserver(
getActivity(), (NotificationDotsPreference) preference);
@@ -188,9 +182,6 @@
mNotificationDotsObserver.dispatchOnChange();
return true;
- case ADD_ICON_PREFERENCE_KEY:
- return Utilities.ATLEAST_OREO;
-
case ALLOW_ROTATION_PREFERENCE_KEY:
if (getResources().getBoolean(R.bool.allow_rotation)) {
// Launcher supports rotation by default. No need to show this setting.
diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java
index 60b87d9..beb5b68 100644
--- a/src/com/android/launcher3/statemanager/StateManager.java
+++ b/src/com/android/launcher3/statemanager/StateManager.java
@@ -16,6 +16,8 @@
package com.android.launcher3.statemanager;
+import static android.animation.ValueAnimator.areAnimatorsEnabled;
+
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_COMPONENTS;
import android.animation.Animator;
@@ -26,7 +28,6 @@
import android.os.Looper;
import android.util.Log;
-import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
@@ -179,7 +180,7 @@
private void goToState(STATE_TYPE state, boolean animated, long delay,
final Runnable onCompleteRunnable) {
- animated &= Utilities.areAnimationsEnabled(mActivity);
+ animated &= areAnimatorsEnabled();
if (mActivity.isInState(state)) {
if (mConfig.currentAnimation == null) {
// Run any queued runnable
@@ -311,7 +312,13 @@
handler.setStateWithAnimation(state, mConfig, builder);
}
}
- builder.addListener(new AnimationSuccessListener() {
+ builder.addListener(createStateAnimationListener(state));
+ mConfig.setAnimation(builder.buildAnim(), state);
+ return builder;
+ }
+
+ private AnimatorListener createStateAnimationListener(STATE_TYPE state) {
+ return new AnimationSuccessListener() {
@Override
public void onAnimationStart(Animator animation) {
@@ -326,9 +333,7 @@
}
onStateTransitionEnd(state);
}
- });
- mConfig.setAnimation(builder.buildAnim(), state);
- return builder;
+ };
}
private void onStateTransitionStart(STATE_TYPE state) {
@@ -396,6 +401,19 @@
}
/**
+ * @see #setCurrentAnimation(AnimatorSet, Animator...). Using this method tells the StateManager
+ * that this is a custom animation to the given state, and thus the StateManager will add an
+ * animation listener to call {@link #onStateTransitionStart} and {@link #onStateTransitionEnd}.
+ * @param anim The custom animation to the given state.
+ * @param toState The state we are animating towards.
+ */
+ public void setCurrentAnimation(AnimatorSet anim, STATE_TYPE toState) {
+ cancelAnimation();
+ setCurrentAnimation(anim);
+ anim.addListener(createStateAnimationListener(toState));
+ }
+
+ /**
* Sets the animation as the current state animation, i.e., canceled when
* starting another animation and may block some launcher interactions while running.
*
diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java
index f90ad3c..8b72177 100644
--- a/src/com/android/launcher3/states/StateAnimationConfig.java
+++ b/src/com/android/launcher3/states/StateAnimationConfig.java
@@ -71,6 +71,7 @@
ANIM_ALL_APPS_HEADER_FADE,
ANIM_OVERVIEW_MODAL,
ANIM_DEPTH,
+ ANIM_OVERVIEW_ACTIONS_FADE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AnimType {}
@@ -89,10 +90,11 @@
public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
public static final int ANIM_OVERVIEW_MODAL = 13;
public static final int ANIM_DEPTH = 14;
+ public static final int ANIM_OVERVIEW_ACTIONS_FADE = 15;
- private static final int ANIM_TYPES_COUNT = 15;
+ private static final int ANIM_TYPES_COUNT = 16;
- private final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT];
+ protected final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT];
public StateAnimationConfig() { }
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 8616881..30f8fb0 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -27,12 +27,11 @@
public static final int NORMAL_STATE_ORDINAL = 0;
public static final int SPRING_LOADED_STATE_ORDINAL = 1;
public static final int OVERVIEW_STATE_ORDINAL = 2;
- public static final int OVERVIEW_PEEK_STATE_ORDINAL = 3;
- public static final int OVERVIEW_MODAL_TASK_STATE_ORDINAL = 4;
- public static final int QUICK_SWITCH_STATE_ORDINAL = 5;
- public static final int ALL_APPS_STATE_ORDINAL = 6;
- public static final int BACKGROUND_APP_STATE_ORDINAL = 7;
- public static final int HINT_STATE_ORDINAL = 8;
+ public static final int OVERVIEW_MODAL_TASK_STATE_ORDINAL = 3;
+ public static final int QUICK_SWITCH_STATE_ORDINAL = 4;
+ public static final int ALL_APPS_STATE_ORDINAL = 5;
+ public static final int BACKGROUND_APP_STATE_ORDINAL = 6;
+ public static final int HINT_STATE_ORDINAL = 7;
public static final String TAPL_EVENTS_TAG = "TaplEvents";
public static final String SEQUENCE_MAIN = "Main";
public static final String SEQUENCE_TIS = "TIS";
@@ -46,8 +45,6 @@
return "SpringLoaded";
case OVERVIEW_STATE_ORDINAL:
return "Overview";
- case OVERVIEW_PEEK_STATE_ORDINAL:
- return "OverviewPeek";
case OVERVIEW_MODAL_TASK_STATE_ORDINAL:
return "OverviewModal";
case QUICK_SWITCH_STATE_ORDINAL:
@@ -98,7 +95,6 @@
public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
- public static final String REQUEST_OVERVIEW_ACTIONS_ENABLED = "overview-actions-enabled";
public static final String REQUEST_OVERVIEW_SHARE_ENABLED = "overview-share-enabled";
public static boolean sDisableSensorRotation;
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 66dbf6a..8ee5a6e 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -26,7 +26,7 @@
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_COMPONENTS;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_NON_ATOMIC;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -513,15 +513,7 @@
if (mAtomicAnim == null) {
return 0;
}
- if (Utilities.ATLEAST_OREO) {
- return mAtomicAnim.getTotalDuration() - mAtomicAnim.getCurrentPlayTime();
- } else {
- long remainingDuration = 0;
- for (Animator anim : mAtomicAnim.getChildAnimations()) {
- remainingDuration = Math.max(remainingDuration, anim.getDuration());
- }
- return remainingDuration;
- }
+ return mAtomicAnim.getTotalDuration() - mAtomicAnim.getCurrentPlayTime();
}
protected void updateSwipeCompleteAnimation(ValueAnimator animator, long expectedDuration,
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index 1aaa608..fb02f79 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -108,6 +108,11 @@
}
@Override
+ public <T> void setSecondary(T target, Float2DAction<T> action, float param) {
+ action.call(target, param, 0);
+ }
+
+ @Override
public float getPrimaryDirection(MotionEvent event, int pointerIndex) {
return event.getY(pointerIndex);
}
@@ -148,8 +153,9 @@
}
@Override
- public void setPrimaryAndResetSecondaryTranslate(View view, float translation) {
- view.setTranslationX(0);
+ public void setPrimaryAndResetSecondaryTranslate(
+ View view, float translation, float defaultTranslationX, float defaultTranslationY) {
+ view.setTranslationX(defaultTranslationX);
view.setTranslationY(translation);
}
@@ -215,7 +221,11 @@
}
@Override
- public int getTaskDismissDirectionFactor() {
+ public int getPrimaryTranslationDirectionFactor() {
+ return -1;
+ }
+
+ public int getSecondaryTranslationDirectionFactor() {
return 1;
}
diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java
index f88cdb3..354d78d 100644
--- a/src/com/android/launcher3/touch/PagedOrientationHandler.java
+++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java
@@ -57,6 +57,7 @@
<T> void set(T target, Int2DAction<T> action, int param);
<T> void set(T target, Float2DAction<T> action, float param);
+ <T> void setSecondary(T target, Float2DAction<T> action, float param);
float getPrimaryDirection(MotionEvent event, int pointerIndex);
float getPrimaryVelocity(VelocityTracker velocityTracker, int pointerId);
int getMeasuredSize(View view);
@@ -65,7 +66,8 @@
int getSecondaryDimension(View view);
FloatProperty<View> getPrimaryViewTranslate();
FloatProperty<View> getSecondaryViewTranslate();
- void setPrimaryAndResetSecondaryTranslate(View view, float translation);
+ void setPrimaryAndResetSecondaryTranslate(
+ View view, float translation, float defaultTranslationX, float defaultTranslationY);
int getPrimaryScroll(View view);
float getPrimaryScale(View view);
int getChildStart(View view);
@@ -74,7 +76,8 @@
int getScrollOffsetStart(View view, Rect insets);
int getScrollOffsetEnd(View view, Rect insets);
SingleAxisSwipeDetector.Direction getOppositeSwipeDirection();
- int getTaskDismissDirectionFactor();
+ int getPrimaryTranslationDirectionFactor();
+ int getSecondaryTranslationDirectionFactor();
int getTaskDragDisplacementFactor(boolean isRtl);
ChildBounds getChildBounds(View child, int childStart, int pageCenter, boolean layoutChild);
void setMaxScroll(AccessibilityEvent event, int maxScroll);
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index f18b109..06479e6 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -105,6 +105,11 @@
}
@Override
+ public <T> void setSecondary(T target, Float2DAction<T> action, float param) {
+ action.call(target, 0, param);
+ }
+
+ @Override
public float getPrimaryDirection(MotionEvent event, int pointerIndex) {
return event.getX(pointerIndex);
}
@@ -145,9 +150,10 @@
}
@Override
- public void setPrimaryAndResetSecondaryTranslate(View view, float translation) {
+ public void setPrimaryAndResetSecondaryTranslate(
+ View view, float translation, float defaultTranslationX, float defaultTranslationY) {
view.setTranslationX(translation);
- view.setTranslationY(0);
+ view.setTranslationY(defaultTranslationY);
}
@Override
@@ -212,7 +218,11 @@
}
@Override
- public int getTaskDismissDirectionFactor() {
+ public int getPrimaryTranslationDirectionFactor() {
+ return 1;
+ }
+
+ public int getSecondaryTranslationDirectionFactor() {
return -1;
}
diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
index e91f16d..60d19d9 100644
--- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
@@ -28,7 +28,7 @@
public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
@Override
- public int getTaskDismissDirectionFactor() {
+ public int getSecondaryTranslationDirectionFactor() {
return -1;
}
@@ -75,12 +75,6 @@
}
@Override
- public void setPrimaryAndResetSecondaryTranslate(View view, float translation) {
- view.setTranslationX(0);
- view.setTranslationY(translation);
- }
-
- @Override
public int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect) {
return dp.widthPx - rect.right;
}
diff --git a/src/com/android/launcher3/util/ConfigMonitor.java b/src/com/android/launcher3/util/ConfigMonitor.java
index 0f81520..b3b69f6 100644
--- a/src/com/android/launcher3/util/ConfigMonitor.java
+++ b/src/com/android/launcher3/util/ConfigMonitor.java
@@ -26,14 +26,16 @@
import android.graphics.Point;
import android.util.Log;
+import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
+import com.android.launcher3.util.DisplayController.Info;
+
import java.util.function.Consumer;
/**
* {@link BroadcastReceiver} which watches configuration changes and
* notifies the callback in case changes which affect the device profile occur.
*/
-public class ConfigMonitor extends BroadcastReceiver implements
- DefaultDisplay.DisplayInfoChangeListener {
+public class ConfigMonitor extends BroadcastReceiver implements DisplayInfoChangeListener {
private static final String TAG = "ConfigMonitor";
@@ -57,9 +59,9 @@
mFontScale = config.fontScale;
mDensity = config.densityDpi;
- DefaultDisplay display = DefaultDisplay.INSTANCE.get(context);
+ DisplayController.DisplayHolder display = DisplayController.getDefaultDisplay(context);
display.addChangeListener(this);
- DefaultDisplay.Info displayInfo = display.getInfo();
+ Info displayInfo = display.getInfo();
mDisplayId = displayInfo.id;
mRealSize = new Point(displayInfo.realSize);
@@ -82,7 +84,7 @@
}
@Override
- public void onDisplayInfoChanged(DefaultDisplay.Info info, int flags) {
+ public void onDisplayInfoChanged(Info info, int flags) {
if (info.id != mDisplayId) {
return;
}
@@ -113,8 +115,7 @@
public void unregister() {
try {
mContext.unregisterReceiver(this);
- DefaultDisplay display = DefaultDisplay.INSTANCE.get(mContext);
- display.removeChangeListener(this);
+ DisplayController.getDefaultDisplay(mContext).removeChangeListener(this);
} catch (Exception e) {
Log.e(TAG, "Failed to unregister config monitor", e);
}
diff --git a/src/com/android/launcher3/util/DefaultDisplay.java b/src/com/android/launcher3/util/DefaultDisplay.java
deleted file mode 100644
index 35788a5..0000000
--- a/src/com/android/launcher3/util/DefaultDisplay.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (C) 2019 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.launcher3.util;
-
-import static android.view.Display.DEFAULT_DISPLAY;
-
-import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
-
-import android.content.Context;
-import android.graphics.Point;
-import android.hardware.display.DisplayManager;
-import android.hardware.display.DisplayManager.DisplayListener;
-import android.os.Handler;
-import android.os.Message;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.Display;
-
-import androidx.annotation.VisibleForTesting;
-
-import java.util.ArrayList;
-
-/**
- * Utility class to cache properties of default display to avoid a system RPC on every call.
- */
-public class DefaultDisplay implements DisplayListener {
-
- public static final MainThreadInitializedObject<DefaultDisplay> INSTANCE =
- new MainThreadInitializedObject<>(DefaultDisplay::new);
-
- private static final String TAG = "DefaultDisplay";
-
- public static final int CHANGE_SIZE = 1 << 0;
- public static final int CHANGE_ROTATION = 1 << 1;
- public static final int CHANGE_FRAME_DELAY = 1 << 2;
-
- public static final int CHANGE_ALL = CHANGE_SIZE | CHANGE_ROTATION | CHANGE_FRAME_DELAY;
-
- private final Context mDisplayContext;
- private final int mId;
- private final ArrayList<DisplayInfoChangeListener> mListeners = new ArrayList<>();
- private final Handler mChangeHandler;
- private Info mInfo;
-
- private DefaultDisplay(Context context) {
- DisplayManager dm = context.getSystemService(DisplayManager.class);
- // Use application context to create display context so that it can have its own Resources.
- mDisplayContext = context.getApplicationContext().createDisplayContext(
- dm.getDisplay(DEFAULT_DISPLAY));
- // Note that the Display object must be obtained from DisplayManager which is associated to
- // the display context, so the Display is isolated from Activity and Application to provide
- // the actual state of device that excludes the additional adjustment and override.
- mInfo = new Info(mDisplayContext);
- mId = mInfo.id;
- mChangeHandler = new Handler(this::onChange);
-
- dm.registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler());
- }
-
- @Override
- public final void onDisplayAdded(int displayId) { }
-
- @Override
- public final void onDisplayRemoved(int displayId) { }
-
- @Override
- public final void onDisplayChanged(int displayId) {
- if (displayId != mId) {
- return;
- }
-
- Info oldInfo = mInfo;
- Info info = new Info(mDisplayContext);
-
- int change = 0;
- if (info.hasDifferentSize(oldInfo)) {
- change |= CHANGE_SIZE;
- }
- if (oldInfo.rotation != info.rotation) {
- change |= CHANGE_ROTATION;
- }
- if (info.singleFrameMs != oldInfo.singleFrameMs) {
- change |= CHANGE_FRAME_DELAY;
- }
-
- if (change != 0) {
- mInfo = info;
- mChangeHandler.sendEmptyMessage(change);
- }
- }
-
- public static int getSingleFrameMs(Context context) {
- return INSTANCE.get(context).getInfo().singleFrameMs;
- }
-
- public Info getInfo() {
- return mInfo;
- }
-
- public void addChangeListener(DisplayInfoChangeListener listener) {
- mListeners.add(listener);
- }
-
- public void removeChangeListener(DisplayInfoChangeListener listener) {
- mListeners.remove(listener);
- }
-
- private boolean onChange(Message msg) {
- for (int i = mListeners.size() - 1; i >= 0; i--) {
- mListeners.get(i).onDisplayInfoChanged(mInfo, msg.what);
- }
- return true;
- }
-
- public static class Info {
-
- public final int id;
- public final int rotation;
- public final int singleFrameMs;
-
- public final Point realSize;
- public final Point smallestSize;
- public final Point largestSize;
-
- public final DisplayMetrics metrics;
-
- @VisibleForTesting
- public Info(int id, int rotation, int singleFrameMs, Point realSize, Point smallestSize,
- Point largestSize, DisplayMetrics metrics) {
- this.id = id;
- this.rotation = rotation;
- this.singleFrameMs = singleFrameMs;
- this.realSize = realSize;
- this.smallestSize = smallestSize;
- this.largestSize = largestSize;
- this.metrics = metrics;
- }
-
- private Info(Context context) {
- this(context, context.getSystemService(DisplayManager.class)
- .getDisplay(DEFAULT_DISPLAY));
- }
-
- public Info(Context context, Display display) {
- id = display.getDisplayId();
- rotation = display.getRotation();
-
- float refreshRate = display.getRefreshRate();
- singleFrameMs = refreshRate > 0 ? (int) (1000 / refreshRate) : 16;
-
- realSize = new Point();
- smallestSize = new Point();
- largestSize = new Point();
- display.getRealSize(realSize);
- display.getCurrentSizeRange(smallestSize, largestSize);
-
- metrics = context.getResources().getDisplayMetrics();
- }
-
- private boolean hasDifferentSize(Info info) {
- if (!realSize.equals(info.realSize)
- && !realSize.equals(info.realSize.y, info.realSize.x)) {
- Log.d(TAG, String.format("Display size changed from %s to %s",
- info.realSize, realSize));
- return true;
- }
-
- if (!smallestSize.equals(info.smallestSize) || !largestSize.equals(info.largestSize)) {
- Log.d(TAG, String.format("Available size changed from [%s, %s] to [%s, %s]",
- smallestSize, largestSize, info.smallestSize, info.largestSize));
- return true;
- }
-
- return false;
- }
- }
-
- /**
- * Interface for listening for display changes
- */
- public interface DisplayInfoChangeListener {
-
- void onDisplayInfoChanged(Info info, int flags);
- }
-}
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
new file mode 100644
index 0000000..e5c8441
--- /dev/null
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -0,0 +1,274 @@
+/*
+ * Copyright (C) 2019 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.launcher3.util;
+
+import static android.view.Display.DEFAULT_DISPLAY;
+
+import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
+import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
+
+import android.content.Context;
+import android.graphics.Point;
+import android.hardware.display.DisplayManager;
+import android.hardware.display.DisplayManager.DisplayListener;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.util.SparseArray;
+import android.view.Display;
+
+import androidx.annotation.VisibleForTesting;
+
+import java.util.ArrayList;
+
+/**
+ * Utility class to cache properties of default display to avoid a system RPC on every call.
+ */
+public class DisplayController implements DisplayListener {
+
+ private static final String TAG = "DisplayController";
+
+ public static final MainThreadInitializedObject<DisplayController> INSTANCE =
+ new MainThreadInitializedObject<>(DisplayController::new);
+
+ private final SparseArray<DisplayHolder> mOtherDisplays = new SparseArray<>(0);
+ // We store the default display separately, to avoid null checks for primary use case.
+ private final DisplayHolder mDefaultDisplay;
+
+ private final ArrayList<DisplayListChangeListener> mListListeners = new ArrayList<>();
+
+ private DisplayController(Context context) {
+ mDefaultDisplay = new DisplayHolder(context, DEFAULT_DISPLAY);
+
+ DisplayManager dm = context.getSystemService(DisplayManager.class);
+ dm.registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler());
+ }
+
+ @Override
+ public final void onDisplayAdded(int displayId) {
+ DisplayHolder holder = new DisplayHolder(mDefaultDisplay.mDisplayContext, displayId);
+ synchronized (mOtherDisplays) {
+ mOtherDisplays.put(displayId, holder);
+ }
+ MAIN_EXECUTOR.execute(() -> mListListeners.forEach(l-> l.onDisplayAdded(holder)));
+ }
+
+ @Override
+ public final void onDisplayRemoved(int displayId) {
+ synchronized (mOtherDisplays) {
+ mOtherDisplays.remove(displayId);
+ }
+ MAIN_EXECUTOR.execute(() -> mListListeners.forEach(l-> l.onDisplayRemoved(displayId)));
+ }
+
+ /**
+ * Returns the holder corresponding to the given display
+ */
+ public DisplayHolder getHolder(int displayId) {
+ if (displayId == mDefaultDisplay.mId) {
+ return mDefaultDisplay;
+ } else {
+ synchronized (mOtherDisplays) {
+ return mOtherDisplays.get(displayId);
+ }
+ }
+ }
+
+ /**
+ * Adds a listener for display list changes
+ */
+ public void addListChangeListener(DisplayListChangeListener listener) {
+ mListListeners.add(listener);
+ }
+
+ /**
+ * Removes a previously added display list change listener
+ */
+ public void removeListChangeListener(DisplayListChangeListener listener) {
+ mListListeners.remove(listener);
+ }
+
+ @Override
+ public final void onDisplayChanged(int displayId) {
+ DisplayHolder holder = getHolder(displayId);
+ if (holder != null) {
+ holder.handleOnChange();
+ }
+ }
+
+ public static int getSingleFrameMs(Context context) {
+ return getDefaultDisplay(context).getInfo().singleFrameMs;
+ }
+
+ public static DisplayHolder getDefaultDisplay(Context context) {
+ return INSTANCE.get(context).mDefaultDisplay;
+ }
+
+ /**
+ * A listener to receiving addition or removal of new displays
+ */
+ public interface DisplayListChangeListener {
+
+ /**
+ * Called when a new display is added
+ */
+ void onDisplayAdded(DisplayHolder holder);
+
+ /**
+ * Called when a previously added display is removed
+ */
+ void onDisplayRemoved(int displayId);
+ }
+
+ /**
+ * Interface for listening for display changes
+ */
+ public interface DisplayInfoChangeListener {
+
+ void onDisplayInfoChanged(Info info, int flags);
+ }
+
+ public static class DisplayHolder {
+
+ public static final int CHANGE_SIZE = 1 << 0;
+ public static final int CHANGE_ROTATION = 1 << 1;
+ public static final int CHANGE_FRAME_DELAY = 1 << 2;
+
+ public static final int CHANGE_ALL = CHANGE_SIZE | CHANGE_ROTATION | CHANGE_FRAME_DELAY;
+
+ final Context mDisplayContext;
+ final int mId;
+ private final ArrayList<DisplayInfoChangeListener> mListeners = new ArrayList<>();
+ private DisplayController.Info mInfo;
+
+ public DisplayHolder(Context context, int id) {
+ DisplayManager dm = context.getSystemService(DisplayManager.class);
+ // Use application context to create display context so that it can have its own
+ // Resources.
+ mDisplayContext = context.getApplicationContext()
+ .createDisplayContext(dm.getDisplay(id));
+ // Note that the Display object must be obtained from DisplayManager which is
+ // associated to the display context, so the Display is isolated from Activity and
+ // Application to provide the actual state of device that excludes the additional
+ // adjustment and override.
+ mInfo = new DisplayController.Info(mDisplayContext);
+ mId = mInfo.id;
+ }
+
+ public void addChangeListener(DisplayInfoChangeListener listener) {
+ mListeners.add(listener);
+ }
+
+ public void removeChangeListener(DisplayInfoChangeListener listener) {
+ mListeners.remove(listener);
+ }
+
+ public DisplayController.Info getInfo() {
+ return mInfo;
+ }
+
+ protected void handleOnChange() {
+ Info oldInfo = mInfo;
+ Info info = new Info(mDisplayContext);
+
+ int change = 0;
+ if (info.hasDifferentSize(oldInfo)) {
+ change |= CHANGE_SIZE;
+ }
+ if (oldInfo.rotation != info.rotation) {
+ change |= CHANGE_ROTATION;
+ }
+ if (info.singleFrameMs != oldInfo.singleFrameMs) {
+ change |= CHANGE_FRAME_DELAY;
+ }
+
+ if (change != 0) {
+ mInfo = info;
+ final int flags = change;
+ MAIN_EXECUTOR.execute(() -> notifyChange(flags));
+ }
+ }
+
+ private void notifyChange(int flags) {
+ for (int i = mListeners.size() - 1; i >= 0; i--) {
+ mListeners.get(i).onDisplayInfoChanged(mInfo, flags);
+ }
+ }
+
+ }
+
+ public static class Info {
+
+ public final int id;
+ public final int rotation;
+ public final int singleFrameMs;
+
+ public final Point realSize;
+ public final Point smallestSize;
+ public final Point largestSize;
+
+ public final DisplayMetrics metrics;
+
+ @VisibleForTesting
+ public Info(int id, int rotation, int singleFrameMs, Point realSize, Point smallestSize,
+ Point largestSize, DisplayMetrics metrics) {
+ this.id = id;
+ this.rotation = rotation;
+ this.singleFrameMs = singleFrameMs;
+ this.realSize = realSize;
+ this.smallestSize = smallestSize;
+ this.largestSize = largestSize;
+ this.metrics = metrics;
+ }
+
+ private Info(Context context) {
+ this(context, context.getSystemService(DisplayManager.class)
+ .getDisplay(DEFAULT_DISPLAY));
+ }
+
+ public Info(Context context, Display display) {
+ id = display.getDisplayId();
+ rotation = display.getRotation();
+
+ float refreshRate = display.getRefreshRate();
+ singleFrameMs = refreshRate > 0 ? (int) (1000 / refreshRate) : 16;
+
+ realSize = new Point();
+ smallestSize = new Point();
+ largestSize = new Point();
+ display.getRealSize(realSize);
+ display.getCurrentSizeRange(smallestSize, largestSize);
+
+ metrics = context.getResources().getDisplayMetrics();
+ }
+
+ private boolean hasDifferentSize(Info info) {
+ if (!realSize.equals(info.realSize)
+ && !realSize.equals(info.realSize.y, info.realSize.x)) {
+ Log.d(TAG, String.format("Display size changed from %s to %s",
+ info.realSize, realSize));
+ return true;
+ }
+
+ if (!smallestSize.equals(info.smallestSize) || !largestSize.equals(info.largestSize)) {
+ Log.d(TAG, String.format("Available size changed from [%s, %s] to [%s, %s]",
+ smallestSize, largestSize, info.smallestSize, info.largestSize));
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/src/com/android/launcher3/util/IOUtils.java b/src/com/android/launcher3/util/IOUtils.java
index fcb96d7..1cec0ec 100644
--- a/src/com/android/launcher3/util/IOUtils.java
+++ b/src/com/android/launcher3/util/IOUtils.java
@@ -16,20 +16,19 @@
package com.android.launcher3.util;
-import android.content.Context;
+import android.os.FileUtils;
import android.util.Log;
+import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.UUID;
/**
* Supports various IO utility functions
@@ -52,6 +51,9 @@
}
public static long copy(InputStream from, OutputStream to) throws IOException {
+ if (Utilities.ATLEAST_Q) {
+ return FileUtils.copy(from, to);
+ }
byte[] buf = new byte[BUF_SIZE];
long total = 0;
int r;
@@ -62,25 +64,6 @@
return total;
}
- /**
- * Utility method to debug binary data
- */
- public static String createTempFile(Context context, byte[] data) {
- if (!FeatureFlags.IS_STUDIO_BUILD) {
- throw new IllegalStateException("Method only allowed in development mode");
- }
-
- String name = UUID.randomUUID().toString();
- File file = new File(context.getCacheDir(), name);
- try (FileOutputStream fo = new FileOutputStream(file)) {
- fo.write(data);
- fo.flush();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return file.getAbsolutePath();
- }
-
public static void closeSilently(Closeable c) {
if (c != null) {
try {
diff --git a/src/com/android/launcher3/util/MultiValueAlpha.java b/src/com/android/launcher3/util/MultiValueAlpha.java
index a8642b0..5be9529 100644
--- a/src/com/android/launcher3/util/MultiValueAlpha.java
+++ b/src/com/android/launcher3/util/MultiValueAlpha.java
@@ -19,6 +19,8 @@
import android.util.FloatProperty;
import android.view.View;
+import com.android.launcher3.anim.AlphaUpdateListener;
+
import java.util.Arrays;
/**
@@ -44,6 +46,8 @@
private final AlphaProperty[] mMyProperties;
private int mValidMask;
+ // Whether we should change from INVISIBLE to VISIBLE and vice versa at low alpha values.
+ private boolean mUpdateVisibility;
public MultiValueAlpha(View view, int size) {
mView = view;
@@ -66,6 +70,11 @@
return mMyProperties[index];
}
+ /** Sets whether we should update between INVISIBLE and VISIBLE based on alpha. */
+ public void setUpdateVisibility(boolean updateVisibility) {
+ mUpdateVisibility = updateVisibility;
+ }
+
public class AlphaProperty {
private final int mMyMask;
@@ -99,6 +108,9 @@
mValue = value;
mView.setAlpha(mOthers * mValue);
+ if (mUpdateVisibility) {
+ AlphaUpdateListener.updateVisibility(mView);
+ }
}
public float getValue() {
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index 86f3431..523545a 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -37,7 +37,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.PatternMatcher;
-import android.os.Process;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
@@ -46,7 +45,6 @@
import com.android.launcher3.PendingAddItemInfo;
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
@@ -96,36 +94,12 @@
* Returns the application info for the provided package or null
*/
public ApplicationInfo getApplicationInfo(String packageName, UserHandle user, int flags) {
- if (Utilities.ATLEAST_OREO) {
- try {
- ApplicationInfo info = mLauncherApps.getApplicationInfo(packageName, flags, user);
- return (info.flags & ApplicationInfo.FLAG_INSTALLED) == 0 || !info.enabled
- ? null : info;
- } catch (PackageManager.NameNotFoundException e) {
- return null;
- }
- } else {
- final boolean isPrimaryUser = Process.myUserHandle().equals(user);
- if (!isPrimaryUser && (flags == 0)) {
- // We are looking for an installed app on a secondary profile. Prior to O, the only
- // entry point for work profiles is through the LauncherActivity.
- List<LauncherActivityInfo> activityList =
- mLauncherApps.getActivityList(packageName, user);
- return activityList.size() > 0 ? activityList.get(0).getApplicationInfo() : null;
- }
- try {
- ApplicationInfo info = mPm.getApplicationInfo(packageName, flags);
- // There is no way to check if the app is installed for managed profile. But for
- // primary profile, we can still have this check.
- if (isPrimaryUser && ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0)
- || !info.enabled) {
- return null;
- }
- return info;
- } catch (PackageManager.NameNotFoundException e) {
- // Package not found
- return null;
- }
+ try {
+ ApplicationInfo info = mLauncherApps.getApplicationInfo(packageName, flags, user);
+ return (info.flags & ApplicationInfo.FLAG_INSTALLED) == 0 || !info.enabled
+ ? null : info;
+ } catch (PackageManager.NameNotFoundException e) {
+ return null;
}
}
diff --git a/src/com/android/launcher3/util/PersistedItemArray.java b/src/com/android/launcher3/util/PersistedItemArray.java
new file mode 100644
index 0000000..ae20638
--- /dev/null
+++ b/src/com/android/launcher3/util/PersistedItemArray.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2020 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.launcher3.util;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+import android.util.AtomicFile;
+import android.util.Log;
+import android.util.Xml;
+
+import androidx.annotation.Nullable;
+import androidx.annotation.WorkerThread;
+
+import com.android.launcher3.AutoInstallsLayout;
+import com.android.launcher3.LauncherSettings.Favorites;
+import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.pm.UserCache;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.LongFunction;
+
+/**
+ * Utility class to read/write a list of {@link com.android.launcher3.model.data.ItemInfo} on disk.
+ * This class is not thread safe, the caller should ensure proper threading
+ */
+public class PersistedItemArray<T extends ItemInfo> {
+
+ private static final String TAG = "PersistedItemArray";
+
+ private static final String TAG_ROOT = "items";
+ private static final String TAG_ENTRY = "entry";
+
+ private final String mFileName;
+
+ public PersistedItemArray(String fileName) {
+ mFileName = fileName + ".xml";
+ }
+
+ /**
+ * Writes the provided list of items on the disk
+ */
+ @WorkerThread
+ public void write(Context context, List<T> items) {
+ AtomicFile file = new AtomicFile(context.getFileStreamPath(mFileName));
+
+ FileOutputStream fos;
+ try {
+ fos = file.startWrite();
+ } catch (IOException e) {
+ Log.e(TAG, "Unable to persist items in " + mFileName, e);
+ return;
+ }
+
+ UserCache userCache = UserCache.INSTANCE.get(context);
+
+ try {
+ XmlSerializer out = Xml.newSerializer();
+ out.setOutput(fos, StandardCharsets.UTF_8.name());
+ out.startDocument(null, true);
+ out.startTag(null, TAG_ROOT);
+ for (T item : items) {
+ Intent intent = item.getIntent();
+ if (intent == null) {
+ continue;
+ }
+
+ out.startTag(null, TAG_ENTRY);
+ out.attribute(null, Favorites.ITEM_TYPE, Integer.toString(item.itemType));
+ out.attribute(null, Favorites.PROFILE_ID,
+ Long.toString(userCache.getSerialNumberForUser(item.user)));
+ out.attribute(null, Favorites.INTENT, intent.toUri(0));
+ out.endTag(null, TAG_ENTRY);
+ }
+ out.endTag(null, TAG_ROOT);
+ out.endDocument();
+ } catch (IOException e) {
+ file.failWrite(fos);
+ Log.e(TAG, "Unable to persist items in " + mFileName, e);
+ return;
+ }
+
+ file.finishWrite(fos);
+ }
+
+ /**
+ * Reads the items from the disk
+ */
+ @WorkerThread
+ public List<T> read(Context context, ItemFactory<T> factory) {
+ return read(context, factory, UserCache.INSTANCE.get(context)::getUserForSerialNumber);
+ }
+
+ /**
+ * Reads the items from the disk
+ * @param userFn method to provide user handle for a given user serial
+ */
+ @WorkerThread
+ public List<T> read(Context context, ItemFactory<T> factory, LongFunction<UserHandle> userFn) {
+ List<T> result = new ArrayList<>();
+ AtomicFile file = new AtomicFile(context.getFileStreamPath(mFileName));
+
+ try (FileInputStream fis = file.openRead()) {
+ XmlPullParser parser = Xml.newPullParser();
+ parser.setInput(new InputStreamReader(fis, StandardCharsets.UTF_8));
+
+ AutoInstallsLayout.beginDocument(parser, TAG_ROOT);
+ final int depth = parser.getDepth();
+
+ int type;
+ while (((type = parser.next()) != XmlPullParser.END_TAG
+ || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
+ if (type != XmlPullParser.START_TAG || !TAG_ENTRY.equals(parser.getName())) {
+ continue;
+ }
+ try {
+ int itemType = Integer.parseInt(
+ parser.getAttributeValue(null, Favorites.ITEM_TYPE));
+ UserHandle user = userFn.apply(Long.parseLong(
+ parser.getAttributeValue(null, Favorites.PROFILE_ID)));
+ Intent intent = Intent.parseUri(
+ parser.getAttributeValue(null, Favorites.INTENT), 0);
+
+ if (user != null && intent != null) {
+ T item = factory.createInfo(itemType, user, intent);
+ if (item != null) {
+ result.add(item);
+ }
+ }
+ } catch (Exception e) {
+ // Ignore this entry
+ }
+ }
+ } catch (FileNotFoundException e) {
+ // Ignore
+ } catch (IOException | XmlPullParserException e) {
+ Log.e(TAG, "Unable to read items in " + mFileName, e);
+ return Collections.emptyList();
+ }
+ return result;
+ }
+
+ /**
+ * Interface to create an ItemInfo during parsing
+ */
+ public interface ItemFactory<T extends ItemInfo> {
+
+ /**
+ * Returns an item info or null in which case the entry is ignored
+ */
+ @Nullable
+ T createInfo(int itemType, UserHandle user, Intent intent);
+ }
+}
diff --git a/src/com/android/launcher3/util/SystemUiController.java b/src/com/android/launcher3/util/SystemUiController.java
index 3e48006..50166c3 100644
--- a/src/com/android/launcher3/util/SystemUiController.java
+++ b/src/com/android/launcher3/util/SystemUiController.java
@@ -19,8 +19,6 @@
import android.view.View;
import android.view.Window;
-import com.android.launcher3.Utilities;
-
import java.util.Arrays;
/**
@@ -78,12 +76,10 @@
}
private int getSysUiVisibilityFlags(int stateFlag, int currentVisibility) {
- if (Utilities.ATLEAST_OREO) {
- if ((stateFlag & FLAG_LIGHT_NAV) != 0) {
- currentVisibility |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
- } else if ((stateFlag & FLAG_DARK_NAV) != 0) {
- currentVisibility &= ~(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
- }
+ if ((stateFlag & FLAG_LIGHT_NAV) != 0) {
+ currentVisibility |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+ } else if ((stateFlag & FLAG_DARK_NAV) != 0) {
+ currentVisibility &= ~(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
if ((stateFlag & FLAG_LIGHT_STATUS) != 0) {
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index 357eeb8..2be827b 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -20,7 +20,7 @@
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
-import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import android.annotation.TargetApi;
import android.app.WallpaperInfo;
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 8186dfa..52a82f8 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -256,7 +256,6 @@
Drawable drawable = null;
Drawable badge = null;
boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get()
- && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& !info.isDisabled(); // Use original icon for disabled icons.
Drawable btvIcon = originalView instanceof BubbleTextView
? ((BubbleTextView) originalView).getIcon() : null;
@@ -383,8 +382,7 @@
@WorkerThread
@SuppressWarnings("WrongThread")
private static int getOffsetForIconBounds(Launcher l, Drawable drawable, RectF position) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O
- || !(drawable instanceof AdaptiveIconDrawable)
+ if (!(drawable instanceof AdaptiveIconDrawable)
|| (drawable instanceof FolderAdaptiveIcon)) {
return 0;
}
diff --git a/src/com/android/launcher3/views/FloatingSurfaceView.java b/src/com/android/launcher3/views/FloatingSurfaceView.java
index 040619e..9582232 100644
--- a/src/com/android/launcher3/views/FloatingSurfaceView.java
+++ b/src/com/android/launcher3/views/FloatingSurfaceView.java
@@ -40,7 +40,7 @@
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Executors;
/**
@@ -97,7 +97,7 @@
// Remove after some time, to avoid flickering
Executors.MAIN_EXECUTOR.getHandler().postDelayed(mRemoveViewRunnable,
- DefaultDisplay.INSTANCE.get(mLauncher).getInfo().singleFrameMs);
+ DisplayController.getDefaultDisplay(mLauncher).getInfo().singleFrameMs);
}
private void removeViewFromParent() {
diff --git a/src/com/android/launcher3/views/HeroSearchResultView.java b/src/com/android/launcher3/views/HeroSearchResultView.java
new file mode 100644
index 0000000..c2a02bc
--- /dev/null
+++ b/src/com/android/launcher3/views/HeroSearchResultView.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2020 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.launcher3.views;
+
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS;
+
+import android.content.Context;
+import android.graphics.Point;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+
+import com.android.launcher3.BubbleTextView;
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.DragSource;
+import com.android.launcher3.DropTarget;
+import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
+import com.android.launcher3.allapps.AlphabeticalAppsList;
+import com.android.launcher3.dragndrop.DragOptions;
+import com.android.launcher3.dragndrop.DraggableView;
+import com.android.launcher3.graphics.DragPreviewProvider;
+import com.android.launcher3.model.data.AppInfo;
+import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
+import com.android.launcher3.touch.ItemLongClickListener;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A view representing a high confidence app search result that includes shortcuts
+ */
+public class HeroSearchResultView extends LinearLayout implements DragSource {
+
+ BubbleTextView mBubbleTextView;
+ View mIconView;
+ BubbleTextView[] mDeepShortcutTextViews = new BubbleTextView[2];
+
+ public HeroSearchResultView(Context context) {
+ super(context);
+ }
+
+ public HeroSearchResultView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public HeroSearchResultView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ Launcher launcher = Launcher.getLauncher(getContext());
+ DeviceProfile grid = launcher.getDeviceProfile();
+ mIconView = findViewById(R.id.icon);
+ ViewGroup.LayoutParams iconParams = mIconView.getLayoutParams();
+ iconParams.height = grid.allAppsIconSizePx;
+ iconParams.width = grid.allAppsIconSizePx;
+
+
+ mBubbleTextView = findViewById(R.id.bubble_text);
+ mBubbleTextView.setOnClickListener(launcher.getItemOnClickListener());
+ mBubbleTextView.setOnLongClickListener(new HeroItemDragHandler(getContext(), this));
+ setLayoutParams(
+ new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, grid.allAppsCellHeightPx));
+
+
+ mDeepShortcutTextViews[0] = findViewById(R.id.shortcut_0);
+ mDeepShortcutTextViews[1] = findViewById(R.id.shortcut_1);
+ for (BubbleTextView bubbleTextView : mDeepShortcutTextViews) {
+ bubbleTextView.setLayoutParams(
+ new LinearLayout.LayoutParams(grid.allAppsIconSizePx,
+ grid.allAppsIconSizePx));
+ bubbleTextView.setOnClickListener(launcher.getItemOnClickListener());
+ }
+ }
+
+ /**
+ * Apply {@link ItemInfo} for appIcon and shortcut Icons
+ */
+ public void prepareUsingAdapterItem(AlphabeticalAppsList.HeroAppAdapterItem adapterItem) {
+ mBubbleTextView.applyFromApplicationInfo(adapterItem.appInfo);
+ mIconView.setBackground(mBubbleTextView.getIcon());
+ mIconView.setTag(adapterItem.appInfo);
+ List<WorkspaceItemInfo> shorcutInfos = adapterItem.getShortcutInfos();
+ for (int i = 0; i < mDeepShortcutTextViews.length; i++) {
+ mDeepShortcutTextViews[i].setVisibility(shorcutInfos.size() > i ? VISIBLE : GONE);
+ if (i < shorcutInfos.size()) {
+ mDeepShortcutTextViews[i].applyFromWorkspaceItem(shorcutInfos.get(i));
+ }
+ }
+
+ }
+
+ @Override
+ public void onDropCompleted(View target, DropTarget.DragObject d, boolean success) {
+ mBubbleTextView.setVisibility(VISIBLE);
+ mBubbleTextView.setIconVisible(true);
+ }
+
+ @Override
+ public void fillInLogContainerData(ItemInfo childInfo, LauncherLogProto.Target child,
+ ArrayList<LauncherLogProto.Target> parents) {
+
+ }
+
+ private void setWillDrawIcon(boolean willDraw) {
+ mIconView.setVisibility(willDraw ? View.VISIBLE : View.INVISIBLE);
+ }
+
+
+ /**
+ * Drag and drop handler for popup items in Launcher activity
+ */
+ public static class HeroItemDragHandler implements OnLongClickListener {
+ private final Launcher mLauncher;
+ private final HeroSearchResultView mContainer;
+
+ HeroItemDragHandler(Context context, HeroSearchResultView container) {
+ mLauncher = Launcher.getLauncher(context);
+ mContainer = container;
+ }
+
+ @Override
+ public boolean onLongClick(View v) {
+ if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
+ mContainer.setWillDrawIcon(false);
+
+ DraggableView draggableView = DraggableView.ofType(DraggableView.DRAGGABLE_ICON);
+ WorkspaceItemInfo itemInfo = new WorkspaceItemInfo((AppInfo) v.getTag());
+ itemInfo.container = CONTAINER_ALL_APPS;
+ DragPreviewProvider previewProvider = new ShortcutDragPreviewProvider(
+ mContainer.mIconView, new Point());
+ mLauncher.getWorkspace().beginDragShared(mContainer.mBubbleTextView,
+ draggableView, mContainer, itemInfo, previewProvider, new DragOptions());
+
+ return false;
+ }
+ }
+}
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index e95dc5b..9ad2331 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -226,15 +226,15 @@
if (!TextUtils.isEmpty(pickerPackage)) {
intent.setPackage(pickerPackage);
}
- return launcher.startActivitySafely(v, intent, dummyInfo(intent));
+ return launcher.startActivitySafely(v, intent, placeholderInfo(intent));
}
- static WorkspaceItemInfo dummyInfo(Intent intent) {
- WorkspaceItemInfo dummyInfo = new WorkspaceItemInfo();
- dummyInfo.intent = intent;
- dummyInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
- dummyInfo.container = LauncherSettings.Favorites.CONTAINER_SETTINGS;
- return dummyInfo;
+ static WorkspaceItemInfo placeholderInfo(Intent intent) {
+ WorkspaceItemInfo placeholderInfo = new WorkspaceItemInfo();
+ placeholderInfo.intent = intent;
+ placeholderInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
+ placeholderInfo.container = LauncherSettings.Favorites.CONTAINER_SETTINGS;
+ return placeholderInfo;
}
public static class OptionItem {
diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
index 6f2e179..780a1a1 100644
--- a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
@@ -80,9 +80,7 @@
setAccessibilityDelegate(mLauncher.getAccessibilityDelegate());
setBackgroundResource(R.drawable.widget_internal_focus_bg);
- if (Utilities.ATLEAST_OREO) {
- setExecutor(Executors.THREAD_POOL_EXECUTOR);
- }
+ setExecutor(Executors.THREAD_POOL_EXECUTOR);
if (Utilities.ATLEAST_Q && Themes.getAttrBoolean(mLauncher, R.attr.isWorkspaceDarkText)) {
setOnLightBackground(true);
}
diff --git a/src/com/android/launcher3/widget/WidgetManagerHelper.java b/src/com/android/launcher3/widget/WidgetManagerHelper.java
index 4b6c569..c0c5c48 100644
--- a/src/com/android/launcher3/widget/WidgetManagerHelper.java
+++ b/src/com/android/launcher3/widget/WidgetManagerHelper.java
@@ -23,13 +23,11 @@
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
-import android.os.Process;
import android.os.UserHandle;
import androidx.annotation.Nullable;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
-import com.android.launcher3.Utilities;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.pm.UserCache;
@@ -84,22 +82,8 @@
return allWidgetsSteam(mContext).collect(Collectors.toList());
}
- if (Utilities.ATLEAST_OREO) {
- return mAppWidgetManager.getInstalledProvidersForPackage(
- packageUser.mPackageName, packageUser.mUser);
- }
-
- String pkg = packageUser.mPackageName;
- return Stream.concat(
- // Only get providers for the given package/user.
- mAppWidgetManager.getInstalledProvidersForProfile(packageUser.mUser)
- .stream()
- .filter(w -> w.provider.equals(pkg)),
- Process.myUserHandle().equals(packageUser.mUser)
- && mContext.getPackageName().equals(pkg)
- ? CustomWidgetManager.INSTANCE.get(mContext).stream()
- : Stream.empty())
- .collect(Collectors.toList());
+ return mAppWidgetManager.getInstalledProvidersForPackage(
+ packageUser.mPackageName, packageUser.mUser);
}
/**
diff --git a/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
index c57f07d..be20e2d 100644
--- a/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
+++ b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
@@ -16,35 +16,28 @@
package com.android.systemui.plugins;
-import android.app.Activity;
-import android.view.ViewGroup;
-import android.widget.EditText;
+import android.os.Bundle;
import com.android.systemui.plugins.annotations.ProvidesInterface;
+import java.util.List;
+import java.util.function.Consumer;
+
/**
- * Implement this plugin interface to replace the all apps recycler view of the all apps drawer.
+ * Implement this plugin interface to fetch search result data from the plugin side.
*/
@ProvidesInterface(action = AllAppsSearchPlugin.ACTION, version = AllAppsSearchPlugin.VERSION)
public interface AllAppsSearchPlugin extends Plugin {
String ACTION = "com.android.systemui.action.PLUGIN_ALL_APPS_SEARCH_ACTIONS";
- int VERSION = 3;
-
- /** Following are the order that these methods should be called. */
- void setup(ViewGroup parent, Activity activity, float allAppsContainerHeight);
+ int VERSION = 4;
/**
- * When drag starts, pass window inset related fields and the progress to indicate
- * whether user is swiping down or swiping up
+ * Send signal when user starts typing.
*/
- void onDragStart(float progress);
+ void startedTyping();
- /** progress is between [0, 1] 1: down, 0: up */
- void setProgress(float progress);
-
- /** Called when container animation stops, so that plugin can perform cleanups */
- void onAnimationEnd(float progress);
-
- /** pass over the search box object */
- void setEditText(EditText editText);
+ /**
+ * Send over the query and get the search results.
+ */
+ void performSearch(String query, Consumer<List<Bundle>> results);
}
diff --git a/src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java b/src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java
index dcb4636..269af7b 100644
--- a/src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java
+++ b/src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java
@@ -21,7 +21,6 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.model.BgDataModel.Callbacks;
import com.android.launcher3.util.ComponentKey;
-import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.widget.WidgetListRowEntry;
import java.util.ArrayList;
@@ -34,12 +33,7 @@
public LoaderResults(LauncherAppState app, BgDataModel dataModel,
AllAppsList allAppsList, Callbacks[] callbacks) {
- this(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR);
- }
-
- public LoaderResults(LauncherAppState app, BgDataModel dataModel,
- AllAppsList allAppsList, Callbacks[] callbacks, LooperExecutor executor) {
- super(app, dataModel, allAppsList, callbacks, executor);
+ super(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR);
}
@Override
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/ColorExtractionAlgorithm.java b/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/ColorExtractionAlgorithm.java
index 5a1f9ca..780a0f0 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/ColorExtractionAlgorithm.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/ColorExtractionAlgorithm.java
@@ -21,16 +21,16 @@
import android.util.Pair;
import android.util.Range;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.core.graphics.ColorUtils;
+
import com.android.launcher3.Utilities;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.core.graphics.ColorUtils;
-
/**
* Implementation of tonal color extraction
**/
@@ -69,7 +69,7 @@
// palettes. The best fit is tweaked to be closer to the source color
// and replaces the original palette
- // Get the most preeminent, non-blacklisted color.
+ // Get the most preeminent, non-disallowed color.
Integer bestColor = 0;
final float[] hsl = new float[3];
for (int i = 0; i < mainColorsSize; i++) {
@@ -78,7 +78,7 @@
Color.blue(colorValue), hsl);
// Stop when we find a color that meets our criteria
- if (!isBlacklisted(hsl)) {
+ if (!isDisallowed(hsl)) {
bestColor = colorValue;
break;
}
@@ -167,12 +167,12 @@
}
/**
- * Checks if a given color exists in the blacklist
+ * Checks if a given color exists in the disallowed_colors list.
* @param hsl float array with 3 components (H 0..360, S 0..1 and L 0..1)
* @return true if color should be avoided
*/
- private boolean isBlacklisted(float[] hsl) {
- for (ColorRange badRange: BLACKLISTED_COLORS) {
+ private boolean isDisallowed(float[] hsl) {
+ for (ColorRange badRange: DISALLOWED_COLORS) {
if (badRange.containsColor(hsl[0], hsl[1], hsl[2])) {
return true;
}
@@ -592,7 +592,7 @@
);
@SuppressWarnings("WeakerAccess")
- static final ColorRange[] BLACKLISTED_COLORS = new ColorRange[] {
+ static final ColorRange[] DISALLOWED_COLORS = new ColorRange[] {
// Red
new ColorRange(
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompat.java b/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompat.java
index 0fd0a35..9dbe47c 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompat.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompat.java
@@ -17,8 +17,7 @@
package com.android.launcher3.uioverrides.dynamicui;
import android.content.Context;
-
-import com.android.launcher3.Utilities;
+import android.os.Build;
import androidx.annotation.Nullable;
@@ -32,7 +31,7 @@
if (sInstance == null) {
context = context.getApplicationContext();
- if (Utilities.ATLEAST_OREO_MR1) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
try {
sInstance = new WallpaperManagerCompatVOMR1(context);
} catch (Throwable e) {
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
index 7a6332c..d102bcc 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -38,10 +38,6 @@
return new OverviewState(id);
}
- public static OverviewState newPeekState(int id) {
- return new OverviewState(id);
- }
-
public static OverviewState newSwitchState(int id) {
return new OverviewState(id);
}
diff --git a/tests/src/com/android/launcher3/testcomponent/ListViewService.java b/tests/src/com/android/launcher3/testcomponent/ListViewService.java
index 3da20e0..9e3a492 100644
--- a/tests/src/com/android/launcher3/testcomponent/ListViewService.java
+++ b/tests/src/com/android/launcher3/testcomponent/ListViewService.java
@@ -89,7 +89,7 @@
public RemoteViewsFactory onGetViewFactory(Intent intent) {
return SimpleViewsFactory.this;
}
- }.onBind(new Intent("dummy_intent"));
+ }.onBind(new Intent("stub_intent"));
}
}
}
diff --git a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
index 0e43d81..822fefc 100644
--- a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
@@ -30,7 +30,6 @@
import androidx.test.runner.AndroidJUnit4;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
@@ -126,9 +125,6 @@
private void runTest(String activityMethod, boolean isWidget, ItemOperator itemMatcher,
Intent... commandIntents) throws Throwable {
- if (!Utilities.ATLEAST_OREO) {
- return;
- }
clearHomescreen();
mDevice.pressHome();
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index c621616..80adf05 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -64,6 +64,7 @@
import com.android.launcher3.ResourceUtils;
import com.android.launcher3.testing.TestProtocol;
+import com.android.systemui.shared.system.ContextUtils;
import com.android.systemui.shared.system.QuickStepContract;
import org.junit.Assert;
@@ -175,8 +176,7 @@
private Runnable mOnLauncherCrashed;
private static Pattern getTouchEventPattern(String prefix, String action) {
- // The pattern includes sanity checks that we don't get a multi-touch events or other
- // surprises.
+ // The pattern includes checks that we don't get a multi-touch events or other surprises.
return Pattern.compile(
prefix + ": MotionEvent.*?action=" + action + ".*?id\\[0\\]=0"
+ ".*?toolType\\[0\\]=TOOL_TYPE_FINGER.*?buttonState=0.*?pointerCount=1");
@@ -239,11 +239,12 @@
if (pm.getComponentEnabledSetting(cn) != COMPONENT_ENABLED_STATE_ENABLED) {
if (TestHelpers.isInLauncherProcess()) {
- getContext().getPackageManager().setComponentEnabledSetting(
- cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);
+ pm.setComponentEnabledSetting(cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);
} else {
try {
- mDevice.executeShellCommand("pm enable " + cn.flattenToString());
+ final int userId = ContextUtils.getUserId(getContext());
+ mDevice.executeShellCommand(
+ "pm enable --user " + userId + " " + cn.flattenToString());
} catch (IOException e) {
fail(e.toString());
}
@@ -1303,17 +1304,8 @@
if (getNavigationModel() == NavigationModel.TWO_BUTTON) {
return true;
}
- // Overview actions hide all apps
- if (overviewActionsEnabled()) {
- return false;
- }
- // ...otherwise there should be all apps
- return true;
- }
-
- private boolean overviewActionsEnabled() {
- return getTestInfo(TestProtocol.REQUEST_OVERVIEW_ACTIONS_ENABLED).getBoolean(
- TestProtocol.TEST_INFO_RESPONSE_FIELD);
+ // ...otherwise there are overview actions, which hide all apps
+ return false;
}
boolean overviewShareEnabled() {