From eb01a25c87070145984dd1659efc33a627cbdbf6 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Tue, 27 Oct 2020 11:37:11 +0800 Subject: [PATCH] Migrate Bubbles to wm-shell (5/n) Move bubbles package and related resources to shell package, also copied some used codes and resources. Bug: 161980186 Test: atest SystemUITests Test: atest WMShellUnitTests Change-Id: Ia108bd4149b3c3bf86631ba1a7a6bce0e76af78f --- .../inputmethod/SoftInputShowHideReason.java | 2 +- libs/WindowManager/Shell/Android.bp | 5 +- .../res/drawable/bubble_dismiss_circle.xml | 28 ++ .../res/drawable/bubble_dismiss_icon.xml | 28 +- .../res/drawable/bubble_ic_create_bubble.xml | 25 ++ .../bubble_ic_empty_overflow_dark.xml | 0 .../bubble_ic_empty_overflow_light.xml | 0 .../drawable/bubble_ic_overflow_button.xml | 0 .../res/drawable/bubble_ic_stop_bubble.xml | 25 ++ .../res/drawable/bubble_manage_menu_row.xml | 2 +- .../bubble_stack_user_education_bg.xml | 0 .../bubble_stack_user_education_bg_rtl.xml | 0 .../res/drawable/ic_remove_no_shadow.xml | 28 ++ .../Shell/res/drawable/rounded_bg_full.xml | 26 ++ .../res/layout/bubble_dismiss_target.xml | 0 .../res/layout/bubble_expanded_view.xml | 12 +- .../Shell}/res/layout/bubble_flyout.xml | 2 +- .../Shell}/res/layout/bubble_manage_menu.xml | 6 +- .../Shell}/res/layout/bubble_menu_view.xml | 18 +- .../res/layout/bubble_overflow_activity.xml | 0 .../res/layout/bubble_overflow_button.xml | 4 +- .../res/layout/bubble_overflow_view.xml | 2 +- .../layout/bubble_stack_user_education.xml | 0 .../Shell}/res/layout/bubble_view.xml | 2 +- .../bubbles_manage_button_education.xml | 8 +- .../Shell/res/values-land/dimens.xml | 4 + .../Shell/res/values-night/colors.xml | 20 ++ .../WindowManager/Shell/res/values/colors.xml | 10 + libs/WindowManager/Shell/res/values/dimen.xml | 90 ++++++ libs/WindowManager/Shell/res/values/ids.xml | 17 + .../Shell/res/values/integers.xml | 25 ++ .../Shell/res/values/strings.xml | 49 +++ .../src/com/android/wm/shell}/TaskView.java | 11 +- .../wm/shell/animation/Interpolators.java | 6 + .../wm/shell}/bubbles/BadgedImageView.java | 14 +- .../com/android/wm/shell}/bubbles/Bubble.java | 4 +- .../wm/shell}/bubbles/BubbleController.java | 16 +- .../android/wm/shell}/bubbles/BubbleData.java | 14 +- .../wm/shell}/bubbles/BubbleDataRepository.kt | 8 +- .../wm/shell}/bubbles/BubbleDebugConfig.java | 4 +- .../wm/shell}/bubbles/BubbleEntry.java | 2 +- .../wm/shell}/bubbles/BubbleExpandedView.java | 19 +- .../wm/shell}/bubbles/BubbleFlyoutView.java | 13 +- .../wm/shell}/bubbles/BubbleIconFactory.java | 7 +- .../wm/shell}/bubbles/BubbleLogger.java | 2 +- .../wm/shell}/bubbles/BubbleOverflow.kt | 6 +- .../bubbles/BubbleOverflowActivity.java | 15 +- .../wm/shell}/bubbles/BubblePositioner.java | 2 +- .../wm/shell}/bubbles/BubbleStackView.java | 25 +- .../wm/shell}/bubbles/BubbleViewInfoTask.java | 14 +- .../wm/shell}/bubbles/BubbleViewProvider.java | 2 +- .../android/wm/shell}/bubbles/Bubbles.java | 2 +- .../android/wm/shell}/bubbles/DismissView.kt | 22 +- .../wm/shell}/bubbles/ManageEducationView.kt | 6 +- .../wm/shell}/bubbles/ObjectWrapper.java | 2 +- .../shell}/bubbles/RelativeTouchListener.kt | 2 +- .../wm/shell}/bubbles/StackEducationView.kt | 6 +- .../animation/AnimatableScaleMatrix.java | 2 +- .../ExpandedAnimationController.java | 8 +- .../bubbles/animation/OneTimeEndListener.java | 2 +- .../animation/PhysicsAnimationLayout.java | 4 +- .../animation/StackAnimationController.java | 10 +- .../wm/shell}/bubbles/storage/BubbleEntity.kt | 2 +- .../storage/BubblePersistentRepository.kt | 2 +- .../storage/BubbleVolatileRepository.kt | 4 +- .../shell}/bubbles/storage/BubbleXmlHelper.kt | 8 +- .../wm/shell/common/AlphaOptimizedButton.java | 50 +++ .../wm/shell/common/TriangleShape.java | 77 +++++ .../Shell/tests/unittest/AndroidManifest.xml | 7 + .../Shell/tests/unittest/res/layout/main.xml | 32 ++ .../PipTestCase.java => ShellTestCase.java} | 17 +- .../com/android/wm/shell}/TaskViewTest.java | 8 +- .../wm/shell}/bubbles/BubbleDataTest.java | 10 +- .../shell}/bubbles/BubbleFlyoutViewTest.java | 10 +- .../android/wm/shell}/bubbles/BubbleTest.java | 12 +- .../wm/shell/bubbles/BubblesTestActivity.java | 40 +++ .../ExpandedAnimationControllerTest.java | 8 +- .../animation/PhysicsAnimationLayoutTest.java | 4 +- .../PhysicsAnimationLayoutTestCase.java | 10 +- .../StackAnimationControllerTest.java | 8 +- .../storage/BubblePersistentRepositoryTest.kt | 6 +- .../storage/BubbleVolatileRepositoryTest.kt | 6 +- .../bubbles/storage/BubbleXmlHelperTest.kt | 6 +- .../shell/pip/PipAnimationControllerTest.java | 6 +- .../wm/shell/pip/PipBoundsHandlerTest.java | 5 +- .../wm/shell/pip/PipBoundsStateTest.java | 4 +- .../wm/shell/pip/PipTaskOrganizerTest.java | 3 +- .../wm/shell/pip/phone/PipControllerTest.java | 4 +- .../shell/pip/phone/PipTouchHandlerTest.java | 8 +- .../wm/shell/pip/phone/PipTouchStateTest.java | 5 +- .../android/systemui/CarSystemUIBinder.java | 4 +- packages/SystemUI/AndroidManifest.xml | 2 +- .../res/drawable/bubble_dismiss_circle.xml | 28 -- .../res/drawable/ic_create_bubble.xml | 25 -- .../SystemUI/res/drawable/ic_stop_bubble.xml | 25 -- packages/SystemUI/res/values-land/dimens.xml | 4 - packages/SystemUI/res/values/colors.xml | 4 - packages/SystemUI/res/values/dimens.xml | 84 ----- packages/SystemUI/res/values/ids.xml | 17 - packages/SystemUI/res/values/integers.xml | 11 - packages/SystemUI/res/values/strings.xml | 49 --- .../com/android/systemui/SystemUIFactory.java | 2 + .../bubbles/BubbleExperimentConfig.java | 301 ------------------ .../systemui/bubbles/dagger/BubbleModule.java | 98 ------ .../android/systemui/dagger/GlobalModule.java | 18 -- .../systemui/dagger/SysUIComponent.java | 4 + .../systemui/dagger/SystemUIBinder.java | 4 +- .../systemui/dagger/SystemUIModule.java | 47 ++- .../android/systemui/dagger/WMComponent.java | 6 +- .../NotificationViewHierarchyManager.java | 2 +- .../dagger/StatusBarDependenciesModule.java | 2 +- .../notification/NotificationClicker.java | 2 +- .../coordinator/BubbleCoordinator.java | 4 +- .../NotificationGroupManagerLegacy.java | 2 +- .../init/NotificationsController.kt | 2 +- .../init/NotificationsControllerImpl.kt | 2 +- .../init/NotificationsControllerStub.kt | 2 +- .../row/NotificationContentView.java | 4 +- .../phone/NotificationIconAreaController.java | 2 +- .../statusbar/phone/ShadeControllerImpl.java | 8 +- .../systemui/statusbar/phone/StatusBar.java | 2 +- .../phone/dagger/StatusBarPhoneModule.java | 2 +- .../systemui/wmshell/BubblesManager.java | 8 +- .../systemui/wmshell/WMShellBaseModule.java | 37 ++- packages/SystemUI/tests/AndroidManifest.xml | 2 +- .../buttons/KeyButtonViewTest.java | 3 - .../NotificationViewHierarchyManagerTest.java | 2 +- .../notification/NotificationFilterTest.java | 2 +- .../row/NotificationConversationInfoTest.java | 2 +- .../row/NotificationTestHelper.java | 4 +- ...ificationGroupAlertTransferHelperTest.java | 2 +- .../NotificationGroupManagerLegacyTest.java | 2 +- .../NotificationIconAreaControllerTest.java | 2 +- .../statusbar/phone/StatusBarTest.java | 4 +- .../android/systemui/wmshell/BubblesTest.java | 16 +- .../BubblesTestActivity.java | 7 +- .../wmshell/NewNotifPipelineBubblesTest.java | 14 +- .../wmshell/TestableBubbleController.java | 10 +- 138 files changed, 959 insertions(+), 977 deletions(-) create mode 100644 libs/WindowManager/Shell/res/drawable/bubble_dismiss_circle.xml rename {packages/SystemUI => libs/WindowManager/Shell}/res/drawable/bubble_dismiss_icon.xml (53%) create mode 100644 libs/WindowManager/Shell/res/drawable/bubble_ic_create_bubble.xml rename packages/SystemUI/res/drawable/ic_empty_bubble_overflow_dark.xml => libs/WindowManager/Shell/res/drawable/bubble_ic_empty_overflow_dark.xml (100%) rename packages/SystemUI/res/drawable/ic_empty_bubble_overflow_light.xml => libs/WindowManager/Shell/res/drawable/bubble_ic_empty_overflow_light.xml (100%) rename packages/SystemUI/res/drawable/ic_bubble_overflow_button.xml => libs/WindowManager/Shell/res/drawable/bubble_ic_overflow_button.xml (100%) create mode 100644 libs/WindowManager/Shell/res/drawable/bubble_ic_stop_bubble.xml rename {packages/SystemUI => libs/WindowManager/Shell}/res/drawable/bubble_manage_menu_row.xml (94%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/drawable/bubble_stack_user_education_bg.xml (100%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/drawable/bubble_stack_user_education_bg_rtl.xml (100%) create mode 100644 libs/WindowManager/Shell/res/drawable/ic_remove_no_shadow.xml create mode 100644 libs/WindowManager/Shell/res/drawable/rounded_bg_full.xml rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_dismiss_target.xml (100%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_expanded_view.xml (80%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_flyout.xml (97%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_manage_menu.xml (95%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_menu_view.xml (65%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_overflow_activity.xml (100%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_overflow_button.xml (89%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_overflow_view.xml (97%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_stack_user_education.xml (100%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubble_view.xml (95%) rename {packages/SystemUI => libs/WindowManager/Shell}/res/layout/bubbles_manage_button_education.xml (92%) create mode 100644 libs/WindowManager/Shell/res/values-night/colors.xml create mode 100644 libs/WindowManager/Shell/res/values/integers.xml rename {packages/SystemUI/src/com/android/systemui/bubbles => libs/WindowManager/Shell/src/com/android/wm/shell}/TaskView.java (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BadgedImageView.java (98%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/Bubble.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleController.java (98%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleData.java (98%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleDataRepository.kt (96%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleDebugConfig.java (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleEntry.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleExpandedView.java (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleFlyoutView.java (98%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleIconFactory.java (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleLogger.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleOverflow.kt (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleOverflowActivity.java (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubblePositioner.java (98%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleStackView.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleViewInfoTask.java (95%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/BubbleViewProvider.java (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/Bubbles.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/DismissView.kt (81%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/ManageEducationView.kt (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/ObjectWrapper.java (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/RelativeTouchListener.kt (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/StackEducationView.kt (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/animation/AnimatableScaleMatrix.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/animation/ExpandedAnimationController.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/animation/OneTimeEndListener.java (96%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/animation/PhysicsAnimationLayout.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/animation/StackAnimationController.java (99%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/storage/BubbleEntity.kt (95%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/storage/BubblePersistentRepository.kt (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/storage/BubbleVolatileRepository.kt (97%) rename {packages/SystemUI/src/com/android/systemui => libs/WindowManager/Shell/src/com/android/wm/shell}/bubbles/storage/BubbleXmlHelper.kt (98%) create mode 100644 libs/WindowManager/Shell/src/com/android/wm/shell/common/AlphaOptimizedButton.java create mode 100644 libs/WindowManager/Shell/src/com/android/wm/shell/common/TriangleShape.java create mode 100644 libs/WindowManager/Shell/tests/unittest/res/layout/main.xml rename libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/{pip/PipTestCase.java => ShellTestCase.java} (79%) rename {packages/SystemUI/tests/src/com/android/systemui/bubbles => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/TaskViewTest.java (95%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/BubbleDataTest.java (99%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/BubbleFlyoutViewTest.java (93%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/BubbleTest.java (95%) create mode 100644 libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubblesTestActivity.java rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/animation/ExpandedAnimationControllerTest.java (96%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/animation/PhysicsAnimationLayoutTest.java (99%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/animation/PhysicsAnimationLayoutTestCase.java (97%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/animation/StackAnimationControllerTest.java (98%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/storage/BubblePersistentRepositoryTest.kt (92%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/storage/BubbleVolatileRepositoryTest.kt (97%) rename {packages/SystemUI/tests/src/com/android/systemui => libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell}/bubbles/storage/BubbleXmlHelperTest.kt (95%) delete mode 100644 packages/SystemUI/res/drawable/bubble_dismiss_circle.xml delete mode 100644 packages/SystemUI/res/drawable/ic_create_bubble.xml delete mode 100644 packages/SystemUI/res/drawable/ic_stop_bubble.xml delete mode 100644 packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java delete mode 100644 packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java rename packages/SystemUI/tests/src/com/android/systemui/{bubbles => wmshell}/BubblesTestActivity.java (82%) diff --git a/core/java/com/android/internal/inputmethod/SoftInputShowHideReason.java b/core/java/com/android/internal/inputmethod/SoftInputShowHideReason.java index f46626be48a81..ffc7f05eb7038 100644 --- a/core/java/com/android/internal/inputmethod/SoftInputShowHideReason.java +++ b/core/java/com/android/internal/inputmethod/SoftInputShowHideReason.java @@ -144,7 +144,7 @@ public @interface SoftInputShowHideReason { int HIDE_RECENTS_ANIMATION = 18; /** - * Hide soft input when {@link com.android.systemui.bubbles.BubbleController} is expanding, + * Hide soft input when {@link com.android.wm.shell.bubbles.BubbleController} is expanding, * switching, or collapsing Bubbles. */ int HIDE_BUBBLES = 19; diff --git a/libs/WindowManager/Shell/Android.bp b/libs/WindowManager/Shell/Android.bp index 0defbd6451fef..39e32c694d2ed 100644 --- a/libs/WindowManager/Shell/Android.bp +++ b/libs/WindowManager/Shell/Android.bp @@ -116,12 +116,15 @@ android_library { "res", ], static_libs: [ + "androidx.appcompat_appcompat", + "androidx.arch.core_core-runtime", "androidx.dynamicanimation_dynamicanimation", "kotlinx-coroutines-android", "kotlinx-coroutines-core", + "iconloader_base", "protolog-lib", + "SettingsLib", "WindowManager-Shell-proto", - "androidx.appcompat_appcompat", ], kotlincflags: ["-Xjvm-default=enable"], manifest: "AndroidManifest.xml", diff --git a/libs/WindowManager/Shell/res/drawable/bubble_dismiss_circle.xml b/libs/WindowManager/Shell/res/drawable/bubble_dismiss_circle.xml new file mode 100644 index 0000000000000..2104be48d1d99 --- /dev/null +++ b/libs/WindowManager/Shell/res/drawable/bubble_dismiss_circle.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bubble_dismiss_icon.xml b/libs/WindowManager/Shell/res/drawable/bubble_dismiss_icon.xml similarity index 53% rename from packages/SystemUI/res/drawable/bubble_dismiss_icon.xml rename to libs/WindowManager/Shell/res/drawable/bubble_dismiss_icon.xml index 5c8de581f8d1d..ff8feded11abd 100644 --- a/packages/SystemUI/res/drawable/bubble_dismiss_icon.xml +++ b/libs/WindowManager/Shell/res/drawable/bubble_dismiss_icon.xml @@ -1,18 +1,18 @@ + ~ 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. + --> + + + + diff --git a/packages/SystemUI/res/drawable/ic_empty_bubble_overflow_dark.xml b/libs/WindowManager/Shell/res/drawable/bubble_ic_empty_overflow_dark.xml similarity index 100% rename from packages/SystemUI/res/drawable/ic_empty_bubble_overflow_dark.xml rename to libs/WindowManager/Shell/res/drawable/bubble_ic_empty_overflow_dark.xml diff --git a/packages/SystemUI/res/drawable/ic_empty_bubble_overflow_light.xml b/libs/WindowManager/Shell/res/drawable/bubble_ic_empty_overflow_light.xml similarity index 100% rename from packages/SystemUI/res/drawable/ic_empty_bubble_overflow_light.xml rename to libs/WindowManager/Shell/res/drawable/bubble_ic_empty_overflow_light.xml diff --git a/packages/SystemUI/res/drawable/ic_bubble_overflow_button.xml b/libs/WindowManager/Shell/res/drawable/bubble_ic_overflow_button.xml similarity index 100% rename from packages/SystemUI/res/drawable/ic_bubble_overflow_button.xml rename to libs/WindowManager/Shell/res/drawable/bubble_ic_overflow_button.xml diff --git a/libs/WindowManager/Shell/res/drawable/bubble_ic_stop_bubble.xml b/libs/WindowManager/Shell/res/drawable/bubble_ic_stop_bubble.xml new file mode 100644 index 0000000000000..8609576ce789a --- /dev/null +++ b/libs/WindowManager/Shell/res/drawable/bubble_ic_stop_bubble.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/packages/SystemUI/res/drawable/bubble_manage_menu_row.xml b/libs/WindowManager/Shell/res/drawable/bubble_manage_menu_row.xml similarity index 94% rename from packages/SystemUI/res/drawable/bubble_manage_menu_row.xml rename to libs/WindowManager/Shell/res/drawable/bubble_manage_menu_row.xml index a793680a037d1..c61ac1c5f2d52 100644 --- a/packages/SystemUI/res/drawable/bubble_manage_menu_row.xml +++ b/libs/WindowManager/Shell/res/drawable/bubble_manage_menu_row.xml @@ -12,7 +12,7 @@ ~ 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 + ~ limitations under the License. --> diff --git a/packages/SystemUI/res/drawable/bubble_stack_user_education_bg.xml b/libs/WindowManager/Shell/res/drawable/bubble_stack_user_education_bg.xml similarity index 100% rename from packages/SystemUI/res/drawable/bubble_stack_user_education_bg.xml rename to libs/WindowManager/Shell/res/drawable/bubble_stack_user_education_bg.xml diff --git a/packages/SystemUI/res/drawable/bubble_stack_user_education_bg_rtl.xml b/libs/WindowManager/Shell/res/drawable/bubble_stack_user_education_bg_rtl.xml similarity index 100% rename from packages/SystemUI/res/drawable/bubble_stack_user_education_bg_rtl.xml rename to libs/WindowManager/Shell/res/drawable/bubble_stack_user_education_bg_rtl.xml diff --git a/libs/WindowManager/Shell/res/drawable/ic_remove_no_shadow.xml b/libs/WindowManager/Shell/res/drawable/ic_remove_no_shadow.xml new file mode 100644 index 0000000000000..265c5019c79a1 --- /dev/null +++ b/libs/WindowManager/Shell/res/drawable/ic_remove_no_shadow.xml @@ -0,0 +1,28 @@ + + + + + \ No newline at end of file diff --git a/libs/WindowManager/Shell/res/drawable/rounded_bg_full.xml b/libs/WindowManager/Shell/res/drawable/rounded_bg_full.xml new file mode 100644 index 0000000000000..e957445739602 --- /dev/null +++ b/libs/WindowManager/Shell/res/drawable/rounded_bg_full.xml @@ -0,0 +1,26 @@ + + + + + + diff --git a/packages/SystemUI/res/layout/bubble_dismiss_target.xml b/libs/WindowManager/Shell/res/layout/bubble_dismiss_target.xml similarity index 100% rename from packages/SystemUI/res/layout/bubble_dismiss_target.xml rename to libs/WindowManager/Shell/res/layout/bubble_dismiss_target.xml diff --git a/packages/SystemUI/res/layout/bubble_expanded_view.xml b/libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml similarity index 80% rename from packages/SystemUI/res/layout/bubble_expanded_view.xml rename to libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml index db40c4fde0536..54b08c6f220e7 100644 --- a/packages/SystemUI/res/layout/bubble_expanded_view.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml @@ -1,6 +1,6 @@ - - - + diff --git a/packages/SystemUI/res/layout/bubble_flyout.xml b/libs/WindowManager/Shell/res/layout/bubble_flyout.xml similarity index 97% rename from packages/SystemUI/res/layout/bubble_flyout.xml rename to libs/WindowManager/Shell/res/layout/bubble_flyout.xml index 22a81357ee15c..7fdf290efd092 100644 --- a/packages/SystemUI/res/layout/bubble_flyout.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_flyout.xml @@ -34,7 +34,7 @@ android:layout_height="30dp" android:layout_marginEnd="@dimen/bubble_flyout_avatar_message_space" android:scaleType="centerInside" - android:src="@drawable/ic_create_bubble"/> + android:src="@drawable/bubble_ic_create_bubble"/> + android:tint="@color/bubbles_icon_tint"/> + android:src="@drawable/bubble_ic_stop_bubble" + android:tint="@color/bubbles_icon_tint"/> - - + diff --git a/packages/SystemUI/res/layout/bubble_overflow_activity.xml b/libs/WindowManager/Shell/res/layout/bubble_overflow_activity.xml similarity index 100% rename from packages/SystemUI/res/layout/bubble_overflow_activity.xml rename to libs/WindowManager/Shell/res/layout/bubble_overflow_activity.xml diff --git a/packages/SystemUI/res/layout/bubble_overflow_button.xml b/libs/WindowManager/Shell/res/layout/bubble_overflow_button.xml similarity index 89% rename from packages/SystemUI/res/layout/bubble_overflow_button.xml rename to libs/WindowManager/Shell/res/layout/bubble_overflow_button.xml index 8f0fd4f374616..61000fe19d2cc 100644 --- a/packages/SystemUI/res/layout/bubble_overflow_button.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_overflow_button.xml @@ -14,9 +14,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - + android:src="@drawable/bubble_ic_overflow_button"/> diff --git a/packages/SystemUI/res/layout/bubble_overflow_view.xml b/libs/WindowManager/Shell/res/layout/bubble_overflow_view.xml similarity index 97% rename from packages/SystemUI/res/layout/bubble_overflow_view.xml rename to libs/WindowManager/Shell/res/layout/bubble_overflow_view.xml index 1218fba235023..c1f67bd27d936 100644 --- a/packages/SystemUI/res/layout/bubble_overflow_view.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_overflow_view.xml @@ -21,7 +21,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - - - diff --git a/libs/WindowManager/Shell/res/values-land/dimens.xml b/libs/WindowManager/Shell/res/values-land/dimens.xml index 77a601ddf4401..aafba58cef59a 100644 --- a/libs/WindowManager/Shell/res/values-land/dimens.xml +++ b/libs/WindowManager/Shell/res/values-land/dimens.xml @@ -18,4 +18,8 @@ 2dp 16dp + + + 4dp \ No newline at end of file diff --git a/libs/WindowManager/Shell/res/values-night/colors.xml b/libs/WindowManager/Shell/res/values-night/colors.xml new file mode 100644 index 0000000000000..24b364043938f --- /dev/null +++ b/libs/WindowManager/Shell/res/values-night/colors.xml @@ -0,0 +1,20 @@ + + + + + @color/GM2_grey_200 + \ No newline at end of file diff --git a/libs/WindowManager/Shell/res/values/colors.xml b/libs/WindowManager/Shell/res/values/colors.xml index cc3bf2a094543..1674d0bf78beb 100644 --- a/libs/WindowManager/Shell/res/values/colors.xml +++ b/libs/WindowManager/Shell/res/values/colors.xml @@ -25,4 +25,14 @@ #330000FF + + + #FFFFFF + @color/GM2_grey_800 + @color/GM2_grey_700 + + + #E8EAED + #5F6368 + #3C4043 \ No newline at end of file diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index b87a642a8dc78..8a60aafcd13d1 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -75,4 +75,94 @@ 16dp + + + 20dp + 20dp + 12dp + 4dp + 22dp + + + 1dp + + 4dp + + 12dp + + 10dp + + 6dp + + 8dp + + 6dp + + 16dp + + 60dp + + 52dp + + 24dp + + 12dp + + 52dp + + 4dp + + 8dp + + 180dp + + 480dp + + 16dp + + 15dp + + 7dp + + 200dp + + 50dp + + 8dp + + 12dp + + 16dp + + 48dp + + 144dp + + 32dp + + 4dp + + 10dp + + 15dp + + 9dp + + 120dp + + 8dp + + 40dp + 20dp + 4dp + + + 160dp + + 65dp + + 72dp diff --git a/libs/WindowManager/Shell/res/values/ids.xml b/libs/WindowManager/Shell/res/values/ids.xml index fb892388cf740..434a000010c43 100644 --- a/libs/WindowManager/Shell/res/values/ids.xml +++ b/libs/WindowManager/Shell/res/values/ids.xml @@ -23,4 +23,21 @@ + + + + + + + + + + + + + + + + + diff --git a/libs/WindowManager/Shell/res/values/integers.xml b/libs/WindowManager/Shell/res/values/integers.xml new file mode 100644 index 0000000000000..583bf3341a690 --- /dev/null +++ b/libs/WindowManager/Shell/res/values/integers.xml @@ -0,0 +1,25 @@ + + + + 5 + + 4 + + 16 + \ No newline at end of file diff --git a/libs/WindowManager/Shell/res/values/strings.xml b/libs/WindowManager/Shell/res/values/strings.xml index da5965dab71ab..30ef72c2a3521 100644 --- a/libs/WindowManager/Shell/res/values/strings.xml +++ b/libs/WindowManager/Shell/res/values/strings.xml @@ -97,4 +97,53 @@ Start one-handed mode Exit one-handed mode + + + Settings for %1$s bubbles + + Overflow + + Add back to stack + + %1$s from %2$s + + %1$s from %2$s and %3$d more + + Move top left + + Move top right + + Move bottom left + + Move bottom right + + %1$s settings + + Dismiss bubble + + Don\u2019t bubble conversation + + Chat using bubbles + + New conversations appear as floating icons, or bubbles. Tap to open bubble. Drag to move it. + + Control bubbles anytime + + Tap Manage to turn off bubbles from this app + + Got it + + No recent bubbles + + Recent bubbles and dismissed bubbles will appear here + + + Bubble + + + Manage + + + Bubble dismissed. diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/TaskView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/TaskView.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java index 0a2cfbfffd9e5..59a765d49a144 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/TaskView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; @@ -30,26 +30,23 @@ import android.content.pm.LauncherApps; import android.content.pm.ShortcutInfo; import android.graphics.Rect; import android.os.Binder; +import android.util.CloseGuard; import android.view.SurfaceControl; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; -import com.android.wm.shell.ShellTaskOrganizer; - -import dalvik.system.CloseGuard; - import java.io.PrintWriter; import java.util.concurrent.Executor; /** * View that can display a task. */ -// TODO: Place in com.android.wm.shell vs. com.android.wm.shell.bubbles on shell migration. public class TaskView extends SurfaceView implements SurfaceHolder.Callback, ShellTaskOrganizer.TaskListener { + /** Callback for listening task state. */ public interface Listener { /** Called when the container is ready for launching activities. */ default void onInitialized() {} @@ -70,7 +67,7 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, default void onBackPressedOnTaskRoot(int taskId) {} } - private final CloseGuard mGuard = CloseGuard.get(); + private final CloseGuard mGuard = new CloseGuard(); private final ShellTaskOrganizer mTaskOrganizer; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/animation/Interpolators.java b/libs/WindowManager/Shell/src/com/android/wm/shell/animation/Interpolators.java index a3b720c457c60..8aca01d2467b0 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/animation/Interpolators.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/animation/Interpolators.java @@ -56,4 +56,10 @@ public class Interpolators { * Interpolator to be used when animating a move based on a click. Pair with enough duration. */ public static final Interpolator TOUCH_RESPONSE = new PathInterpolator(0.3f, 0f, 0.1f, 1f); + + /** + * Interpolator to be used when animating a panel closing. + */ + public static final Interpolator PANEL_CLOSE_ACCELERATED = + new PathInterpolator(0.3f, 0, 0.5f, 1); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java similarity index 98% rename from packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java index 8bcffc8ece1aa..4d06c039551b0 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -13,7 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; + +import static android.graphics.Paint.DITHER_FLAG; +import static android.graphics.Paint.FILTER_BITMAP_FLAG; import android.annotation.Nullable; import android.content.Context; @@ -28,14 +31,11 @@ import android.util.PathParser; import android.widget.ImageView; import com.android.launcher3.icons.DotRenderer; -import com.android.systemui.Interpolators; -import com.android.systemui.R; +import com.android.wm.shell.R; +import com.android.wm.shell.animation.Interpolators; import java.util.EnumSet; -import static android.graphics.Paint.DITHER_FLAG; -import static android.graphics.Paint.FILTER_BITMAP_FLAG; - /** * View that displays an adaptive icon with an app-badge and a dot. * diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java index 09d9e03cb0cb2..93ed3959776b3 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.os.AsyncTask.Status.FINISHED; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java similarity index 98% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java index 598a604099acc..05acb552a8d91 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.service.notification.NotificationListenerService.REASON_CANCEL; @@ -22,8 +22,8 @@ import static android.view.View.INVISIBLE; import static android.view.View.VISIBLE; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.NonNull; import android.annotation.UserIdInt; @@ -59,8 +59,6 @@ import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.UiEventLogger; import com.android.internal.statusbar.IStatusBarService; -import com.android.systemui.bubbles.dagger.BubbleModule; -import com.android.systemui.dagger.qualifiers.Main; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.WindowManagerShellWrapper; import com.android.wm.shell.common.FloatingContentCoordinator; @@ -165,7 +163,7 @@ public class BubbleController implements Bubbles { private boolean mIsStatusBarShade = true; /** - * Injected constructor. See {@link BubbleModule}. + * Injected constructor. */ public static BubbleController create(Context context, @Nullable BubbleStackView.SurfaceSynchronizer synchronizer, @@ -175,7 +173,7 @@ public class BubbleController implements Bubbles { WindowManagerShellWrapper windowManagerShellWrapper, LauncherApps launcherApps, UiEventLogger uiEventLogger, - @Main Handler mainHandler, + Handler mainHandler, ShellTaskOrganizer organizer) { BubbleLogger logger = new BubbleLogger(uiEventLogger); return new BubbleController(context, @@ -903,7 +901,7 @@ public class BubbleController implements Bubbles { } if (!mBubbleData.hasBubbleInStackWithKey(bubble.getKey())) { if (!mBubbleData.hasOverflowBubbleWithKey(bubble.getKey()) - && (!bubble.showInShade() + && (!bubble.showInShade() || reason == DISMISS_NOTIF_CANCEL || reason == DISMISS_GROUP_CANCELLED)) { // The bubble is now gone & the notification is hidden from the shade, so diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java similarity index 98% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java index 8cacc8f2ef019..b6a97e251009c 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.internal.annotations.VisibleForTesting.Visibility.PRIVATE; -import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_DATA; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_DATA; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.NonNull; import android.app.PendingIntent; @@ -33,8 +33,8 @@ import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.FrameworkStatsLog; -import com.android.systemui.R; -import com.android.systemui.bubbles.Bubbles.DismissReason; +import com.android.wm.shell.R; +import com.android.wm.shell.bubbles.Bubbles.DismissReason; import java.io.FileDescriptor; import java.io.PrintWriter; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDataRepository.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDataRepository.kt similarity index 96% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleDataRepository.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDataRepository.kt index 2ab9e8734bef7..fc565f17546df 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDataRepository.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDataRepository.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles +package com.android.wm.shell.bubbles import android.annotation.SuppressLint import android.annotation.UserIdInt @@ -24,9 +24,9 @@ import android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC import android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER import android.os.UserHandle import android.util.Log -import com.android.systemui.bubbles.storage.BubbleEntity -import com.android.systemui.bubbles.storage.BubblePersistentRepository -import com.android.systemui.bubbles.storage.BubbleVolatileRepository +import com.android.wm.shell.bubbles.storage.BubbleEntity +import com.android.wm.shell.bubbles.storage.BubblePersistentRepository +import com.android.wm.shell.bubbles.storage.BubbleVolatileRepository import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDebugConfig.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDebugConfig.java similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleDebugConfig.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDebugConfig.java index 3937422750cc0..53f4e87b04959 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDebugConfig.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDebugConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import android.content.Context; import android.provider.Settings; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleEntry.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleEntry.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleEntry.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleEntry.java index a0d3391f8347b..ff68861eb40c4 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleEntry.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleEntry.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static android.app.Notification.FLAG_BUBBLE; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java index ae3c683cb165b..74521c761d109 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,17 +14,17 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; -import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_EXPANDED_VIEW; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; -import static com.android.systemui.bubbles.BubbleOverflowActivity.EXTRA_BUBBLE_CONTROLLER; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_EXPANDED_VIEW; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; +import static com.android.wm.shell.bubbles.BubbleOverflowActivity.EXTRA_BUBBLE_CONTROLLER; import android.annotation.NonNull; import android.annotation.SuppressLint; @@ -54,10 +54,11 @@ import android.widget.LinearLayout; import androidx.annotation.Nullable; import com.android.internal.policy.ScreenDecorationsUtils; -import com.android.systemui.R; -import com.android.systemui.recents.TriangleShape; -import com.android.systemui.statusbar.AlphaOptimizedButton; +import com.android.wm.shell.R; +import com.android.wm.shell.TaskView; +import com.android.wm.shell.common.AlphaOptimizedButton; import com.android.wm.shell.common.HandlerExecutor; +import com.android.wm.shell.common.TriangleShape; import java.io.FileDescriptor; import java.io.PrintWriter; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java similarity index 98% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java index d8b32500db85d..460e0e798bdb1 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,12 +14,13 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static android.graphics.Paint.ANTI_ALIAS_FLAG; import static android.graphics.Paint.FILTER_BITMAP_FLAG; -import static com.android.systemui.Interpolators.ALPHA_IN; -import static com.android.systemui.Interpolators.ALPHA_OUT; + +import static com.android.wm.shell.animation.Interpolators.ALPHA_IN; +import static com.android.wm.shell.animation.Interpolators.ALPHA_OUT; import android.animation.ArgbEvaluator; import android.content.Context; @@ -47,8 +48,8 @@ import android.widget.TextView; import androidx.annotation.Nullable; -import com.android.systemui.R; -import com.android.systemui.recents.TriangleShape; +import com.android.wm.shell.R; +import com.android.wm.shell.common.TriangleShape; /** * Flyout view that appears as a 'chat bubble' alongside the bubble stack. The flyout can visually diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleIconFactory.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleIconFactory.java similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleIconFactory.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleIconFactory.java index 371e8490d235d..2d9da215efb73 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleIconFactory.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleIconFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import android.annotation.NonNull; import android.annotation.Nullable; @@ -26,14 +26,13 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.graphics.drawable.AdaptiveIconDrawable; -import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import com.android.launcher3.icons.BaseIconFactory; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.ShadowGenerator; -import com.android.systemui.R; +import com.android.wm.shell.R; /** * Factory for creating normalized bubble icons. diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleLogger.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleLogger.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java index a24f5c2b54c5b..3361c4ce11dad 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleLogger.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.UiEvent; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt index 297144a861439..686d2d4e1d9f6 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles +package com.android.wm.shell.bubbles import android.app.ActivityTaskManager.INVALID_TASK_ID import android.content.Context @@ -31,7 +31,7 @@ import android.util.TypedValue import android.view.LayoutInflater import android.view.View import android.widget.FrameLayout -import com.android.systemui.R +import com.android.wm.shell.R class BubbleOverflow( private val context: Context, @@ -72,7 +72,7 @@ class BubbleOverflow( updateResources() expandedView.applyThemeAttrs() // Apply inset and new style to fresh icon drawable. - overflowBtn.setImageResource(R.drawable.ic_bubble_overflow_button) + overflowBtn.setImageResource(R.drawable.bubble_ic_overflow_button) updateBtnTheme() } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowActivity.java similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowActivity.java index bc841730833c1..2759b590bfadb 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowActivity.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; -import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_OVERFLOW; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_OVERFLOW; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.app.Activity; import android.content.Context; @@ -43,13 +43,12 @@ import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.android.internal.util.ContrastColorUtil; -import com.android.systemui.R; +import com.android.wm.shell.R; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; - /** * Activity for showing aged out bubbles. * Must be public to be accessible to androidx...AppComponentFactory @@ -168,8 +167,8 @@ public class BubbleOverflowActivity extends Activity { final boolean isNightMode = (mode == Configuration.UI_MODE_NIGHT_YES); mEmptyStateImage.setImageDrawable(isNightMode - ? res.getDrawable(R.drawable.ic_empty_bubble_overflow_dark) - : res.getDrawable(R.drawable.ic_empty_bubble_overflow_light)); + ? res.getDrawable(R.drawable.bubble_ic_empty_overflow_dark) + : res.getDrawable(R.drawable.bubble_ic_empty_overflow_light)); findViewById(android.R.id.content) .setBackgroundColor(isNightMode diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubblePositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java similarity index 98% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubblePositioner.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java index 029caee6364ff..eccd00980209c 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubblePositioner.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import android.content.Context; import android.content.res.Configuration; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index 69ed5b72c1b25..155f3427f3d4d 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Android Open Source Project + * 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. @@ -14,14 +14,14 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; -import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_VIEW; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_VIEW; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -71,13 +71,13 @@ import androidx.dynamicanimation.animation.SpringForce; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.FrameworkStatsLog; -import com.android.systemui.Interpolators; -import com.android.systemui.R; -import com.android.systemui.bubbles.animation.AnimatableScaleMatrix; -import com.android.systemui.bubbles.animation.ExpandedAnimationController; -import com.android.systemui.bubbles.animation.PhysicsAnimationLayout; -import com.android.systemui.bubbles.animation.StackAnimationController; +import com.android.wm.shell.R; +import com.android.wm.shell.animation.Interpolators; import com.android.wm.shell.animation.PhysicsAnimator; +import com.android.wm.shell.bubbles.animation.AnimatableScaleMatrix; +import com.android.wm.shell.bubbles.animation.ExpandedAnimationController; +import com.android.wm.shell.bubbles.animation.PhysicsAnimationLayout; +import com.android.wm.shell.bubbles.animation.StackAnimationController; import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.common.magnetictarget.MagnetizedObject; @@ -2661,14 +2661,17 @@ public class BubbleStackView extends FrameLayout .floatValue(); } + /** Set the start position of the bubble stack. */ public void setStackStartPosition(RelativeStackPosition position) { mStackAnimationController.setStackStartPosition(position); } + /** @return the position of the bubble stack. */ public PointF getStackPosition() { return mStackAnimationController.getStackPosition(); } + /** @return the relative position of the bubble stack. */ public RelativeStackPosition getRelativeStackPosition() { return mStackAnimationController.getRelativeStackPosition(); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java similarity index 95% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java index a3e6a1ecc387a..0b683067c45bf 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; -import static com.android.systemui.bubbles.BadgedImageView.DEFAULT_PATH_SIZE; -import static com.android.systemui.bubbles.BadgedImageView.WHITE_SCRIM_ALPHA; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; +import static com.android.wm.shell.bubbles.BadgedImageView.DEFAULT_PATH_SIZE; +import static com.android.wm.shell.bubbles.BadgedImageView.WHITE_SCRIM_ALPHA; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.NonNull; import android.content.Context; @@ -42,7 +42,7 @@ import androidx.annotation.Nullable; import com.android.internal.graphics.ColorUtils; import com.android.launcher3.icons.BitmapInfo; -import com.android.systemui.R; +import com.android.wm.shell.R; import java.lang.ref.WeakReference; import java.util.Objects; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewProvider.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewProvider.java similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewProvider.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewProvider.java index 589017242311d..ec900be13658d 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewProvider.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import android.graphics.Bitmap; import android.graphics.Path; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubbles.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubbles.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/Bubbles.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubbles.java index 415edb1b647ca..79c42d83d7ead 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubbles.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubbles.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.LOCAL_VARIABLE; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/DismissView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/DismissView.kt similarity index 81% rename from packages/SystemUI/src/com/android/systemui/bubbles/DismissView.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/DismissView.kt index b3c552d24dcdd..04b5ad6dddf90 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/DismissView.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/DismissView.kt @@ -1,4 +1,20 @@ -package com.android.systemui.bubbles +/* + * 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.wm.shell.bubbles import android.content.Context import android.graphics.drawable.TransitionDrawable @@ -9,9 +25,9 @@ import android.widget.FrameLayout import androidx.dynamicanimation.animation.DynamicAnimation import androidx.dynamicanimation.animation.SpringForce.DAMPING_RATIO_LOW_BOUNCY import androidx.dynamicanimation.animation.SpringForce.STIFFNESS_LOW -import com.android.systemui.R -import com.android.wm.shell.common.DismissCircleView +import com.android.wm.shell.R import com.android.wm.shell.animation.PhysicsAnimator +import com.android.wm.shell.common.DismissCircleView /* * View that handles interactions between DismissCircleView and BubbleStackView. diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/ManageEducationView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/ManageEducationView.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt index 3db07c227d024..4cc67025fff4d 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/ManageEducationView.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles +package com.android.wm.shell.bubbles import android.content.Context import android.graphics.Color @@ -24,8 +24,8 @@ import android.widget.Button import android.widget.LinearLayout import android.widget.TextView import com.android.internal.util.ContrastColorUtil -import com.android.systemui.Interpolators -import com.android.systemui.R +import com.android.wm.shell.R +import com.android.wm.shell.animation.Interpolators /** * User education view to highlight the manage button that allows a user to configure the settings diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/ObjectWrapper.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ObjectWrapper.java similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/ObjectWrapper.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ObjectWrapper.java index f054122eaa470..528907f5e4839 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/ObjectWrapper.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ObjectWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import android.os.Binder; import android.os.IBinder; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/RelativeTouchListener.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/RelativeTouchListener.kt similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/RelativeTouchListener.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/RelativeTouchListener.kt index b1291a507b574..b34732901648f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/RelativeTouchListener.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/RelativeTouchListener.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles +package com.android.wm.shell.bubbles import android.graphics.PointF import android.os.Handler diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/StackEducationView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/StackEducationView.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt index 216df2e1f402a..04c4dfb9b08d3 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/StackEducationView.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles +package com.android.wm.shell.bubbles import android.content.Context import android.graphics.Color @@ -23,8 +23,8 @@ import android.view.View import android.widget.LinearLayout import android.widget.TextView import com.android.internal.util.ContrastColorUtil -import com.android.systemui.Interpolators -import com.android.systemui.R +import com.android.wm.shell.R +import com.android.wm.shell.animation.Interpolators /** * User education view to highlight the collapsed stack of bubbles. diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/AnimatableScaleMatrix.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/AnimatableScaleMatrix.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/animation/AnimatableScaleMatrix.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/AnimatableScaleMatrix.java index 07acb710c6d7c..2612b81aae00f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/AnimatableScaleMatrix.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/AnimatableScaleMatrix.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import android.graphics.Matrix; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java index 5a70401abb4ad..61fbf813ebfdb 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import android.content.res.Configuration; import android.content.res.Resources; @@ -28,10 +28,10 @@ import androidx.annotation.Nullable; import androidx.dynamicanimation.animation.DynamicAnimation; import androidx.dynamicanimation.animation.SpringForce; -import com.android.systemui.Interpolators; -import com.android.systemui.R; -import com.android.systemui.bubbles.BubblePositioner; +import com.android.wm.shell.R; +import com.android.wm.shell.animation.Interpolators; import com.android.wm.shell.animation.PhysicsAnimator; +import com.android.wm.shell.bubbles.BubblePositioner; import com.android.wm.shell.common.magnetictarget.MagnetizedObject; import com.google.android.collect.Sets; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/OneTimeEndListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/OneTimeEndListener.java similarity index 96% rename from packages/SystemUI/src/com/android/systemui/bubbles/animation/OneTimeEndListener.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/OneTimeEndListener.java index 4e0abc8009b43..37355c41810c1 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/OneTimeEndListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/OneTimeEndListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import androidx.dynamicanimation.animation.DynamicAnimation; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayout.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayout.java index 0a596d5c69b69..0618d5d5f2137 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayout.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -35,7 +35,7 @@ import androidx.dynamicanimation.animation.DynamicAnimation; import androidx.dynamicanimation.animation.SpringAnimation; import androidx.dynamicanimation.animation.SpringForce; -import com.android.systemui.R; +import com.android.wm.shell.R; import java.util.ArrayList; import java.util.HashMap; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/StackAnimationController.java similarity index 99% rename from packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/StackAnimationController.java index 43893f215d8a9..d7f2e4b20e64c 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/StackAnimationController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import android.content.ContentResolver; import android.content.res.Resources; @@ -34,11 +34,11 @@ import androidx.dynamicanimation.animation.FloatPropertyCompat; import androidx.dynamicanimation.animation.SpringAnimation; import androidx.dynamicanimation.animation.SpringForce; -import com.android.systemui.R; -import com.android.systemui.bubbles.BadgedImageView; -import com.android.systemui.bubbles.BubblePositioner; -import com.android.systemui.bubbles.BubbleStackView; +import com.android.wm.shell.R; import com.android.wm.shell.animation.PhysicsAnimator; +import com.android.wm.shell.bubbles.BadgedImageView; +import com.android.wm.shell.bubbles.BubblePositioner; +import com.android.wm.shell.bubbles.BubbleStackView; import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.common.magnetictarget.MagnetizedObject; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleEntity.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleEntity.kt similarity index 95% rename from packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleEntity.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleEntity.kt index 24768cd84a76d..aeba302bf4876 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleEntity.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleEntity.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles.storage +package com.android.wm.shell.bubbles.storage import android.annotation.DimenRes import android.annotation.UserIdInt diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubblePersistentRepository.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubblePersistentRepository.kt similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/storage/BubblePersistentRepository.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubblePersistentRepository.kt index ce0786d86460d..66a75af7d64c9 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubblePersistentRepository.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubblePersistentRepository.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles.storage +package com.android.wm.shell.bubbles.storage import android.content.Context import android.util.AtomicFile diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleVolatileRepository.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleVolatileRepository.kt similarity index 97% rename from packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleVolatileRepository.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleVolatileRepository.kt index e0a7c7879f43d..7f0b165bdc25e 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleVolatileRepository.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleVolatileRepository.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles.storage +package com.android.wm.shell.bubbles.storage import android.content.pm.LauncherApps import android.os.UserHandle import com.android.internal.annotations.VisibleForTesting -import com.android.systemui.bubbles.ShortcutKey +import com.android.wm.shell.bubbles.ShortcutKey private const val CAPACITY = 16 diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleXmlHelper.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelper.kt similarity index 98% rename from packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleXmlHelper.kt rename to libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelper.kt index bf163a230affc..fe72bd301e04d 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/storage/BubbleXmlHelper.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelper.kt @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.bubbles.storage +package com.android.wm.shell.bubbles.storage -import com.android.internal.util.FastXmlSerializer -import org.xmlpull.v1.XmlSerializer -import java.io.IOException import android.util.Xml +import com.android.internal.util.FastXmlSerializer import com.android.internal.util.XmlUtils import org.xmlpull.v1.XmlPullParser +import org.xmlpull.v1.XmlSerializer +import java.io.IOException import java.io.InputStream import java.io.OutputStream import java.nio.charset.StandardCharsets diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/AlphaOptimizedButton.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/AlphaOptimizedButton.java new file mode 100644 index 0000000000000..6f0a61b3187f8 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/AlphaOptimizedButton.java @@ -0,0 +1,50 @@ +/* + * 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.wm.shell.common; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.Button; + +/** + * A Button which doesn't have overlapping drawing commands + * + * This is the copy from SystemUI/statusbar. + */ +public class AlphaOptimizedButton extends Button { + public AlphaOptimizedButton(Context context) { + super(context); + } + + public AlphaOptimizedButton(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public AlphaOptimizedButton(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public AlphaOptimizedButton(Context context, AttributeSet attrs, int defStyleAttr, + int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + public boolean hasOverlappingRendering() { + return false; + } +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/TriangleShape.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/TriangleShape.java new file mode 100644 index 0000000000000..7079190330659 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/TriangleShape.java @@ -0,0 +1,77 @@ +/* + * 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.wm.shell.common; + +import android.graphics.Outline; +import android.graphics.Path; +import android.graphics.drawable.shapes.PathShape; + +import androidx.annotation.NonNull; + +/** + * Wrapper around {@link PathShape} + * that creates a shape with a triangular path (pointing up or down). + * + * This is the copy from SystemUI/recents. + */ +public class TriangleShape extends PathShape { + private Path mTriangularPath; + + public TriangleShape(Path path, float stdWidth, float stdHeight) { + super(path, stdWidth, stdHeight); + mTriangularPath = path; + } + + public static TriangleShape create(float width, float height, boolean isPointingUp) { + Path triangularPath = new Path(); + if (isPointingUp) { + triangularPath.moveTo(0, height); + triangularPath.lineTo(width, height); + triangularPath.lineTo(width / 2, 0); + triangularPath.close(); + } else { + triangularPath.moveTo(0, 0); + triangularPath.lineTo(width / 2, height); + triangularPath.lineTo(width, 0); + triangularPath.close(); + } + return new TriangleShape(triangularPath, width, height); + } + + /** Create an arrow TriangleShape that points to the left or the right */ + public static TriangleShape createHorizontal( + float width, float height, boolean isPointingLeft) { + Path triangularPath = new Path(); + if (isPointingLeft) { + triangularPath.moveTo(0, height / 2); + triangularPath.lineTo(width, height); + triangularPath.lineTo(width, 0); + triangularPath.close(); + } else { + triangularPath.moveTo(0, height); + triangularPath.lineTo(width, height / 2); + triangularPath.lineTo(0, 0); + triangularPath.close(); + } + return new TriangleShape(triangularPath, width, height); + } + + @Override + public void getOutline(@NonNull Outline outline) { + outline.setPath(mTriangularPath); + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/AndroidManifest.xml b/libs/WindowManager/Shell/tests/unittest/AndroidManifest.xml index a8f795ec8a8d9..59d9104fb5ba4 100644 --- a/libs/WindowManager/Shell/tests/unittest/AndroidManifest.xml +++ b/libs/WindowManager/Shell/tests/unittest/AndroidManifest.xml @@ -22,6 +22,13 @@ + + + + + + + + + diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipTestCase.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java similarity index 79% rename from libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipTestCase.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java index fdebe4e4e6f5e..5bdf831a81f44 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipTestCase.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.wm.shell.pip; +package com.android.wm.shell; import static android.view.Display.DEFAULT_DISPLAY; @@ -24,17 +24,18 @@ import android.testing.TestableContext; import androidx.test.InstrumentationRegistry; +import org.junit.After; import org.junit.Before; /** - * Base class that does One Handed specific setup. + * Base class that does shell test case setup. */ -public abstract class PipTestCase { +public abstract class ShellTestCase { protected TestableContext mContext; @Before - public void setup() { + public void shellSetup() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); final DisplayManager dm = context.getSystemService(DisplayManager.class); @@ -47,6 +48,14 @@ public abstract class PipTestCase { .adoptShellPermissionIdentity(); } + @After + public void shellTearDown() { + InstrumentationRegistry + .getInstrumentation() + .getUiAutomation() + .dropShellPermissionIdentity(); + } + protected Context getContext() { return mContext; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/TaskViewTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/TaskViewTest.java similarity index 95% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/TaskViewTest.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/TaskViewTest.java index 5c148598f10a4..34f772faf9a99 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/TaskViewTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/TaskViewTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; @@ -30,7 +30,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import android.app.ActivityManager; import android.app.ActivityOptions; @@ -45,8 +44,6 @@ import android.window.WindowContainerToken; import androidx.test.filters.SmallTest; -import com.android.systemui.SysuiTestCase; -import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.HandlerExecutor; import org.junit.After; @@ -60,8 +57,7 @@ import org.mockito.invocation.InvocationOnMock; @SmallTest @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -// TODO: Place in com.android.wm.shell vs. com.android.wm.shell.bubbles on shell migration. -public class TaskViewTest extends SysuiTestCase { +public class TaskViewTest extends ShellTestCase { @Mock TaskView.Listener mViewListener; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java similarity index 99% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java index 31c08ae471ae8..7adc4112fa902 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; @@ -38,8 +38,8 @@ import android.util.Pair; import androidx.test.filters.SmallTest; -import com.android.systemui.SysuiTestCase; -import com.android.systemui.bubbles.BubbleData.TimeSource; +import com.android.wm.shell.ShellTestCase; +import com.android.wm.shell.bubbles.BubbleData.TimeSource; import com.google.common.collect.ImmutableList; @@ -63,7 +63,7 @@ import org.mockito.MockitoAnnotations; @SmallTest @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -public class BubbleDataTest extends SysuiTestCase { +public class BubbleDataTest extends ShellTestCase { private BubbleEntry mEntryA1; private BubbleEntry mEntryA2; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleFlyoutViewTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleFlyoutViewTest.java similarity index 93% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleFlyoutViewTest.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleFlyoutViewTest.java index fd6e2ee66107d..5b77e4a0b72fa 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleFlyoutViewTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleFlyoutViewTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotSame; @@ -30,8 +30,8 @@ import android.widget.TextView; import androidx.test.filters.SmallTest; -import com.android.systemui.R; -import com.android.systemui.SysuiTestCase; +import com.android.wm.shell.R; +import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.junit.Test; @@ -42,7 +42,7 @@ import org.mockito.MockitoAnnotations; @SmallTest @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -public class BubbleFlyoutViewTest extends SysuiTestCase { +public class BubbleFlyoutViewTest extends ShellTestCase { private BubbleFlyoutView mFlyout; private TextView mFlyoutText; private TextView mSenderName; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleTest.java similarity index 95% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleTest.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleTest.java index 690a1ad428617..0693052129584 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.wm.shell.bubbles; import static com.google.common.truth.Truth.assertThat; @@ -37,8 +37,8 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; -import com.android.systemui.R; -import com.android.systemui.SysuiTestCase; +import com.android.wm.shell.R; +import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.junit.Test; @@ -49,7 +49,7 @@ import org.mockito.MockitoAnnotations; @SmallTest @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper -public class BubbleTest extends SysuiTestCase { +public class BubbleTest extends ShellTestCase { @Mock private Notification mNotif; @Mock @@ -72,7 +72,7 @@ public class BubbleTest extends SysuiTestCase { Intent target = new Intent(mContext, BubblesTestActivity.class); Notification.BubbleMetadata metadata = new Notification.BubbleMetadata.Builder( PendingIntent.getActivity(mContext, 0, target, 0), - Icon.createWithResource(mContext, R.drawable.android)) + Icon.createWithResource(mContext, R.drawable.bubble_ic_create_bubble)) .build(); when(mSbn.getNotification()).thenReturn(mNotif); when(mNotif.getBubbleMetadata()).thenReturn(metadata); diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubblesTestActivity.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubblesTestActivity.java new file mode 100644 index 0000000000000..d5fbe556045a6 --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubblesTestActivity.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.wm.shell.bubbles; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +import com.android.wm.shell.R; + +/** + * Referenced by NotificationTestHelper#makeBubbleMetadata + */ +public class BubblesTestActivity extends Activity { + + public static final String BUBBLE_ACTIVITY_OPENED = "BUBBLE_ACTIVITY_OPENED"; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + Intent i = new Intent(BUBBLE_ACTIVITY_OPENED); + sendBroadcast(i); + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationControllerTest.java similarity index 96% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationControllerTest.java index a5bb8ea235593..9c4f341bdfd5b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationControllerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; @@ -34,8 +34,8 @@ import android.widget.FrameLayout; import androidx.dynamicanimation.animation.DynamicAnimation; import androidx.test.filters.SmallTest; -import com.android.systemui.R; -import com.android.systemui.bubbles.BubblePositioner; +import com.android.wm.shell.R; +import com.android.wm.shell.bubbles.BubblePositioner; import org.junit.Before; import org.junit.Ignore; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayoutTest.java similarity index 99% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayoutTest.java index 498330c83dcb2..c4edbb286e169 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayoutTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTestCase.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayoutTestCase.java similarity index 97% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTestCase.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayoutTestCase.java index a5f2e8b3db379..a7a7db8697767 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTestCase.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/PhysicsAnimationLayoutTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import static org.mockito.Mockito.when; @@ -30,8 +30,8 @@ import android.widget.FrameLayout; import androidx.dynamicanimation.animation.DynamicAnimation; import androidx.dynamicanimation.animation.SpringForce; -import com.android.systemui.R; -import com.android.systemui.SysuiTestCase; +import com.android.wm.shell.R; +import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.mockito.Mock; @@ -50,7 +50,7 @@ import java.util.concurrent.TimeUnit; * * See physics-animation-testing.md. */ -public class PhysicsAnimationLayoutTestCase extends SysuiTestCase { +public class PhysicsAnimationLayoutTestCase extends ShellTestCase { TestablePhysicsAnimationLayout mLayout; List mViews = new ArrayList<>(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/StackAnimationControllerTest.java similarity index 98% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/StackAnimationControllerTest.java index 7d0abec79de1c..6b01462afd8d3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/animation/StackAnimationControllerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles.animation; +package com.android.wm.shell.bubbles.animation; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; @@ -33,8 +33,8 @@ import androidx.dynamicanimation.animation.DynamicAnimation; import androidx.dynamicanimation.animation.SpringForce; import androidx.test.filters.SmallTest; -import com.android.systemui.R; -import com.android.systemui.bubbles.BubblePositioner; +import com.android.wm.shell.R; +import com.android.wm.shell.bubbles.BubblePositioner; import com.android.wm.shell.common.FloatingContentCoordinator; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubblePersistentRepositoryTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubblePersistentRepositoryTest.kt similarity index 92% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubblePersistentRepositoryTest.kt rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubblePersistentRepositoryTest.kt index 9b8fd11febe3a..416028088294f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubblePersistentRepositoryTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubblePersistentRepositoryTest.kt @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.android.systemui.bubbles.storage +package com.android.wm.shell.bubbles.storage import android.testing.AndroidTestingRunner import androidx.test.filters.SmallTest -import com.android.systemui.SysuiTestCase +import com.android.wm.shell.ShellTestCase import junit.framework.Assert.assertEquals import junit.framework.Assert.assertNotNull import junit.framework.Assert.assertTrue @@ -28,7 +28,7 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidTestingRunner::class) -class BubblePersistentRepositoryTest : SysuiTestCase() { +class BubblePersistentRepositoryTest : ShellTestCase() { private val bubbles = listOf( BubbleEntity(0, "com.example.messenger", "shortcut-1", "key-1", 120, 0), diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubbleVolatileRepositoryTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleVolatileRepositoryTest.kt similarity index 97% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubbleVolatileRepositoryTest.kt rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleVolatileRepositoryTest.kt index 7ea611c9c6a90..4fab9a5496ecd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubbleVolatileRepositoryTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleVolatileRepositoryTest.kt @@ -14,14 +14,14 @@ * limitations under the License. */ -package com.android.systemui.bubbles.storage +package com.android.wm.shell.bubbles.storage import android.content.pm.LauncherApps import android.os.UserHandle import android.testing.AndroidTestingRunner import androidx.test.filters.SmallTest -import com.android.systemui.SysuiTestCase import com.android.systemui.util.mockito.eq +import com.android.wm.shell.ShellTestCase import junit.framework.Assert.assertEquals import org.junit.Before import org.junit.Test @@ -32,7 +32,7 @@ import org.mockito.Mockito.verifyNoMoreInteractions @SmallTest @RunWith(AndroidTestingRunner::class) -class BubbleVolatileRepositoryTest : SysuiTestCase() { +class BubbleVolatileRepositoryTest : ShellTestCase() { private val user0 = UserHandle.of(0) private val user10 = UserHandle.of(10) diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubbleXmlHelperTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelperTest.kt similarity index 95% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubbleXmlHelperTest.kt rename to libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelperTest.kt index 8cf4534ecdce2..e0891a95c6a6f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/storage/BubbleXmlHelperTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelperTest.kt @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.android.systemui.bubbles.storage +package com.android.wm.shell.bubbles.storage import android.testing.AndroidTestingRunner import androidx.test.filters.SmallTest -import com.android.systemui.SysuiTestCase +import com.android.wm.shell.ShellTestCase import junit.framework.Assert.assertEquals import junit.framework.Assert.assertTrue import org.junit.Test @@ -28,7 +28,7 @@ import java.io.ByteArrayOutputStream @SmallTest @RunWith(AndroidTestingRunner::class) -class BubbleXmlHelperTest : SysuiTestCase() { +class BubbleXmlHelperTest : ShellTestCase() { private val bubbles = listOf( BubbleEntity(0, "com.example.messenger", "shortcut-1", "k1", 120, 0), diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipAnimationControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipAnimationControllerTest.java index 255e74917ca00..55e7a354f4cd7 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipAnimationControllerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipAnimationControllerTest.java @@ -32,9 +32,7 @@ import android.view.SurfaceControl; import androidx.test.filters.SmallTest; -import com.android.wm.shell.pip.PipAnimationController; -import com.android.wm.shell.pip.PipSurfaceTransactionHelper; -import com.android.wm.shell.pip.PipTestCase; +import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.junit.Test; @@ -49,7 +47,7 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidTestingRunner.class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) -public class PipAnimationControllerTest extends PipTestCase { +public class PipAnimationControllerTest extends ShellTestCase { private PipAnimationController mPipAnimationController; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsHandlerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsHandlerTest.java index 37421d910513f..5169243f02d60 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsHandlerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsHandlerTest.java @@ -30,8 +30,7 @@ import android.view.Gravity; import androidx.test.filters.SmallTest; -import com.android.wm.shell.pip.PipBoundsHandler; -import com.android.wm.shell.pip.PipTestCase; +import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.junit.Test; @@ -46,7 +45,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidTestingRunner.class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) -public class PipBoundsHandlerTest extends PipTestCase { +public class PipBoundsHandlerTest extends ShellTestCase { private static final int ROUNDING_ERROR_MARGIN = 16; private static final float ASPECT_RATIO_ERROR_MARGIN = 0.01f; private static final float DEFAULT_ASPECT_RATIO = 1f; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsStateTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsStateTest.java index dc9399edaa3b6..844f82d00dad9 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsStateTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipBoundsStateTest.java @@ -28,6 +28,8 @@ import android.util.Size; import androidx.test.filters.SmallTest; +import com.android.wm.shell.ShellTestCase; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -38,7 +40,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper @SmallTest -public class PipBoundsStateTest extends PipTestCase { +public class PipBoundsStateTest extends ShellTestCase { private static final Rect DEFAULT_BOUNDS = new Rect(0, 0, 10, 10); private static final float DEFAULT_SNAP_FRACTION = 1.0f; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipTaskOrganizerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipTaskOrganizerTest.java index 39381c6d677e9..efe553a1a3a4a 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipTaskOrganizerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/PipTaskOrganizerTest.java @@ -40,6 +40,7 @@ import android.view.DisplayInfo; import android.window.WindowContainerToken; import com.android.wm.shell.ShellTaskOrganizer; +import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.pip.phone.PipMenuActivityController; import com.android.wm.shell.splitscreen.SplitScreen; @@ -58,7 +59,7 @@ import java.util.Optional; @SmallTest @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper -public class PipTaskOrganizerTest extends PipTestCase { +public class PipTaskOrganizerTest extends ShellTestCase { private PipTaskOrganizer mSpiedPipTaskOrganizer; @Mock private DisplayController mMockdDisplayController; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java index 5f0f1964814fb..a00a3b6a654ed 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java @@ -35,6 +35,7 @@ import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; +import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.WindowManagerShellWrapper; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.ShellExecutor; @@ -42,7 +43,6 @@ import com.android.wm.shell.pip.PipBoundsHandler; import com.android.wm.shell.pip.PipBoundsState; import com.android.wm.shell.pip.PipMediaController; import com.android.wm.shell.pip.PipTaskOrganizer; -import com.android.wm.shell.pip.PipTestCase; import org.junit.Before; import org.junit.Test; @@ -56,7 +56,7 @@ import org.mockito.MockitoAnnotations; @SmallTest @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper -public class PipControllerTest extends PipTestCase { +public class PipControllerTest extends ShellTestCase { private PipController mPipController; @Mock private DisplayController mMockDisplayController; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchHandlerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchHandlerTest.java index 3f60cc01f20b5..f6dcec23626b8 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchHandlerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchHandlerTest.java @@ -31,17 +31,13 @@ import android.util.Size; import androidx.test.filters.SmallTest; import com.android.wm.shell.R; +import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.pip.PipBoundsHandler; import com.android.wm.shell.pip.PipBoundsState; import com.android.wm.shell.pip.PipSnapAlgorithm; import com.android.wm.shell.pip.PipTaskOrganizer; -import com.android.wm.shell.pip.PipTestCase; import com.android.wm.shell.pip.PipUiEventLogger; -import com.android.wm.shell.pip.phone.PipMenuActivityController; -import com.android.wm.shell.pip.phone.PipMotionHelper; -import com.android.wm.shell.pip.phone.PipResizeGestureHandler; -import com.android.wm.shell.pip.phone.PipTouchHandler; import org.junit.Before; import org.junit.Test; @@ -59,7 +55,7 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidTestingRunner.class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) -public class PipTouchHandlerTest extends PipTestCase { +public class PipTouchHandlerTest extends ShellTestCase { private PipTouchHandler mPipTouchHandler; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchStateTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchStateTest.java index 40667f76b17ea..000f7e8b2e857 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchStateTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipTouchStateTest.java @@ -35,8 +35,7 @@ import android.view.ViewConfiguration; import androidx.test.filters.SmallTest; -import com.android.wm.shell.pip.PipTestCase; -import com.android.wm.shell.pip.phone.PipTouchState; +import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.junit.Test; @@ -47,7 +46,7 @@ import java.util.concurrent.CountDownLatch; @RunWith(AndroidTestingRunner.class) @SmallTest @RunWithLooper -public class PipTouchStateTest extends PipTestCase { +public class PipTouchStateTest extends ShellTestCase { private PipTouchState mTouchState; private CountDownLatch mDoubleTapCallbackTriggeredLatch; diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java index 3def945dd03c5..ec1240fac5aef 100644 --- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java +++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java @@ -17,7 +17,6 @@ package com.android.systemui; import com.android.systemui.biometrics.AuthController; -import com.android.systemui.bubbles.dagger.BubbleModule; import com.android.systemui.car.navigationbar.CarNavigationBar; import com.android.systemui.car.notification.CarNotificationModule; import com.android.systemui.car.sideloaded.SideLoadedAppController; @@ -48,8 +47,7 @@ import dagger.multibindings.IntoMap; /** Binder for car specific {@link SystemUI} modules. */ @Module(includes = {RecentsModule.class, StatusBarModule.class, NotificationsModule.class, - BubbleModule.class, KeyguardModule.class, OverlayWindowModule.class, - CarNotificationModule.class}) + KeyguardModule.class, OverlayWindowModule.class, CarNotificationModule.class}) public abstract class CarSystemUIBinder { /** Inject into AuthController. */ @Binds diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index f9268eece2930..39a6ed12c02d8 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -352,7 +352,7 @@ android:exported="true" /> - - - - - - - \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_create_bubble.xml b/packages/SystemUI/res/drawable/ic_create_bubble.xml deleted file mode 100644 index 4abbc8179b4da..0000000000000 --- a/packages/SystemUI/res/drawable/ic_create_bubble.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/packages/SystemUI/res/drawable/ic_stop_bubble.xml b/packages/SystemUI/res/drawable/ic_stop_bubble.xml deleted file mode 100644 index 6cf67a77ff55b..0000000000000 --- a/packages/SystemUI/res/drawable/ic_stop_bubble.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml index b584dfee1e60d..e45f4eb3f2cae 100644 --- a/packages/SystemUI/res/values-land/dimens.xml +++ b/packages/SystemUI/res/values-land/dimens.xml @@ -36,10 +36,6 @@ 136dp 12dp - - 4dp - 25dp 140dp diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 6df8b4e733bb1..be36316d013c4 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -204,10 +204,6 @@ @color/GM2_grey_500 #40000000 - - #FFFFFF - @color/GM2_grey_800 - #F8F9FA #F1F3F4 diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 17dc4004ae9bb..a2e9f39feefdc 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1159,90 +1159,6 @@ 16dp - - - 1dp - - 4dp - - 12dp - - 10dp - - 6dp - - 8dp - - 6dp - - 16dp - - 60dp - - 52dp - - 24dp - - 12dp - - 52dp - - 4dp - - 8dp - - 180dp - - 480dp - - 16dp - - 15dp - - 7dp - - 200dp - - 50dp - - 8dp - - 12dp - - 16dp - - 48dp - - 144dp - - 32dp - - 4dp - - 10dp - - 15dp - - 9dp - - 120dp - - 8dp - - 40dp - 20dp - 4dp - - - 160dp - - 65dp - - 72dp - 10sp diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml index 7d3135ac1937c..5f68bdb4f0c60 100644 --- a/packages/SystemUI/res/values/ids.xml +++ b/packages/SystemUI/res/values/ids.xml @@ -130,12 +130,6 @@ - - - - - - @@ -146,17 +140,6 @@ - - - - - - - - - - - diff --git a/packages/SystemUI/res/values/integers.xml b/packages/SystemUI/res/values/integers.xml index b1e91c8a86c67..b50b5c14b1fad 100644 --- a/packages/SystemUI/res/values/integers.xml +++ b/packages/SystemUI/res/values/integers.xml @@ -22,17 +22,6 @@ 0 1 - - 5 - - - 4 - - - 16 - 2 Notification dismissed. - - Bubble dismissed. - Notification shade. @@ -1845,9 +1842,6 @@ Default - - Bubble - Automatic @@ -1881,12 +1875,6 @@ %1$s doesn\u2019t support conversation features - - No recent bubbles - - - Recent bubbles and dismissed bubbles will appear here - These notifications can\'t be modified. @@ -2607,45 +2595,8 @@ Tap to restart this app and go full screen. - - Settings for %1$s bubbles - - Overflow - - Add back to stack - - Manage - - %1$s from %2$s - - %1$s from %2$s and %3$d more Move - - Move top left - - Move top right - - Move bottom left - - Move bottom right - - Dismiss bubble - - Don\u2019t bubble conversation - - Chat using bubbles - - New conversations appear as floating icons, or bubbles. Tap to open bubble. Drag to move it. - - Control bubbles anytime - - Tap Manage to turn off bubbles from this app - - Got it - - %1$s settings System navigation updated. To make changes, go to Settings. diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index b30103ef9b59f..17bb40e69e27a 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -108,12 +108,14 @@ public class SystemUIFactory { .setPip(mWMComponent.getPip()) .setSplitScreen(mWMComponent.getSplitScreen()) .setOneHanded(mWMComponent.getOneHanded()) + .setBubbles(mWMComponent.getBubbles()) .setShellDump(mWMComponent.getShellDump()); } else { // TODO: Call on prepareSysUIComponentBuilder but not with real components. builder = builder.setPip(Optional.ofNullable(null)) .setSplitScreen(Optional.ofNullable(null)) .setOneHanded(Optional.ofNullable(null)) + .setBubbles(Optional.ofNullable(null)) .setShellDump(Optional.ofNullable(null)); } mSysUIComponent = builder diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java deleted file mode 100644 index ffb650d620648..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java +++ /dev/null @@ -1,301 +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.systemui.bubbles; - -import static android.app.Notification.EXTRA_MESSAGES; -import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC; -import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_MANIFEST; -import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED; - -import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_EXPERIMENTS; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; - -import android.app.Notification; -import android.app.PendingIntent; -import android.app.Person; -import android.content.Context; -import android.content.pm.LauncherApps; -import android.content.pm.ShortcutInfo; -import android.graphics.Color; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.Icon; -import android.os.Bundle; -import android.os.Parcelable; -import android.os.UserHandle; -import android.provider.Settings; -import android.util.Log; - -import com.android.internal.graphics.ColorUtils; -import com.android.internal.util.ArrayUtils; -import com.android.internal.util.ContrastColorUtil; -import com.android.systemui.statusbar.notification.collection.NotificationEntry; -import com.android.systemui.statusbar.notification.people.PeopleHubNotificationListenerKt; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Common class for experiments controlled via secure settings. - */ -public class BubbleExperimentConfig { - private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleController" : TAG_BUBBLES; - - private static final int BUBBLE_HEIGHT = 10000; - - private static final String ALLOW_ANY_NOTIF_TO_BUBBLE = "allow_any_notif_to_bubble"; - private static final boolean ALLOW_ANY_NOTIF_TO_BUBBLE_DEFAULT = false; - - private static final String ALLOW_MESSAGE_NOTIFS_TO_BUBBLE = "allow_message_notifs_to_bubble"; - private static final boolean ALLOW_MESSAGE_NOTIFS_TO_BUBBLE_DEFAULT = false; - - private static final String ALLOW_SHORTCUTS_TO_BUBBLE = "allow_shortcuts_to_bubble"; - private static final boolean ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT = false; - - private static final String WHITELISTED_AUTO_BUBBLE_APPS = "whitelisted_auto_bubble_apps"; - - /** - * When true, if a notification has the information necessary to bubble (i.e. valid - * contentIntent and an icon or image), then a {@link android.app.Notification.BubbleMetadata} - * object will be created by the system and added to the notification. - *

- * This does not produce a bubble, only adds the metadata based on the notification info. - */ - static boolean allowAnyNotifToBubble(Context context) { - return Settings.Secure.getInt(context.getContentResolver(), - ALLOW_ANY_NOTIF_TO_BUBBLE, - ALLOW_ANY_NOTIF_TO_BUBBLE_DEFAULT ? 1 : 0) != 0; - } - - /** - * Same as {@link #allowAnyNotifToBubble(Context)} except it filters for notifications that - * are using {@link Notification.MessagingStyle} and have remote input. - */ - static boolean allowMessageNotifsToBubble(Context context) { - return Settings.Secure.getInt(context.getContentResolver(), - ALLOW_MESSAGE_NOTIFS_TO_BUBBLE, - ALLOW_MESSAGE_NOTIFS_TO_BUBBLE_DEFAULT ? 1 : 0) != 0; - } - - /** - * When true, if the notification is able to bubble via {@link #allowAnyNotifToBubble(Context)} - * or {@link #allowMessageNotifsToBubble(Context)} or via normal BubbleMetadata, then a new - * BubbleMetadata object is constructed based on the shortcut info. - *

- * This does not produce a bubble, only adds the metadata based on shortcut info. - */ - static boolean useShortcutInfoToBubble(Context context) { - return Settings.Secure.getInt(context.getContentResolver(), - ALLOW_SHORTCUTS_TO_BUBBLE, - ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT ? 1 : 0) != 0; - } - - /** - * Returns whether the provided package is whitelisted to bubble. - */ - static boolean isPackageWhitelistedToAutoBubble(Context context, String packageName) { - String unsplitList = Settings.Secure.getString(context.getContentResolver(), - WHITELISTED_AUTO_BUBBLE_APPS); - if (unsplitList != null) { - // We expect the list to be separated by commas and no white space (but we trim in case) - String[] packageList = unsplitList.split(","); - for (int i = 0; i < packageList.length; i++) { - if (packageList[i].trim().equals(packageName)) { - return true; - } - } - } - return false; - } - - /** - * If {@link #allowAnyNotifToBubble(Context)} is true, this method creates and adds - * {@link android.app.Notification.BubbleMetadata} to the notification entry as long as - * the notification has necessary info for BubbleMetadata. - * - * @return whether an adjustment was made. - */ - static boolean adjustForExperiments(Context context, NotificationEntry entry, - boolean previouslyUserCreated, boolean userBlocked) { - Notification.BubbleMetadata metadata = null; - boolean addedMetadata = false; - boolean whiteListedToAutoBubble = - isPackageWhitelistedToAutoBubble(context, entry.getSbn().getPackageName()); - - Notification notification = entry.getSbn().getNotification(); - boolean isMessage = Notification.MessagingStyle.class.equals( - notification.getNotificationStyle()); - boolean bubbleNotifForExperiment = (isMessage && allowMessageNotifsToBubble(context)) - || allowAnyNotifToBubble(context); - - boolean useShortcutInfo = useShortcutInfoToBubble(context); - String shortcutId = entry.getSbn().getNotification().getShortcutId(); - - boolean hasMetadata = entry.getBubbleMetadata() != null; - if ((!hasMetadata && (previouslyUserCreated || bubbleNotifForExperiment)) - || useShortcutInfo) { - if (DEBUG_EXPERIMENTS) { - Log.d(TAG, "Adjusting " + entry.getKey() + " for bubble experiment." - + " allowMessages=" + allowMessageNotifsToBubble(context) - + " isMessage=" + isMessage - + " allowNotifs=" + allowAnyNotifToBubble(context) - + " useShortcutInfo=" + useShortcutInfo - + " previouslyUserCreated=" + previouslyUserCreated); - } - } - - if (useShortcutInfo && shortcutId != null) { - // We don't actually get anything useful from ShortcutInfo so just check existence - ShortcutInfo info = getShortcutInfo(context, entry.getSbn().getPackageName(), - entry.getSbn().getUser(), shortcutId); - if (info != null) { - metadata = createForShortcut(shortcutId); - } - - // Replace existing metadata with shortcut, or we're bubbling for experiment - boolean shouldBubble = entry.getBubbleMetadata() != null - || bubbleNotifForExperiment - || previouslyUserCreated; - if (shouldBubble && metadata != null) { - if (DEBUG_EXPERIMENTS) { - Log.d(TAG, "Adding experimental shortcut bubble for: " + entry.getKey()); - } - entry.setBubbleMetadata(metadata); - addedMetadata = true; - } - } - - // Didn't get metadata from a shortcut & we're bubbling for experiment - if (entry.getBubbleMetadata() == null - && (bubbleNotifForExperiment || previouslyUserCreated)) { - metadata = createFromNotif(context, entry); - if (metadata != null) { - if (DEBUG_EXPERIMENTS) { - Log.d(TAG, "Adding experimental notification bubble for: " + entry.getKey()); - } - entry.setBubbleMetadata(metadata); - addedMetadata = true; - } - } - - boolean bubbleForWhitelist = !userBlocked - && whiteListedToAutoBubble - && (addedMetadata || hasMetadata); - if ((previouslyUserCreated && addedMetadata) || bubbleForWhitelist) { - // Update to a previous bubble (or new autobubble), set its flag now. - if (DEBUG_EXPERIMENTS) { - Log.d(TAG, "Setting FLAG_BUBBLE for: " + entry.getKey()); - } - entry.setFlagBubble(true); - return true; - } - return addedMetadata; - } - - static Notification.BubbleMetadata createFromNotif(Context context, NotificationEntry entry) { - Notification notification = entry.getSbn().getNotification(); - final PendingIntent intent = notification.contentIntent; - Icon icon = null; - // Use the icon of the person if available - List personList = getPeopleFromNotification(entry); - if (personList.size() > 0) { - final Person person = personList.get(0); - if (person != null) { - icon = person.getIcon(); - if (icon == null) { - // Lets try and grab the icon constructed by the layout - Drawable d = PeopleHubNotificationListenerKt.extractAvatarFromRow(entry); - if (d instanceof BitmapDrawable) { - icon = Icon.createWithBitmap(((BitmapDrawable) d).getBitmap()); - } - } - } - } - if (icon == null) { - boolean shouldTint = notification.getLargeIcon() == null; - icon = shouldTint - ? notification.getSmallIcon() - : notification.getLargeIcon(); - if (shouldTint) { - int notifColor = entry.getSbn().getNotification().color; - notifColor = ColorUtils.setAlphaComponent(notifColor, 255); - notifColor = ContrastColorUtil.findContrastColor(notifColor, Color.WHITE, - true /* findFg */, 3f); - icon.setTint(notifColor); - } - } - if (intent != null) { - return new Notification.BubbleMetadata.Builder(intent, icon) - .setDesiredHeight(BUBBLE_HEIGHT) - .build(); - } - return null; - } - - static Notification.BubbleMetadata createForShortcut(String shortcutId) { - return new Notification.BubbleMetadata.Builder(shortcutId) - .setDesiredHeight(BUBBLE_HEIGHT) - .build(); - } - - static ShortcutInfo getShortcutInfo(Context context, String packageName, UserHandle user, - String shortcutId) { - LauncherApps launcherAppService = - (LauncherApps) context.getSystemService(Context.LAUNCHER_APPS_SERVICE); - LauncherApps.ShortcutQuery query = new LauncherApps.ShortcutQuery(); - if (packageName != null) { - query.setPackage(packageName); - } - if (shortcutId != null) { - query.setShortcutIds(Arrays.asList(shortcutId)); - } - query.setQueryFlags(FLAG_MATCH_DYNAMIC | FLAG_MATCH_PINNED | FLAG_MATCH_MANIFEST); - List shortcuts = launcherAppService.getShortcuts(query, user); - return shortcuts != null && shortcuts.size() > 0 - ? shortcuts.get(0) - : null; - } - - static List getPeopleFromNotification(NotificationEntry entry) { - Bundle extras = entry.getSbn().getNotification().extras; - ArrayList personList = new ArrayList<>(); - if (extras == null) { - return personList; - } - - List p = extras.getParcelableArrayList(Notification.EXTRA_PEOPLE_LIST); - - if (p != null) { - personList.addAll(p); - } - - if (Notification.MessagingStyle.class.equals( - entry.getSbn().getNotification().getNotificationStyle())) { - final Parcelable[] messages = extras.getParcelableArray(EXTRA_MESSAGES); - if (!ArrayUtils.isEmpty(messages)) { - for (Notification.MessagingStyle.Message message : - Notification.MessagingStyle.Message - .getMessagesFromBundleArray(messages)) { - personList.add(message.getSenderPerson()); - } - } - } - return personList; - } -} diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java b/packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java deleted file mode 100644 index 5a7e033607f8c..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java +++ /dev/null @@ -1,98 +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.systemui.bubbles.dagger; - -import android.app.INotificationManager; -import android.content.Context; -import android.content.pm.LauncherApps; -import android.os.Handler; -import android.view.WindowManager; - -import androidx.annotation.Nullable; - -import com.android.internal.logging.UiEventLogger; -import com.android.internal.statusbar.IStatusBarService; -import com.android.systemui.bubbles.BubbleController; -import com.android.systemui.bubbles.Bubbles; -import com.android.systemui.dagger.SysUISingleton; -import com.android.systemui.dagger.qualifiers.Main; -import com.android.systemui.dump.DumpManager; -import com.android.systemui.model.SysUiState; -import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.statusbar.FeatureFlags; -import com.android.systemui.statusbar.NotificationLockscreenUserManager; -import com.android.systemui.statusbar.NotificationShadeWindowController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; -import com.android.systemui.statusbar.notification.collection.NotifPipeline; -import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; -import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider; -import com.android.systemui.statusbar.phone.ShadeController; -import com.android.systemui.statusbar.policy.ConfigurationController; -import com.android.systemui.statusbar.policy.ZenModeController; -import com.android.systemui.wmshell.BubblesManager; -import com.android.wm.shell.ShellTaskOrganizer; -import com.android.wm.shell.WindowManagerShellWrapper; -import com.android.wm.shell.common.FloatingContentCoordinator; - -import java.util.Optional; - -import dagger.Module; -import dagger.Provides; - -/** */ -@Module -public interface BubbleModule { - - /** - */ - @SysUISingleton - @Provides - static Bubbles newBubbleController(Context context, - FloatingContentCoordinator floatingContentCoordinator, - IStatusBarService statusBarService, - WindowManager windowManager, - WindowManagerShellWrapper windowManagerShellWrapper, - LauncherApps launcherApps, - UiEventLogger uiEventLogger, - @Main Handler mainHandler, - ShellTaskOrganizer organizer) { - return BubbleController.create(context, null /* synchronizer */, floatingContentCoordinator, - statusBarService, windowManager, windowManagerShellWrapper, launcherApps, - uiEventLogger, mainHandler, organizer); - } - - /** Provides Optional of BubbleManager */ - @SysUISingleton - @Provides - static Optional provideBubblesManager(Context context, - Optional bubblesOptional, - NotificationShadeWindowController notificationShadeWindowController, - StatusBarStateController statusBarStateController, ShadeController shadeController, - ConfigurationController configurationController, - @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, - NotificationInterruptStateProvider interruptionStateProvider, - ZenModeController zenModeController, NotificationLockscreenUserManager notifUserManager, - NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, - NotifPipeline notifPipeline, SysUiState sysUiState, FeatureFlags featureFlags, - DumpManager dumpManager) { - return Optional.ofNullable(BubblesManager.create(context, bubblesOptional, - notificationShadeWindowController, statusBarStateController, shadeController, - configurationController, statusBarService, notificationManager, - interruptionStateProvider, zenModeController, notifUserManager, - groupManager, entryManager, notifPipeline, sysUiState, featureFlags, dumpManager)); - } -} diff --git a/packages/SystemUI/src/com/android/systemui/dagger/GlobalModule.java b/packages/SystemUI/src/com/android/systemui/dagger/GlobalModule.java index 554d9cbb454f0..53383d65e3790 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/GlobalModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/GlobalModule.java @@ -22,9 +22,7 @@ import android.util.DisplayMetrics; import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLoggerImpl; import com.android.systemui.util.concurrency.GlobalConcurrencyModule; -import com.android.wm.shell.WindowManagerShellWrapper; import com.android.wm.shell.animation.FlingAnimationUtils; -import com.android.wm.shell.common.FloatingContentCoordinator; import javax.inject.Singleton; @@ -51,22 +49,6 @@ import dagger.Provides; GlobalConcurrencyModule.class}) public class GlobalModule { - // TODO(b/161980186): Currently only used by Bubbles, can move back to WMShellBaseModule once - // Bubbles has migrated over - @Singleton - @Provides - static FloatingContentCoordinator provideFloatingContentCoordinator() { - return new FloatingContentCoordinator(); - } - - // TODO(b/161980186): Currently only used by Bubbles, can move back to WMShellBaseModule once - // Bubbles has migrated over - @Singleton - @Provides - static WindowManagerShellWrapper provideWindowManagerShellWrapper() { - return new WindowManagerShellWrapper(); - } - // TODO(b/162923491): This should not be a singleton at all, the display metrics can change and // callers should be creating a new builder on demand @Singleton diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java b/packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java index d73633e57c9b0..b94a68b2441de 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java @@ -27,6 +27,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.util.InjectionInflationController; import com.android.wm.shell.ShellDump; import com.android.wm.shell.ShellTaskOrganizer; +import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.onehanded.OneHanded; import com.android.wm.shell.pip.Pip; import com.android.wm.shell.splitscreen.SplitScreen; @@ -63,6 +64,9 @@ public interface SysUIComponent { @BindsInstance Builder setOneHanded(Optional o); + @BindsInstance + Builder setBubbles(Optional b); + @BindsInstance Builder setInputConsumerController(InputConsumerController i); diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java index 1f6288a94ad46..c0013d8cb981c 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java @@ -24,7 +24,6 @@ import com.android.systemui.SystemUI; import com.android.systemui.accessibility.SystemActions; import com.android.systemui.accessibility.WindowMagnification; import com.android.systemui.biometrics.AuthController; -import com.android.systemui.bubbles.dagger.BubbleModule; import com.android.systemui.globalactions.GlobalActionsComponent; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.dagger.KeyguardModule; @@ -51,8 +50,7 @@ import dagger.multibindings.IntoMap; /** * SystemUI objects that are injectable should go here. */ -@Module(includes = {RecentsModule.class, StatusBarModule.class, BubbleModule.class, - KeyguardModule.class}) +@Module(includes = {RecentsModule.class, StatusBarModule.class, KeyguardModule.class}) public abstract class SystemUIBinder { /** Inject into AuthController. */ @Binds diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index a982ec5c01948..780bb5b011034 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -16,32 +16,49 @@ package com.android.systemui.dagger; +import android.app.INotificationManager; +import android.content.Context; + +import androidx.annotation.Nullable; + +import com.android.internal.statusbar.IStatusBarService; import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.BootCompleteCache; import com.android.systemui.BootCompleteCacheImpl; import com.android.systemui.appops.dagger.AppOpsModule; import com.android.systemui.assist.AssistModule; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.controls.dagger.ControlsModule; import com.android.systemui.demomode.dagger.DemoModeModule; import com.android.systemui.doze.dagger.DozeComponent; +import com.android.systemui.dump.DumpManager; import com.android.systemui.fragments.FragmentService; import com.android.systemui.log.dagger.LogModule; import com.android.systemui.model.SysUiState; +import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.power.dagger.PowerModule; import com.android.systemui.recents.Recents; import com.android.systemui.screenshot.dagger.ScreenshotModule; import com.android.systemui.settings.dagger.SettingsModule; import com.android.systemui.statusbar.CommandQueue; +import com.android.systemui.statusbar.FeatureFlags; +import com.android.systemui.statusbar.NotificationLockscreenUserManager; +import com.android.systemui.statusbar.NotificationShadeWindowController; +import com.android.systemui.statusbar.notification.NotificationEntryManager; +import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl; +import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; +import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider; import com.android.systemui.statusbar.notification.people.PeopleHubModule; import com.android.systemui.statusbar.notification.row.dagger.ExpandableNotificationRowComponent; import com.android.systemui.statusbar.notification.row.dagger.NotificationRowComponent; import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent; +import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.dagger.StatusBarComponent; +import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.HeadsUpManager; +import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.policy.dagger.SmartRepliesInflationModule; import com.android.systemui.statusbar.policy.dagger.StatusBarPolicyModule; import com.android.systemui.tuner.dagger.TunerModule; @@ -53,6 +70,10 @@ import com.android.systemui.util.settings.SettingsUtilModule; import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClockImpl; import com.android.systemui.volume.dagger.VolumeModule; +import com.android.systemui.wmshell.BubblesManager; +import com.android.wm.shell.bubbles.Bubbles; + +import java.util.Optional; import dagger.Binds; import dagger.BindsOptionalOf; @@ -126,10 +147,28 @@ public abstract class SystemUIModule { @BindsOptionalOf abstract StatusBar optionalStatusBar(); - @BindsOptionalOf - abstract Bubbles optionalBubbles(); - @SysUISingleton @Binds abstract SystemClock bindSystemClock(SystemClockImpl systemClock); + + /** Provides Optional of BubbleManager */ + @SysUISingleton + @Provides + static Optional provideBubblesManager(Context context, + Optional bubblesOptional, + NotificationShadeWindowController notificationShadeWindowController, + StatusBarStateController statusBarStateController, ShadeController shadeController, + ConfigurationController configurationController, + @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, + NotificationInterruptStateProvider interruptionStateProvider, + ZenModeController zenModeController, NotificationLockscreenUserManager notifUserManager, + NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, + NotifPipeline notifPipeline, SysUiState sysUiState, FeatureFlags featureFlags, + DumpManager dumpManager) { + return Optional.ofNullable(BubblesManager.create(context, bubblesOptional, + notificationShadeWindowController, statusBarStateController, shadeController, + configurationController, statusBarService, notificationManager, + interruptionStateProvider, zenModeController, notifUserManager, + groupManager, entryManager, notifPipeline, sysUiState, featureFlags, dumpManager)); + } } diff --git a/packages/SystemUI/src/com/android/systemui/dagger/WMComponent.java b/packages/SystemUI/src/com/android/systemui/dagger/WMComponent.java index 66352860612b0..8f3d8eaac2d34 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/WMComponent.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/WMComponent.java @@ -21,6 +21,7 @@ import com.android.systemui.wmshell.WMShellModule; import com.android.wm.shell.ShellDump; import com.android.wm.shell.ShellInit; import com.android.wm.shell.ShellTaskOrganizer; +import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.onehanded.OneHanded; import com.android.wm.shell.pip.Pip; import com.android.wm.shell.splitscreen.SplitScreen; @@ -64,13 +65,11 @@ public interface WMComponent { InputConsumerController getInputConsumerController(); // TODO(b/162923491): To be removed once Bubbles migrates over to the Shell - @WMSingleton ShellTaskOrganizer getShellTaskOrganizer(); // TODO(b/162923491): We currently pass the instances through to SysUI, but that may change // depending on the threading mechanism we go with - @WMSingleton Optional getOneHanded(); @@ -79,4 +78,7 @@ public interface WMComponent { @WMSingleton Optional getSplitScreen(); + + @WMSingleton + Optional getBubbles(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java index a92b9e4818b43..9bd34ad1937f6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java @@ -26,7 +26,6 @@ import android.view.View; import android.view.ViewGroup; import com.android.systemui.R; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.dagger.StatusBarModule; @@ -43,6 +42,7 @@ import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectio import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.util.Assert; +import com.android.wm.shell.bubbles.Bubbles; import java.util.ArrayList; import java.util.HashMap; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java index cee9c70f53eb4..efd0519d6608d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java @@ -21,7 +21,6 @@ import android.content.Context; import android.os.Handler; import com.android.internal.statusbar.IStatusBarService; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.media.MediaDataManager; @@ -62,6 +61,7 @@ import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.tracing.ProtoTracer; import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.concurrency.DelayableExecutor; +import com.android.wm.shell.bubbles.Bubbles; import java.util.Optional; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java index 7d8979ca1129e..aef01e9bd8114 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java @@ -22,10 +22,10 @@ import android.util.Log; import android.view.View; import com.android.systemui.DejankUtils; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.phone.StatusBar; +import com.android.wm.shell.bubbles.Bubbles; import java.util.Optional; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BubbleCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BubbleCoordinator.java index 83a569bd6573f..29a030f910a47 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BubbleCoordinator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BubbleCoordinator.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.notification.collection.coordinator; -import com.android.systemui.bubbles.BubbleController; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.statusbar.notification.collection.NotifCollection; import com.android.systemui.statusbar.notification.collection.NotifPipeline; @@ -26,6 +24,8 @@ import com.android.systemui.statusbar.notification.collection.listbuilder.plugga import com.android.systemui.statusbar.notification.collection.notifcollection.DismissedByUserStats; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifDismissInterceptor; import com.android.systemui.wmshell.BubblesManager; +import com.android.wm.shell.bubbles.BubbleController; +import com.android.wm.shell.bubbles.Bubbles; import java.util.HashSet; import java.util.Optional; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java index 36adfac21bc34..3db544011700a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java @@ -22,7 +22,6 @@ import android.util.ArraySet; import android.util.Log; import com.android.systemui.Dumpable; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; @@ -34,6 +33,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; +import com.android.wm.shell.bubbles.Bubbles; import java.io.FileDescriptor; import java.io.PrintWriter; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt index 049b471aa7cb6..52b9b0606e81b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt @@ -17,13 +17,13 @@ package com.android.systemui.statusbar.notification.init import android.service.notification.StatusBarNotification -import com.android.systemui.bubbles.Bubbles import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption import com.android.systemui.statusbar.NotificationPresenter import com.android.systemui.statusbar.notification.NotificationActivityStarter import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl import com.android.systemui.statusbar.notification.stack.NotificationListContainer import com.android.systemui.statusbar.phone.StatusBar +import com.android.wm.shell.bubbles.Bubbles import java.io.FileDescriptor import java.io.PrintWriter import java.util.Optional diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt index 45a5d1044b9a9..8f352ad550415 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.init import android.service.notification.StatusBarNotification -import com.android.systemui.bubbles.Bubbles import com.android.systemui.dagger.SysUISingleton import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption import com.android.systemui.statusbar.FeatureFlags @@ -41,6 +40,7 @@ import com.android.systemui.statusbar.phone.StatusBar import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.statusbar.policy.RemoteInputUriController +import com.android.wm.shell.bubbles.Bubbles import dagger.Lazy import java.io.FileDescriptor import java.io.PrintWriter diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt index 7569c1bdbb736..d0e68bf753739 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.init import android.service.notification.StatusBarNotification -import com.android.systemui.bubbles.Bubbles import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption import com.android.systemui.statusbar.NotificationListener import com.android.systemui.statusbar.NotificationPresenter @@ -25,6 +24,7 @@ import com.android.systemui.statusbar.notification.NotificationActivityStarter import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl import com.android.systemui.statusbar.notification.stack.NotificationListContainer import com.android.systemui.statusbar.phone.StatusBar +import com.android.wm.shell.bubbles.Bubbles import java.io.FileDescriptor import java.io.PrintWriter import java.util.Optional diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java index 71e1d12b610ee..8dad6fb6bb548 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java @@ -1359,8 +1359,8 @@ public class NotificationContentView extends FrameLayout { && entry.getBubbleMetadata() != null; if (showButton) { Drawable d = mContext.getResources().getDrawable(entry.isBubble() - ? R.drawable.ic_stop_bubble - : R.drawable.ic_create_bubble); + ? R.drawable.bubble_ic_stop_bubble + : R.drawable.bubble_ic_create_bubble); mContainingNotification.updateNotificationColor(); final int tint = mContainingNotification.getNotificationColor(); d.setTint(tint); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java index f2ae3da73f5e0..a1bc81aa466a6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -19,7 +19,6 @@ import com.android.internal.util.ContrastColorUtil; import com.android.settingslib.Utils; import com.android.systemui.Interpolators; import com.android.systemui.R; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.demomode.DemoMode; import com.android.systemui.demomode.DemoModeController; @@ -36,6 +35,7 @@ import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.ListEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry; +import com.android.wm.shell.bubbles.Bubbles; import java.util.ArrayList; import java.util.List; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java index af2f3e55c9ce6..a930a897c2dc5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java @@ -22,13 +22,13 @@ import android.view.ViewTreeObserver; import android.view.WindowManager; import com.android.systemui.assist.AssistManager; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.StatusBarState; +import com.android.wm.shell.bubbles.Bubbles; import java.util.ArrayList; import java.util.Optional; @@ -51,7 +51,7 @@ public class ShadeControllerImpl implements ShadeController { private final int mDisplayId; protected final Lazy mStatusBarLazy; private final Lazy mAssistManagerLazy; - private final Optional> mBubblesOptional; + private final Optional mBubblesOptional; private final ArrayList mPostCollapseRunnables = new ArrayList<>(); @@ -64,7 +64,7 @@ public class ShadeControllerImpl implements ShadeController { WindowManager windowManager, Lazy statusBarLazy, Lazy assistManagerLazy, - Optional> bubblesOptional + Optional bubblesOptional ) { mCommandQueue = commandQueue; mStatusBarStateController = statusBarStateController; @@ -135,7 +135,7 @@ public class ShadeControllerImpl implements ShadeController { getStatusBar().getNotificationShadeWindowViewController().cancelExpandHelper(); getStatusBarView().collapsePanel(true /* animate */, delayed, speedUpFactor); } else if (mBubblesOptional.isPresent()) { - mBubblesOptional.get().get().collapseStack(); + mBubblesOptional.get().collapseStack(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index a8d41046a1eb2..5c7f54b4a9a93 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -144,7 +144,6 @@ import com.android.systemui.R; import com.android.systemui.SystemUI; import com.android.systemui.assist.AssistManager; import com.android.systemui.broadcast.BroadcastDispatcher; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.charging.WirelessChargingAnimation; import com.android.systemui.classifier.FalsingLog; import com.android.systemui.colorextraction.SysuiColorExtractor; @@ -229,6 +228,7 @@ import com.android.systemui.statusbar.policy.UserInfoControllerImpl; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.volume.VolumeComponent; import com.android.systemui.wmshell.BubblesManager; +import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.splitscreen.SplitScreen; import java.io.FileDescriptor; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java index b69da859b3c89..13d5bf59fb4b6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java @@ -31,7 +31,6 @@ import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.InitController; import com.android.systemui.assist.AssistManager; import com.android.systemui.broadcast.BroadcastDispatcher; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.UiBackground; @@ -98,6 +97,7 @@ import com.android.systemui.statusbar.policy.UserInfoControllerImpl; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.volume.VolumeComponent; import com.android.systemui.wmshell.BubblesManager; +import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.splitscreen.SplitScreen; import java.util.Optional; diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java index ad596c27ba977..844f12e0c43ec 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java @@ -27,10 +27,10 @@ import static android.service.notification.NotificationListenerService.REASON_GR import static android.service.notification.NotificationStats.DISMISSAL_BUBBLE; import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEUTRAL; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; -import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.systemui.statusbar.StatusBarState.SHADE; import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; +import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.app.INotificationManager; import android.app.Notification; @@ -53,8 +53,6 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dumpable; -import com.android.systemui.bubbles.BubbleEntry; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dump.DumpManager; import com.android.systemui.model.SysUiState; @@ -80,6 +78,8 @@ import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; +import com.android.wm.shell.bubbles.BubbleEntry; +import com.android.wm.shell.bubbles.Bubbles; import java.io.FileDescriptor; import java.io.PrintWriter; diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java index 91ae08e07677d..bdca503f40c1e 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java @@ -18,21 +18,27 @@ package com.android.systemui.wmshell; import android.app.IActivityManager; import android.content.Context; +import android.content.pm.LauncherApps; import android.content.pm.PackageManager; import android.os.Handler; import android.view.IWindowManager; +import android.view.WindowManager; import com.android.internal.logging.UiEventLogger; -import com.android.systemui.bubbles.Bubbles; +import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.dagger.WMSingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.shared.system.InputConsumerController; import com.android.wm.shell.ShellDump; import com.android.wm.shell.ShellInit; import com.android.wm.shell.ShellTaskOrganizer; +import com.android.wm.shell.WindowManagerShellWrapper; +import com.android.wm.shell.bubbles.BubbleController; +import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.common.AnimationThread; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.DisplayImeController; +import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.common.HandlerExecutor; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.SyncTransactionQueue; @@ -114,6 +120,18 @@ public abstract class WMShellBaseModule { return InputConsumerController.getPipInputConsumer(); } + @WMSingleton + @Provides + static FloatingContentCoordinator provideFloatingContentCoordinator() { + return new FloatingContentCoordinator(); + } + + @WMSingleton + @Provides + static WindowManagerShellWrapper provideWindowManagerShellWrapper() { + return new WindowManagerShellWrapper(); + } + @WMSingleton @Provides static PipAppOpsListener providePipAppOpsListener(Context context, @@ -166,8 +184,21 @@ public abstract class WMShellBaseModule { @BindsOptionalOf abstract SplitScreen optionalSplitScreen(); - @BindsOptionalOf - abstract Bubbles optionalBubbles(); + @WMSingleton + @Provides + static Optional provideBubbles(Context context, + FloatingContentCoordinator floatingContentCoordinator, + IStatusBarService statusBarService, + WindowManager windowManager, + WindowManagerShellWrapper windowManagerShellWrapper, + LauncherApps launcherApps, + UiEventLogger uiEventLogger, + @Main Handler mainHandler, + ShellTaskOrganizer organizer) { + return Optional.of(BubbleController.create(context, null /* synchronizer */, + floatingContentCoordinator, statusBarService, windowManager, + windowManagerShellWrapper, launcherApps, uiEventLogger, mainHandler, organizer)); + } @WMSingleton @Provides diff --git a/packages/SystemUI/tests/AndroidManifest.xml b/packages/SystemUI/tests/AndroidManifest.xml index e5847b08a4c56..f1c687ff32244 100644 --- a/packages/SystemUI/tests/AndroidManifest.xml +++ b/packages/SystemUI/tests/AndroidManifest.xml @@ -63,7 +63,7 @@ - mStatusBar, () -> mAssistManager, Optional.of(() -> mBubbles)); + () -> mStatusBar, () -> mAssistManager, Optional.of(mBubbles)); mStatusBar = new StatusBar( mContext, diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java index 88d04011e7389..a46e563a7c57f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -64,14 +64,6 @@ import androidx.test.filters.SmallTest; import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.SysuiTestCase; -import com.android.systemui.bubbles.Bubble; -import com.android.systemui.bubbles.BubbleData; -import com.android.systemui.bubbles.BubbleDataRepository; -import com.android.systemui.bubbles.BubbleEntry; -import com.android.systemui.bubbles.BubbleLogger; -import com.android.systemui.bubbles.BubblePositioner; -import com.android.systemui.bubbles.BubbleStackView; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardViewMediator; @@ -102,6 +94,14 @@ import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.WindowManagerShellWrapper; +import com.android.wm.shell.bubbles.Bubble; +import com.android.wm.shell.bubbles.BubbleData; +import com.android.wm.shell.bubbles.BubbleDataRepository; +import com.android.wm.shell.bubbles.BubbleEntry; +import com.android.wm.shell.bubbles.BubbleLogger; +import com.android.wm.shell.bubbles.BubblePositioner; +import com.android.wm.shell.bubbles.BubbleStackView; +import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.common.FloatingContentCoordinator; import com.google.common.collect.ImmutableList; diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubblesTestActivity.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTestActivity.java similarity index 82% rename from packages/SystemUI/tests/src/com/android/systemui/bubbles/BubblesTestActivity.java rename to packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTestActivity.java index 43d2ad1dfe0af..f4d96a1236245 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubblesTestActivity.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTestActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.bubbles; +package com.android.systemui.wmshell; import android.app.Activity; import android.content.Intent; @@ -27,8 +27,7 @@ import com.android.systemui.R; */ public class BubblesTestActivity extends Activity { - public static final String BUBBLE_ACTIVITY_OPENED = - "com.android.systemui.bubbles.BUBBLE_ACTIVITY_OPENED"; + public static final String BUBBLE_ACTIVITY_OPENED = "BUBBLE_ACTIVITY_OPENED"; @Override public void onCreate(Bundle savedInstanceState) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java index 99c8ca417778c..d8033dbdd281e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java @@ -60,13 +60,6 @@ import androidx.test.filters.SmallTest; import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.SysuiTestCase; -import com.android.systemui.bubbles.BubbleData; -import com.android.systemui.bubbles.BubbleDataRepository; -import com.android.systemui.bubbles.BubbleEntry; -import com.android.systemui.bubbles.BubbleLogger; -import com.android.systemui.bubbles.BubblePositioner; -import com.android.systemui.bubbles.BubbleStackView; -import com.android.systemui.bubbles.Bubbles; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardViewMediator; @@ -95,6 +88,13 @@ import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.WindowManagerShellWrapper; +import com.android.wm.shell.bubbles.BubbleData; +import com.android.wm.shell.bubbles.BubbleDataRepository; +import com.android.wm.shell.bubbles.BubbleEntry; +import com.android.wm.shell.bubbles.BubbleLogger; +import com.android.wm.shell.bubbles.BubblePositioner; +import com.android.wm.shell.bubbles.BubbleStackView; +import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.common.FloatingContentCoordinator; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableBubbleController.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableBubbleController.java index 2273bc48ce8b8..fd39b6e5b1c86 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableBubbleController.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableBubbleController.java @@ -22,13 +22,13 @@ import android.os.Handler; import android.view.WindowManager; import com.android.internal.statusbar.IStatusBarService; -import com.android.systemui.bubbles.BubbleController; -import com.android.systemui.bubbles.BubbleData; -import com.android.systemui.bubbles.BubbleDataRepository; -import com.android.systemui.bubbles.BubbleLogger; -import com.android.systemui.bubbles.BubblePositioner; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.WindowManagerShellWrapper; +import com.android.wm.shell.bubbles.BubbleController; +import com.android.wm.shell.bubbles.BubbleData; +import com.android.wm.shell.bubbles.BubbleDataRepository; +import com.android.wm.shell.bubbles.BubbleLogger; +import com.android.wm.shell.bubbles.BubblePositioner; import com.android.wm.shell.common.FloatingContentCoordinator; /**