Snap for 9547664 from f667823a8e437893e3f0ba3d56ae547a3cd2616c to tm-qpr3-release
Change-Id: Ic5d831d46badf7b745649b82457b9721aa70bf36
diff --git a/quickstep/res/drawable/mock_app_icon.xml b/quickstep/res/drawable/mock_app_icon.xml
new file mode 100644
index 0000000..92cdea3
--- /dev/null
+++ b/quickstep/res/drawable/mock_app_icon.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="@color/mock_app_icon" />
+ <corners android:radius="@dimen/gesture_tutorial_taskbar_icon_corner_radius" />
+</shape>
\ No newline at end of file
diff --git a/quickstep/res/drawable/mock_taskbar_background.xml b/quickstep/res/drawable/mock_taskbar_background.xml
new file mode 100644
index 0000000..8ac9080
--- /dev/null
+++ b/quickstep/res/drawable/mock_taskbar_background.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="@color/gesture_tutorial_taskbar_color" />
+ <corners android:radius="@dimen/gesture_tutorial_taskbar_corner_radius" />
+</shape>
\ No newline at end of file
diff --git a/quickstep/res/layout-land/gesture_tutorial_mock_hotseat.xml b/quickstep/res/layout-land/gesture_tutorial_mock_hotseat.xml
index 20d2ecc..1e2e014 100644
--- a/quickstep/res/layout-land/gesture_tutorial_mock_hotseat.xml
+++ b/quickstep/res/layout-land/gesture_tutorial_mock_hotseat.xml
@@ -31,7 +31,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintVertical_chainStyle="spread_inside"
app:layout_constraintTop_toTopOf="parent"
@@ -45,7 +45,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_icon_1"
app:layout_constraintBottom_toTopOf="@id/hotseat_icon_3"
@@ -58,7 +58,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_3"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_icon_2"
app:layout_constraintBottom_toTopOf="@id/hotseat_icon_4"
@@ -71,7 +71,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_4"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_icon_3"
app:layout_constraintBottom_toBottomOf="parent"
diff --git a/quickstep/res/layout-land/gesture_tutorial_tablet_mock_hotseat.xml b/quickstep/res/layout-land/gesture_tutorial_tablet_mock_hotseat.xml
index 6877b89..f04fbb6 100644
--- a/quickstep/res/layout-land/gesture_tutorial_tablet_mock_hotseat.xml
+++ b/quickstep/res/layout-land/gesture_tutorial_tablet_mock_hotseat.xml
@@ -43,7 +43,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -57,7 +57,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -71,7 +71,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_3"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -85,7 +85,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -99,25 +99,11 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_4"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_4"
- app:layout_constraintEnd_toStartOf="@id/hotseat_icon_6"/>
-
- <androidx.cardview.widget.CardView
- android:id="@+id/hotseat_icon_6"
- android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
- android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
-
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
- app:layout_constraintDimensionRatio="1:1"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/hotseat_icon_5"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/quickstep/res/layout/gesture_tutorial_foldable_mock_hotseat.xml b/quickstep/res/layout/gesture_tutorial_foldable_mock_hotseat.xml
index 027e4a0..363f14e 100644
--- a/quickstep/res/layout/gesture_tutorial_foldable_mock_hotseat.xml
+++ b/quickstep/res/layout/gesture_tutorial_foldable_mock_hotseat.xml
@@ -42,7 +42,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
@@ -57,7 +57,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_1"
@@ -71,7 +71,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_3"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_2"
@@ -85,7 +85,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_3"
@@ -99,24 +99,10 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_4"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_4"
- app:layout_constraintEnd_toStartOf="@id/hotseat_icon_6"/>
-
- <androidx.cardview.widget.CardView
- android:id="@+id/hotseat_icon_6"
- android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
- android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
- android:layout_marginTop="@dimen/gesture_tutorial_hotseat_icon_search_margin"
-
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
- app:layout_constraintDimensionRatio="1:1"
- app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
- app:layout_constraintStart_toEndOf="@id/hotseat_icon_5"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/quickstep/res/layout/gesture_tutorial_fragment.xml b/quickstep/res/layout/gesture_tutorial_fragment.xml
index b3ca297..8eeef67 100644
--- a/quickstep/res/layout/gesture_tutorial_fragment.xml
+++ b/quickstep/res/layout/gesture_tutorial_fragment.xml
@@ -102,11 +102,11 @@
<include
layout="@layout/gesture_tutorial_tablet_mock_taskbar"
android:id="@+id/gesture_tutorial_fake_taskbar_view"
- android:layout_width="match_parent"
- android:layout_height="@dimen/gesture_tutorial_mock_taskbar_height"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
- android:layout_alignParentStart="true"
- android:layout_alignParentEnd="true" />
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="@dimen/gesture_tutorial_taskbar_margin_bottom"/>
<ImageView
android:id="@+id/gesture_tutorial_edge_gesture_video"
diff --git a/quickstep/res/layout/gesture_tutorial_mock_hotseat.xml b/quickstep/res/layout/gesture_tutorial_mock_hotseat.xml
index b3e86cf..8513dcf 100644
--- a/quickstep/res/layout/gesture_tutorial_mock_hotseat.xml
+++ b/quickstep/res/layout/gesture_tutorial_mock_hotseat.xml
@@ -15,7 +15,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintTop_toTopOf="parent"
@@ -29,7 +29,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_1"
@@ -42,7 +42,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_3"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_2"
@@ -55,7 +55,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_4"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_3"
diff --git a/quickstep/res/layout/gesture_tutorial_tablet_mock_hotseat.xml b/quickstep/res/layout/gesture_tutorial_tablet_mock_hotseat.xml
index 027e4a0..363f14e 100644
--- a/quickstep/res/layout/gesture_tutorial_tablet_mock_hotseat.xml
+++ b/quickstep/res/layout/gesture_tutorial_tablet_mock_hotseat.xml
@@ -42,7 +42,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
@@ -57,7 +57,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_1"
@@ -71,7 +71,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_3"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_2"
@@ -85,7 +85,7 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_3"
@@ -99,24 +99,10 @@
app:cardElevation="0dp"
app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_4"
+ app:cardBackgroundColor="@color/mock_app_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
app:layout_constraintStart_toEndOf="@id/hotseat_icon_4"
- app:layout_constraintEnd_toStartOf="@id/hotseat_icon_6"/>
-
- <androidx.cardview.widget.CardView
- android:id="@+id/hotseat_icon_6"
- android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
- android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
- android:layout_marginTop="@dimen/gesture_tutorial_hotseat_icon_search_margin"
-
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_hotseat_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
- app:layout_constraintDimensionRatio="1:1"
- app:layout_constraintTop_toBottomOf="@id/hotseat_search_bar"
- app:layout_constraintStart_toEndOf="@id/hotseat_icon_5"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/quickstep/res/layout/gesture_tutorial_tablet_mock_taskbar.xml b/quickstep/res/layout/gesture_tutorial_tablet_mock_taskbar.xml
index ddfeeec..bc68928 100644
--- a/quickstep/res/layout/gesture_tutorial_tablet_mock_taskbar.xml
+++ b/quickstep/res/layout/gesture_tutorial_tablet_mock_taskbar.xml
@@ -2,115 +2,240 @@
<com.android.quickstep.interaction.AnimatedTaskbarView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="@dimen/gesture_tutorial_mock_taskbar_height">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:clipChildren="false">
+ <!-- Pill-shaped background -->
<View
android:id="@+id/taskbar_background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/gesture_tutorial_taskbar_color"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:background="@drawable/mock_taskbar_background"
+ android:clipToOutline="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
+ <!-- Container for the all apps button and app icons -->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/icon_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/gesture_tutorial_taskbar_padding"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
- <androidx.cardview.widget.CardView
+ <!-- All apps button -->
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/taskbar_all_apps"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_icon_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_icon_size"
+ android:layout_marginEnd="@dimen/taskbar_icon_spacing"
+ android:padding="@dimen/gesture_tutorial_taskbar_padding"
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/taskbar_icon_1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent">
+
+ <!-- 9 mini circles representing the all apps button icon -->
+ <View
+ android:id="@+id/all_apps_mini_1"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintHorizontal_chainStyle="spread_inside"
+ app:layout_constraintVertical_chainStyle="spread_inside"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/all_apps_mini_4"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/all_apps_mini_2"/>
+
+ <View
+ android:id="@+id/all_apps_mini_2"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintVertical_chainStyle="spread_inside"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/all_apps_mini_5"
+ app:layout_constraintStart_toEndOf="@id/all_apps_mini_1"
+ app:layout_constraintEnd_toStartOf="@id/all_apps_mini_3"/>
+
+ <View
+ android:id="@+id/all_apps_mini_3"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintVertical_chainStyle="spread_inside"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/all_apps_mini_6"
+ app:layout_constraintStart_toEndOf="@id/all_apps_mini_2"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ <View
+ android:id="@+id/all_apps_mini_4"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintHorizontal_chainStyle="spread_inside"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintTop_toBottomOf="@id/all_apps_mini_1"
+ app:layout_constraintBottom_toTopOf="@id/all_apps_mini_7"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/all_apps_mini_5"/>
+
+ <View
+ android:id="@+id/all_apps_mini_5"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintTop_toBottomOf="@id/all_apps_mini_2"
+ app:layout_constraintBottom_toTopOf="@id/all_apps_mini_8"
+ app:layout_constraintStart_toEndOf="@id/all_apps_mini_4"
+ app:layout_constraintEnd_toStartOf="@id/all_apps_mini_6"/>
+
+ <View
+ android:id="@+id/all_apps_mini_6"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintTop_toBottomOf="@id/all_apps_mini_3"
+ app:layout_constraintBottom_toTopOf="@id/all_apps_mini_9"
+ app:layout_constraintStart_toEndOf="@id/all_apps_mini_5"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ <View
+ android:id="@+id/all_apps_mini_7"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintHorizontal_chainStyle="spread_inside"
+ app:layout_constraintTop_toBottomOf="@id/all_apps_mini_4"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/all_apps_mini_8"/>
+
+ <View
+ android:id="@+id/all_apps_mini_8"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintTop_toBottomOf="@id/all_apps_mini_5"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/all_apps_mini_7"
+ app:layout_constraintEnd_toStartOf="@id/all_apps_mini_9"/>
+
+ <View
+ android:id="@+id/all_apps_mini_9"
+ android:layout_width="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:layout_height="@dimen/gesture_tutorial_taskbar_all_apps_mini_size"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
+
+ app:layout_constraintTop_toBottomOf="@id/all_apps_mini_6"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/all_apps_mini_8"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <!-- App icons -->
+ <View
android:id="@+id/taskbar_icon_1"
android:layout_width="@dimen/gesture_tutorial_taskbar_icon_size"
android:layout_height="@dimen/gesture_tutorial_taskbar_icon_size"
- android:layout_marginStart="@dimen/gesture_tutorial_taskbar_padding_start_end"
+ android:layout_marginStart="@dimen/taskbar_icon_spacing"
+ android:layout_marginEnd="@dimen/taskbar_icon_spacing"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_taskbar_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
- app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintStart_toEndOf="@id/taskbar_all_apps"
app:layout_constraintEnd_toStartOf="@id/taskbar_icon_2"/>
- <androidx.cardview.widget.CardView
+ <View
android:id="@+id/taskbar_icon_2"
android:layout_width="@dimen/gesture_tutorial_taskbar_icon_size"
android:layout_height="@dimen/gesture_tutorial_taskbar_icon_size"
+ android:layout_marginStart="@dimen/taskbar_icon_spacing"
+ android:layout_marginEnd="@dimen/taskbar_icon_spacing"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_taskbar_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
- app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/taskbar_icon_1"
app:layout_constraintEnd_toStartOf="@id/taskbar_icon_3"/>
- <androidx.cardview.widget.CardView
+ <View
android:id="@+id/taskbar_icon_3"
android:layout_width="@dimen/gesture_tutorial_taskbar_icon_size"
android:layout_height="@dimen/gesture_tutorial_taskbar_icon_size"
+ android:layout_marginStart="@dimen/taskbar_icon_spacing"
+ android:layout_marginEnd="@dimen/taskbar_icon_spacing"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_taskbar_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_3"
- app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/taskbar_icon_2"
app:layout_constraintEnd_toStartOf="@id/taskbar_icon_4"/>
- <androidx.cardview.widget.CardView
+ <View
android:id="@+id/taskbar_icon_4"
android:layout_width="@dimen/gesture_tutorial_taskbar_icon_size"
android:layout_height="@dimen/gesture_tutorial_taskbar_icon_size"
+ android:layout_marginStart="@dimen/taskbar_icon_spacing"
+ android:layout_marginEnd="@dimen/taskbar_icon_spacing"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_taskbar_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_1"
- app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/taskbar_icon_3"
app:layout_constraintEnd_toStartOf="@id/taskbar_icon_5"/>
- <androidx.cardview.widget.CardView
+ <View
android:id="@+id/taskbar_icon_5"
android:layout_width="@dimen/gesture_tutorial_taskbar_icon_size"
android:layout_height="@dimen/gesture_tutorial_taskbar_icon_size"
+ android:layout_marginStart="@dimen/taskbar_icon_spacing"
+ android:background="@drawable/mock_app_icon"
+ android:clipToOutline="true"
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_taskbar_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_4"
- app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/taskbar_icon_4"
- app:layout_constraintEnd_toStartOf="@id/taskbar_icon_6"/>
-
- <androidx.cardview.widget.CardView
- android:id="@+id/taskbar_icon_6"
- android:layout_width="@dimen/gesture_tutorial_taskbar_icon_size"
- android:layout_height="@dimen/gesture_tutorial_taskbar_icon_size"
- android:layout_marginEnd="@dimen/gesture_tutorial_taskbar_padding_start_end"
-
- app:cardElevation="0dp"
- app:cardCornerRadius="@dimen/gesture_tutorial_taskbar_icon_corner_radius"
- app:cardBackgroundColor="@color/mock_app_icon_2"
- app:layout_constraintDimensionRatio="1:1"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/taskbar_icon_5"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/quickstep/res/values/colors.xml b/quickstep/res/values/colors.xml
index 262e418..86244b9 100644
--- a/quickstep/res/values/colors.xml
+++ b/quickstep/res/values/colors.xml
@@ -40,13 +40,10 @@
<color name="gesture_tutorial_fake_task_view_color">#6DA1FF</color> <!-- Light Blue -->
<!-- Must contrast gesture_tutorial_fake_wallpaper_color -->
<color name="gesture_tutorial_fake_previous_task_view_color">#3C4043</color> <!-- Gray -->
- <color name="gesture_tutorial_taskbar_color">#202124</color>
+ <color name="gesture_tutorial_taskbar_color">#E8EAED</color>
<!-- Mock hotseat -->
- <color name="mock_app_icon_1">#8AB4F8</color>
- <color name="mock_app_icon_2">#F28B82</color>
- <color name="mock_app_icon_3">#FDD663</color>
- <color name="mock_app_icon_4">#81C995</color>
+ <color name="mock_app_icon">#BDC1C6</color>
<color name="mock_search_bar">#3C4043</color>
<!-- Mock conversation -->
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index d97e435..d339d28 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -196,9 +196,13 @@
<integer name="gesture_tutorial_webpage_extra_lines_visibility">0</integer> <!-- VISIBLE -->
<!-- Gesture Tutorial mock taskbar -->
- <dimen name="gesture_tutorial_taskbar_icon_size">44dp</dimen>
+ <dimen name="gesture_tutorial_taskbar_icon_size">52dp</dimen>
+ <dimen name="gesture_tutorial_taskbar_all_apps_mini_size">7dp</dimen>
<dimen name="gesture_tutorial_taskbar_icon_corner_radius">100dp</dimen>
- <dimen name="gesture_tutorial_taskbar_padding_start_end">52dp</dimen>
+ <dimen name="gesture_tutorial_taskbar_corner_radius">100dp</dimen>
+ <dimen name="gesture_tutorial_taskbar_padding">12dp</dimen>
+ <dimen name="gesture_tutorial_taskbar_icon_spacing">24dp</dimen>
+ <dimen name="gesture_tutorial_taskbar_margin_bottom">24dp</dimen>
<!-- All Set page -->
<dimen name="allset_page_margin_horizontal">40dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java
index ba412c9..80bdb6f 100644
--- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java
+++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java
@@ -193,7 +193,7 @@
icon.setEnabled(false);
icon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
icon.verifyHighRes();
- CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1, -1);
+ CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1);
mSampleHotseat.addViewToCellLayout(icon, i, info.getViewId(), lp, true);
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index 77bb3bf..9cec881 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -18,6 +18,7 @@
import static android.view.View.AccessibilityDelegate;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
+import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
@@ -487,13 +488,6 @@
}
/**
- * Returns true if IME switcher is visible
- */
- public boolean isImeSwitcherVisible() {
- return (mState & FLAG_SWITCHER_SHOWING) != 0;
- }
-
- /**
* Returns true if the home button is disabled
*/
public boolean isHomeDisabled() {
@@ -871,8 +865,8 @@
mAreNavButtonsInSeparateWindow = true;
mContext.getDragLayer().removeView(mNavButtonsView);
mSeparateWindowParent.addView(mNavButtonsView);
- WindowManager.LayoutParams windowLayoutParams = mContext.createDefaultWindowLayoutParams();
- windowLayoutParams.setTitle(NAV_BUTTONS_SEPARATE_WINDOW_TITLE);
+ WindowManager.LayoutParams windowLayoutParams = mContext.createDefaultWindowLayoutParams(
+ TYPE_NAVIGATION_BAR_PANEL, NAV_BUTTONS_SEPARATE_WINDOW_TITLE);
mContext.addWindowView(mSeparateWindowParent, windowLayoutParams);
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index accbf21..dc2c720 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -241,7 +241,8 @@
public void init(@NonNull TaskbarSharedState sharedState) {
mLastRequestedNonFullscreenHeight = getDefaultTaskbarWindowHeight();
- mWindowLayoutParams = createDefaultWindowLayoutParams();
+ mWindowLayoutParams =
+ createDefaultWindowLayoutParams(TYPE_NAVIGATION_BAR_PANEL, WINDOW_TITLE);
// Initialize controllers after all are constructed.
mControllers.init(sharedState);
@@ -317,16 +318,12 @@
return super.getStatsLogManager();
}
- /** @see #createDefaultWindowLayoutParams(int) */
- public WindowManager.LayoutParams createDefaultWindowLayoutParams() {
- return createDefaultWindowLayoutParams(TYPE_NAVIGATION_BAR_PANEL);
- }
-
/**
* Creates LayoutParams for adding a view directly to WindowManager as a new window.
* @param type The window type to pass to the created WindowManager.LayoutParams.
+ * @param title The window title to pass to the created WindowManager.LayoutParams.
*/
- public WindowManager.LayoutParams createDefaultWindowLayoutParams(int type) {
+ public WindowManager.LayoutParams createDefaultWindowLayoutParams(int type, String title) {
DeviceProfile deviceProfile = getDeviceProfile();
// Taskbar is on the logical bottom of the screen
boolean isVerticalBarLayout = TaskbarManager.isPhoneMode(deviceProfile) &&
@@ -346,7 +343,7 @@
type,
windowFlags,
PixelFormat.TRANSLUCENT);
- windowLayoutParams.setTitle(WINDOW_TITLE);
+ windowLayoutParams.setTitle(title);
windowLayoutParams.packageName = getPackageName();
windowLayoutParams.gravity = !isVerticalBarLayout ?
Gravity.BOTTOM :
@@ -557,8 +554,6 @@
fromInit);
mControllers.taskbarViewController.setImeIsVisible(
mControllers.navbarButtonsViewController.isImeVisible());
- mControllers.taskbarViewController.setIsImeSwitcherVisible(
- mControllers.navbarButtonsViewController.isImeSwitcherVisible());
int shadeExpandedFlags = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
onNotificationShadeExpandChanged((systemUiStateFlags & shadeExpandedFlags) != 0, fromInit);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
index cd27a46..267bee1 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
@@ -49,6 +49,8 @@
private final AnimatedFloat mNotificationShadeBgTaskbar = new AnimatedFloat(
this::updateBackgroundAlpha);
private final AnimatedFloat mImeBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
+ private final AnimatedFloat mAssistantBgTaskbar = new AnimatedFloat(
+ this::updateBackgroundAlpha);
// Used to hide our background color when someone else (e.g. ScrimView) is handling it.
private final AnimatedFloat mBgOverride = new AnimatedFloat(this::updateBackgroundAlpha);
@@ -60,6 +62,7 @@
private AnimatedFloat mNavButtonDarkIntensityMultiplier;
private float mLastSetBackgroundAlpha;
+ private boolean mIsBackgroundDrawnElsewhere;
public TaskbarDragLayerController(TaskbarActivityContext activity,
TaskbarDragLayer taskbarDragLayer) {
@@ -81,6 +84,7 @@
mKeyguardBgTaskbar.value = 1;
mNotificationShadeBgTaskbar.value = 1;
mImeBgTaskbar.value = 1;
+ mAssistantBgTaskbar.value = 1;
mBgOverride.value = 1;
updateBackgroundAlpha();
}
@@ -119,6 +123,10 @@
return mImeBgTaskbar;
}
+ public AnimatedFloat getAssistantBgTaskbar() {
+ return mAssistantBgTaskbar;
+ }
+
public AnimatedFloat getOverrideBackgroundAlpha() {
return mBgOverride;
}
@@ -143,7 +151,8 @@
private void updateBackgroundAlpha() {
final float bgNavbar = mBgNavbar.value;
final float bgTaskbar = mBgTaskbar.value * mKeyguardBgTaskbar.value
- * mNotificationShadeBgTaskbar.value * mImeBgTaskbar.value;
+ * mNotificationShadeBgTaskbar.value * mImeBgTaskbar.value
+ * mAssistantBgTaskbar.value;
mLastSetBackgroundAlpha = mBgOverride.value * Math.max(bgNavbar, bgTaskbar);
mTaskbarDragLayer.setTaskbarBackgroundAlpha(mLastSetBackgroundAlpha);
@@ -168,9 +177,23 @@
mTaskbarDragLayer.setCornerRoundness(cornerRoundness);
}
+ /**
+ * Set if another controller is temporarily handling background drawing. In this case we:
+ * - Override our background alpha to be 0.
+ * - Keep the nav bar dark intensity assuming taskbar background is at full alpha.
+ */
+ public void setIsBackgroundDrawnElsewhere(boolean isBackgroundDrawnElsewhere) {
+ mIsBackgroundDrawnElsewhere = isBackgroundDrawnElsewhere;
+ mBgOverride.updateValue(mIsBackgroundDrawnElsewhere ? 0 : 1);
+ updateNavBarDarkIntensityMultiplier();
+ }
+
private void updateNavBarDarkIntensityMultiplier() {
// Zero out the app-requested dark intensity when we're drawing our own background.
float effectiveBgAlpha = mLastSetBackgroundAlpha * (1 - mBgOffset.value);
+ if (mIsBackgroundDrawnElsewhere) {
+ effectiveBgAlpha = 1;
+ }
mNavButtonDarkIntensityMultiplier.updateValue(1 - effectiveBgAlpha);
}
@@ -181,6 +204,13 @@
pw.println(prefix + "\tmBgOffset=" + mBgOffset.value);
pw.println(prefix + "\tmFolderMargin=" + mFolderMargin);
pw.println(prefix + "\tmLastSetBackgroundAlpha=" + mLastSetBackgroundAlpha);
+ pw.println(prefix + "\t\tmBgOverride=" + mBgOverride.value);
+ pw.println(prefix + "\t\tmBgNavbar=" + mBgNavbar.value);
+ pw.println(prefix + "\t\tmBgTaskbar=" + mBgTaskbar.value);
+ pw.println(prefix + "\t\tmKeyguardBgTaskbar=" + mKeyguardBgTaskbar.value);
+ pw.println(prefix + "\t\tmNotificationShadeBgTaskbar=" + mNotificationShadeBgTaskbar.value);
+ pw.println(prefix + "\t\tmImeBgTaskbar=" + mImeBgTaskbar.value);
+ pw.println(prefix + "\t\tmAssistantBgTaskbar=" + mAssistantBgTaskbar.value);
}
/**
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt
index c4d1ab2..faf7451 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt
@@ -151,7 +151,7 @@
}
override fun dumpLogs(prefix: String?, pw: PrintWriter?) {
- pw?.println("$(prefix)TaskbarEduController:")
+ pw?.println(prefix + "TaskbarEduTooltipController:")
pw?.println("$prefix\tisTooltipEnabled=$isTooltipEnabled")
pw?.println("$prefix\tisOpen=$isOpen")
pw?.println("$prefix\ttooltipStep=$tooltipStep")
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
index edf4648..93ba4eb 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
@@ -90,13 +90,8 @@
*/
private void updateIconsForBouncer() {
boolean disableBack = (mKeyguardSysuiFlags & SYSUI_STATE_BACK_DISABLED) != 0;
- boolean disableRecent = (mKeyguardSysuiFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0;
- boolean disableHome = (mKeyguardSysuiFlags & SYSUI_STATE_HOME_DISABLED) != 0;
- boolean onlyBackEnabled = !disableBack && disableRecent && disableHome;
-
- boolean showBackForBouncer = onlyBackEnabled &&
- mKeyguardManager.isDeviceSecure() &&
- mBouncerShowing;
+ boolean showBackForBouncer =
+ !disableBack && mKeyguardManager.isDeviceSecure() && mBouncerShowing;
mNavbarButtonsViewController.setBackForBouncer(showBackForBouncer);
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index 62f1293..3e51e67 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -161,6 +161,7 @@
mIconAlignment.finishAnimation();
+ Log.d("b/260135164", "onDestroy - updateIconAlphaForHome(1)");
mLauncher.getHotseat().setIconsAlpha(1f);
mLauncher.getStateManager().removeStateListener(mStateListener);
@@ -411,6 +412,8 @@
public void onAnimationEnd(Animator animation) {
if (isInStashedState && committed) {
// Reset hotseat alpha to default
+ Log.d("b/260135164",
+ "playStateTransitionAnim#onAnimationEnd - setIconsAlpha(1)");
mLauncher.getHotseat().setIconsAlpha(1);
}
}
@@ -459,6 +462,9 @@
* Hide Launcher Hotseat icons when Taskbar icons have opacity. Both icon sets
* should not be visible at the same time.
*/
+ Log.d("b/260135164",
+ "updateIconAlphaForHome - setIconsAlpha(" + (hotseatVisible ? 1 : 0)
+ + "), isTaskbarPresent: " + mLauncher.getDeviceProfile().isTaskbarPresent);
mLauncher.getHotseat().setIconsAlpha(hotseatVisible ? 1 : 0);
mLauncher.getHotseat().setQsbAlpha(
mLauncher.getDeviceProfile().isQsbInline && !hotseatVisible ? 0 : 1);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java
index 88767dd..5ea00cf 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java
@@ -67,7 +67,8 @@
final boolean manageMenuExpanded =
(stateFlags & SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0;
final boolean showScrim = !mControllers.navbarButtonsViewController.isImeVisible()
- && bubblesExpanded && mControllers.taskbarStashController.isInAppAndNotStashed();
+ && bubblesExpanded
+ && mControllers.taskbarStashController.isTaskbarVisibleAndNotStashing();
final float scrimAlpha = manageMenuExpanded
// When manage menu shows there's the first scrim and second scrim so figure out
// what the total transparency would be.
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 999db3b..6b7bfa0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -35,8 +35,6 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
-import android.animation.ValueAnimator;
-import android.annotation.Nullable;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.util.Log;
@@ -45,6 +43,7 @@
import android.view.ViewConfiguration;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
@@ -350,10 +349,10 @@
/**
- * Returns whether the taskbar is currently visible and in an app.
+ * Returns whether the taskbar is currently visible and not in the process of being stashed.
*/
- public boolean isInAppAndNotStashed() {
- return !mIsStashed && isInApp();
+ public boolean isTaskbarVisibleAndNotStashing() {
+ return !mIsStashed && mControllers.taskbarViewController.areIconsVisible();
}
public boolean isInApp() {
@@ -697,15 +696,26 @@
}
public void applyState(long duration) {
- createApplyStateAnimator(duration).start();
+ Animator animator = createApplyStateAnimator(duration);
+ if (animator != null) {
+ animator.start();
+ }
}
public void applyState(long duration, long startDelay) {
Animator animator = createApplyStateAnimator(duration);
- animator.setStartDelay(startDelay);
- animator.start();
+ if (animator != null) {
+ animator.setStartDelay(startDelay);
+ animator.start();
+ }
}
+
+ /**
+ * Returns an animator which applies the latest state if mIsStashed is changed, or {@code null}
+ * otherwise.
+ */
+ @Nullable
public Animator createApplyStateAnimator(long duration) {
return mStatePropertyHolder.createSetStateAnimator(mState, duration);
}
@@ -946,9 +956,9 @@
* creating a new animation (stored in mAnimator).
* @param flags The latest flags to apply (see the top of this file).
* @param duration The length of the animation.
- * @return mAnimator if mIsStashed changed or an empty animator.
+ * @return mAnimator if mIsStashed changed, or {@code null} otherwise.
*/
- @NonNull
+ @Nullable
public Animator createSetStateAnimator(int flags, long duration) {
int changedFlags = mPrevFlags ^ flags;
if (mPrevFlags != flags) {
@@ -977,7 +987,7 @@
createAnimToIsStashed(mIsStashed, duration, /* animateBg= */ true, changedFlags);
return mAnimator;
}
- return ValueAnimator.ofFloat(0, 1).setDuration(duration);
+ return null;
}
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java
index 586115d..80f030f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java
@@ -113,7 +113,7 @@
return;
}
reset();
- if (mControllers.taskbarStashController.isInAppAndNotStashed()) {
+ if (mControllers.taskbarStashController.isTaskbarVisibleAndNotStashing()) {
mControllers.taskbarEduTooltipController.maybeShowFeaturesEdu();
}
}));
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 168c353..69f79ba 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -79,9 +79,8 @@
public static final int ALPHA_INDEX_RECENTS_DISABLED = 3;
public static final int ALPHA_INDEX_NOTIFICATION_EXPANDED = 4;
public static final int ALPHA_INDEX_ASSISTANT_INVOKED = 5;
- public static final int ALPHA_INDEX_IME_BUTTON_NAV = 6;
- public static final int ALPHA_INDEX_SMALL_SCREEN = 7;
- private static final int NUM_ALPHA_CHANNELS = 8;
+ public static final int ALPHA_INDEX_SMALL_SCREEN = 6;
+ private static final int NUM_ALPHA_CHANNELS = 7;
private final TaskbarActivityContext mActivity;
private final TaskbarView mTaskbarView;
@@ -201,14 +200,6 @@
}
/**
- * Should be called when the IME switcher visibility changes.
- */
- public void setIsImeSwitcherVisible(boolean isImeSwitcherVisible) {
- mTaskbarIconAlpha.get(ALPHA_INDEX_IME_BUTTON_NAV).setValue(
- isImeSwitcherVisible ? 0 : 1);
- }
-
- /**
* Should be called when the recents button is disabled, so we can hide taskbar icons as well.
*/
public void setRecentsButtonDisabled(boolean isDisabled) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt b/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt
index be34fb1..7a5deb7 100644
--- a/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt
@@ -1,31 +1,70 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.android.launcher3.taskbar
+import android.animation.AnimatorSet
import android.graphics.Canvas
+import android.view.View
+import android.view.ViewTreeObserver
+import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION
import android.view.WindowManager
import android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
+import com.android.launcher3.util.DisplayController
import com.android.launcher3.views.BaseDragLayer
import com.android.systemui.animation.ViewRootSync
import java.io.PrintWriter
private const val TASKBAR_ICONS_FADE_DURATION = 300L
private const val STASHED_HANDLE_FADE_DURATION = 180L
+private const val TEMP_BACKGROUND_WINDOW_TITLE = "VoiceInteractionTaskbarBackground"
-/** Controls Taskbar behavior while Voice Interaction Window (assistant) is showing. */
+/**
+ * Controls Taskbar behavior while Voice Interaction Window (assistant) is showing. Specifically:
+ * - We always hide the taskbar icons or stashed handle, whichever is currently showing.
+ * - For persistent taskbar, we also move the taskbar background to a new window/layer
+ * (TYPE_APPLICATION_OVERLAY) which is behind the assistant.
+ * - For transient taskbar, we hide the real taskbar background (if it's showing).
+ */
class VoiceInteractionWindowController(val context: TaskbarActivityContext) :
TaskbarControllers.LoggableTaskbarController, TaskbarControllers.BackgroundRendererController {
+ private val isSeparateBackgroundEnabled = !DisplayController.isTransientTaskbar(context)
private val taskbarBackgroundRenderer = TaskbarBackgroundRenderer(context)
+ private val nonTouchableInsetsComputer =
+ ViewTreeObserver.OnComputeInternalInsetsListener {
+ it.touchableRegion.setEmpty()
+ it.setTouchableInsets(TOUCHABLE_INSETS_REGION)
+ }
// Initialized in init.
private lateinit var controllers: TaskbarControllers
- private lateinit var separateWindowForTaskbarBackground: BaseDragLayer<TaskbarActivityContext>
- private lateinit var separateWindowLayoutParams: WindowManager.LayoutParams
+ // Only initialized if isSeparateBackgroundEnabled
+ private var separateWindowForTaskbarBackground: BaseDragLayer<TaskbarActivityContext>? = null
+ private var separateWindowLayoutParams: WindowManager.LayoutParams? = null
private var isVoiceInteractionWindowVisible: Boolean = false
+ private var pendingAttachedToWindowListener: View.OnAttachStateChangeListener? = null
fun init(controllers: TaskbarControllers) {
this.controllers = controllers
+ if (!isSeparateBackgroundEnabled) {
+ return
+ }
+
separateWindowForTaskbarBackground =
object : BaseDragLayer<TaskbarActivityContext>(context, null, 0) {
override fun recreateControllers() {
@@ -34,24 +73,39 @@
override fun draw(canvas: Canvas) {
super.draw(canvas)
- if (
- this@VoiceInteractionWindowController.context.isGestureNav &&
- controllers.taskbarStashController.isInAppAndNotStashed
- ) {
+ if (controllers.taskbarStashController.isTaskbarVisibleAndNotStashing) {
taskbarBackgroundRenderer.draw(canvas)
}
}
+
+ override fun onAttachedToWindow() {
+ super.onAttachedToWindow()
+ viewTreeObserver.addOnComputeInternalInsetsListener(nonTouchableInsetsComputer)
+ }
+
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ viewTreeObserver.removeOnComputeInternalInsetsListener(
+ nonTouchableInsetsComputer
+ )
+ }
}
- separateWindowForTaskbarBackground.recreateControllers()
- separateWindowForTaskbarBackground.setWillNotDraw(false)
+ separateWindowForTaskbarBackground?.recreateControllers()
+ separateWindowForTaskbarBackground?.setWillNotDraw(false)
separateWindowLayoutParams =
- context.createDefaultWindowLayoutParams(TYPE_APPLICATION_OVERLAY)
- separateWindowLayoutParams.isSystemApplicationOverlay = true
+ context.createDefaultWindowLayoutParams(
+ TYPE_APPLICATION_OVERLAY,
+ TEMP_BACKGROUND_WINDOW_TITLE
+ )
+ separateWindowLayoutParams?.isSystemApplicationOverlay = true
}
fun onDestroy() {
setIsVoiceInteractionWindowVisible(visible = false, skipAnim = true)
+ separateWindowForTaskbarBackground?.removeOnAttachStateChangeListener(
+ pendingAttachedToWindowListener
+ )
}
fun setIsVoiceInteractionWindowVisible(visible: Boolean, skipAnim: Boolean) {
@@ -72,14 +126,24 @@
.get(StashedHandleViewController.ALPHA_INDEX_ASSISTANT_INVOKED)
.animateToValue(taskbarIconAlpha)
.setDuration(STASHED_HANDLE_FADE_DURATION)
- fadeTaskbarIcons.start()
- fadeStashedHandle.start()
+ val animSet = AnimatorSet()
+ animSet.play(fadeTaskbarIcons)
+ animSet.play(fadeStashedHandle)
+ if (!isSeparateBackgroundEnabled) {
+ val fadeTaskbarBackground =
+ controllers.taskbarDragLayerController.assistantBgTaskbar
+ .animateToValue(taskbarIconAlpha)
+ .setDuration(TASKBAR_ICONS_FADE_DURATION)
+ animSet.play(fadeTaskbarBackground)
+ }
+ animSet.start()
if (skipAnim) {
- fadeTaskbarIcons.end()
- fadeStashedHandle.end()
+ animSet.end()
}
- moveTaskbarBackgroundToAppropriateLayer(skipAnim)
+ if (isSeparateBackgroundEnabled) {
+ moveTaskbarBackgroundToAppropriateLayer(skipAnim)
+ }
}
/**
@@ -92,8 +156,6 @@
* Removes the temporary window and show the TaskbarDragLayer background again.
*/
private fun moveTaskbarBackgroundToAppropriateLayer(skipAnim: Boolean) {
- val taskbarBackgroundOverride =
- controllers.taskbarDragLayerController.overrideBackgroundAlpha
val moveToLowerLayer = isVoiceInteractionWindowVisible
val onWindowsSynchronized =
if (moveToLowerLayer) {
@@ -102,31 +164,60 @@
separateWindowForTaskbarBackground,
separateWindowLayoutParams
);
- { taskbarBackgroundOverride.updateValue(0f) }
+ { controllers.taskbarDragLayerController.setIsBackgroundDrawnElsewhere(true) }
} else {
// First reapply the original taskbar background, then remove the temporary window.
- taskbarBackgroundOverride.updateValue(1f);
+ controllers.taskbarDragLayerController.setIsBackgroundDrawnElsewhere(false);
{ context.removeWindowView(separateWindowForTaskbarBackground) }
}
if (skipAnim) {
onWindowsSynchronized()
} else {
- ViewRootSync.synchronizeNextDraw(
- separateWindowForTaskbarBackground,
- context.dragLayer,
- onWindowsSynchronized
- )
+ separateWindowForTaskbarBackground?.runWhenAttachedToWindow {
+ ViewRootSync.synchronizeNextDraw(
+ separateWindowForTaskbarBackground!!,
+ context.dragLayer,
+ onWindowsSynchronized
+ )
+ }
}
}
+ private fun View.runWhenAttachedToWindow(onAttachedToWindow: () -> Unit) {
+ if (isAttachedToWindow) {
+ onAttachedToWindow()
+ return
+ }
+ removeOnAttachStateChangeListener(pendingAttachedToWindowListener)
+ pendingAttachedToWindowListener =
+ object : View.OnAttachStateChangeListener {
+ override fun onViewAttachedToWindow(v: View?) {
+ onAttachedToWindow()
+ removeOnAttachStateChangeListener(this)
+ pendingAttachedToWindowListener = null
+ }
+
+ override fun onViewDetachedFromWindow(v: View?) {}
+ }
+ addOnAttachStateChangeListener(pendingAttachedToWindowListener)
+ }
+
override fun setCornerRoundness(cornerRoundness: Float) {
+ if (!isSeparateBackgroundEnabled) {
+ return
+ }
taskbarBackgroundRenderer.setCornerRoundness(cornerRoundness)
- separateWindowForTaskbarBackground.invalidate()
+ separateWindowForTaskbarBackground?.invalidate()
}
override fun dumpLogs(prefix: String, pw: PrintWriter) {
pw.println(prefix + "VoiceInteractionWindowController:")
+ pw.println("$prefix\tisSeparateBackgroundEnabled=$isSeparateBackgroundEnabled")
pw.println("$prefix\tisVoiceInteractionWindowVisible=$isVoiceInteractionWindowVisible")
+ pw.println(
+ "$prefix\tisSeparateTaskbarBackgroundAttachedToWindow=" +
+ "${separateWindowForTaskbarBackground?.isAttachedToWindow}"
+ )
}
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index abbd01d..5537878 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -86,7 +86,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import com.android.app.viewcapture.ViewCapture;
+import com.android.app.viewcapture.SettingsAwareViewCapture;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
@@ -556,7 +556,7 @@
addMultiWindowModeChangedListener(mDepthController);
initUnfoldTransitionProgressProvider();
if (FeatureFlags.CONTINUOUS_VIEW_TREE_CAPTURE.get()) {
- mViewCapture = ViewCapture.getInstance().startCapture(getWindow());
+ mViewCapture = SettingsAwareViewCapture.getInstance(this).startCapture(getWindow());
}
getWindow().addPrivateFlags(PRIVATE_FLAG_OPTIMIZE_MEASURE);
}
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index deeb027..e3427b7 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -51,7 +51,6 @@
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.EXPECTING_TASK_APPEARED;
-import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.LAUNCHER_DESTROYED;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.ON_SETTLED_ON_END_TARGET;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
@@ -183,7 +182,6 @@
if (mActivity != activity) {
return;
}
- handleActivityDestroyed();
mRecentsView = null;
mActivity = null;
}
@@ -464,7 +462,6 @@
if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
return false;
}
- mStateCallback.resumeCallbacks();
T createdActivity = mActivityInterface.getCreatedActivity();
if (createdActivity != null) {
@@ -534,15 +531,6 @@
return true;
}
- private void handleActivityDestroyed() {
- ActiveGestureLog.INSTANCE.addLog("Launcher activity destroyed", LAUNCHER_DESTROYED);
- if (mActivityInterface.shouldCancelGestureOnDestroy()) {
- onGestureCancelled();
- } else {
- mStateCallback.pauseCallbacks();
- }
- }
-
/**
* Return true if the window should be translated horizontally if the recents view scrolls
*/
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 22eaa97..274b686 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -123,14 +123,6 @@
public abstract AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback);
- /**
- * Returns {@code true} iff an ongoing navigational gesture should be cancelled on activity
- * destroy. Otherwise, the MultiStateCallbacks will be paused until the activity is recreated.
- */
- public boolean shouldCancelGestureOnDestroy() {
- return true;
- }
-
public abstract ActivityInitListener createActivityInitListener(
Predicate<Boolean> onInitListener);
diff --git a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
index 4cb4665..ae9fb0b 100644
--- a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
@@ -88,11 +88,6 @@
}
@Override
- public boolean shouldCancelGestureOnDestroy() {
- return false;
- }
-
- @Override
public ActivityInitListener createActivityInitListener(
Predicate<Boolean> onInitListener) {
return new ActivityInitListener<>((activity, alreadyOnHome) ->
diff --git a/quickstep/src/com/android/quickstep/MultiStateCallback.java b/quickstep/src/com/android/quickstep/MultiStateCallback.java
index 6d767ed..a68bea2 100644
--- a/quickstep/src/com/android/quickstep/MultiStateCallback.java
+++ b/quickstep/src/com/android/quickstep/MultiStateCallback.java
@@ -31,7 +31,6 @@
import java.util.ArrayList;
import java.util.LinkedList;
-import java.util.List;
import java.util.StringJoiner;
import java.util.function.Consumer;
@@ -53,9 +52,6 @@
private int mState = 0;
- private boolean mCallbacksPaused = false;
- private final List<Runnable> mPendingCallbacks = new ArrayList<>();
-
public MultiStateCallback(String[] stateNames) {
this(stateNames, stateFlag -> null);
}
@@ -82,24 +78,6 @@
}
}
- /** Pauses callbacks. */
- public void pauseCallbacks() {
- mCallbacksPaused = true;
- }
-
- /** Immediately queues any callbacks that were pending paused. */
- public void resumeCallbacks() {
- if (!mCallbacksPaused) {
- return;
- }
- mCallbacksPaused = false;
- List<Runnable> queuedCallbacks = new ArrayList<>(mPendingCallbacks);
- mPendingCallbacks.clear();
- for (Runnable runnable : queuedCallbacks) {
- runnable.run();
- }
- }
-
/**
* Adds the provided state flags to the global state and executes any callbacks as a result.
*/
@@ -121,12 +99,7 @@
if ((mState & state) == state) {
LinkedList<Runnable> callbacks = mCallbacks.valueAt(i);
while (!callbacks.isEmpty()) {
- Runnable cb = callbacks.pollFirst();
- if (mCallbacksPaused) {
- mPendingCallbacks.add(cb);
- } else {
- cb.run();
- }
+ callbacks.pollFirst().run();
}
}
}
@@ -178,11 +151,7 @@
if (wasOn != isOn) {
ArrayList<Consumer<Boolean>> listeners = mStateChangeListeners.valueAt(i);
for (Consumer<Boolean> listener : listeners) {
- if (mCallbacksPaused) {
- mPendingCallbacks.add(() -> listener.accept(isOn));
- } else {
- listener.accept(isOn);
- }
+ listener.accept(isOn);
}
}
}
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index d19f124..687ed36 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -68,7 +68,7 @@
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
-import com.android.app.viewcapture.ViewCapture;
+import com.android.app.viewcapture.SettingsAwareViewCapture;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
@@ -1208,7 +1208,7 @@
mTaskbarManager.dumpLogs("", pw);
if (FeatureFlags.CONTINUOUS_VIEW_TREE_CAPTURE.get()) {
- ViewCapture.getInstance().dump(pw, fd, this);
+ SettingsAwareViewCapture.getInstance(this).dump(pw, fd, this);
}
}
}
diff --git a/quickstep/src/com/android/quickstep/interaction/AnimatedTaskbarView.java b/quickstep/src/com/android/quickstep/interaction/AnimatedTaskbarView.java
index e8cc45b..d706711 100644
--- a/quickstep/src/com/android/quickstep/interaction/AnimatedTaskbarView.java
+++ b/quickstep/src/com/android/quickstep/interaction/AnimatedTaskbarView.java
@@ -43,12 +43,12 @@
private View mBackground;
private View mIconContainer;
+ private View mAllAppsButton;
private View mIcon1;
private View mIcon2;
private View mIcon3;
private View mIcon4;
private View mIcon5;
- private View mIcon6;
@Nullable private Animator mRunningAnimator;
@@ -78,12 +78,12 @@
mBackground = findViewById(R.id.taskbar_background);
mIconContainer = findViewById(R.id.icon_container);
+ mAllAppsButton = findViewById(R.id.taskbar_all_apps);
mIcon1 = findViewById(R.id.taskbar_icon_1);
mIcon2 = findViewById(R.id.taskbar_icon_2);
mIcon3 = findViewById(R.id.taskbar_icon_3);
mIcon4 = findViewById(R.id.taskbar_icon_4);
mIcon5 = findViewById(R.id.taskbar_icon_5);
- mIcon6 = findViewById(R.id.taskbar_icon_6);
}
/**
@@ -92,22 +92,20 @@
public void animateDisappearanceToHotseat(ViewGroup hotseat) {
ArrayList<Animator> animators = new ArrayList<>();
int hotseatTop = hotseat.getTop();
+ int hotseatLeft = hotseat.getLeft();
- animators.add(ObjectAnimator.ofFloat(
- mBackground, View.TRANSLATION_Y, 0, mBackground.getHeight()));
animators.add(ObjectAnimator.ofFloat(mBackground, View.ALPHA, 1f, 0f));
+ animators.add(ObjectAnimator.ofFloat(mAllAppsButton, View.ALPHA, 1f, 0f));
animators.add(createIconDisappearanceToHotseatAnimator(
- mIcon1, hotseat.findViewById(R.id.hotseat_icon_1), hotseatTop));
+ mIcon1, hotseat.findViewById(R.id.hotseat_icon_1), hotseatTop, hotseatLeft));
animators.add(createIconDisappearanceToHotseatAnimator(
- mIcon2, hotseat.findViewById(R.id.hotseat_icon_2), hotseatTop));
+ mIcon2, hotseat.findViewById(R.id.hotseat_icon_2), hotseatTop, hotseatLeft));
animators.add(createIconDisappearanceToHotseatAnimator(
- mIcon3, hotseat.findViewById(R.id.hotseat_icon_3), hotseatTop));
+ mIcon3, hotseat.findViewById(R.id.hotseat_icon_3), hotseatTop, hotseatLeft));
animators.add(createIconDisappearanceToHotseatAnimator(
- mIcon4, hotseat.findViewById(R.id.hotseat_icon_4), hotseatTop));
+ mIcon4, hotseat.findViewById(R.id.hotseat_icon_4), hotseatTop, hotseatLeft));
animators.add(createIconDisappearanceToHotseatAnimator(
- mIcon5, hotseat.findViewById(R.id.hotseat_icon_5), hotseatTop));
- animators.add(createIconDisappearanceToHotseatAnimator(
- mIcon6, hotseat.findViewById(R.id.hotseat_icon_6), hotseatTop));
+ mIcon5, hotseat.findViewById(R.id.hotseat_icon_5), hotseatTop, hotseatLeft));
AnimatorSet animatorSet = new AnimatorSet();
@@ -135,22 +133,20 @@
public void animateAppearanceFromHotseat(ViewGroup hotseat) {
ArrayList<Animator> animators = new ArrayList<>();
int hotseatTop = hotseat.getTop();
+ int hotseatLeft = hotseat.getLeft();
- animators.add(ObjectAnimator.ofFloat(
- mBackground, View.TRANSLATION_Y, mBackground.getHeight(), 0));
animators.add(ObjectAnimator.ofFloat(mBackground, View.ALPHA, 0f, 1f));
+ animators.add(ObjectAnimator.ofFloat(mAllAppsButton, View.ALPHA, 0f, 1f));
animators.add(createIconAppearanceFromHotseatAnimator(
- mIcon1, hotseat.findViewById(R.id.hotseat_icon_1), hotseatTop));
+ mIcon1, hotseat.findViewById(R.id.hotseat_icon_1), hotseatTop, hotseatLeft));
animators.add(createIconAppearanceFromHotseatAnimator(
- mIcon2, hotseat.findViewById(R.id.hotseat_icon_2), hotseatTop));
+ mIcon2, hotseat.findViewById(R.id.hotseat_icon_2), hotseatTop, hotseatLeft));
animators.add(createIconAppearanceFromHotseatAnimator(
- mIcon3, hotseat.findViewById(R.id.hotseat_icon_3), hotseatTop));
+ mIcon3, hotseat.findViewById(R.id.hotseat_icon_3), hotseatTop, hotseatLeft));
animators.add(createIconAppearanceFromHotseatAnimator(
- mIcon4, hotseat.findViewById(R.id.hotseat_icon_4), hotseatTop));
+ mIcon4, hotseat.findViewById(R.id.hotseat_icon_4), hotseatTop, hotseatLeft));
animators.add(createIconAppearanceFromHotseatAnimator(
- mIcon5, hotseat.findViewById(R.id.hotseat_icon_5), hotseatTop));
- animators.add(createIconAppearanceFromHotseatAnimator(
- mIcon6, hotseat.findViewById(R.id.hotseat_icon_6), hotseatTop));
+ mIcon5, hotseat.findViewById(R.id.hotseat_icon_5), hotseatTop, hotseatLeft));
AnimatorSet animatorSet = new AnimatorSet();
@@ -166,98 +162,6 @@
start(animatorSet);
}
- /**
- * Animates this fake taskbar's disappearance to the bottom of the screen.
- */
- public void animateDisappearanceToBottom() {
- ArrayList<Animator> animators = new ArrayList<>();
-
- animators.add(ObjectAnimator.ofFloat(
- mBackground, View.TRANSLATION_Y, 0, mBackground.getHeight()));
- animators.add(ObjectAnimator.ofFloat(mBackground, View.ALPHA, 1f, 0f));
- animators.add(ObjectAnimator.ofFloat(mIconContainer, View.SCALE_X, 1f, 0f));
- animators.add(ObjectAnimator.ofFloat(mIconContainer, View.SCALE_Y, 1f, 0f));
-
- initializeIconContainerPivot();
-
- AnimatorSet animatorSet = new AnimatorSet();
-
- animatorSet.playTogether(animators);
- animatorSet.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- setVisibility(INVISIBLE);
- resetIconContainerPivot();
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- super.onAnimationCancel(animation);
- resetIconContainerPivot();
- }
-
- @Override
- public void onAnimationStart(Animator animation) {
- super.onAnimationStart(animation);
- setVisibility(VISIBLE);
- }
- });
-
- start(animatorSet);
- }
-
- /**
- * Animates this fake taskbar's appearance from the bottom of the screen.
- */
- public void animateAppearanceFromBottom() {
- ArrayList<Animator> animators = new ArrayList<>();
-
- animators.add(ObjectAnimator.ofFloat(
- mBackground, View.TRANSLATION_Y, mBackground.getHeight(), 0));
- animators.add(ObjectAnimator.ofFloat(mBackground, View.ALPHA, 0f, 1f));
- animators.add(ObjectAnimator.ofFloat(mIconContainer, View.SCALE_X, 0f, 1f));
- animators.add(ObjectAnimator.ofFloat(mIconContainer, View.SCALE_Y, 0f, 1f));
-
- initializeIconContainerPivot();
-
- AnimatorSet animatorSet = new AnimatorSet();
-
- animatorSet.playTogether(animators);
- animatorSet.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- super.onAnimationStart(animation);
- setVisibility(VISIBLE);
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- resetIconContainerPivot();
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- super.onAnimationCancel(animation);
- resetIconContainerPivot();
- }
- });
-
- start(animatorSet);
- }
-
- private void initializeIconContainerPivot() {
- mIconContainer.setPivotX(getWidth() / 2f);
- mIconContainer.setPivotY(getHeight() * 0.8f);
- }
-
- private void resetIconContainerPivot() {
- mIconContainer.resetPivot();
- mIconContainer.setScaleX(1f);
- mIconContainer.setScaleY(1f);
- }
-
private void start(Animator animator) {
if (mRunningAnimator != null) {
mRunningAnimator.cancel();
@@ -287,7 +191,7 @@
}
private Animator createIconDisappearanceToHotseatAnimator(
- View taskbarIcon, View hotseatIcon, int hotseatTop) {
+ View taskbarIcon, View hotseatIcon, int hotseatTop, int hotseatLeft) {
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofFloat(
@@ -296,7 +200,10 @@
0,
(hotseatTop + hotseatIcon.getTop()) - (getTop() + taskbarIcon.getTop())));
animators.add(ObjectAnimator.ofFloat(
- taskbarIcon, View.TRANSLATION_X, 0, hotseatIcon.getLeft() - taskbarIcon.getLeft()));
+ taskbarIcon,
+ View.TRANSLATION_X,
+ 0,
+ (hotseatLeft + hotseatIcon.getLeft()) - (getLeft() + taskbarIcon.getLeft())));
animators.add(ObjectAnimator.ofFloat(
taskbarIcon,
View.SCALE_X,
@@ -330,7 +237,7 @@
}
private Animator createIconAppearanceFromHotseatAnimator(
- View taskbarIcon, View hotseatIcon, int hotseatTop) {
+ View taskbarIcon, View hotseatIcon, int hotseatTop, int hotseatLeft) {
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofFloat(
@@ -339,7 +246,10 @@
(hotseatTop + hotseatIcon.getTop()) - (getTop() + taskbarIcon.getTop()),
0));
animators.add(ObjectAnimator.ofFloat(
- taskbarIcon, View.TRANSLATION_X, hotseatIcon.getLeft() - taskbarIcon.getLeft(), 0));
+ taskbarIcon,
+ View.TRANSLATION_X,
+ (hotseatLeft + hotseatIcon.getLeft()) - (getLeft() + taskbarIcon.getLeft()),
+ 0));
animators.add(ObjectAnimator.ofFloat(
taskbarIcon,
View.SCALE_X,
diff --git a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
index 05b246b..b00dc47 100644
--- a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
@@ -154,7 +154,6 @@
AnimatorSet animset = new AnimatorSet();
animset.playTogether(animators);
- hideFakeTaskbar(/* animateToHotseat= */ false);
animset.start();
mRunningWindowAnim = SwipeUpAnimationLogic.RunningWindowAnim.wrap(animset);
}
diff --git a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java
index 4e1521f..1e8b48d0 100644
--- a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java
@@ -76,7 +76,7 @@
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
- controller.resetFakeTaskView(false);
+ controller.resetFakeTaskViewFromOverview();
}
});
ArrayList<Animator> animators = new ArrayList<>();
diff --git a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
index 670ee9b..de93818 100644
--- a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
@@ -203,7 +203,15 @@
mRunningWindowAnim = RunningWindowAnim.wrap(animset);
}
+ void resetFakeTaskViewFromOverview() {
+ resetFakeTaskView(false, false);
+ }
+
void resetFakeTaskView(boolean animateFromHome) {
+ resetFakeTaskView(animateFromHome, true);
+ }
+
+ void resetFakeTaskView(boolean animateFromHome, boolean animateTaskbar) {
mFakeTaskView.setVisibility(View.VISIBLE);
PendingAnimation anim = new PendingAnimation(300);
anim.setFloat(mTaskViewSwipeUpAnimation
@@ -211,7 +219,9 @@
anim.setViewAlpha(mFakeTaskView, 1, ACCEL);
anim.addListener(mResetTaskView);
AnimatorSet animset = anim.buildAnim();
- showFakeTaskbar(animateFromHome);
+ if (animateTaskbar) {
+ showFakeTaskbar(animateFromHome);
+ }
animset.start();
mRunningWindowAnim = RunningWindowAnim.wrap(animset);
}
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
index fa7d848..e775ce3 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
@@ -478,8 +478,6 @@
if (animateToHotseat) {
mFakeTaskbarViewCallback = () ->
mFakeTaskbarView.animateDisappearanceToHotseat(mFakeHotseatView);
- } else {
- mFakeTaskbarViewCallback = mFakeTaskbarView::animateDisappearanceToBottom;
}
mFakeTaskbarView.post(mFakeTaskbarViewCallback);
}
@@ -494,8 +492,6 @@
if (animateFromHotseat) {
mFakeTaskbarViewCallback = () ->
mFakeTaskbarView.animateAppearanceFromHotseat(mFakeHotseatView);
- } else {
- mFakeTaskbarViewCallback = mFakeTaskbarView::animateAppearanceFromBottom;
}
mFakeTaskbarView.post(mFakeTaskbarViewCallback);
}
diff --git a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java
index 0fdd8b5..60065fb 100644
--- a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java
+++ b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java
@@ -37,7 +37,7 @@
ON_SETTLED_ON_END_TARGET, START_RECENTS_ANIMATION, FINISH_RECENTS_ANIMATION,
CANCEL_RECENTS_ANIMATION, SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION,
CLEANUP_SCREENSHOT, SCROLLER_ANIMATION_ABORTED, TASK_APPEARED, EXPECTING_TASK_APPEARED,
- FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER, LAUNCHER_DESTROYED,
+ FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER,
/**
* These GestureEvents are specifically associated to state flags that get set in
@@ -162,13 +162,6 @@
+ "before/without setting end target to new task",
writer);
break;
- case LAUNCHER_DESTROYED:
- errorDetected |= printErrorIfTrue(
- true,
- prefix,
- /* errorMessage= */ "Launcher destroyed mid-gesture",
- writer);
- break;
case STATE_GESTURE_COMPLETED:
errorDetected |= printErrorIfTrue(
!encounteredEvents.contains(GestureEvent.MOTION_UP),
diff --git a/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarKeyguardControllerTest.kt b/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarKeyguardControllerTest.kt
index 59db8c8..148e36c 100644
--- a/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarKeyguardControllerTest.kt
+++ b/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarKeyguardControllerTest.kt
@@ -19,8 +19,6 @@
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DOZING
-import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED
-import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
import org.junit.Before
@@ -34,16 +32,14 @@
class TaskbarKeyguardControllerTest : TaskbarBaseTestCase() {
- @Mock
- lateinit var baseDragLayer: TaskbarDragLayer
- @Mock
- lateinit var keyguardManager: KeyguardManager
+ @Mock lateinit var baseDragLayer: TaskbarDragLayer
+ @Mock lateinit var keyguardManager: KeyguardManager
@Before
override fun setup() {
super.setup()
whenever(taskbarActivityContext.getSystemService(KeyguardManager::class.java))
- .thenReturn(keyguardManager)
+ .thenReturn(keyguardManager)
whenever(baseDragLayer.childCount).thenReturn(0)
whenever(taskbarActivityContext.dragLayer).thenReturn(baseDragLayer)
@@ -60,41 +56,35 @@
@Test
fun keyguardShowing() {
setFlags(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING)
- verify(navbarButtonsViewController, times(1)).setKeyguardVisible(
- true /*isKeyguardVisible*/,
- false /*isKeyguardOccluded*/)
+ verify(navbarButtonsViewController, times(1))
+ .setKeyguardVisible(true /*isKeyguardVisible*/, false /*isKeyguardOccluded*/)
}
@Test
fun dozingShowing() {
setFlags(SYSUI_STATE_DEVICE_DOZING)
- verify(navbarButtonsViewController, times(1)).setKeyguardVisible(
- true /*isKeyguardVisible*/,
- false /*isKeyguardOccluded*/)
+ verify(navbarButtonsViewController, times(1))
+ .setKeyguardVisible(true /*isKeyguardVisible*/, false /*isKeyguardOccluded*/)
}
@Test
fun keyguardOccluded() {
setFlags(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED)
- verify(navbarButtonsViewController, times(1)).setKeyguardVisible(
- false /*isKeyguardVisible*/,
- true /*isKeyguardOccluded*/)
+ verify(navbarButtonsViewController, times(1))
+ .setKeyguardVisible(false /*isKeyguardVisible*/, true /*isKeyguardOccluded*/)
}
@Test
fun keyguardOccludedAndDozing() {
setFlags(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED.or(SYSUI_STATE_DEVICE_DOZING))
- verify(navbarButtonsViewController, times(1)).setKeyguardVisible(
- true /*isKeyguardVisible*/,
- true /*isKeyguardOccluded*/)
+ verify(navbarButtonsViewController, times(1))
+ .setKeyguardVisible(true /*isKeyguardVisible*/, true /*isKeyguardOccluded*/)
}
@Test
fun deviceInsecure_hideBackForBouncer() {
whenever(keyguardManager.isDeviceSecure).thenReturn(false)
- setFlags(SYSUI_STATE_OVERVIEW_DISABLED
- .or(SYSUI_STATE_HOME_DISABLED)
- .or(SYSUI_STATE_BOUNCER_SHOWING))
+ setFlags(SYSUI_STATE_BOUNCER_SHOWING)
verify(navbarButtonsViewController, times(1)).setBackForBouncer(false)
}
@@ -102,49 +92,20 @@
@Test
fun deviceSecure_showBackForBouncer() {
whenever(keyguardManager.isDeviceSecure).thenReturn(true)
- setFlags(SYSUI_STATE_OVERVIEW_DISABLED
- .or(SYSUI_STATE_HOME_DISABLED)
- .or(SYSUI_STATE_BOUNCER_SHOWING))
+ setFlags(SYSUI_STATE_BOUNCER_SHOWING)
verify(navbarButtonsViewController, times(1)).setBackForBouncer(true)
}
@Test
- fun homeShowing_hideBackForBouncer() {
- whenever(keyguardManager.isDeviceSecure).thenReturn(true)
- setFlags(SYSUI_STATE_OVERVIEW_DISABLED
- .or(SYSUI_STATE_BOUNCER_SHOWING))
-
- verify(navbarButtonsViewController, times(1)).setBackForBouncer(false)
- }
-
- @Test
- fun overviewShowing_hideBackForBouncer() {
- whenever(keyguardManager.isDeviceSecure).thenReturn(true)
- setFlags(SYSUI_STATE_HOME_DISABLED
- .or(SYSUI_STATE_BOUNCER_SHOWING))
-
- verify(navbarButtonsViewController, times(1)).setBackForBouncer(false)
- }
-
- @Test
fun backDisabled_hideBackForBouncer() {
whenever(keyguardManager.isDeviceSecure).thenReturn(true)
- setFlags(SYSUI_STATE_BACK_DISABLED
- .or(SYSUI_STATE_BOUNCER_SHOWING))
+ setFlags(SYSUI_STATE_BACK_DISABLED.or(SYSUI_STATE_BOUNCER_SHOWING))
verify(navbarButtonsViewController, times(1)).setBackForBouncer(false)
-
- // back disabled along with home and overview
- setFlags(SYSUI_STATE_BACK_DISABLED
- .or(SYSUI_STATE_HOME_DISABLED)
- .or(SYSUI_STATE_OVERVIEW_DISABLED)
- .or(SYSUI_STATE_BOUNCER_SHOWING))
-
- verify(navbarButtonsViewController, times(2)).setBackForBouncer(false)
}
private fun setFlags(flags: Int) {
taskbarKeyguardController.updateStateForSysuiFlags(flags)
}
-}
\ No newline at end of file
+}
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index a4dbf6a..62d46d3 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -32,6 +32,8 @@
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.rule.ShellCommandRule.disableHeadsUpNotification;
import static com.android.launcher3.util.rule.ShellCommandRule.getLauncherCommand;
+import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
+import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -59,6 +61,7 @@
import com.android.launcher3.util.rule.FailureWatcher;
import com.android.launcher3.util.rule.SamplerRule;
import com.android.launcher3.util.rule.ScreenRecordRule;
+import com.android.launcher3.util.rule.TestStabilityRule;
import com.android.quickstep.views.RecentsView;
import org.junit.After;
@@ -168,6 +171,7 @@
// b/143488140
//@NavigationModeSwitch
+ @TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/266606727
@Test
public void goToOverviewFromHome() {
mDevice.pressHome();
@@ -215,6 +219,7 @@
// b/143488140
//@NavigationModeSwitch
+ @TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/266606727
@Test
public void testOverview() {
startAppFast(getAppPackageName());
diff --git a/res/values/styles.xml b/res/values/styles.xml
index dfff926..6b57532 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -54,7 +54,7 @@
<item name="folderPreviewColor">@color/folder_preview_light</item>
<item name="folderBackgroundColor">@color/folder_background_light</item>
<item name="folderIconBorderColor">?android:attr/colorPrimary</item>
- <item name="folderTextColor">@color/workspace_text_color_dark</item>
+ <item name="folderTextColor">?android:attr/textColorPrimary</item>
<item name="isFolderDarkText">true</item>
<item name="folderHintColor">@color/folder_hint_text_color_dark</item>
<item name="loadingIconColor">#CCFFFFFF</item>
@@ -109,7 +109,6 @@
<item name="folderPreviewColor">@color/folder_preview_dark</item>
<item name="folderBackgroundColor">@color/folder_background_dark</item>
<item name="folderIconBorderColor">?android:attr/colorPrimary</item>
- <item name="folderTextColor">@color/workspace_text_color_light</item>
<item name="isFolderDarkText">false</item>
<item name="folderHintColor">@color/folder_hint_text_color_light</item>
<item name="isMainColorDark">true</item>
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java
index 85bd2d3..94b8cd8 100644
--- a/src/com/android/launcher3/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher3/AppWidgetResizeFrame.java
@@ -33,6 +33,7 @@
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
+import com.android.launcher3.celllayout.CellPosMapper.CellPos;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.logging.InstanceId;
@@ -268,10 +269,11 @@
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) mWidgetView.getLayoutParams();
ItemInfo widgetInfo = (ItemInfo) mWidgetView.getTag();
- lp.setCellX(widgetInfo.cellX);
- lp.setTmpCellX(widgetInfo.cellX);
- lp.setCellY(widgetInfo.cellY);
- lp.setTmpCellY(widgetInfo.cellY);
+ CellPos presenterPos = mLauncher.getCellPosMapper().mapModelToPresenter(widgetInfo);
+ lp.setCellX(presenterPos.cellX);
+ lp.setTmpCellX(presenterPos.cellX);
+ lp.setCellY(presenterPos.cellY);
+ lp.setTmpCellY(presenterPos.cellY);
lp.cellHSpan = widgetInfo.spanX;
lp.cellVSpan = widgetInfo.spanY;
lp.isLockedToGrid = true;
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 05b225c..d388ebc 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -62,6 +62,7 @@
import com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
+import com.android.launcher3.celllayout.CellPosMapper.CellPos;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.folder.PreviewBackground;
@@ -267,7 +268,7 @@
mDragCell[0] = mDragCell[1] = -1;
mDragCellSpan[0] = mDragCellSpan[1] = -1;
for (int i = 0; i < mDragOutlines.length; i++) {
- mDragOutlines[i] = new CellLayoutLayoutParams(0, 0, 0, 0, -1);
+ mDragOutlines[i] = new CellLayoutLayoutParams(0, 0, 0, 0);
}
mDragOutlinePaint.setColor(Themes.getAttrColor(context, R.attr.workspaceTextColor));
@@ -1084,8 +1085,8 @@
final int oldY = lp.y;
lp.isLockedToGrid = true;
if (permanent) {
- lp.setCellX(info.cellX = cellX);
- lp.setCellY(info.cellY = cellY);
+ lp.setCellX(cellX);
+ lp.setCellY(cellY);
} else {
lp.setTmpCellX(cellX);
lp.setTmpCellY(cellY);
@@ -1627,20 +1628,16 @@
// We do a null check here because the item info can be null in the case of the
// AllApps button in the hotseat.
if (info != null && child != dragView) {
- final boolean requiresDbUpdate = (info.cellX != lp.getTmpCellX()
- || info.cellY != lp.getTmpCellY() || info.spanX != lp.cellHSpan
- || info.spanY != lp.cellVSpan);
+ CellPos presenterPos = mActivity.getCellPosMapper().mapModelToPresenter(info);
+ final boolean requiresDbUpdate = (presenterPos.cellX != lp.getTmpCellX()
+ || presenterPos.cellY != lp.getTmpCellY() || info.spanX != lp.cellHSpan
+ || info.spanY != lp.cellVSpan || presenterPos.screenId != screenId);
lp.setCellX(lp.getTmpCellX());
- info.cellX = lp.getTmpCellX();
- info.cellY = lp.getTmpCellY();
lp.setCellY(lp.getTmpCellY());
- info.spanX = lp.cellHSpan;
- info.spanY = lp.cellVSpan;
-
if (requiresDbUpdate) {
Launcher.cast(mActivity).getModelWriter().modifyItemInDatabase(info, container,
- screenId, info.cellX, info.cellY, info.spanX, info.spanY);
+ screenId, lp.getCellX(), lp.getCellY(), lp.cellHSpan, lp.cellVSpan);
}
}
}
@@ -2792,7 +2789,8 @@
if (view instanceof LauncherAppWidgetHostView
&& view.getTag() instanceof LauncherAppWidgetInfo) {
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) view.getTag();
- mOccupied.markCells(info.cellX, info.cellY, info.spanX, info.spanY, true);
+ CellPos pos = mActivity.getCellPosMapper().mapModelToPresenter(info);
+ mOccupied.markCells(pos.cellX, pos.cellY, info.spanX, info.spanY, true);
return;
}
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
@@ -2805,7 +2803,8 @@
if (view instanceof LauncherAppWidgetHostView
&& view.getTag() instanceof LauncherAppWidgetInfo) {
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) view.getTag();
- mOccupied.markCells(info.cellX, info.cellY, info.spanX, info.spanY, false);
+ CellPos pos = mActivity.getCellPosMapper().mapModelToPresenter(info);
+ mOccupied.markCells(pos.cellX, pos.cellY, info.spanX, info.spanY, false);
return;
}
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
@@ -2858,13 +2857,13 @@
final int screenId;
final int container;
- public CellInfo(View v, ItemInfo info) {
- cellX = info.cellX;
- cellY = info.cellY;
+ public CellInfo(View v, ItemInfo info, CellPos cellPos) {
+ cellX = cellPos.cellX;
+ cellY = cellPos.cellY;
spanX = info.spanX;
spanY = info.spanY;
cell = v;
- screenId = info.screenId;
+ screenId = cellPos.screenId;
container = info.container;
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index e9b9f31..2f1f59c 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -32,6 +32,7 @@
import static com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_WIDGET_TRANSITION;
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherAnimUtils.WORKSPACE_SCALE_PROPERTY_FACTORY;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.FLAG_MULTI_PAGE;
@@ -135,6 +136,8 @@
import com.android.launcher3.allapps.BaseSearchConfig;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.PropertyListBuilder;
+import com.android.launcher3.celllayout.CellPosMapper;
+import com.android.launcher3.celllayout.CellPosMapper.CellPos;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dot.DotInfo;
@@ -406,6 +409,8 @@
private StringCache mStringCache;
private BaseSearchConfig mBaseSearchConfig;
+ private CellPosMapper mCellPosMapper = CellPosMapper.DEFAULT;
+
@Override
@TargetApi(Build.VERSION_CODES.S)
protected void onCreate(Bundle savedInstanceState) {
@@ -725,10 +730,17 @@
}
onDeviceProfileInitiated();
- mModelWriter = mModel.getWriter(getDeviceProfile().isVerticalBarLayout(), true, this);
+ mCellPosMapper = CellPosMapper.DEFAULT;
+ mModelWriter = mModel.getWriter(getDeviceProfile().isVerticalBarLayout(), true,
+ mCellPosMapper, this);
return true;
}
+ @Override
+ public CellPosMapper getCellPosMapper() {
+ return mCellPosMapper;
+ }
+
public RotationHelper getRotationHelper() {
return mRotationHelper;
}
@@ -794,16 +806,18 @@
*/
private int completeAdd(
int requestCode, Intent intent, int appWidgetId, PendingRequestArgs info) {
- int screenId = info.screenId;
- if (info.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ CellPos cellPos = getCellPosMapper().mapModelToPresenter(info);
+ int screenId = cellPos.screenId;
+ if (info.container == CONTAINER_DESKTOP) {
// When the screen id represents an actual screen (as opposed to a rank) we make sure
// that the drop page actually exists.
- screenId = ensurePendingDropLayoutExists(info.screenId);
+ screenId = ensurePendingDropLayoutExists(cellPos.screenId);
}
switch (requestCode) {
case REQUEST_CREATE_SHORTCUT:
- completeAddShortcut(intent, info.container, screenId, info.cellX, info.cellY, info);
+ completeAddShortcut(intent, info.container, screenId,
+ cellPos.cellX, cellPos.cellY, info);
announceForAccessibility(R.string.item_added_to_workspace);
break;
case REQUEST_CREATE_APPWIDGET:
@@ -899,14 +913,17 @@
ON_ACTIVITY_RESULT_ANIMATION_DELAY, false,
() -> getStateManager().goToState(NORMAL));
} else {
- if (requestArgs.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ CellPos presenterPos = getCellPosMapper().mapModelToPresenter(requestArgs);
+ if (requestArgs.container == CONTAINER_DESKTOP) {
// When the screen id represents an actual screen (as opposed to a rank)
// we make sure that the drop page actually exists.
- requestArgs.screenId =
- ensurePendingDropLayoutExists(requestArgs.screenId);
+ int newScreenId = ensurePendingDropLayoutExists(presenterPos.screenId);
+ requestArgs.screenId = getCellPosMapper().mapPresenterToModel(
+ presenterPos.cellX, presenterPos.cellY, newScreenId, CONTAINER_DESKTOP)
+ .screenId;
}
final CellLayout dropLayout =
- mWorkspace.getScreenWithId(requestArgs.screenId);
+ mWorkspace.getScreenWithId(presenterPos.screenId);
dropLayout.setDropPending(true);
final Runnable onComplete = new Runnable() {
@@ -964,9 +981,10 @@
setWaitingForResult(null);
View v = null;
- CellLayout layout = getCellLayout(pendingArgs.container, pendingArgs.screenId);
+ CellPos cellPos = getCellPosMapper().mapModelToPresenter(pendingArgs);
+ CellLayout layout = getCellLayout(pendingArgs.container, cellPos.screenId);
if (layout != null) {
- v = layout.getChildAt(pendingArgs.cellX, pendingArgs.cellY);
+ v = layout.getChildAt(cellPos.cellX, cellPos.cellY);
}
Intent intent = pendingArgs.getPendingIntent();
@@ -1002,7 +1020,8 @@
@Thunk
void completeTwoStageWidgetDrop(
final int resultCode, final int appWidgetId, final PendingRequestArgs requestArgs) {
- CellLayout cellLayout = mWorkspace.getScreenWithId(requestArgs.screenId);
+ CellLayout cellLayout = mWorkspace.getScreenWithId(
+ getCellPosMapper().mapModelToPresenter(requestArgs).screenId);
Runnable onCompleteRunnable = null;
int animationType = 0;
@@ -1493,9 +1512,9 @@
launcherInfo.sourceContainer =
((PendingRequestArgs) itemInfo).getWidgetSourceContainer();
}
-
+ CellPos presenterPos = getCellPosMapper().mapModelToPresenter(itemInfo);
getModelWriter().addItemToDatabase(launcherInfo,
- itemInfo.container, itemInfo.screenId, itemInfo.cellX, itemInfo.cellY);
+ itemInfo.container, presenterPos.screenId, presenterPos.cellX, presenterPos.cellY);
hostView.setVisibility(View.VISIBLE);
prepareAppWidget(hostView, launcherInfo);
@@ -1505,7 +1524,7 @@
// Show the widget resize frame.
if (hostView instanceof LauncherAppWidgetHostView) {
final LauncherAppWidgetHostView launcherHostView = (LauncherAppWidgetHostView) hostView;
- CellLayout cellLayout = getCellLayout(launcherInfo.container, launcherInfo.screenId);
+ CellLayout cellLayout = getCellLayout(launcherInfo.container, presenterPos.screenId);
if (mStateManager.getState() == NORMAL) {
AppWidgetResizeFrame.showForWidget(launcherHostView, cellLayout);
} else {
@@ -1887,12 +1906,17 @@
public void addPendingItem(PendingAddItemInfo info, int container, int screenId,
int[] cell, int spanX, int spanY) {
- info.container = container;
- info.screenId = screenId;
- if (cell != null) {
- info.cellX = cell[0];
- info.cellY = cell[1];
+ if (cell == null) {
+ CellPos modelPos = getCellPosMapper().mapPresenterToModel(0, 0, screenId, container);
+ info.screenId = modelPos.screenId;
+ } else {
+ CellPos modelPos = getCellPosMapper().mapPresenterToModel(
+ cell[0], cell[1], screenId, container);
+ info.screenId = modelPos.screenId;
+ info.cellX = modelPos.cellX;
+ info.cellY = modelPos.cellY;
}
+ info.container = container;
info.spanX = spanX;
info.spanY = spanY;
@@ -2455,10 +2479,11 @@
/*
* Remove colliding items.
*/
- if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
- CellLayout cl = mWorkspace.getScreenWithId(item.screenId);
- if (cl != null && cl.isOccupied(item.cellX, item.cellY)) {
- View v = cl.getChildAt(item.cellX, item.cellY);
+ CellPos presenterPos = getCellPosMapper().mapModelToPresenter(item);
+ if (item.container == CONTAINER_DESKTOP) {
+ CellLayout cl = mWorkspace.getScreenWithId(presenterPos.screenId);
+ if (cl != null && cl.isOccupied(presenterPos.cellX, presenterPos.cellY)) {
+ View v = cl.getChildAt(presenterPos.cellX, presenterPos.cellY);
if (v == null) {
Log.e(TAG, "bindItems failed when removing colliding item=" + item);
}
@@ -2484,7 +2509,7 @@
view.setScaleX(0f);
view.setScaleY(0f);
bounceAnims.add(createNewAppBounceAnimation(view, i));
- newItemsScreenId = item.screenId;
+ newItemsScreenId = presenterPos.screenId;
}
if (newView == null) {
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 2c6458b..4472383 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -37,6 +37,7 @@
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
+import com.android.launcher3.celllayout.CellPosMapper;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.logging.FileLog;
@@ -165,9 +166,9 @@
@NonNull
public ModelWriter getWriter(final boolean hasVerticalHotseat, final boolean verifyChanges,
- @Nullable final Callbacks owner) {
+ CellPosMapper cellPosMapper, @Nullable final Callbacks owner) {
return new ModelWriter(mApp.getContext(), this, mBgDataModel,
- hasVerticalHotseat, verifyChanges, owner);
+ hasVerticalHotseat, verifyChanges, cellPosMapper, owner);
}
@Override
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 460c658..df829f1 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -26,6 +26,7 @@
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
+import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT;
@@ -69,6 +70,8 @@
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
+import com.android.launcher3.celllayout.CellPosMapper;
+import com.android.launcher3.celllayout.CellPosMapper.CellPos;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dot.FolderDotInfo;
import com.android.launcher3.dragndrop.DragController;
@@ -585,7 +588,7 @@
}
int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns;
- CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1, FIRST_SCREEN_ID);
+ CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1);
lp.canReorder = false;
if (!firstPage.addViewToCellLayout(
mFirstPagePinnedItem, 0, R.id.search_container_workspace, lp, true)) {
@@ -642,7 +645,7 @@
// Inflate the cell layout, but do not add it automatically so that we can get the newly
// created CellLayout.
CellLayout newScreen = (CellLayout) LayoutInflater.from(getContext()).inflate(
- R.layout.workspace_screen, this, false /* attachToRoot */);
+ R.layout.workspace_screen, this, false /* attachToRoot */);
mWorkspaceScreens.put(screenId, newScreen);
mScreenOrder.add(insertIndex, screenId);
@@ -664,7 +667,8 @@
// If the icon was dragged from Hotseat, there is no page pair
if (isTwoPanelEnabled() && !(mDragSourceInternal.getParent() instanceof Hotseat)) {
- int pagePairScreenId = getScreenPair(dragObject.dragInfo.screenId);
+ int pagePairScreenId = getScreenPair(getCellPosMapper().mapModelToPresenter(
+ dragObject.dragInfo).screenId);
CellLayout pagePair = mWorkspaceScreens.get(pagePairScreenId);
dragSourceChildCount += pagePair.getShortcutsAndWidgets().getChildCount();
}
@@ -680,7 +684,7 @@
lastChildOnScreen = true;
}
CellLayout cl = (CellLayout) mDragSourceInternal.getParent();
- if (getLeftmostVisiblePageForIndex(indexOfChild(cl))
+ if (!FOLDABLE_SINGLE_PAGE.get() && getLeftmostVisiblePageForIndex(indexOfChild(cl))
== getLeftmostVisiblePageForIndex(getPageCount() - 1)) {
childOnFinalScreen = true;
}
@@ -1954,8 +1958,11 @@
minSpanY = item.minSpanY;
}
- droppedOnOriginalCell = item.screenId == screenId && item.container == container
- && item.cellX == mTargetCell[0] && item.cellY == mTargetCell[1];
+ CellPos originalPresenterPos = getCellPosMapper().mapModelToPresenter(item);
+ droppedOnOriginalCell = originalPresenterPos.screenId == screenId
+ && item.container == container
+ && originalPresenterPos.cellX == mTargetCell[0]
+ && originalPresenterPos.cellY == mTargetCell[1];
droppedOnOriginalCellDuringTransition = droppedOnOriginalCell && mIsSwitchingState;
// When quickly moving an item, a user may accidentally rearrange their
@@ -3434,6 +3441,11 @@
> deviceProfile.availableWidthPx * SIGNIFICANT_MOVE_SCREEN_WIDTH_PERCENTAGE;
}
+ @Override
+ public CellPosMapper getCellPosMapper() {
+ return mLauncher.getCellPosMapper();
+ }
+
/**
* Used as a workaround to ensure that the AppWidgetService receives the
* PACKAGE_ADDED broadcast before updating widgets.
diff --git a/src/com/android/launcher3/WorkspaceLayoutManager.java b/src/com/android/launcher3/WorkspaceLayoutManager.java
index bf448c9..4768773 100644
--- a/src/com/android/launcher3/WorkspaceLayoutManager.java
+++ b/src/com/android/launcher3/WorkspaceLayoutManager.java
@@ -20,6 +20,8 @@
import android.view.ViewGroup;
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
+import com.android.launcher3.celllayout.CellPosMapper;
+import com.android.launcher3.celllayout.CellPosMapper.CellPos;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.model.data.ItemInfo;
@@ -48,15 +50,16 @@
* See {@link #addInScreen}.
*/
default void addInScreenFromBind(View child, ItemInfo info) {
- int x = info.cellX;
- int y = info.cellY;
+ CellPos presenterPos = getCellPosMapper().mapModelToPresenter(info);
+ int x = presenterPos.cellX;
+ int y = presenterPos.cellY;
if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT
|| info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) {
- int screenId = info.screenId;
+ int screenId = presenterPos.screenId;
x = getHotseat().getCellXFromOrder(screenId);
y = getHotseat().getCellYFromOrder(screenId);
}
- addInScreen(child, info.container, info.screenId, x, y, info.spanX, info.spanY);
+ addInScreen(child, info.container, presenterPos.screenId, x, y, info.spanX, info.spanY);
}
/**
@@ -64,7 +67,9 @@
* See {@link #addInScreen(View, int, int, int, int, int, int)}.
*/
default void addInScreen(View child, ItemInfo info) {
- addInScreen(child, info.container, info.screenId, info.cellX, info.cellY,
+ CellPos presenterPos = getCellPosMapper().mapModelToPresenter(info);
+ addInScreen(child, info.container,
+ presenterPos.screenId, presenterPos.cellX, presenterPos.cellY,
info.spanX, info.spanY);
}
@@ -114,7 +119,7 @@
ViewGroup.LayoutParams genericLp = child.getLayoutParams();
CellLayoutLayoutParams lp;
if (genericLp == null || !(genericLp instanceof CellLayoutLayoutParams)) {
- lp = new CellLayoutLayoutParams(x, y, spanX, spanY, screenId);
+ lp = new CellLayoutLayoutParams(x, y, spanX, spanY);
} else {
lp = (CellLayoutLayoutParams) genericLp;
lp.setCellX(x);
@@ -151,6 +156,11 @@
return ItemLongClickListener.INSTANCE_WORKSPACE;
}
+ /**
+ * Returns the mapper for converting between model and presenter
+ */
+ CellPosMapper getCellPosMapper();
+
Hotseat getHotseat();
CellLayout getScreenWithId(int screenId);
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index 3bb8fb4..da47398 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -426,6 +426,10 @@
return;
}
+ RecyclerView.ItemDecoration decoration = getMainAdapterProvider().getDecorator();
+ getSearchRecyclerView().removeItemDecoration(decoration);
+ getSearchRecyclerView().addItemDecoration(decoration);
+
// replaceAppsRVcontainer() needs to use both mUsingTabs value to remove the old view AND
// showTabs value to create new view. Hence the mUsingTabs new value assignment MUST happen
// after this call.
diff --git a/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java b/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java
index 726ef05..4b6a062 100644
--- a/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java
+++ b/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java
@@ -29,8 +29,6 @@
*/
public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams {
- private int mScreenId = -1;
-
@ViewDebug.ExportedProperty
private int mCellX;
@@ -97,20 +95,17 @@
this.mCellY = source.getCellY();
this.cellHSpan = source.cellHSpan;
this.cellVSpan = source.cellVSpan;
- this.mScreenId = source.getScreenId();
this.mTmpCellX = source.getTmpCellX();
this.mTmpCellY = source.getTmpCellY();
this.useTmpCoords = source.useTmpCoords;
}
- public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan,
- int screenId) {
+ public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan) {
super(CellLayoutLayoutParams.MATCH_PARENT, CellLayoutLayoutParams.MATCH_PARENT);
this.mCellX = cellX;
this.mCellY = cellY;
this.cellHSpan = cellHSpan;
this.cellVSpan = cellVSpan;
- this.mScreenId = screenId;
}
/**
@@ -178,14 +173,6 @@
return "(" + this.getCellX() + ", " + this.getCellY() + ")";
}
- public int getScreenId() {
- return mScreenId;
- }
-
- public void setScreenId(int screenId) {
- this.mScreenId = screenId;
- }
-
/**
* Horizontal location of the item in the grid.
*/
diff --git a/src/com/android/launcher3/celllayout/CellPosMapper.java b/src/com/android/launcher3/celllayout/CellPosMapper.java
new file mode 100644
index 0000000..1891696
--- /dev/null
+++ b/src/com/android/launcher3/celllayout/CellPosMapper.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2026 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.celllayout;
+
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
+
+import com.android.launcher3.model.data.ItemInfo;
+
+import java.util.Objects;
+
+/**
+ * Class for mapping between model position and presenter position.
+ */
+public class CellPosMapper {
+
+ public static final CellPosMapper DEFAULT = new CellPosMapper();
+
+ private CellPosMapper() { }
+
+ /**
+ * Maps the position in model to the position in view
+ */
+ public CellPos mapModelToPresenter(ItemInfo info) {
+ return new CellPos(info.cellX, info.cellY, info.screenId);
+ }
+
+ /**
+ * Maps the position in view to the position in model
+ */
+ public CellPos mapPresenterToModel(int presenterX, int presenterY, int presenterScreen,
+ int container) {
+ return new CellPos(presenterX, presenterY, presenterScreen);
+ }
+
+ /**
+ * Cell mapper which maps two panels into a single layout
+ */
+ public static class TwoPanelCellPosMapper extends CellPosMapper {
+
+ private final int mColumnCount;
+
+ public TwoPanelCellPosMapper(int columnCount) {
+ mColumnCount = columnCount;
+ }
+
+ /**
+ * Maps the position in model to the position in view
+ */
+ public CellPos mapModelToPresenter(ItemInfo info) {
+ if (info.container != CONTAINER_DESKTOP || (info.screenId % 2) == 0) {
+ return super.mapModelToPresenter(info);
+ }
+ return new CellPos(info.cellX + mColumnCount, info.cellY, info.screenId - 1);
+ }
+
+ @Override
+ public CellPos mapPresenterToModel(int presenterX, int presenterY, int presenterScreen,
+ int container) {
+ if (container == CONTAINER_DESKTOP && (presenterScreen % 2) == 0
+ && presenterX >= mColumnCount) {
+ return new CellPos(presenterX - mColumnCount, presenterY, presenterScreen + 1);
+ }
+ return super.mapPresenterToModel(presenterX, presenterY, presenterScreen, container);
+ }
+ }
+
+ /**
+ * Utility class to indicate the position of a cell
+ */
+ public static class CellPos {
+ public final int cellX;
+ public final int cellY;
+ public final int screenId;
+
+ public CellPos(int cellX, int cellY, int screenId) {
+ this.cellX = cellX;
+ this.cellY = cellY;
+ this.screenId = screenId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof CellPos)) return false;
+ CellPos cellPos = (CellPos) o;
+ return cellX == cellPos.cellX && cellY == cellPos.cellY && screenId == cellPos.screenId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(cellX, cellY, screenId);
+ }
+ }
+}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 2841129..a24b30f 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -305,6 +305,9 @@
"FOLDABLE_WORKSPACE_REORDER", true,
"In foldables, when reordering the icons and widgets, is now going to use both sides");
+ public static final BooleanFlag ENABLE_QUICK_LAUNCH_V3 = new DeviceFlag(
+ "ENABLE_QUICK_LAUNCH_V3", false, "Quick Launch V3");
+
public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
"ENABLE_WIDGET_PICKER_DEPTH", true, "Enable changing depth in widget picker.");
@@ -331,6 +334,10 @@
"ENABLE_DOWNLOAD_APP_UX_V2", true, "Updates the download app UX"
+ " to have better visuals");
+ public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V3 = getDebugFlag(
+ "ENABLE_DOWNLOAD_APP_UX_V3", false, "Updates the download app UX"
+ + " to have better visuals, improve contrast, and color");
+
public static final BooleanFlag ENABLE_TASKBAR_REVISED_THRESHOLDS = getDebugFlag(
"ENABLE_TASKBAR_REVISED_THRESHOLDS", true,
"Uses revised thresholds for transient taskbar.");
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index 10a2637..d43731b 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -222,7 +222,7 @@
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) textView.getLayoutParams();
if (lp == null) {
textView.setLayoutParams(new CellLayoutLayoutParams(
- item.cellX, item.cellY, item.spanX, item.spanY, item.screenId));
+ item.cellX, item.cellY, item.spanX, item.spanY));
} else {
lp.setCellX(item.cellX);
lp.setCellY(item.cellY);
diff --git a/src/com/android/launcher3/folder/LauncherDelegate.java b/src/com/android/launcher3/folder/LauncherDelegate.java
index 1f0a011..3e55425 100644
--- a/src/com/android/launcher3/folder/LauncherDelegate.java
+++ b/src/com/android/launcher3/folder/LauncherDelegate.java
@@ -28,6 +28,7 @@
import com.android.launcher3.DropTarget;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.celllayout.CellPosMapper;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
@@ -177,7 +178,7 @@
ModelWriter getModelWriter() {
if (mWriter == null) {
mWriter = LauncherAppState.getInstance((Context) mContext).getModel()
- .getWriter(false, false, null);
+ .getWriter(false, false, CellPosMapper.DEFAULT, null);
}
return mWriter;
}
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index 4810b15..b061f8f 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -75,6 +75,7 @@
import com.android.launcher3.Workspace;
import com.android.launcher3.WorkspaceLayoutManager;
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
+import com.android.launcher3.celllayout.CellPosMapper;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.icons.BaseIconFactory;
@@ -348,6 +349,11 @@
return mWorkspaceScreens.get(screenId);
}
+ @Override
+ public CellPosMapper getCellPosMapper() {
+ return CellPosMapper.DEFAULT;
+ }
+
private void inflateAndAddIcon(WorkspaceItemInfo info) {
CellLayout screen = mWorkspaceScreens.get(info.screenId);
BubbleTextView icon = (BubbleTextView) mHomeElementInflater.inflate(
@@ -539,10 +545,9 @@
// Add first page QSB
if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID);
- View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen,
- false);
- CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, firstScreen.getCountX(),
- 1, FIRST_SCREEN_ID);
+ View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen, false);
+ CellLayoutLayoutParams lp = new CellLayoutLayoutParams(
+ 0, 0, firstScreen.getCountX(), 1);
lp.canReorder = false;
firstScreen.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
}
diff --git a/src/com/android/launcher3/model/BaseModelUpdateTask.java b/src/com/android/launcher3/model/BaseModelUpdateTask.java
index 74a2c5d..01e58f2 100644
--- a/src/com/android/launcher3/model/BaseModelUpdateTask.java
+++ b/src/com/android/launcher3/model/BaseModelUpdateTask.java
@@ -24,6 +24,7 @@
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.LauncherModel.ModelUpdateTask;
+import com.android.launcher3.celllayout.CellPosMapper;
import com.android.launcher3.model.BgDataModel.Callbacks;
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
import com.android.launcher3.model.data.AppInfo;
@@ -96,7 +97,8 @@
public ModelWriter getModelWriter() {
// Updates from model task, do not deal with icon position in hotseat. Also no need to
// verify changes as the ModelTasks always push the changes to callbacks
- return mModel.getWriter(false /* hasVerticalHotseat */, false /* verifyChanges */, null);
+ return mModel.getWriter(false /* hasVerticalHotseat */, false /* verifyChanges */,
+ CellPosMapper.DEFAULT, null);
}
public void bindUpdatedWorkspaceItems(@NonNull final List<WorkspaceItemInfo> allUpdates) {
diff --git a/src/com/android/launcher3/model/ModelWriter.java b/src/com/android/launcher3/model/ModelWriter.java
index f444bd5..772ffa4 100644
--- a/src/com/android/launcher3/model/ModelWriter.java
+++ b/src/com/android/launcher3/model/ModelWriter.java
@@ -37,6 +37,8 @@
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.LauncherSettings.Settings;
import com.android.launcher3.Utilities;
+import com.android.launcher3.celllayout.CellPosMapper;
+import com.android.launcher3.celllayout.CellPosMapper.CellPos;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.model.BgDataModel.Callbacks;
@@ -81,9 +83,10 @@
// Keep track of delete operations that occur when an Undo option is present; we may not commit.
private final List<Runnable> mDeleteRunnables = new ArrayList<>();
private boolean mPreparingToUndo;
+ private final CellPosMapper mCellPosMapper;
public ModelWriter(Context context, LauncherModel model, BgDataModel dataModel,
- boolean hasVerticalHotseat, boolean verifyChanges,
+ boolean hasVerticalHotseat, boolean verifyChanges, CellPosMapper cellPosMapper,
@Nullable Callbacks owner) {
mContext = context;
mModel = model;
@@ -91,21 +94,24 @@
mHasVerticalHotseat = hasVerticalHotseat;
mVerifyChanges = verifyChanges;
mOwner = owner;
+ mCellPosMapper = cellPosMapper;
mUiExecutor = Executors.MAIN_EXECUTOR;
}
private void updateItemInfoProps(
ItemInfo item, int container, int screenId, int cellX, int cellY) {
+ CellPos modelPos = mCellPosMapper.mapPresenterToModel(cellX, cellY, screenId, container);
+
item.container = container;
- item.cellX = cellX;
- item.cellY = cellY;
+ item.cellX = modelPos.cellX;
+ item.cellY = modelPos.cellY;
// We store hotseat items in canonical form which is this orientation invariant position
// in the hotseat
if (container == Favorites.CONTAINER_HOTSEAT) {
item.screenId = mHasVerticalHotseat
? LauncherAppState.getIDP(mContext).numDatabaseHotseatIcons - cellY - 1 : cellX;
} else {
- item.screenId = screenId;
+ item.screenId = modelPos.screenId;
}
}
diff --git a/src/com/android/launcher3/touch/ItemLongClickListener.java b/src/com/android/launcher3/touch/ItemLongClickListener.java
index 1421ece..7db7b0d 100644
--- a/src/com/android/launcher3/touch/ItemLongClickListener.java
+++ b/src/com/android/launcher3/touch/ItemLongClickListener.java
@@ -80,7 +80,8 @@
}
}
- CellLayout.CellInfo longClickCellInfo = new CellLayout.CellInfo(v, info);
+ CellLayout.CellInfo longClickCellInfo = new CellLayout.CellInfo(v, info,
+ launcher.getCellPosMapper().mapModelToPresenter(info));
launcher.getWorkspace().startDrag(longClickCellInfo, dragOptions);
}
diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java
index fe60eba..2ab4601 100644
--- a/src/com/android/launcher3/views/ActivityContext.java
+++ b/src/com/android/launcher3/views/ActivityContext.java
@@ -56,6 +56,7 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
+import com.android.launcher3.celllayout.CellPosMapper;
import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.folder.FolderIcon;
@@ -459,6 +460,10 @@
return false;
}
+ default CellPosMapper getCellPosMapper() {
+ return CellPosMapper.DEFAULT;
+ }
+
/**
* Returns the ActivityContext associated with the given Context, or throws an exception if
* the Context is not associated with any ActivityContext.
diff --git a/tests/src/com/android/launcher3/celllayout/CellPosMapperTest.java b/tests/src/com/android/launcher3/celllayout/CellPosMapperTest.java
new file mode 100644
index 0000000..29efb18
--- /dev/null
+++ b/tests/src/com/android/launcher3/celllayout/CellPosMapperTest.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.celllayout;
+
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+
+import com.android.launcher3.celllayout.CellPosMapper.CellPos;
+import com.android.launcher3.celllayout.CellPosMapper.TwoPanelCellPosMapper;
+import com.android.launcher3.model.data.ItemInfo;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests for {@link CellPosMapper}
+ */
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class CellPosMapperTest {
+
+ @Test
+ public void testMapModelToPresenter_default() {
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(0, 0, 0, CONTAINER_DESKTOP))).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(0, 0, 1, CONTAINER_DESKTOP))).isEqualTo(new CellPos(0, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(5, 0, 1, CONTAINER_DESKTOP))).isEqualTo(new CellPos(5, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(5, 0, 0, CONTAINER_DESKTOP))).isEqualTo(new CellPos(5, 0, 0));
+
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(0, 0, 0, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(0, 0, 1, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(0, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(5, 0, 1, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(5, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapModelToPresenter(
+ createInfo(5, 0, 0, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(5, 0, 0));
+ }
+
+ @Test
+ public void testMapPresenterToModel_default() {
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 0, 0, 0, CONTAINER_DESKTOP)).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 0, 0, 1, CONTAINER_DESKTOP)).isEqualTo(new CellPos(0, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 5, 0, 1, CONTAINER_DESKTOP)).isEqualTo(new CellPos(5, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 5, 0, 0, CONTAINER_DESKTOP)).isEqualTo(new CellPos(5, 0, 0));
+
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 0, 0, 0, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 0, 0, 1, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(0, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 5, 0, 1, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(5, 0, 1));
+ assertThat(CellPosMapper.DEFAULT.mapPresenterToModel(
+ 5, 0, 0, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(5, 0, 0));
+ }
+
+ @Test
+ public void testMapModelToPresenter_twoPanel() {
+ CellPosMapper mapper = new TwoPanelCellPosMapper(8);
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(0, 0, 0, CONTAINER_DESKTOP))).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(0, 0, 1, CONTAINER_DESKTOP))).isEqualTo(new CellPos(8, 0, 0));
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(5, 0, 1, CONTAINER_DESKTOP))).isEqualTo(new CellPos(13, 0, 0));
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(5, 0, 0, CONTAINER_DESKTOP))).isEqualTo(new CellPos(5, 0, 0));
+
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(0, 0, 0, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(0, 0, 1, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(0, 0, 1));
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(5, 0, 1, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(5, 0, 1));
+ assertThat(mapper.mapModelToPresenter(
+ createInfo(5, 0, 0, CONTAINER_HOTSEAT))).isEqualTo(new CellPos(5, 0, 0));
+ }
+
+ @Test
+ public void testMapPresenterToModel_twoPanel() {
+ CellPosMapper mapper = new TwoPanelCellPosMapper(3);
+ assertThat(mapper.mapPresenterToModel(
+ 0, 0, 0, CONTAINER_DESKTOP)).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(mapper.mapPresenterToModel(
+ 0, 0, 1, CONTAINER_DESKTOP)).isEqualTo(new CellPos(0, 0, 1));
+ assertThat(mapper.mapPresenterToModel(
+ 5, 0, 1, CONTAINER_DESKTOP)).isEqualTo(new CellPos(5, 0, 1));
+ assertThat(mapper.mapPresenterToModel(
+ 5, 0, 0, CONTAINER_DESKTOP)).isEqualTo(new CellPos(2, 0, 1));
+
+ assertThat(mapper.mapPresenterToModel(
+ 0, 0, 0, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(0, 0, 0));
+ assertThat(mapper.mapPresenterToModel(
+ 0, 0, 1, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(0, 0, 1));
+ assertThat(mapper.mapPresenterToModel(
+ 5, 0, 1, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(5, 0, 1));
+ assertThat(mapper.mapPresenterToModel(
+ 5, 0, 0, CONTAINER_HOTSEAT)).isEqualTo(new CellPos(5, 0, 0));
+ }
+
+ private ItemInfo createInfo(int cellX, int cellY, int screen, int container) {
+ ItemInfo info = new ItemInfo();
+ info.cellX = cellX;
+ info.cellY = cellY;
+ info.screenId = screen;
+ info.container = container;
+ return info;
+ }
+}