Snap for 13147095 from eb808032f1 to 25Q3-release
Change-Id: I3c085130801e9cd0b9b51e737124026da8053038
This commit is contained in:
commit
7135fbfe4c
324 files changed
+9745
-6079
No files matched your search
@@ -455,6 +455,9 @@ android_app {
|
||||
extra_check_modules: ["Launcher3LintChecker"],
|
||||
baseline_filename: "lint-baseline.xml",
|
||||
},
|
||||
kotlincflags: [
|
||||
"-Xjvm-default=all",
|
||||
],
|
||||
}
|
||||
|
||||
// Library with all the dependencies for building quickstep
|
||||
@@ -519,6 +522,9 @@ android_library {
|
||||
min_sdk_version: "current",
|
||||
// TODO(b/319712088): re-enable use_resource_processor
|
||||
use_resource_processor: false,
|
||||
kotlincflags: [
|
||||
"-Xjvm-default=all",
|
||||
],
|
||||
}
|
||||
|
||||
// Library with all the source code and dependencies for building Quickstep
|
||||
@@ -552,6 +558,9 @@ android_library {
|
||||
min_sdk_version: "current",
|
||||
// TODO(b/319712088): re-enable use_resource_processor
|
||||
use_resource_processor: false,
|
||||
kotlincflags: [
|
||||
"-Xjvm-default=all",
|
||||
],
|
||||
}
|
||||
|
||||
// Build rule for Quickstep app.
|
||||
|
||||
@@ -131,13 +131,11 @@
|
||||
android:writePermission="${applicationId}.permission.WRITE_SETTINGS"
|
||||
android:readPermission="${applicationId}.permission.READ_SETTINGS" />
|
||||
|
||||
<!--
|
||||
The content provider for exposing various launcher grid options.
|
||||
TODO: Add proper permissions
|
||||
-->
|
||||
<!-- The content provider for exposing various launcher grid options. -->
|
||||
<provider
|
||||
android:name="com.android.launcher3.graphics.GridCustomizationsProvider"
|
||||
android:name="com.android.launcher3.graphics.LauncherCustomizationProvider"
|
||||
android:authorities="${applicationId}.grid_control"
|
||||
android:permission="android.permission.BIND_WALLPAPER"
|
||||
android:exported="true" />
|
||||
|
||||
<!--
|
||||
|
||||
@@ -622,3 +622,17 @@ flag {
|
||||
description: "Enables custom theme manager in Launcher"
|
||||
bug: "381897614"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_alt_tab_kqs_flatenning"
|
||||
namespace: "lse_desktop_experience"
|
||||
description: "Enable Alt + Tab KQS view to show apps in flattened structure"
|
||||
bug: "382769617"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_gesture_nav_on_connected_displays"
|
||||
namespace: "lse_desktop_experience"
|
||||
description: "Enables gesture navigation handling on connected displays"
|
||||
bug: "382130680"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package: "com.android.launcher3"
|
||||
container: "system_ext"
|
||||
|
||||
flag {
|
||||
name: "enable_growth_nudge"
|
||||
namespace: "desktop_oobe"
|
||||
description: "Add growth nudge in launcher"
|
||||
bug: "396165728"
|
||||
}
|
||||
@@ -96,3 +96,17 @@ flag {
|
||||
description: "Enable overview on connected displays."
|
||||
bug: "363251602"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_overview_background_wallpaper_blur"
|
||||
namespace: "launcher_overview"
|
||||
description: "Enable wallpaper blur in overview."
|
||||
bug: "369975912"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_overview_desktop_tile_wallpaper_background"
|
||||
namespace: "launcher_overview"
|
||||
description: "Enable wallpaper background for desktop tasks in overview."
|
||||
bug: "363257721"
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
* Utility class for defining singletons which are initiated on main thread.
|
||||
*/
|
||||
public class MainThreadInitializedObject<T extends SafeCloseable> {
|
||||
|
||||
private final ObjectProvider<T> mProvider;
|
||||
private T mValue;
|
||||
|
||||
public MainThreadInitializedObject(ObjectProvider<T> provider) {
|
||||
mProvider = provider;
|
||||
}
|
||||
|
||||
public T get(Context context) {
|
||||
Context app = context.getApplicationContext();
|
||||
if (app instanceof ObjectSandbox sc) {
|
||||
return sc.getObject(this);
|
||||
}
|
||||
|
||||
if (mValue == null) {
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
mValue = TraceHelper.allowIpcs("main.thread.object", () -> mProvider.get(app));
|
||||
} else {
|
||||
try {
|
||||
return MAIN_EXECUTOR.submit(() -> get(context)).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mValue;
|
||||
}
|
||||
|
||||
public interface ObjectProvider<T> {
|
||||
|
||||
T get(Context context);
|
||||
}
|
||||
|
||||
/** Sandbox for isolating {@link MainThreadInitializedObject} instances from Launcher. */
|
||||
public interface ObjectSandbox {
|
||||
|
||||
/**
|
||||
* Find a cached object from mObjectMap if we have already created one. If not, generate
|
||||
* an object using the provider.
|
||||
*/
|
||||
<T extends SafeCloseable> T getObject(MainThreadInitializedObject<T> object);
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,17 @@
|
||||
|
||||
package com.android.launcher3.dagger
|
||||
|
||||
import com.android.launcher3.model.ModelDelegate
|
||||
import com.android.launcher3.model.QuickstepModelDelegate
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
|
||||
/**
|
||||
* Module containing bindings for the final derivative app, an implementation of this module should
|
||||
* be included in the final app code.
|
||||
*/
|
||||
@Module abstract class AppModule {}
|
||||
@Module
|
||||
abstract class AppModule {
|
||||
|
||||
@Binds abstract fun bindModelDelegate(impl: QuickstepModelDelegate): ModelDelegate
|
||||
}
|
||||
@@ -29,7 +29,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true"
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -49,11 +48,10 @@
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/text_content_view"
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/allset_page_margin_horizontal"
|
||||
android:layout_marginEnd="@dimen/allset_page_margin_horizontal"
|
||||
android:paddingHorizontal="@dimen/allset_page_padding_horizontal"
|
||||
android:layoutDirection="locale"
|
||||
android:textDirection="locale"
|
||||
android:forceHasOverlappingRendering="false"
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<TextView
|
||||
android:id="@+id/icon_text_collapsed"
|
||||
android:layout_width="@dimen/task_thumbnail_icon_menu_text_collapsed_max_width"
|
||||
android:layout_height="@dimen/task_thumbnail_icon_menu_app_icon_collapsed_size"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
@@ -62,7 +62,7 @@
|
||||
<TextView
|
||||
android:id="@+id/icon_text_expanded"
|
||||
android:layout_width="@dimen/task_thumbnail_icon_menu_text_expanded_max_width"
|
||||
android:layout_height="@dimen/task_thumbnail_icon_menu_app_icon_collapsed_size"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
|
||||
@@ -48,13 +48,13 @@
|
||||
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/text"
|
||||
app:layout_constraintBottom_toTopOf="@id/small_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<TextView
|
||||
style="@style/KeyboardQuickSwitchText.OnTaskView"
|
||||
android:id="@+id/text"
|
||||
android:id="@+id/small_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
android:layout_above="@id/gesture_tutorial_fragment_action_button"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:screenReaderFocusable="true"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
@@ -146,8 +147,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="104dp"
|
||||
android:accessibilityHeading="true"
|
||||
android:accessibilityTraversalBefore="@id/gesture_tutorial_fragment_feedback_subtitle"
|
||||
android:gravity="top"
|
||||
android:lineSpacingExtra="-1sp"
|
||||
android:textAppearance="@style/TextAppearance.GestureTutorial.MainTitle"
|
||||
@@ -162,8 +161,6 @@
|
||||
android:layout_marginTop="24dp"
|
||||
android:lineSpacingExtra="4sp"
|
||||
android:textAppearance="@style/TextAppearance.GestureTutorial.MainSubtitle"
|
||||
android:accessibilityTraversalAfter="@id/gesture_tutorial_fragment_feedback_title"
|
||||
android:accessibilityTraversalBefore="@id/gesture_tutorial_fragment_action_button"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_title" />
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/task_thumbnail_view_header"
|
||||
android:background="@drawable/task_thumbnail_header_bg">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -61,6 +62,7 @@
|
||||
android:layout_marginStart="@dimen/task_thumbnail_header_margin_between_views"
|
||||
android:src="@drawable/task_header_close_button"
|
||||
android:tint="@android:color/darker_gray"
|
||||
android:background="@null"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:id="@+id/taskbar_edu_title"
|
||||
style="@style/TextAppearance.TaskbarEduTooltip.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
app:layout_constraintEnd_toEndOf="@id/splitscreen_text"
|
||||
app:layout_constraintStart_toStartOf="@id/splitscreen_text"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
app:layout_constraintTop_toBottomOf="@id/taskbar_edu_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splitscreen_text"
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
app:layout_constraintEnd_toEndOf="@id/pinning_text"
|
||||
app:layout_constraintStart_toStartOf="@id/pinning_text"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
app:layout_constraintTop_toBottomOf="@id/taskbar_edu_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pinning_text"
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
app:layout_constraintEnd_toEndOf="@id/suggestions_text"
|
||||
app:layout_constraintStart_toStartOf="@id/suggestions_text"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
app:layout_constraintTop_toBottomOf="@id/taskbar_edu_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/suggestions_text"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:id="@+id/taskbar_edu_title"
|
||||
style="@style/TextAppearance.TaskbarEduTooltip.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -37,7 +37,7 @@
|
||||
app:layout_constraintBottom_toTopOf="@id/pinning_text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/taskbar_edu_title"
|
||||
app:lottie_rawRes="@raw/taskbar_edu_pinning"
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true" />
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:id="@+id/taskbar_edu_title"
|
||||
style="@style/TextAppearance.TaskbarEduTooltip.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -37,7 +37,7 @@
|
||||
app:layout_constraintBottom_toTopOf="@id/search_edu_text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/taskbar_edu_title"
|
||||
app:lottie_rawRes="@raw/taskbar_edu_search"
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true" />
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:id="@+id/taskbar_edu_title"
|
||||
style="@style/TextAppearance.TaskbarEduTooltip.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -36,7 +36,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/taskbar_edu_title"
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_rawRes="@raw/taskbar_edu_stashing" />
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
<string name="taskbar_edu_pinning_title" msgid="210102174154211712">"Taskleiste immer anzeigen"</string>
|
||||
<string name="taskbar_edu_pinning_standalone" msgid="2636919474366410467">"Damit die Taskleiste immer unten angezeigt wird, halte den Teiler gedrückt"</string>
|
||||
<string name="taskbar_search_edu_title" msgid="5569194922234364530">"Aktionstaste gedrückt halten, um auf dem Bildschirm zu suchen"</string>
|
||||
<string name="taskbar_edu_search_disclosure" msgid="8734536088447779686">"Dieses Produkt verwendet den ausgewählten Teil deines Bildschirms für die Suche. Es gelten die <xliff:g id="BEGIN_PRIVACY_LINK"><a href="%1$s"></xliff:g>Datenschutzerklärung<xliff:g id="END_PRIVACY_LINK"></a></xliff:g> und die <xliff:g id="BEGIN_TOS_LINK"><a href="%2$s"></xliff:g>Nutzungsbedingungen<xliff:g id="END_TOS_LINK"></a></xliff:g> von Google."</string>
|
||||
<string name="taskbar_edu_search_disclosure" msgid="8734536088447779686">"Dieses Produkt sucht dann anhand des ausgewählten Teils deines Displays nach weiteren Informationen. Es gelten die <xliff:g id="BEGIN_PRIVACY_LINK"><a href="%1$s"></xliff:g>Datenschutzerklärung<xliff:g id="END_PRIVACY_LINK"></a></xliff:g> und die <xliff:g id="BEGIN_TOS_LINK"><a href="%2$s"></xliff:g>Nutzungsbedingungen<xliff:g id="END_TOS_LINK"></a></xliff:g> von Google."</string>
|
||||
<string name="taskbar_edu_close" msgid="887022990168191073">"Schließen"</string>
|
||||
<string name="taskbar_edu_done" msgid="6880178093977704569">"Fertig"</string>
|
||||
<string name="taskbar_button_home" msgid="2151398979630664652">"Startbildschirm"</string>
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
<string name="taskbar_edu_pinning_title" msgid="210102174154211712">"Mostrar siempre la Barra de tareas"</string>
|
||||
<string name="taskbar_edu_pinning_standalone" msgid="2636919474366410467">"Mantén presionado el divisor para mostrar siempre la Barra de tareas en la parte inferior de la pantalla"</string>
|
||||
<string name="taskbar_search_edu_title" msgid="5569194922234364530">"Mantén presionada la tecla de acción para buscar qué hay en la pantalla"</string>
|
||||
<string name="taskbar_edu_search_disclosure" msgid="8734536088447779686">"Este producto usa la parte seleccionada de la pantalla para buscar. Se aplican la <xliff:g id="BEGIN_PRIVACY_LINK"><a href="%1$s"></xliff:g>Política de Privacidad<xliff:g id="END_PRIVACY_LINK"></a></xliff:g> y las <xliff:g id="BEGIN_TOS_LINK"><a href="%2$s"></xliff:g>Condiciones del Servicio<xliff:g id="END_TOS_LINK"></a></xliff:g> de Google."</string>
|
||||
<string name="taskbar_edu_search_disclosure" msgid="8734536088447779686">"Este producto usa la parte seleccionada de la pantalla para hacer búsquedas. Se aplican la <xliff:g id="BEGIN_PRIVACY_LINK"><a href="%1$s"></xliff:g>Política de Privacidad<xliff:g id="END_PRIVACY_LINK"></a></xliff:g> y las <xliff:g id="BEGIN_TOS_LINK"><a href="%2$s"></xliff:g>Condiciones del Servicio<xliff:g id="END_TOS_LINK"></a></xliff:g> de Google."</string>
|
||||
<string name="taskbar_edu_close" msgid="887022990168191073">"Cerrar"</string>
|
||||
<string name="taskbar_edu_done" msgid="6880178093977704569">"Listo"</string>
|
||||
<string name="taskbar_button_home" msgid="2151398979630664652">"Botón de inicio"</string>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<string name="allset_title" msgid="5021126669778966707">"Tout est prêt!"</string>
|
||||
<string name="allset_hint" msgid="459504134589971527">"Balayez l\'écran vers le haut pour accéder à l\'écran d\'accueil"</string>
|
||||
<string name="allset_button_hint" msgid="2395219947744706291">"Toucher le bouton d\'accueil pour passer sur votre écran d\'accueil"</string>
|
||||
<string name="allset_description_generic" msgid="5385500062202019855">"Vous êtes maintenant prêt à utiliser votre <xliff:g id="DEVICE">%1$s</xliff:g>"</string>
|
||||
<string name="allset_description_generic" msgid="5385500062202019855">"Vous êtes maintenant prêt à utiliser votre <xliff:g id="DEVICE">%1$s</xliff:g>."</string>
|
||||
<string name="default_device_name" msgid="6660656727127422487">"appareil"</string>
|
||||
<string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Paramètres de navigation du système"</annotation></string>
|
||||
<string name="action_share" msgid="2648470652637092375">"Partager"</string>
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<string name="action_share" msgid="2648470652637092375">"Compartir"</string>
|
||||
<string name="action_screenshot" msgid="8171125848358142917">"Facer captura"</string>
|
||||
<string name="action_split" msgid="2098009717623550676">"Dividir"</string>
|
||||
<string name="action_save_app_pair" msgid="5974823919237645229">"Gardar parella apps"</string>
|
||||
<string name="action_save_app_pair" msgid="5974823919237645229">"Gardar parella de apps"</string>
|
||||
<string name="toast_split_select_app" msgid="8464310533320556058">"Para usar a pantalla dividida, toca outra app"</string>
|
||||
<string name="toast_contextual_split_select_app" msgid="433510957123687090">"Escolle outra aplicación para usar a pantalla dividida."</string>
|
||||
<string name="toast_split_select_app_cancel" msgid="1939025102486630426">"Cancelar"</string>
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
<string name="taskbar_edu_pinning_title" msgid="210102174154211712">"Sempre mostrar a Barra de tarefas"</string>
|
||||
<string name="taskbar_edu_pinning_standalone" msgid="2636919474366410467">"Toque e pressione o divisor para sempre mostrar a Barra de tarefas na parte de baixo da tela"</string>
|
||||
<string name="taskbar_search_edu_title" msgid="5569194922234364530">"Toque na tecla de ação e pressione para pesquisar o que está na tela"</string>
|
||||
<string name="taskbar_edu_search_disclosure" msgid="8734536088447779686">"O produto usa a parte selecionada da tela para pesquisar. O uso desses dados está sujeito à <xliff:g id="BEGIN_PRIVACY_LINK"><a href="%1$s"></xliff:g>Política de Privacidade<xliff:g id="END_PRIVACY_LINK"></a></xliff:g> e aos <xliff:g id="BEGIN_TOS_LINK"><a href="%2$s"></xliff:g>Termos de Serviço<xliff:g id="END_TOS_LINK"></a></xliff:g> do Google."</string>
|
||||
<string name="taskbar_edu_search_disclosure" msgid="8734536088447779686">"Este produto usa a parte selecionada da tela para pesquisar. O uso desses dados está sujeito à <xliff:g id="BEGIN_PRIVACY_LINK"><a href="%1$s"></xliff:g>Política de Privacidade<xliff:g id="END_PRIVACY_LINK"></a></xliff:g> e aos <xliff:g id="BEGIN_TOS_LINK"><a href="%2$s"></xliff:g>Termos de Serviço<xliff:g id="END_TOS_LINK"></a></xliff:g> do Google."</string>
|
||||
<string name="taskbar_edu_close" msgid="887022990168191073">"Fechar"</string>
|
||||
<string name="taskbar_edu_done" msgid="6880178093977704569">"Concluído"</string>
|
||||
<string name="taskbar_button_home" msgid="2151398979630664652">"Início"</string>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
-->
|
||||
<resources>
|
||||
<!-- All Set page -->
|
||||
<dimen name="allset_page_margin_horizontal">48dp</dimen>
|
||||
<dimen name="allset_page_padding_horizontal">48dp</dimen>
|
||||
|
||||
<!-- Gesture Tutorial menu page -->
|
||||
<dimen name="gesture_tutorial_menu_padding_horizontal">48dp</dimen>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<dimen name="overview_actions_top_margin">24dp</dimen>
|
||||
|
||||
<!-- All Set page -->
|
||||
<dimen name="allset_page_margin_horizontal">120dp</dimen>
|
||||
<dimen name="allset_page_padding_horizontal">120dp</dimen>
|
||||
<dimen name="allset_page_allset_text_size">38sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size">15sp</dimen>
|
||||
</resources>
|
||||
@@ -92,7 +92,7 @@
|
||||
<string name="allset_button_hint" msgid="2395219947744706291">"Натисніть кнопку головного екрана, щоб відкрити його"</string>
|
||||
<string name="allset_description_generic" msgid="5385500062202019855">"Тепер ви можете використовувати <xliff:g id="DEVICE">%1$s</xliff:g>"</string>
|
||||
<string name="default_device_name" msgid="6660656727127422487">"пристрій"</string>
|
||||
<string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Системні налаштування навігації"</annotation></string>
|
||||
<string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Налаштування навігації в системі"</annotation></string>
|
||||
<string name="action_share" msgid="2648470652637092375">"Поділитися"</string>
|
||||
<string name="action_screenshot" msgid="8171125848358142917">"Знімок екрана"</string>
|
||||
<string name="action_split" msgid="2098009717623550676">"Розділити"</string>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<string name="allset_title" msgid="5021126669778966707">"Hammasi tayyor!"</string>
|
||||
<string name="allset_hint" msgid="459504134589971527">"Boshiga qaytish uchun tepaga suring"</string>
|
||||
<string name="allset_button_hint" msgid="2395219947744706291">"Bosh ekranga oʻtish uchun bosh ekran tugmasini bosing"</string>
|
||||
<string name="allset_description_generic" msgid="5385500062202019855">"<xliff:g id="DEVICE">%1$s</xliff:g> xizmatga tayyor"</string>
|
||||
<string name="allset_description_generic" msgid="5385500062202019855">"Sizning <xliff:g id="DEVICE">%1$s</xliff:g> xizmatga tayyor"</string>
|
||||
<string name="default_device_name" msgid="6660656727127422487">"qurilma"</string>
|
||||
<string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Tizim navigatsiya sozlamalari"</annotation></string>
|
||||
<string name="action_share" msgid="2648470652637092375">"Ulashish"</string>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
<string name="instant_app_resolver_class" translatable="false">com.android.quickstep.InstantAppResolverImpl</string>
|
||||
<string name="app_launch_tracker_class" translatable="false">com.android.launcher3.appprediction.PredictionAppTracker</string>
|
||||
<string name="main_process_initializer_class" translatable="false">com.android.quickstep.QuickstepProcessInitializer</string>
|
||||
<string name="model_delegate_class" translatable="false">com.android.launcher3.model.QuickstepModelDelegate</string>
|
||||
<string name="secondary_display_predictions_class" translatable="false">com.android.launcher3.secondarydisplay.SecondaryDisplayPredictionsImpl</string>
|
||||
<string name="taskbar_model_callbacks_factory_class" translatable="false">com.android.launcher3.taskbar.TaskbarModelCallbacksFactory</string>
|
||||
<string name="taskbar_view_callbacks_factory_class" translatable="false">com.android.launcher3.taskbar.TaskbarViewCallbacksFactory</string>
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
<dimen name="gesture_tutorial_taskbar_margin_bottom">24dp</dimen>
|
||||
|
||||
<!-- All Set page -->
|
||||
<dimen name="allset_page_margin_horizontal">40dp</dimen>
|
||||
<dimen name="allset_page_padding_horizontal">40dp</dimen>
|
||||
<dimen name="allset_page_allset_text_size">36sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size">14sp</dimen>
|
||||
|
||||
|
||||
@@ -321,6 +321,7 @@
|
||||
<item name="android:fontFamily">google-sans-text-medium</item>
|
||||
<item name="android:textSize">@dimen/task_thumbnail_icon_menu_text_size</item>
|
||||
<item name="android:textColor">@color/materialColorOnSurface</item>
|
||||
<item name="android:includeFontPadding">false</item>
|
||||
<item name="android:letterSpacing">0.025</item>
|
||||
<item name="android:lineHeight">20sp</item>
|
||||
</style>
|
||||
|
||||
@@ -56,7 +56,6 @@ import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVIT
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE;
|
||||
import static com.android.launcher3.util.DisplayController.isTransientTaskbar;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.ORDERED_BG_EXECUTOR;
|
||||
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
|
||||
@@ -79,7 +78,6 @@ import android.app.role.RoleManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
@@ -94,7 +92,6 @@ import android.os.Looper;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Global;
|
||||
import android.util.Pair;
|
||||
import android.util.Size;
|
||||
import android.view.CrossWindowBlurListeners;
|
||||
@@ -226,7 +223,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
private static final int TASKBAR_TO_HOME_DURATION_FAST = 300;
|
||||
private static final int TASKBAR_TO_HOME_DURATION_SLOW = 1000;
|
||||
protected static final int CONTENT_SCALE_DURATION = 350;
|
||||
protected static final int CONTENT_SCRIM_DURATION = 350;
|
||||
|
||||
private static final int MAX_NUM_TASKS = 5;
|
||||
|
||||
@@ -244,16 +240,12 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
private final StartingWindowListener mStartingWindowListener =
|
||||
new StartingWindowListener(this);
|
||||
private ContentObserver mAnimationRemovalObserver = new ContentObserver(
|
||||
ORDERED_BG_EXECUTOR.getHandler()) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
mAreAnimationsEnabled = Global.getFloat(mLauncher.getContentResolver(),
|
||||
Global.ANIMATOR_DURATION_SCALE, 1f) > 0
|
||||
|| Global.getFloat(mLauncher.getContentResolver(),
|
||||
Global.TRANSITION_ANIMATION_SCALE, 1f) > 0;
|
||||
}
|
||||
};
|
||||
|
||||
// TODO(b/397690719): Investigate the memory leak from TaskStackChangeListeners#mImpl
|
||||
// This is a temporary fix of memory leak b/397690719. We track registered
|
||||
// {@link TaskRestartedDuringLaunchListener}, and remove them on activity destroy.
|
||||
private final List<TaskRestartedDuringLaunchListener> mRegisteredTaskStackChangeListener =
|
||||
new ArrayList<>();
|
||||
|
||||
private DeviceProfile mDeviceProfile;
|
||||
|
||||
@@ -282,7 +274,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// Pairs of window starting type and starting window background color for starting tasks
|
||||
// Will never be larger than MAX_NUM_TASKS
|
||||
private LinkedHashMap<Integer, Pair<Integer, Integer>> mTaskStartParams;
|
||||
private boolean mAreAnimationsEnabled = true;
|
||||
|
||||
private final Interpolator mOpeningXInterpolator;
|
||||
private final Interpolator mOpeningInterpolator;
|
||||
@@ -293,7 +284,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mDeviceProfile = mLauncher.getDeviceProfile();
|
||||
mBackAnimationController = new LauncherBackAnimationController(mLauncher, this);
|
||||
checkAndMonitorIfAnimationsAreEnabled();
|
||||
|
||||
Resources res = mLauncher.getResources();
|
||||
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
|
||||
@@ -338,7 +328,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
TaskRestartedDuringLaunchListener restartedListener =
|
||||
new TaskRestartedDuringLaunchListener();
|
||||
restartedListener.register(onEndCallback::executeAllAndDestroy);
|
||||
onEndCallback.add(restartedListener::unregister);
|
||||
mRegisteredTaskStackChangeListener.add(restartedListener);
|
||||
onEndCallback.add(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
restartedListener.unregister();
|
||||
mRegisteredTaskStackChangeListener.remove(restartedListener);
|
||||
}
|
||||
});
|
||||
|
||||
RemoteAnimationRunnerCompat runner = createAppLaunchRunner(v, onEndCallback);
|
||||
|
||||
@@ -1208,8 +1205,12 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
unregisterRemoteTransitions();
|
||||
mLauncher.removeOnDeviceProfileChangeListener(this);
|
||||
SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null);
|
||||
ORDERED_BG_EXECUTOR.execute(() -> mLauncher.getContentResolver()
|
||||
.unregisterContentObserver(mAnimationRemovalObserver));
|
||||
if (BuildConfig.IS_STUDIO_BUILD && !mRegisteredTaskStackChangeListener.isEmpty()) {
|
||||
throw new IllegalStateException("Failed to run onEndCallback created from"
|
||||
+ " getActivityLaunchOptions()");
|
||||
}
|
||||
mRegisteredTaskStackChangeListener.forEach(TaskRestartedDuringLaunchListener::unregister);
|
||||
mRegisteredTaskStackChangeListener.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1257,17 +1258,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndMonitorIfAnimationsAreEnabled() {
|
||||
ORDERED_BG_EXECUTOR.execute(() -> {
|
||||
mAnimationRemovalObserver.onChange(true);
|
||||
mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
|
||||
Global.ANIMATOR_DURATION_SCALE), false, mAnimationRemovalObserver);
|
||||
mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
|
||||
Global.TRANSITION_ANIMATION_SCALE), false, mAnimationRemovalObserver);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private boolean launcherIsATargetWithMode(RemoteAnimationTarget[] targets, int mode) {
|
||||
for (RemoteAnimationTarget target : targets) {
|
||||
if (target.mode == mode && target.taskInfo != null
|
||||
@@ -1403,7 +1393,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
(LauncherAppWidgetHostView) launcherView, targetRect, windowSize,
|
||||
mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher),
|
||||
isTransluscent, fallbackBackgroundColor);
|
||||
} else if (launcherView != null && mAreAnimationsEnabled) {
|
||||
} else if (launcherView != null && !RemoveAnimationSettingsTracker.INSTANCE.get(
|
||||
mLauncher).isRemoveAnimationEnabled()) {
|
||||
floatingIconView = getFloatingIconView(mLauncher, launcherView, null,
|
||||
mLauncher.getTaskbarUIController() == null
|
||||
? null
|
||||
@@ -1793,8 +1784,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
|
||||
/** Get animation duration for taskbar for going to home. */
|
||||
public static int getTaskbarToHomeDuration(boolean isPinnedTaskbar) {
|
||||
return getTaskbarToHomeDuration(false, isPinnedTaskbar);
|
||||
public static int getTaskbarToHomeDuration(boolean isPinnedTaskbarAndNotInDesktopMode) {
|
||||
return getTaskbarToHomeDuration(false, isPinnedTaskbarAndNotInDesktopMode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1803,8 +1794,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
* @param shouldOverrideToFastAnimation should overwrite scaling reveal home animation duration
|
||||
*/
|
||||
public static int getTaskbarToHomeDuration(boolean shouldOverrideToFastAnimation,
|
||||
boolean isPinnedTaskbar) {
|
||||
if (isPinnedTaskbar) {
|
||||
boolean isPinnedTaskbarAndNotInDesktopMode) {
|
||||
if (isPinnedTaskbarAndNotInDesktopMode) {
|
||||
return PINNED_TASKBAR_TRANSITION_DURATION;
|
||||
} else if (enableScalingRevealHomeAnimation() && !shouldOverrideToFastAnimation) {
|
||||
return TASKBAR_TO_HOME_DURATION_SLOW;
|
||||
|
||||
@@ -322,13 +322,14 @@ public class WidgetPickerActivity extends BaseActivity {
|
||||
stringCache.loadStrings(this);
|
||||
|
||||
bindStringCache(stringCache);
|
||||
bindWidgets(mModel.getWidgetsByPackageItem(), mModel.getDefaultWidgetsFilter());
|
||||
bindWidgets(mModel.getWidgetsByPackageItemForPicker(),
|
||||
mModel.getDefaultWidgetsFilter());
|
||||
// Open sheet once widgets are available, so that it doesn't interrupt the open
|
||||
// animation.
|
||||
openWidgetsSheet();
|
||||
if (mUiSurface != null) {
|
||||
mWidgetPredictionsRequester = new WidgetPredictionsRequester(app.getContext(),
|
||||
mUiSurface, mModel.getWidgetsByComponentKey());
|
||||
mUiSurface, mModel.getWidgetsByComponentKeyForPicker());
|
||||
mWidgetPredictionsRequester.request(mAddedWidgets, this::bindRecommendedWidgets);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (C) 2025 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.desktop
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.util.Log
|
||||
import android.view.Choreographer
|
||||
import android.view.SurfaceControl.Transaction
|
||||
import android.view.WindowManager.TRANSIT_CLOSE
|
||||
import android.view.WindowManager.TRANSIT_OPEN
|
||||
import android.view.WindowManager.TRANSIT_TO_BACK
|
||||
import android.window.DesktopModeFlags
|
||||
import android.window.TransitionInfo
|
||||
import android.window.TransitionInfo.Change
|
||||
import androidx.core.animation.addListener
|
||||
import androidx.core.util.Supplier
|
||||
import com.android.app.animation.Interpolators
|
||||
import com.android.internal.jank.Cuj
|
||||
import com.android.internal.jank.InteractionJankMonitor
|
||||
import com.android.internal.policy.ScreenDecorationsUtils
|
||||
import com.android.launcher3.desktop.DesktopAppLaunchTransition.AppLaunchType
|
||||
import com.android.launcher3.desktop.DesktopAppLaunchTransition.Companion.LAUNCH_CHANGE_MODES
|
||||
import com.android.wm.shell.shared.animation.MinimizeAnimator
|
||||
import com.android.wm.shell.shared.animation.WindowAnimator
|
||||
|
||||
/**
|
||||
* Helper class responsible for creating and managing animators for desktop app launch and related
|
||||
* transitions.
|
||||
*
|
||||
* <p>This class handles the complex logic of creating various animators, including launch,
|
||||
* minimize, and trampoline close animations, based on the provided transition information and
|
||||
* launch type. It also utilizes {@link InteractionJankMonitor} to monitor animation jank.
|
||||
*
|
||||
* @param context The application context.
|
||||
* @param launchType The type of app launch, containing animation parameters.
|
||||
* @param cujType The CUJ (Critical User Journey) type for jank monitoring.
|
||||
*/
|
||||
class DesktopAppLaunchAnimatorHelper(
|
||||
private val context: Context,
|
||||
private val launchType: AppLaunchType,
|
||||
@Cuj.CujType private val cujType: Int,
|
||||
private val transactionSupplier: Supplier<Transaction>,
|
||||
) {
|
||||
|
||||
private val interactionJankMonitor = InteractionJankMonitor.getInstance()
|
||||
|
||||
fun createAnimators(info: TransitionInfo, finishCallback: (Animator) -> Unit): List<Animator> {
|
||||
val launchChange = getLaunchChange(info)
|
||||
requireNotNull(launchChange) {
|
||||
val changesString =
|
||||
info.changes.joinToString(", ") { change ->
|
||||
"Change: mode=${change.mode}, " +
|
||||
"taskId=${change.taskInfo?.id}, " +
|
||||
"isFreeform=${change.taskInfo?.isFreeform}"
|
||||
}
|
||||
Log.e(
|
||||
TAG,
|
||||
"No launch change found: Transition type=${info.type}, changes=$changesString",
|
||||
)
|
||||
"expected an app launch Change"
|
||||
}
|
||||
|
||||
val transaction = transactionSupplier.get()
|
||||
|
||||
val minimizeChange = getMinimizeChange(info)
|
||||
val trampolineCloseChange = getTrampolineCloseChange(info)
|
||||
|
||||
val launchAnimator =
|
||||
createLaunchAnimator(
|
||||
launchChange,
|
||||
transaction,
|
||||
finishCallback,
|
||||
isTrampoline = trampolineCloseChange != null,
|
||||
)
|
||||
val animatorsList = mutableListOf(launchAnimator)
|
||||
if (minimizeChange != null) {
|
||||
val minimizeAnimator =
|
||||
createMinimizeAnimator(minimizeChange, transaction, finishCallback)
|
||||
animatorsList.add(minimizeAnimator)
|
||||
}
|
||||
if (trampolineCloseChange != null) {
|
||||
val trampolineCloseAnimator =
|
||||
createTrampolineCloseAnimator(trampolineCloseChange, transaction)
|
||||
animatorsList.add(trampolineCloseAnimator)
|
||||
}
|
||||
return animatorsList
|
||||
}
|
||||
|
||||
private fun getLaunchChange(info: TransitionInfo): Change? =
|
||||
info.changes.firstOrNull { change -> change.mode in LAUNCH_CHANGE_MODES }
|
||||
|
||||
private fun getMinimizeChange(info: TransitionInfo): Change? =
|
||||
info.changes.firstOrNull { change -> change.mode == TRANSIT_TO_BACK }
|
||||
|
||||
private fun getTrampolineCloseChange(info: TransitionInfo): Change? {
|
||||
if (
|
||||
info.changes.size < 2 ||
|
||||
!DesktopModeFlags.ENABLE_DESKTOP_TRAMPOLINE_CLOSE_ANIMATION_BUGFIX.isTrue
|
||||
) {
|
||||
return null
|
||||
}
|
||||
val openChange =
|
||||
info.changes.firstOrNull { change ->
|
||||
change.mode == TRANSIT_OPEN && change.taskInfo?.isFreeform == true
|
||||
}
|
||||
val closeChange =
|
||||
info.changes.firstOrNull { change ->
|
||||
change.mode == TRANSIT_CLOSE && change.taskInfo?.isFreeform == true
|
||||
}
|
||||
val openPackage = openChange?.taskInfo?.baseIntent?.component?.packageName
|
||||
val closePackage = closeChange?.taskInfo?.baseIntent?.component?.packageName
|
||||
return if (openPackage != null && closePackage != null && openPackage == closePackage) {
|
||||
closeChange
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun createLaunchAnimator(
|
||||
change: Change,
|
||||
transaction: Transaction,
|
||||
onAnimFinish: (Animator) -> Unit,
|
||||
isTrampoline: Boolean,
|
||||
): Animator {
|
||||
val boundsAnimator =
|
||||
WindowAnimator.createBoundsAnimator(
|
||||
context.resources.displayMetrics,
|
||||
launchType.boundsAnimationParams,
|
||||
change,
|
||||
transaction,
|
||||
)
|
||||
val alphaAnimator =
|
||||
ValueAnimator.ofFloat(0f, 1f).apply {
|
||||
duration = launchType.alphaDurationMs
|
||||
interpolator = Interpolators.LINEAR
|
||||
addUpdateListener { animation ->
|
||||
transaction
|
||||
.setAlpha(change.leash, animation.animatedValue as Float)
|
||||
.setFrameTimeline(Choreographer.getInstance().vsyncId)
|
||||
.apply()
|
||||
}
|
||||
}
|
||||
val clipRect = Rect(change.endAbsBounds).apply { offsetTo(0, 0) }
|
||||
transaction.setCrop(change.leash, clipRect)
|
||||
transaction.setCornerRadius(
|
||||
change.leash,
|
||||
ScreenDecorationsUtils.getWindowCornerRadius(context),
|
||||
)
|
||||
return AnimatorSet().apply {
|
||||
interactionJankMonitor.begin(change.leash, context, context.mainThreadHandler, cujType)
|
||||
if (isTrampoline) {
|
||||
play(alphaAnimator)
|
||||
} else {
|
||||
playTogether(boundsAnimator, alphaAnimator)
|
||||
}
|
||||
addListener(
|
||||
onEnd = { animation ->
|
||||
onAnimFinish(animation)
|
||||
interactionJankMonitor.end(cujType)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createMinimizeAnimator(
|
||||
change: Change,
|
||||
transaction: Transaction,
|
||||
onAnimFinish: (Animator) -> Unit,
|
||||
): Animator {
|
||||
return MinimizeAnimator.create(
|
||||
context,
|
||||
change,
|
||||
transaction,
|
||||
onAnimFinish,
|
||||
interactionJankMonitor,
|
||||
context.mainThreadHandler,
|
||||
)
|
||||
}
|
||||
|
||||
private fun createTrampolineCloseAnimator(change: Change, transaction: Transaction): Animator {
|
||||
return ValueAnimator.ofFloat(1f, 0f).apply {
|
||||
duration = 100L
|
||||
interpolator = Interpolators.LINEAR
|
||||
addUpdateListener { animation ->
|
||||
transaction.setAlpha(change.leash, animation.animatedValue as Float).apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val TAG = "DesktopAppLaunchAnimatorHelper"
|
||||
}
|
||||
}
|
||||
@@ -17,27 +17,19 @@
|
||||
package com.android.launcher3.desktop
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.os.IBinder
|
||||
import android.view.Choreographer
|
||||
import android.util.Log
|
||||
import android.view.SurfaceControl.Transaction
|
||||
import android.view.WindowManager.TRANSIT_OPEN
|
||||
import android.view.WindowManager.TRANSIT_TO_BACK
|
||||
import android.view.WindowManager.TRANSIT_TO_FRONT
|
||||
import android.window.IRemoteTransitionFinishedCallback
|
||||
import android.window.RemoteTransitionStub
|
||||
import android.window.TransitionInfo
|
||||
import android.window.TransitionInfo.Change
|
||||
import androidx.core.animation.addListener
|
||||
import androidx.core.util.Supplier
|
||||
import com.android.app.animation.Interpolators
|
||||
import com.android.internal.jank.Cuj
|
||||
import com.android.internal.jank.InteractionJankMonitor
|
||||
import com.android.internal.policy.ScreenDecorationsUtils
|
||||
import com.android.quickstep.RemoteRunnable
|
||||
import com.android.wm.shell.shared.animation.MinimizeAnimator
|
||||
import com.android.wm.shell.shared.animation.WindowAnimator
|
||||
import java.util.concurrent.Executor
|
||||
|
||||
@@ -48,14 +40,18 @@ import java.util.concurrent.Executor
|
||||
* ([android.view.WindowManager.TRANSIT_TO_BACK]) this transition will apply a minimize animation to
|
||||
* that window.
|
||||
*/
|
||||
class DesktopAppLaunchTransition(
|
||||
private val context: Context,
|
||||
private val mainExecutor: Executor,
|
||||
class DesktopAppLaunchTransition
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
context: Context,
|
||||
private val launchType: AppLaunchType,
|
||||
@Cuj.CujType private val cujType: Int,
|
||||
private val mainExecutor: Executor,
|
||||
transactionSupplier: Supplier<Transaction> = Supplier { Transaction() },
|
||||
) : RemoteTransitionStub() {
|
||||
|
||||
private val interactionJankMonitor = InteractionJankMonitor.getInstance()
|
||||
private val animatorHelper: DesktopAppLaunchAnimatorHelper =
|
||||
DesktopAppLaunchAnimatorHelper(context, launchType, cujType, transactionSupplier)
|
||||
|
||||
enum class AppLaunchType(
|
||||
val boundsAnimationParams: WindowAnimator.BoundsAnimationParams,
|
||||
@@ -68,15 +64,16 @@ class DesktopAppLaunchTransition(
|
||||
override fun startAnimation(
|
||||
token: IBinder,
|
||||
info: TransitionInfo,
|
||||
t: Transaction,
|
||||
transaction: Transaction,
|
||||
transitionFinishedCallback: IRemoteTransitionFinishedCallback,
|
||||
) {
|
||||
Log.v(TAG, "startAnimation: launchType=$launchType, cujType=$cujType")
|
||||
val safeTransitionFinishedCallback = RemoteRunnable {
|
||||
transitionFinishedCallback.onTransitionFinished(/* wct= */ null, /* sct= */ null)
|
||||
}
|
||||
mainExecutor.execute {
|
||||
runAnimators(info, safeTransitionFinishedCallback)
|
||||
t.apply()
|
||||
transaction.apply()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,78 +83,12 @@ class DesktopAppLaunchTransition(
|
||||
animators -= animator
|
||||
if (animators.isEmpty()) finishedCallback.run()
|
||||
}
|
||||
animators += createAnimators(info, animatorFinishedCallback)
|
||||
animators += animatorHelper.createAnimators(info, animatorFinishedCallback)
|
||||
animators.forEach { it.start() }
|
||||
}
|
||||
|
||||
private fun createAnimators(
|
||||
info: TransitionInfo,
|
||||
finishCallback: (Animator) -> Unit,
|
||||
): List<Animator> {
|
||||
val transaction = Transaction()
|
||||
val launchAnimator =
|
||||
createLaunchAnimator(getLaunchChange(info), transaction, finishCallback)
|
||||
val minimizeChange = getMinimizeChange(info) ?: return listOf(launchAnimator)
|
||||
val minimizeAnimator =
|
||||
MinimizeAnimator.create(
|
||||
context.resources.displayMetrics,
|
||||
minimizeChange,
|
||||
transaction,
|
||||
finishCallback,
|
||||
)
|
||||
return listOf(launchAnimator, minimizeAnimator)
|
||||
}
|
||||
|
||||
private fun getLaunchChange(info: TransitionInfo): Change =
|
||||
requireNotNull(info.changes.firstOrNull { change -> change.mode in LAUNCH_CHANGE_MODES }) {
|
||||
"expected an app launch Change"
|
||||
}
|
||||
|
||||
private fun getMinimizeChange(info: TransitionInfo): Change? =
|
||||
info.changes.firstOrNull { change -> change.mode == TRANSIT_TO_BACK }
|
||||
|
||||
private fun createLaunchAnimator(
|
||||
change: Change,
|
||||
transaction: Transaction,
|
||||
onAnimFinish: (Animator) -> Unit,
|
||||
): Animator {
|
||||
val boundsAnimator =
|
||||
WindowAnimator.createBoundsAnimator(
|
||||
context.resources.displayMetrics,
|
||||
launchType.boundsAnimationParams,
|
||||
change,
|
||||
transaction,
|
||||
)
|
||||
val alphaAnimator =
|
||||
ValueAnimator.ofFloat(0f, 1f).apply {
|
||||
duration = launchType.alphaDurationMs
|
||||
interpolator = Interpolators.LINEAR
|
||||
addUpdateListener { animation ->
|
||||
transaction
|
||||
.setAlpha(change.leash, animation.animatedValue as Float)
|
||||
.setFrameTimeline(Choreographer.getInstance().vsyncId)
|
||||
.apply()
|
||||
}
|
||||
}
|
||||
val clipRect = Rect(change.endAbsBounds).apply { offsetTo(0, 0) }
|
||||
transaction.setCrop(change.leash, clipRect)
|
||||
transaction.setCornerRadius(
|
||||
change.leash,
|
||||
ScreenDecorationsUtils.getWindowCornerRadius(context),
|
||||
)
|
||||
return AnimatorSet().apply {
|
||||
interactionJankMonitor.begin(change.leash, context, context.mainThreadHandler, cujType)
|
||||
playTogether(boundsAnimator, alphaAnimator)
|
||||
addListener(
|
||||
onEnd = { animation ->
|
||||
onAnimFinish(animation)
|
||||
interactionJankMonitor.end(cujType)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "DesktopAppLaunchTransition"
|
||||
/** Change modes that represent a task becoming visible / launching in Desktop mode. */
|
||||
val LAUNCH_CHANGE_MODES = intArrayOf(TRANSIT_OPEN, TRANSIT_TO_FRONT)
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ class DesktopAppLaunchTransitionManager(
|
||||
RemoteTransition(
|
||||
DesktopAppLaunchTransition(
|
||||
context,
|
||||
MAIN_EXECUTOR,
|
||||
AppLaunchType.UNMINIMIZE,
|
||||
Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_INTENT,
|
||||
MAIN_EXECUTOR,
|
||||
),
|
||||
"DesktopWindowLimitUnminimize",
|
||||
)
|
||||
|
||||
@@ -47,6 +47,7 @@ import android.content.pm.LauncherApps;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.StatsEvent;
|
||||
|
||||
@@ -61,6 +62,7 @@ import com.android.launcher3.ConstantItem;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.icons.cache.CacheLookupFlag;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
@@ -89,6 +91,9 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
* Model delegate which loads prediction items
|
||||
*/
|
||||
@@ -114,18 +119,29 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
CONTAINER_WIDGETS_PREDICTION, "widgets_prediction", DESKTOP_ICON_FLAG);
|
||||
|
||||
private final InvariantDeviceProfile mIDP;
|
||||
private final PackageManagerHelper mPmHelper;
|
||||
private final AppEventProducer mAppEventProducer;
|
||||
|
||||
private final StatsManager mStatsManager;
|
||||
|
||||
protected boolean mActive = false;
|
||||
|
||||
public QuickstepModelDelegate(Context context) {
|
||||
@Inject
|
||||
public QuickstepModelDelegate(@ApplicationContext Context context,
|
||||
InvariantDeviceProfile idp,
|
||||
PackageManagerHelper pmHelper,
|
||||
@Nullable @Named("ICONS_DB") String dbFileName) {
|
||||
super(context);
|
||||
mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent);
|
||||
mIDP = idp;
|
||||
mPmHelper = pmHelper;
|
||||
|
||||
mIDP = InvariantDeviceProfile.INSTANCE.get(context);
|
||||
mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent);
|
||||
StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer);
|
||||
mStatsManager = context.getSystemService(StatsManager.class);
|
||||
|
||||
// Only register for launcher snapshot logging if this is the primary ModelDelegate
|
||||
// instance, as there will be additional instances that may be destroyed at any time.
|
||||
mStatsManager = TextUtils.isEmpty(dbFileName)
|
||||
? null : context.getSystemService(StatsManager.class);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@@ -154,10 +170,10 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
// TODO: Implement caching and preloading
|
||||
|
||||
WorkspaceItemFactory factory =
|
||||
new WorkspaceItemFactory(mApp, ums, mPmHelper, pinnedShortcuts, numColumns,
|
||||
new WorkspaceItemFactory(mContext, ums, mPmHelper, pinnedShortcuts, numColumns,
|
||||
state.containerId, state.lookupFlag);
|
||||
FixedContainerItems fci = new FixedContainerItems(state.containerId,
|
||||
state.storage.read(mApp.getContext(), factory, ums.allUsers::get));
|
||||
state.storage.read(mContext, factory, ums.allUsers::get));
|
||||
mDataModel.extraItems.put(state.containerId, fci);
|
||||
}
|
||||
|
||||
@@ -220,7 +236,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
super.modelLoadComplete();
|
||||
|
||||
// Log snapshot of the model
|
||||
LauncherPrefs prefs = LauncherPrefs.get(mApp.getContext());
|
||||
LauncherPrefs prefs = LauncherPrefs.get(mContext);
|
||||
long lastSnapshotTimeMillis = prefs.get(LAST_SNAPSHOT_TIME_MILLIS);
|
||||
// Log snapshot only if previous snapshot was older than a day
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -245,11 +261,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
prefs.put(LAST_SNAPSHOT_TIME_MILLIS, now);
|
||||
}
|
||||
|
||||
// Only register for launcher snapshot logging if this is the primary ModelDelegate
|
||||
// instance, as there will be additional instances that may be destroyed at any time.
|
||||
if (mIsPrimaryInstance) {
|
||||
registerSnapshotLoggingCallback();
|
||||
}
|
||||
registerSnapshotLoggingCallback();
|
||||
}
|
||||
|
||||
protected void additionalSnapshotEvents(InstanceId snapshotInstanceId){}
|
||||
@@ -257,9 +269,9 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
/**
|
||||
* Registers a callback to log launcher workspace layout using Statsd pulled atom.
|
||||
*/
|
||||
protected void registerSnapshotLoggingCallback() {
|
||||
private void registerSnapshotLoggingCallback() {
|
||||
if (mStatsManager == null) {
|
||||
Log.d(TAG, "Failed to get StatsManager");
|
||||
Log.d(TAG, "Skipping snapshot logging");
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -332,7 +344,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
super.destroy();
|
||||
mActive = false;
|
||||
StatsLogCompatManager.LOGS_CONSUMER.remove(mAppEventProducer);
|
||||
if (mIsPrimaryInstance && mStatsManager != null) {
|
||||
if (mStatsManager != null) {
|
||||
try {
|
||||
mStatsManager.clearPullAtomCallback(SysUiStatsLog.LAUNCHER_LAYOUT_SNAPSHOT);
|
||||
} catch (RuntimeException e) {
|
||||
@@ -354,25 +366,24 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
if (!mActive) {
|
||||
return;
|
||||
}
|
||||
Context context = mApp.getContext();
|
||||
AppPredictionManager apm = context.getSystemService(AppPredictionManager.class);
|
||||
AppPredictionManager apm = mContext.getSystemService(AppPredictionManager.class);
|
||||
if (apm == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
registerPredictor(mAllAppsState, apm.createAppPredictionSession(
|
||||
new AppPredictionContext.Builder(context)
|
||||
new AppPredictionContext.Builder(mContext)
|
||||
.setUiSurface("home")
|
||||
.setPredictedTargetCount(mIDP.numDatabaseAllAppsColumns)
|
||||
.build()));
|
||||
|
||||
// TODO: get bundle
|
||||
registerHotseatPredictor(apm, context);
|
||||
registerHotseatPredictor(apm, mContext);
|
||||
|
||||
registerWidgetsPredictor(apm.createAppPredictionSession(
|
||||
new AppPredictionContext.Builder(context)
|
||||
new AppPredictionContext.Builder(mContext)
|
||||
.setUiSurface("widgets")
|
||||
.setExtras(getBundleForWidgetsOnWorkspace(context, mDataModel))
|
||||
.setExtras(getBundleForWidgetsOnWorkspace(mContext, mDataModel))
|
||||
.setPredictedTargetCount(NUM_OF_RECOMMENDED_WIDGETS_PREDICATION)
|
||||
.build()));
|
||||
}
|
||||
@@ -383,12 +394,11 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
if (!mActive) {
|
||||
return;
|
||||
}
|
||||
Context context = mApp.getContext();
|
||||
AppPredictionManager apm = context.getSystemService(AppPredictionManager.class);
|
||||
AppPredictionManager apm = mContext.getSystemService(AppPredictionManager.class);
|
||||
if (apm == null) {
|
||||
return;
|
||||
}
|
||||
registerHotseatPredictor(apm, context);
|
||||
registerHotseatPredictor(apm, mContext);
|
||||
}
|
||||
|
||||
private void registerHotseatPredictor(AppPredictionManager apm, Context context) {
|
||||
@@ -413,7 +423,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
// No diff, skip
|
||||
return;
|
||||
}
|
||||
mApp.getModel().enqueueModelUpdateTask(new PredictionUpdateTask(state, targets));
|
||||
mModel.enqueueModelUpdateTask(new PredictionUpdateTask(state, targets));
|
||||
}
|
||||
|
||||
private void registerWidgetsPredictor(AppPredictor predictor) {
|
||||
@@ -424,7 +434,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
// No diff, skip
|
||||
return;
|
||||
}
|
||||
mApp.getModel().enqueueModelUpdateTask(
|
||||
mModel.enqueueModelUpdateTask(
|
||||
new WidgetsPredictionUpdateTask(mWidgetsRecommendationState, targets));
|
||||
});
|
||||
mWidgetsRecommendationState.predictor.requestPredictionUpdate();
|
||||
@@ -536,7 +546,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
|
||||
private static class WorkspaceItemFactory implements PersistedItemArray.ItemFactory<ItemInfo> {
|
||||
|
||||
private final LauncherAppState mAppState;
|
||||
private final Context mContext;
|
||||
private final UserManagerState mUMS;
|
||||
private final PackageManagerHelper mPmHelper;
|
||||
private final Map<ShortcutKey, ShortcutInfo> mPinnedShortcuts;
|
||||
@@ -546,10 +556,11 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
|
||||
private int mReadCount = 0;
|
||||
|
||||
protected WorkspaceItemFactory(LauncherAppState appState, UserManagerState ums,
|
||||
protected WorkspaceItemFactory(
|
||||
Context context, UserManagerState ums,
|
||||
PackageManagerHelper pmHelper, Map<ShortcutKey, ShortcutInfo> pinnedShortcuts,
|
||||
int maxCount, int container, CacheLookupFlag lookupFlag) {
|
||||
mAppState = appState;
|
||||
mContext = context;
|
||||
mUMS = ums;
|
||||
mPmHelper = pmHelper;
|
||||
mPinnedShortcuts = pinnedShortcuts;
|
||||
@@ -566,7 +577,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
}
|
||||
switch (itemType) {
|
||||
case ITEM_TYPE_APPLICATION: {
|
||||
LauncherActivityInfo lai = mAppState.getContext()
|
||||
LauncherActivityInfo lai = mContext
|
||||
.getSystemService(LauncherApps.class)
|
||||
.resolveActivity(intent, user);
|
||||
if (lai == null) {
|
||||
@@ -574,14 +585,15 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
}
|
||||
AppInfo info = new AppInfo(
|
||||
lai,
|
||||
UserCache.INSTANCE.get(mAppState.getContext()).getUserInfo(user),
|
||||
ApiWrapper.INSTANCE.get(mAppState.getContext()),
|
||||
UserCache.INSTANCE.get(mContext).getUserInfo(user),
|
||||
ApiWrapper.INSTANCE.get(mContext),
|
||||
mPmHelper,
|
||||
mUMS.isUserQuiet(user));
|
||||
info.container = mContainer;
|
||||
mAppState.getIconCache().getTitleAndIcon(info, lai, mLookupFlag);
|
||||
LauncherAppState.getInstance(mContext).getIconCache()
|
||||
.getTitleAndIcon(info, lai, mLookupFlag);
|
||||
mReadCount++;
|
||||
return info.makeWorkspaceItem(mAppState.getContext());
|
||||
return info.makeWorkspaceItem(mContext);
|
||||
}
|
||||
case ITEM_TYPE_DEEP_SHORTCUT: {
|
||||
ShortcutKey key = ShortcutKey.fromIntent(intent, user);
|
||||
@@ -592,9 +604,9 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
if (si == null) {
|
||||
return null;
|
||||
}
|
||||
WorkspaceItemInfo wii = new WorkspaceItemInfo(si, mAppState.getContext());
|
||||
WorkspaceItemInfo wii = new WorkspaceItemInfo(si, mContext);
|
||||
wii.container = mContainer;
|
||||
mAppState.getIconCache().getShortcutIcon(wii, si);
|
||||
LauncherAppState.getInstance(mContext).getIconCache().getShortcutIcon(wii, si);
|
||||
mReadCount++;
|
||||
return wii;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class WidgetPredictionsRequester {
|
||||
List<ItemInfo> items;
|
||||
if (enableCategorizedWidgetSuggestions()) {
|
||||
WidgetRecommendationCategoryProvider categoryProvider =
|
||||
WidgetRecommendationCategoryProvider.newInstance(mContext);
|
||||
new WidgetRecommendationCategoryProvider();
|
||||
items = widgetItems.stream()
|
||||
.map(it -> new PendingAddWidgetInfo(it.widgetInfo, CONTAINER_WIDGETS_PREDICTION,
|
||||
categoryProvider.getWidgetRecommendationCategory(mContext, it)))
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class WidgetsPredictionUpdateTask implements ModelUpdateTask {
|
||||
// Widgets (excluding shortcuts & already added widgets) that belong to apps eligible for
|
||||
// being in predictions.
|
||||
Map<ComponentKey, WidgetItem> allEligibleWidgets =
|
||||
dataModel.widgetsModel.getWidgetsByComponentKey()
|
||||
dataModel.widgetsModel.getWidgetsByComponentKeyForPicker()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.filter(entry -> entry.getValue().widgetInfo != null
|
||||
@@ -137,7 +137,7 @@ public final class WidgetsPredictionUpdateTask implements ModelUpdateTask {
|
||||
List<ItemInfo> items;
|
||||
if (enableCategorizedWidgetSuggestions()) {
|
||||
WidgetRecommendationCategoryProvider categoryProvider =
|
||||
WidgetRecommendationCategoryProvider.newInstance(context);
|
||||
new WidgetRecommendationCategoryProvider();
|
||||
items = servicePredictedItems.stream()
|
||||
.map(it -> new PendingAddWidgetInfo(it.widgetInfo, CONTAINER_WIDGETS_PREDICTION,
|
||||
categoryProvider.getWidgetRecommendationCategory(context, it)))
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.statehandlers
|
||||
import android.content.Context
|
||||
import android.os.Debug
|
||||
import android.util.Log
|
||||
import android.util.Slog
|
||||
import android.util.SparseArray
|
||||
import android.view.Display.DEFAULT_DISPLAY
|
||||
import android.window.DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY
|
||||
@@ -31,7 +32,8 @@ import com.android.launcher3.statemanager.StatefulActivity
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher
|
||||
import com.android.launcher3.util.DaggerSingletonObject
|
||||
import com.android.launcher3.util.DaggerSingletonTracker
|
||||
import com.android.launcher3.util.Executors
|
||||
import com.android.launcher3.util.DisplayController
|
||||
import com.android.launcher3.util.Executors.MAIN_EXECUTOR
|
||||
import com.android.launcher3.util.window.WindowManagerProxy.DesktopVisibilityListener
|
||||
import com.android.quickstep.GestureState.GestureEndTarget
|
||||
import com.android.quickstep.SystemUiProxy
|
||||
@@ -61,8 +63,6 @@ constructor(
|
||||
* (Used only when multiple desks are enabled).
|
||||
*
|
||||
* @property displayId The ID of the display this object represents.
|
||||
* @property canCreateDesks true if it's possible to create new desks on the display represented
|
||||
* by this object.
|
||||
* @property activeDeskId The ID of the active desk on the associated display (if any). It has a
|
||||
* value of `INACTIVE_DESK_ID` (-1) if there are no active desks. Note that there can only be
|
||||
* at most one active desk on each display.
|
||||
@@ -70,20 +70,40 @@ constructor(
|
||||
*/
|
||||
private data class DisplayDeskConfig(
|
||||
val displayId: Int,
|
||||
var canCreateDesks: Boolean,
|
||||
var activeDeskId: Int = INACTIVE_DESK_ID,
|
||||
val deskIds: MutableSet<Int>,
|
||||
)
|
||||
|
||||
/** True if it is possible to create new desks on current setup. */
|
||||
var canCreateDesks: Boolean = false
|
||||
private set(value) {
|
||||
if (field == value) return
|
||||
field = value
|
||||
desktopVisibilityListeners.forEach { it.onCanCreateDesksChanged(field) }
|
||||
}
|
||||
|
||||
/** Maps each display by its ID to its desks configuration. */
|
||||
private val displaysDesksConfigsMap = SparseArray<DisplayDeskConfig>()
|
||||
|
||||
private val desktopVisibilityListeners: MutableSet<DesktopVisibilityListener> = HashSet()
|
||||
private val taskbarDesktopModeListeners: MutableSet<TaskbarDesktopModeListener> = HashSet()
|
||||
|
||||
// This simply indicates that user is currently in desktop mode or not.
|
||||
var isInDesktopMode = false
|
||||
private set
|
||||
|
||||
// to track if any pending notification to be done.
|
||||
var isNotifyingDesktopVisibilityPending = false
|
||||
|
||||
// to let launcher hold off on notifying desktop visibility listeners.
|
||||
var launcherAnimationRunning = false
|
||||
|
||||
// TODO: b/394387739 - Deprecate this and replace it with something that tracks the count per
|
||||
// desk.
|
||||
/** Number of visible desktop windows in desktop mode. */
|
||||
/**
|
||||
* Number of visible desktop windows in desktop mode. This can be > 0 when user goes to overview
|
||||
* from desktop window mode.
|
||||
*/
|
||||
var visibleDesktopTasksCount: Int = 0
|
||||
/**
|
||||
* Sets the number of desktop windows that are visible and updates launcher visibility based
|
||||
@@ -101,13 +121,27 @@ constructor(
|
||||
}
|
||||
|
||||
if (visibleTasksCount != field) {
|
||||
if (visibleDesktopTasksCount == 0 && visibleTasksCount == 1) {
|
||||
isInDesktopMode = true
|
||||
}
|
||||
if (visibleDesktopTasksCount == 1 && visibleTasksCount == 0) {
|
||||
isInDesktopMode = false
|
||||
}
|
||||
val wasVisible = field > 0
|
||||
val isVisible = visibleTasksCount > 0
|
||||
val wereDesktopTasksVisibleBefore = areDesktopTasksVisibleAndNotInOverview()
|
||||
field = visibleTasksCount
|
||||
val areDesktopTasksVisibleNow = areDesktopTasksVisibleAndNotInOverview()
|
||||
if (wereDesktopTasksVisibleBefore != areDesktopTasksVisibleNow) {
|
||||
notifyIsInDesktopModeChanged(DEFAULT_DISPLAY, areDesktopTasksVisibleNow)
|
||||
|
||||
if (
|
||||
wereDesktopTasksVisibleBefore != areDesktopTasksVisibleNow ||
|
||||
wasVisible != isVisible
|
||||
) {
|
||||
if (!launcherAnimationRunning) {
|
||||
notifyIsInDesktopModeChanged(DEFAULT_DISPLAY, areDesktopTasksVisibleNow)
|
||||
} else {
|
||||
isNotifyingDesktopVisibilityPending = true
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -146,13 +180,28 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the active desk (if any) on the display whose ID is [displayId], or
|
||||
* [INACTIVE_DESK_ID] if no desk is currently active or the multiple desks feature is disabled.
|
||||
*/
|
||||
fun getActiveDeskId(displayId: Int): Int {
|
||||
if (!DesktopModeStatus.enableMultipleDesktops(context)) {
|
||||
// When the multiple desks feature is disabled, callers should not rely on the concept
|
||||
// of a desk ID.
|
||||
return INACTIVE_DESK_ID
|
||||
}
|
||||
|
||||
return getDisplayDeskConfig(displayId)?.activeDeskId ?: INACTIVE_DESK_ID
|
||||
}
|
||||
|
||||
/** Returns whether a desk is currently active on the display with the given [displayId]. */
|
||||
fun isInDesktopMode(displayId: Int): Boolean {
|
||||
if (!DesktopModeStatus.enableMultipleDesktops(context)) {
|
||||
return areDesktopTasksVisible()
|
||||
return isInDesktopMode
|
||||
}
|
||||
|
||||
val isInDesktopMode = displaysDesksConfigsMap[displayId].activeDeskId != INACTIVE_DESK_ID
|
||||
val activeDeskId = getDisplayDeskConfig(displayId)?.activeDeskId ?: INACTIVE_DESK_ID
|
||||
val isInDesktopMode = activeDeskId != INACTIVE_DESK_ID
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "isInDesktopMode: $isInDesktopMode")
|
||||
}
|
||||
@@ -174,15 +223,6 @@ constructor(
|
||||
return isInDesktopMode(displayId) && !inOverviewState
|
||||
}
|
||||
|
||||
/** Whether desktop tasks are visible in desktop mode. */
|
||||
private fun areDesktopTasksVisible(): Boolean {
|
||||
val desktopTasksVisible: Boolean = visibleDesktopTasksCount > 0
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "areDesktopTasksVisible: desktopVisible=$desktopTasksVisible")
|
||||
}
|
||||
return desktopTasksVisible
|
||||
}
|
||||
|
||||
/** Whether desktop tasks are visible in desktop mode. */
|
||||
private fun areDesktopTasksVisibleAndNotInOverview(): Boolean {
|
||||
val desktopTasksVisible: Boolean = visibleDesktopTasksCount > 0
|
||||
@@ -216,6 +256,22 @@ constructor(
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Launcher Driven Desktop Mode changes. For example, swipe to home and quick switch from
|
||||
* Desktop Windowing Mode. if there is any pending notification please notify desktop visibility
|
||||
* listeners.
|
||||
*/
|
||||
fun onLauncherAnimationFromDesktopEnd() {
|
||||
launcherAnimationRunning = false
|
||||
if (isNotifyingDesktopVisibilityPending) {
|
||||
isNotifyingDesktopVisibilityPending = false
|
||||
notifyIsInDesktopModeChanged(
|
||||
DEFAULT_DISPLAY,
|
||||
isInDesktopModeAndNotInOverview(DEFAULT_DISPLAY),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun onLauncherStateChanged(state: RecentsState) {
|
||||
onLauncherStateChanged(
|
||||
state,
|
||||
@@ -325,6 +381,26 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifyTaskbarDesktopModeListenersForEntry(duration: Int) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "notifyTaskbarDesktopModeListenersForEntry: duration=" + duration)
|
||||
}
|
||||
for (listener in taskbarDesktopModeListeners) {
|
||||
listener.onEnterDesktopMode(duration)
|
||||
}
|
||||
DisplayController.INSTANCE.get(context).notifyConfigChange()
|
||||
}
|
||||
|
||||
private fun notifyTaskbarDesktopModeListenersForExit(duration: Int) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "notifyTaskbarDesktopModeListenersForExit: duration=" + duration)
|
||||
}
|
||||
for (listener in taskbarDesktopModeListeners) {
|
||||
listener.onExitDesktopMode(duration)
|
||||
}
|
||||
DisplayController.INSTANCE.get(context).notifyConfigChange()
|
||||
}
|
||||
|
||||
/** TODO: b/333533253 - Remove after flag rollout */
|
||||
private fun setBackgroundStateEnabled(backgroundStateEnabled: Boolean) {
|
||||
if (DEBUG) {
|
||||
@@ -391,7 +467,10 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun onListenerConnected(displayDeskStates: Array<DisplayDeskState>) {
|
||||
private fun onListenerConnected(
|
||||
displayDeskStates: Array<DisplayDeskState>,
|
||||
canCreateDesks: Boolean,
|
||||
) {
|
||||
if (!DesktopModeStatus.enableMultipleDesktops(context)) {
|
||||
return
|
||||
}
|
||||
@@ -402,25 +481,24 @@ constructor(
|
||||
displaysDesksConfigsMap[displayDeskState.displayId] =
|
||||
DisplayDeskConfig(
|
||||
displayId = displayDeskState.displayId,
|
||||
canCreateDesks = displayDeskState.canCreateDesk,
|
||||
activeDeskId = displayDeskState.activeDeskId,
|
||||
deskIds = displayDeskState.deskIds.toMutableSet(),
|
||||
)
|
||||
}
|
||||
|
||||
this.canCreateDesks = canCreateDesks
|
||||
}
|
||||
|
||||
private fun getDisplayDeskConfig(displayId: Int): DisplayDeskConfig {
|
||||
return checkNotNull(displaysDesksConfigsMap[displayId]) {
|
||||
"Expected non-null desk config for display: $displayId"
|
||||
}
|
||||
}
|
||||
private fun getDisplayDeskConfig(displayId: Int) =
|
||||
displaysDesksConfigsMap[displayId]
|
||||
?: null.also { Slog.e(TAG, "Expected non-null desk config for display: $displayId") }
|
||||
|
||||
private fun onCanCreateDesksChanged(displayId: Int, canCreateDesks: Boolean) {
|
||||
private fun onCanCreateDesksChanged(canCreateDesks: Boolean) {
|
||||
if (!DesktopModeStatus.enableMultipleDesktops(context)) {
|
||||
return
|
||||
}
|
||||
|
||||
getDisplayDeskConfig(displayId).canCreateDesks = canCreateDesks
|
||||
this.canCreateDesks = canCreateDesks
|
||||
}
|
||||
|
||||
private fun onDeskAdded(displayId: Int, deskId: Int) {
|
||||
@@ -428,7 +506,7 @@ constructor(
|
||||
return
|
||||
}
|
||||
|
||||
getDisplayDeskConfig(displayId).also {
|
||||
getDisplayDeskConfig(displayId)?.also {
|
||||
check(it.deskIds.add(deskId)) {
|
||||
"Found a duplicate desk Id: $deskId on display: $displayId"
|
||||
}
|
||||
@@ -440,7 +518,7 @@ constructor(
|
||||
return
|
||||
}
|
||||
|
||||
getDisplayDeskConfig(displayId).also {
|
||||
getDisplayDeskConfig(displayId)?.also {
|
||||
check(it.deskIds.remove(deskId)) {
|
||||
"Removing non-existing desk Id: $deskId on display: $displayId"
|
||||
}
|
||||
@@ -457,7 +535,7 @@ constructor(
|
||||
|
||||
val wasInDesktopMode = isInDesktopModeAndNotInOverview(displayId)
|
||||
|
||||
getDisplayDeskConfig(displayId).also {
|
||||
getDisplayDeskConfig(displayId)?.also {
|
||||
check(oldActiveDesk == it.activeDeskId) {
|
||||
"Mismatch between the Shell's oldActiveDesk: $oldActiveDesk, and Launcher's: ${it.activeDeskId}"
|
||||
}
|
||||
@@ -525,15 +603,18 @@ constructor(
|
||||
) : Stub() {
|
||||
private val controller = WeakReference(controller)
|
||||
|
||||
override fun onListenerConnected(displayDeskStates: Array<DisplayDeskState>) {
|
||||
Executors.MAIN_EXECUTOR.execute {
|
||||
controller.get()?.onListenerConnected(displayDeskStates)
|
||||
override fun onListenerConnected(
|
||||
displayDeskStates: Array<DisplayDeskState>,
|
||||
canCreateDesks: Boolean,
|
||||
) {
|
||||
MAIN_EXECUTOR.execute {
|
||||
controller.get()?.onListenerConnected(displayDeskStates, canCreateDesks)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTasksVisibilityChanged(displayId: Int, visibleTasksCount: Int) {
|
||||
if (displayId != this.displayId) return
|
||||
Executors.MAIN_EXECUTOR.execute {
|
||||
MAIN_EXECUTOR.execute {
|
||||
controller.get()?.apply {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "desktop visible tasks count changed=$visibleTasksCount")
|
||||
@@ -549,7 +630,7 @@ constructor(
|
||||
|
||||
override fun onTaskbarCornerRoundingUpdate(doesAnyTaskRequireTaskbarRounding: Boolean) {
|
||||
if (!DesktopModeStatus.useRoundedCorners()) return
|
||||
Executors.MAIN_EXECUTOR.execute {
|
||||
MAIN_EXECUTOR.execute {
|
||||
controller.get()?.apply {
|
||||
Log.d(
|
||||
TAG,
|
||||
@@ -561,26 +642,46 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEnterDesktopModeTransitionStarted(transitionDuration: Int) {}
|
||||
|
||||
override fun onExitDesktopModeTransitionStarted(transitionDuration: Int) {}
|
||||
|
||||
override fun onCanCreateDesksChanged(displayId: Int, canCreateDesks: Boolean) {
|
||||
Executors.MAIN_EXECUTOR.execute {
|
||||
controller.get()?.onCanCreateDesksChanged(displayId, canCreateDesks)
|
||||
override fun onEnterDesktopModeTransitionStarted(transitionDuration: Int) {
|
||||
MAIN_EXECUTOR.execute {
|
||||
Log.d(
|
||||
TAG,
|
||||
("DesktopTaskListenerImpl: onEnterDesktopModeTransitionStarted with " +
|
||||
"duration= " +
|
||||
transitionDuration),
|
||||
)
|
||||
controller.get()?.isInDesktopMode = true
|
||||
controller.get()?.notifyTaskbarDesktopModeListenersForEntry(transitionDuration)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onExitDesktopModeTransitionStarted(transitionDuration: Int) {
|
||||
MAIN_EXECUTOR.execute {
|
||||
Log.d(
|
||||
TAG,
|
||||
("DesktopTaskListenerImpl: onExitDesktopModeTransitionStarted with " +
|
||||
"duration= " +
|
||||
transitionDuration),
|
||||
)
|
||||
controller.get()?.isInDesktopMode = false
|
||||
controller.get()?.notifyTaskbarDesktopModeListenersForExit(transitionDuration)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCanCreateDesksChanged(canCreateDesks: Boolean) {
|
||||
MAIN_EXECUTOR.execute { controller.get()?.onCanCreateDesksChanged(canCreateDesks) }
|
||||
}
|
||||
|
||||
override fun onDeskAdded(displayId: Int, deskId: Int) {
|
||||
Executors.MAIN_EXECUTOR.execute { controller.get()?.onDeskAdded(displayId, deskId) }
|
||||
MAIN_EXECUTOR.execute { controller.get()?.onDeskAdded(displayId, deskId) }
|
||||
}
|
||||
|
||||
override fun onDeskRemoved(displayId: Int, deskId: Int) {
|
||||
Executors.MAIN_EXECUTOR.execute { controller.get()?.onDeskRemoved(displayId, deskId) }
|
||||
MAIN_EXECUTOR.execute { controller.get()?.onDeskRemoved(displayId, deskId) }
|
||||
}
|
||||
|
||||
override fun onActiveDeskChanged(displayId: Int, newActiveDesk: Int, oldActiveDesk: Int) {
|
||||
Executors.MAIN_EXECUTOR.execute {
|
||||
MAIN_EXECUTOR.execute {
|
||||
controller.get()?.onActiveDeskChanged(displayId, newActiveDesk, oldActiveDesk)
|
||||
}
|
||||
}
|
||||
@@ -593,7 +694,21 @@ constructor(
|
||||
*
|
||||
* @param doesAnyTaskRequireTaskbarRounding whether task requires taskbar corner roundness.
|
||||
*/
|
||||
fun onTaskbarCornerRoundingUpdate(doesAnyTaskRequireTaskbarRounding: Boolean)
|
||||
fun onTaskbarCornerRoundingUpdate(doesAnyTaskRequireTaskbarRounding: Boolean) {}
|
||||
|
||||
/**
|
||||
* Callback for when user is exiting desktop mode.
|
||||
*
|
||||
* @param duration for exit transition
|
||||
*/
|
||||
fun onExitDesktopMode(duration: Int) {}
|
||||
|
||||
/**
|
||||
* Callback for when user is entering desktop mode.
|
||||
*
|
||||
* @param duration for enter transition
|
||||
*/
|
||||
fun onEnterDesktopMode(duration: Int) {}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -603,6 +718,6 @@ constructor(
|
||||
private const val TAG = "DesktopVisController"
|
||||
private const val DEBUG = false
|
||||
|
||||
private const val INACTIVE_DESK_ID = -1
|
||||
public const val INACTIVE_DESK_ID = -1
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.Flags.enableAltTabKqsOnConnectedDisplays;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.view.MotionEvent;
|
||||
@@ -354,6 +355,27 @@ public final class KeyboardQuickSwitchController implements
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean isShownFromTaskbar() {
|
||||
return isShown() && mQuickSwitchViewController.wasOpenedFromTaskbar();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean isShown() {
|
||||
return mQuickSwitchViewController != null
|
||||
&& !mQuickSwitchViewController.isCloseAnimationRunning();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
List<Integer> shownTaskIds() {
|
||||
if (!isShown()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return mTasks.stream().flatMap(
|
||||
groupTask -> groupTask.getTasks().stream().map(task -> task.key.id)).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dumpLogs(String prefix, PrintWriter pw) {
|
||||
pw.println(prefix + "KeyboardQuickSwitchController:");
|
||||
@@ -423,7 +445,13 @@ public final class KeyboardQuickSwitchController implements
|
||||
if (task == null) {
|
||||
return false;
|
||||
}
|
||||
int runningTaskId = ActivityManagerWrapper.getInstance().getRunningTask().taskId;
|
||||
ActivityManager.RunningTaskInfo runningTaskInfo =
|
||||
ActivityManagerWrapper.getInstance().getRunningTask();
|
||||
if (runningTaskInfo == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int runningTaskId = runningTaskInfo.taskId;
|
||||
return task.containsTask(runningTaskId);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,18 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
|
||||
mIcon2 = findViewById(R.id.icon_2);
|
||||
mContent = findViewById(R.id.content);
|
||||
|
||||
Resources resources = mContext.getResources();
|
||||
|
||||
Preconditions.assertNotNull(mContent);
|
||||
|
||||
TypefaceUtils.setTypeface(
|
||||
mContent.findViewById(R.id.large_text),
|
||||
TypefaceUtils.FONT_FAMILY_HEADLINE_LARGE_EMPHASIZED
|
||||
);
|
||||
TypefaceUtils.setTypeface(
|
||||
mContent.findViewById(R.id.small_text),
|
||||
TypefaceUtils.FONT_FAMILY_LABEL_LARGE_BASELINE
|
||||
);
|
||||
|
||||
Resources resources = mContext.getResources();
|
||||
mBorderAnimator = BorderAnimator.createScalingBorderAnimator(
|
||||
/* borderRadiusPx= */ mBorderRadius != INVALID_BORDER_RADIUS
|
||||
? mBorderRadius
|
||||
@@ -188,8 +197,7 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
|
||||
|
||||
|
||||
final boolean isLeftRightSplit = !splitBounds.appsStackedVertically;
|
||||
final float leftOrTopTaskPercent = isLeftRightSplit
|
||||
? splitBounds.leftTaskPercent : splitBounds.topTaskPercent;
|
||||
final float leftOrTopTaskPercent = splitBounds.getLeftTopTaskPercent();
|
||||
|
||||
ConstraintLayout.LayoutParams leftTopParams = (ConstraintLayout.LayoutParams)
|
||||
mThumbnailView1.getLayoutParams();
|
||||
|
||||
@@ -163,6 +163,10 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
R.dimen.keyboard_quick_switch_view_small_spacing);
|
||||
mOutlineRadius = resources.getDimensionPixelSize(R.dimen.keyboard_quick_switch_view_radius);
|
||||
mIsRtl = Utilities.isRtl(resources);
|
||||
|
||||
TypefaceUtils.setTypeface(
|
||||
mNoRecentItemsPane.findViewById(R.id.no_recent_items_text),
|
||||
TypefaceUtils.FONT_FAMILY_LABEL_LARGE_BASELINE);
|
||||
}
|
||||
|
||||
private void registerOnBackInvokedCallback() {
|
||||
@@ -310,7 +314,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
layoutInflater,
|
||||
previousTaskView);
|
||||
|
||||
desktopButton.<TextView>findViewById(R.id.text).setText(
|
||||
desktopButton.<TextView>findViewById(R.id.small_text).setText(
|
||||
resources.getString(R.string.quick_switch_desktop));
|
||||
}
|
||||
mDisplayingRecentTasks = !groupTasks.isEmpty() || useDesktopTaskView;
|
||||
|
||||
@@ -290,9 +290,9 @@ public class KeyboardQuickSwitchViewController {
|
||||
remoteTransition = new RemoteTransition(
|
||||
new DesktopAppLaunchTransition(
|
||||
context,
|
||||
MAIN_EXECUTOR,
|
||||
UNMINIMIZE,
|
||||
Cuj.CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH
|
||||
Cuj.CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH,
|
||||
MAIN_EXECUTOR
|
||||
),
|
||||
"DesktopKeyboardQuickSwitchUnminimize");
|
||||
}
|
||||
|
||||
@@ -467,10 +467,15 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canToggleHomeAllApps() {
|
||||
return mLauncher.isResumed()
|
||||
protected void toggleAllApps(boolean focusSearch) {
|
||||
boolean canToggleHomeAllApps = mLauncher.isResumed()
|
||||
&& !mTaskbarLauncherStateController.isInOverviewUi()
|
||||
&& !mLauncher.areDesktopTasksVisible();
|
||||
if (canToggleHomeAllApps) {
|
||||
mLauncher.toggleAllApps(focusSearch);
|
||||
return;
|
||||
}
|
||||
super.toggleAllApps(focusSearch);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,7 +119,8 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
mControllers = controllers;
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
Resources resources = mActivity.getResources();
|
||||
if (mActivity.isPhoneGestureNavMode() || mActivity.isTinyTaskbar()) {
|
||||
if (mActivity.isPhoneGestureNavMode() || mActivity.isTinyTaskbar()
|
||||
|| mActivity.isBubbleBarOnPhone()) {
|
||||
mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_phone_size);
|
||||
mStashedHandleWidth =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen);
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar;
|
||||
import static android.os.Trace.TRACE_TAG_APP;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
|
||||
@@ -26,6 +27,7 @@ import static android.window.SplashScreen.SPLASH_SCREEN_STYLE_UNDEFINED;
|
||||
|
||||
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
|
||||
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ON_BOARD_POPUP;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
|
||||
@@ -46,8 +48,8 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING;
|
||||
import static com.android.window.flags.Flags.enableStartLaunchTransitionFromTaskbarBugfix;
|
||||
import static com.android.window.flags.Flags.enableTaskbarConnectedDisplays;
|
||||
import static com.android.wm.shell.Flags.enableBubbleBar;
|
||||
import static com.android.wm.shell.Flags.enableBubbleBarOnPhones;
|
||||
import static com.android.wm.shell.Flags.enableTinyTaskbar;
|
||||
|
||||
import static java.lang.invoke.MethodHandles.Lookup.PROTECTED;
|
||||
@@ -77,6 +79,7 @@ import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
import android.window.DesktopExperienceFlags;
|
||||
import android.window.DesktopModeFlags;
|
||||
import android.window.RemoteTransition;
|
||||
|
||||
@@ -94,12 +97,12 @@ import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.apppairs.AppPairIcon;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.desktop.DesktopAppLaunchTransition;
|
||||
import com.android.launcher3.desktop.DesktopAppLaunchTransition.AppLaunchType;
|
||||
import com.android.launcher3.dot.DotInfo;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
@@ -146,6 +149,7 @@ import com.android.launcher3.util.ApplicationInfoWrapper;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.NavigationMode;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
@@ -226,7 +230,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private boolean mIsDestroyed = false;
|
||||
// The flag to know if the window is excluded from magnification region computation.
|
||||
private boolean mIsExcludeFromMagnificationRegion = false;
|
||||
private boolean mBindingItems = false;
|
||||
private boolean mAddedWindow = false;
|
||||
|
||||
// The bounds of the taskbar items relative to TaskbarDragLayer
|
||||
@@ -298,9 +301,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
// If Bubble bar is present, TaskbarControllers depends on it so build it first.
|
||||
Optional<BubbleControllers> bubbleControllersOptional = Optional.empty();
|
||||
BubbleBarController.onTaskbarRecreated();
|
||||
final boolean deviceBubbleBarEnabled = enableBubbleBarOnPhones()
|
||||
|| (!mDeviceProfile.isPhone && !mDeviceProfile.isVerticalBarLayout());
|
||||
if (BubbleBarController.isBubbleBarEnabled()
|
||||
&& !mDeviceProfile.isPhone
|
||||
&& !mDeviceProfile.isVerticalBarLayout()
|
||||
&& deviceBubbleBarEnabled
|
||||
&& bubbleBarView != null
|
||||
) {
|
||||
Optional<BubbleStashedHandleViewController> bubbleHandleController = Optional.empty();
|
||||
@@ -434,8 +438,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
.setIsTransientTaskbar(true)
|
||||
.build();
|
||||
}
|
||||
mNavMode = (enableTaskbarConnectedDisplays() && !mIsPrimaryDisplay)
|
||||
? NavigationMode.THREE_BUTTONS : DisplayController.getNavigationMode(this);
|
||||
mNavMode = (DesktopExperienceFlags.ENABLE_TASKBAR_CONNECTED_DISPLAYS.isTrue()
|
||||
&& !mIsPrimaryDisplay) ? NavigationMode.THREE_BUTTONS
|
||||
: DisplayController.getNavigationMode(this);
|
||||
|
||||
}
|
||||
|
||||
@@ -445,14 +450,25 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.taskbarViewController.adjustTaskbarForBubbleBar();
|
||||
}
|
||||
|
||||
public void init(@NonNull TaskbarSharedState sharedState) {
|
||||
/**
|
||||
* Init of taskbar activity context.
|
||||
* @param duration If duration is greater than 0, it will be used to create an animation
|
||||
* for the taskbar create/recreate process.
|
||||
*/
|
||||
public void init(@NonNull TaskbarSharedState sharedState, int duration) {
|
||||
mImeDrawsImeNavBar = getBoolByName(IME_DRAWS_IME_NAV_BAR_RES_NAME, getResources(), false);
|
||||
mLastRequestedNonFullscreenSize = getDefaultTaskbarWindowSize();
|
||||
mWindowLayoutParams = createAllWindowParams();
|
||||
mLastUpdatedLayoutParams = new WindowManager.LayoutParams();
|
||||
|
||||
|
||||
AnimatorSet recreateAnim = null;
|
||||
if (duration > 0) {
|
||||
recreateAnim = onRecreateAnimation(duration);
|
||||
}
|
||||
|
||||
// Initialize controllers after all are constructed.
|
||||
mControllers.init(sharedState);
|
||||
mControllers.init(sharedState, recreateAnim);
|
||||
// This may not be necessary and can be reverted once we move towards recreating all
|
||||
// controllers without re-creating the window
|
||||
mControllers.rotationButtonController.onNavigationModeChanged(mNavMode.resValue);
|
||||
@@ -480,6 +496,33 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
} else {
|
||||
notifyUpdateLayoutParams();
|
||||
}
|
||||
|
||||
|
||||
if (recreateAnim != null) {
|
||||
recreateAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create AnimatorSet for taskbar create/recreate animation. Further used in init
|
||||
*/
|
||||
public AnimatorSet onRecreateAnimation(int duration) {
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
animatorSet.setDuration(duration);
|
||||
return animatorSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when we want destroy current taskbar with animation as part of recreate process.
|
||||
*/
|
||||
public AnimatorSet onDestroyAnimation(int duration) {
|
||||
mIsDestroyed = true;
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
mControllers.taskbarViewController.onDestroyAnimation(animatorSet);
|
||||
mControllers.taskbarDragLayerController.onDestroyAnimation(animatorSet);
|
||||
animatorSet.setInterpolator(LINEAR);
|
||||
animatorSet.setDuration(duration);
|
||||
return animatorSet;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -511,6 +554,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return enableTinyTaskbar() && mDeviceProfile.isPhone && mDeviceProfile.isTaskbarPresent;
|
||||
}
|
||||
|
||||
public boolean isBubbleBarOnPhone() {
|
||||
return enableBubbleBarOnPhones() && enableBubbleBar() && mDeviceProfile.isPhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} iff bubble bar is enabled (but not necessarily visible /
|
||||
* containing bubbles).
|
||||
@@ -561,16 +608,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(false);
|
||||
}
|
||||
|
||||
/** Toggles Taskbar All Apps overlay. */
|
||||
public void toggleAllApps() {
|
||||
mControllers.taskbarAllAppsController.toggle();
|
||||
}
|
||||
|
||||
/** Toggles Taskbar All Apps overlay with keyboard ready for search. */
|
||||
public void toggleAllAppsSearch() {
|
||||
mControllers.taskbarAllAppsController.toggleSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceProfile getDeviceProfile() {
|
||||
return mDeviceProfile;
|
||||
@@ -831,31 +868,28 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DotInfo getDotInfoForItem(ItemInfo info) {
|
||||
return getPopupDataProvider().getDotInfoForItem(info);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PopupDataProvider getPopupDataProvider() {
|
||||
return mControllers.taskbarPopupController.getPopupDataProvider();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LauncherBindableItemsContainer getContent() {
|
||||
return mControllers.taskbarViewController.getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityAllAppsContainerView<?> getAppsView() {
|
||||
return mControllers.taskbarAllAppsController.getAppsView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View.AccessibilityDelegate getAccessibilityDelegate() {
|
||||
return mAccessibilityDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBindingItems() {
|
||||
return mBindingItems;
|
||||
}
|
||||
|
||||
public void setBindingItems(boolean bindingItems) {
|
||||
mBindingItems = bindingItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragStart() {
|
||||
setTaskbarWindowFullscreen(true);
|
||||
@@ -868,7 +902,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
|
||||
@Override
|
||||
public void onPopupVisibilityChanged(boolean isVisible) {
|
||||
setTaskbarWindowFocusable(isVisible);
|
||||
setTaskbarWindowFocusable(isVisible /* focusable */, false /* imeFocusable */);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1227,17 +1261,29 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Either adds or removes {@link WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} on the taskbar
|
||||
* window.
|
||||
* Sets whether the taskbar window should be focusable and IME focusable. This won't be IME
|
||||
* focusable unless it is also focusable.
|
||||
*
|
||||
* @param focusable whether it should be focusable.
|
||||
* @param imeFocusable whether it should be IME focusable.
|
||||
*
|
||||
* @see WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE
|
||||
* @see WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM
|
||||
*/
|
||||
public void setTaskbarWindowFocusable(boolean focusable) {
|
||||
public void setTaskbarWindowFocusable(boolean focusable, boolean imeFocusable) {
|
||||
if (isPhoneMode()) {
|
||||
return;
|
||||
}
|
||||
if (focusable) {
|
||||
mWindowLayoutParams.flags &= ~FLAG_NOT_FOCUSABLE;
|
||||
if (imeFocusable) {
|
||||
mWindowLayoutParams.flags &= ~FLAG_ALT_FOCUSABLE_IM;
|
||||
} else {
|
||||
mWindowLayoutParams.flags |= FLAG_ALT_FOCUSABLE_IM;
|
||||
}
|
||||
} else {
|
||||
mWindowLayoutParams.flags |= FLAG_NOT_FOCUSABLE;
|
||||
mWindowLayoutParams.flags &= ~FLAG_ALT_FOCUSABLE_IM;
|
||||
}
|
||||
notifyUpdateLayoutParams();
|
||||
}
|
||||
@@ -1258,8 +1304,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Either adds or removes {@link WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} on the taskbar
|
||||
* window. If we're now focusable, also move nav buttons to a separate window above IME.
|
||||
* Sets whether the taskbar window should be focusable, as well as IME focusable. If we're now
|
||||
* focusable, also move nav buttons to a separate window above IME.
|
||||
*
|
||||
* @param focusable whether it should be focusable.
|
||||
*
|
||||
* @see WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE
|
||||
*/
|
||||
public void setTaskbarWindowFocusableForIme(boolean focusable) {
|
||||
if (focusable) {
|
||||
@@ -1267,7 +1317,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
} else {
|
||||
mControllers.navbarButtonsViewController.moveNavButtonsBackToTaskbarWindow();
|
||||
}
|
||||
setTaskbarWindowFocusable(focusable);
|
||||
setTaskbarWindowFocusable(focusable, true /* imeFocusable */);
|
||||
}
|
||||
|
||||
/** Adds the given view to WindowManager with the provided LayoutParams (creates new window). */
|
||||
@@ -1533,9 +1583,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return new RemoteTransition(
|
||||
new DesktopAppLaunchTransition(
|
||||
this,
|
||||
getMainExecutor(),
|
||||
appLaunchType,
|
||||
cujType
|
||||
cujType,
|
||||
getMainExecutor()
|
||||
),
|
||||
"TaskbarDesktopAppLaunch");
|
||||
}
|
||||
@@ -1558,7 +1608,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
*/
|
||||
private void launchFromInAppTaskbar(@Nullable RecentsView recents,
|
||||
@Nullable View launchingIconView, List<? extends ItemInfo> itemInfos) {
|
||||
if (recents == null) {
|
||||
boolean launchedFromExternalDisplay =
|
||||
DesktopExperienceFlags.ENABLE_TASKBAR_CONNECTED_DISPLAYS.isTrue()
|
||||
&& !mIsPrimaryDisplay;
|
||||
if (recents == null && !launchedFromExternalDisplay) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1699,7 +1752,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
// There is no task associated with this launch - launch a new task through an intent
|
||||
ActivityOptionsWrapper opts = getActivityLaunchDesktopOptions();
|
||||
if (enableStartLaunchTransitionFromTaskbarBugfix()) {
|
||||
if (DesktopModeFlags.ENABLE_START_LAUNCH_TRANSITION_FROM_TASKBAR_BUGFIX.isTrue()) {
|
||||
mSysUiProxy.startLaunchIntentTransition(intent, opts.options.toBundle(), displayId);
|
||||
} else {
|
||||
startActivity(intent, opts.options.toBundle());
|
||||
@@ -1956,6 +2009,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return mControllers.taskbarStashController.isInApp();
|
||||
}
|
||||
|
||||
public boolean isInOverview() {
|
||||
return mControllers.taskbarStashController.isInOverview();
|
||||
}
|
||||
|
||||
public boolean isInStashedLauncherState() {
|
||||
return mControllers.taskbarStashController.isInStashedLauncherState();
|
||||
}
|
||||
@@ -1979,8 +2036,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
"%s\tmIsUserSetupComplete=%b", prefix, mIsUserSetupComplete));
|
||||
pw.println(String.format(
|
||||
"%s\tmWindowLayoutParams.height=%dpx", prefix, mWindowLayoutParams.height));
|
||||
pw.println(String.format(
|
||||
"%s\tmBindInProgress=%b", prefix, mBindingItems));
|
||||
mControllers.dumpLogs(prefix + "\t", pw);
|
||||
mDeviceProfile.dump(this, prefix, pw);
|
||||
}
|
||||
@@ -2005,10 +2060,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.keyboardQuickSwitchController.closeQuickSwitchView(false);
|
||||
}
|
||||
|
||||
boolean canToggleHomeAllApps() {
|
||||
return mControllers.uiController.canToggleHomeAllApps();
|
||||
}
|
||||
|
||||
boolean isIconAlignedWithHotseat() {
|
||||
return mControllers.uiController.isIconAlignedWithHotseat();
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
}
|
||||
|
||||
var isAnimatingPinning = false
|
||||
var isAnimatingPersistentTaskbar = false
|
||||
var isAnimatingTransientTaskbar = false
|
||||
|
||||
val paint = Paint()
|
||||
private val strokePaint = Paint()
|
||||
@@ -108,7 +110,7 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
fun updateStashedHandleWidth(context: TaskbarActivityContext, res: Resources) {
|
||||
stashedHandleWidth =
|
||||
res.getDimensionPixelSize(
|
||||
if (context.isPhoneMode || context.isTinyTaskbar) {
|
||||
if (context.isPhoneMode || context.isTinyTaskbar || context.isBubbleBarOnPhone) {
|
||||
R.dimen.taskbar_stashed_small_screen
|
||||
} else {
|
||||
R.dimen.taskbar_stashed_handle_width
|
||||
@@ -144,7 +146,7 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
/** Draws the background with the given paint and height, on the provided canvas. */
|
||||
fun draw(canvas: Canvas) {
|
||||
if (isInSetup) return
|
||||
val isTransientTaskbar = backgroundProgress == 0f
|
||||
val isTransientTaskbar = DisplayController.isTransientTaskbar(context)
|
||||
canvas.save()
|
||||
if (!isTransientTaskbar || transientBackgroundBounds.isEmpty || isAnimatingPinning) {
|
||||
drawPersistentBackground(canvas)
|
||||
@@ -158,7 +160,7 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
}
|
||||
|
||||
private fun drawPersistentBackground(canvas: Canvas) {
|
||||
if (isAnimatingPinning) {
|
||||
if (isAnimatingPinning || isAnimatingPersistentTaskbar) {
|
||||
val persistentTaskbarHeight = maxPersistentTaskbarHeight * backgroundProgress
|
||||
canvas.translate(0f, canvas.height - persistentTaskbarHeight)
|
||||
// Draw the background behind taskbar content.
|
||||
@@ -181,12 +183,13 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
private fun drawTransientBackground(canvas: Canvas) {
|
||||
val res = context.resources
|
||||
val transientTaskbarHeight = maxTransientTaskbarHeight * (1f - backgroundProgress)
|
||||
val isAnimating = isAnimatingPinning || isAnimatingTransientTaskbar
|
||||
val heightProgressWhileAnimating =
|
||||
if (isAnimatingPinning) transientTaskbarHeight else backgroundHeight
|
||||
if (isAnimating) transientTaskbarHeight else backgroundHeight
|
||||
|
||||
var progress = heightProgressWhileAnimating / maxTransientTaskbarHeight
|
||||
progress = Math.round(progress * 100f) / 100f
|
||||
if (isAnimatingPinning) {
|
||||
if (isAnimating) {
|
||||
var scale = transientTaskbarHeight / maxTransientTaskbarHeight
|
||||
scale = Math.round(scale * 100f) / 100f
|
||||
bottomMargin =
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.content.pm.ActivityInfo.Config;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -149,15 +150,15 @@ public class TaskbarControllers {
|
||||
* TaskbarControllers instance, but should be careful to only access things that were created
|
||||
* in constructors for now, as some controllers may still be waiting for init().
|
||||
*/
|
||||
public void init(@NonNull TaskbarSharedState sharedState) {
|
||||
public void init(@NonNull TaskbarSharedState sharedState, AnimatorSet startAnimation) {
|
||||
mAreAllControllersInitialized = false;
|
||||
mSharedState = sharedState;
|
||||
|
||||
taskbarDragController.init(this);
|
||||
navbarButtonsViewController.init(this);
|
||||
rotationButtonController.init();
|
||||
taskbarDragLayerController.init(this);
|
||||
taskbarViewController.init(this);
|
||||
taskbarDragLayerController.init(this, startAnimation);
|
||||
taskbarViewController.init(this, startAnimation);
|
||||
taskbarScrimViewController.init(this);
|
||||
taskbarUnfoldAnimationController.init(this);
|
||||
taskbarKeyguardController.init(navbarButtonsViewController);
|
||||
|
||||
@@ -30,6 +30,9 @@ class TaskbarDesktopModeController(
|
||||
private lateinit var taskbarControllers: TaskbarControllers
|
||||
private lateinit var taskbarSharedState: TaskbarSharedState
|
||||
|
||||
val isInDesktopMode: Boolean
|
||||
get() = desktopVisibilityController.isInDesktopMode
|
||||
|
||||
fun init(controllers: TaskbarControllers, sharedState: TaskbarSharedState) {
|
||||
taskbarControllers = controllers
|
||||
taskbarSharedState = sharedState
|
||||
@@ -42,6 +45,7 @@ class TaskbarDesktopModeController(
|
||||
desktopVisibilityController.isInDesktopModeAndNotInOverview(displayId)
|
||||
|
||||
override fun onTaskbarCornerRoundingUpdate(doesAnyTaskRequireTaskbarRounding: Boolean) {
|
||||
if (taskbarControllers.taskbarActivityContext.isDestroyed) return
|
||||
taskbarSharedState.showCornerRadiusInDesktopMode = doesAnyTaskRequireTaskbarRounding
|
||||
val cornerRadius = getTaskbarCornerRoundness(doesAnyTaskRequireTaskbarRounding)
|
||||
taskbarControllers.taskbarCornerRoundness.animateToValue(cornerRadius).start()
|
||||
|
||||
@@ -52,6 +52,7 @@ import android.view.ViewRootImpl;
|
||||
import android.window.SurfaceSyncGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.internal.logging.InstanceId;
|
||||
@@ -67,6 +68,7 @@ import com.android.launcher3.dragndrop.DragDriver;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.dragndrop.DraggableView;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.graphics.DragPreviewProvider;
|
||||
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
@@ -75,6 +77,7 @@ import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.popup.PopupContainerWithArrow;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarViewController;
|
||||
import com.android.launcher3.testing.TestLogging;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
@@ -114,6 +117,7 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
private int mRegistrationY;
|
||||
|
||||
private boolean mIsSystemDragInProgress;
|
||||
private boolean mIsDropHandledByDropTarget;
|
||||
|
||||
// Animation for the drag shadow back into position after an unsuccessful drag
|
||||
private ValueAnimator mReturnAnimator;
|
||||
@@ -250,7 +254,8 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
/* originalView = */ btv,
|
||||
dragLayerX + dragOffset.x,
|
||||
dragLayerY + dragOffset.y,
|
||||
(View target, DropTarget.DragObject d, boolean success) -> {} /* DragSource */,
|
||||
(View target, DropTarget.DragObject d, boolean success) ->
|
||||
mIsDropHandledByDropTarget = success /* DragSource */,
|
||||
btv.getTag() instanceof ItemInfo itemInfo ? itemInfo : null,
|
||||
dragRect,
|
||||
scale * iconScale,
|
||||
@@ -517,6 +522,7 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
return mIsSystemDragInProgress;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
private void maybeOnDragEnd() {
|
||||
if (!isDragging()) {
|
||||
((BubbleTextView) mDragObject.originalView).setIconDisabled(false);
|
||||
@@ -524,20 +530,41 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING, false);
|
||||
mActivity.onDragEnd();
|
||||
if (mReturnAnimator == null) {
|
||||
// If an item is dropped on the bubble bar, the bubble bar handles the drop,
|
||||
// so it should not collapse along with the taskbar.
|
||||
boolean droppedOnBubbleBar = notifyBubbleBarItemDropped();
|
||||
// Upon successful drag, immediately stash taskbar.
|
||||
// Note, this must be done last to ensure no AutohideSuspendFlags are active, as
|
||||
// that will prevent us from stashing until the timeout.
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(
|
||||
/* stash = */ true,
|
||||
/* shouldBubblesFollow = */ !droppedOnBubbleBar
|
||||
);
|
||||
mActivity.getStatsLogManager().logger().withItemInfo(mDragObject.dragInfo)
|
||||
.log(LAUNCHER_APP_LAUNCH_DRAGDROP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exits the Bubble Bar drop target mode if applicable.
|
||||
*
|
||||
* @return {@code true} if drop target mode was active.
|
||||
*/
|
||||
private boolean notifyBubbleBarItemDropped() {
|
||||
return mControllers.bubbleControllers.map(bc -> {
|
||||
BubbleBarViewController bubbleBarViewController = bc.bubbleBarViewController;
|
||||
boolean showingDropTarget = bubbleBarViewController.isShowingDropTarget();
|
||||
if (showingDropTarget) {
|
||||
bubbleBarViewController.onItemDroppedInBubbleBarDragZone();
|
||||
}
|
||||
return showingDropTarget;
|
||||
}).orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endDrag() {
|
||||
if (mDisallowGlobalDrag) {
|
||||
if (mDisallowGlobalDrag && !mIsDropHandledByDropTarget) {
|
||||
// We need to explicitly set deferDragViewCleanupPostAnimation to true here so the
|
||||
// super call doesn't remove it from the drag layer before the animation completes.
|
||||
// This variable gets set in to false in super.dispatchDropComplete() because it
|
||||
@@ -741,8 +768,11 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
|
||||
@Override
|
||||
public void addDropTarget(DropTarget target) {
|
||||
// No-op as Taskbar currently doesn't support any drop targets internally.
|
||||
// Note: if we do add internal DropTargets, we'll still need to ignore Folder.
|
||||
if (target instanceof Folder) {
|
||||
// we need to ignore Folder.
|
||||
return;
|
||||
}
|
||||
super.addDropTarget(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -186,6 +186,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (mContainer.isDestroyed()) return;
|
||||
float backgroundHeight = mControllerCallbacks.getTaskbarBackgroundHeight()
|
||||
* (1f - mTaskbarBackgroundOffset);
|
||||
mBackgroundRenderer.setBackgroundHeight(backgroundHeight);
|
||||
@@ -285,6 +286,21 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets animation boolean when only animating persistent taskbar.
|
||||
*/
|
||||
public void setIsAnimatingPersistentTaskbarBackground(boolean animatingPersistentTaskbarBg) {
|
||||
mBackgroundRenderer.setAnimatingPersistentTaskbar(animatingPersistentTaskbarBg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets animation boolean when only animating transient taskbar.
|
||||
*/
|
||||
public void setIsAnimatingTransientTaskbarBackground(boolean animatingTransientTaskbarBg) {
|
||||
mBackgroundRenderer.setAnimatingTransientTaskbar(animatingTransientTaskbarBg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the width percentage to inset the transient taskbar's background from the left and from
|
||||
* the right.
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_PERSISTENT;
|
||||
import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_TRANSIENT;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Point;
|
||||
@@ -29,6 +32,7 @@ import android.view.ViewTreeObserver;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.util.DimensionUtils;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
||||
@@ -58,6 +62,8 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
private final AnimatedFloat mImeBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
|
||||
private final AnimatedFloat mAssistantBgTaskbar = new AnimatedFloat(
|
||||
this::updateBackgroundAlpha);
|
||||
private final AnimatedFloat mBgTaskbarRecreate = 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);
|
||||
|
||||
@@ -88,7 +94,10 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
mFolderMargin = resources.getDimensionPixelSize(R.dimen.taskbar_folder_margin);
|
||||
}
|
||||
|
||||
public void init(TaskbarControllers controllers) {
|
||||
/**
|
||||
* Init of taskbar drag layer controller
|
||||
*/
|
||||
public void init(TaskbarControllers controllers, AnimatorSet startAnimation) {
|
||||
mControllers = controllers;
|
||||
mTaskbarStashViaTouchController = new TaskbarStashViaTouchController(mControllers);
|
||||
mTaskbarDragLayer.init(new TaskbarDragLayerCallbacks());
|
||||
@@ -96,15 +105,45 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
mOnBackgroundNavButtonColorIntensity = mControllers.navbarButtonsViewController
|
||||
.getOnTaskbarBackgroundNavButtonColorOverride();
|
||||
|
||||
mTaskbarBackgroundProgress.updateValue(DisplayController.isTransientTaskbar(mActivity)
|
||||
? PINNING_TRANSIENT
|
||||
: PINNING_PERSISTENT);
|
||||
|
||||
if (startAnimation != null) {
|
||||
// set taskbar background render animation boolean
|
||||
if (DisplayController.isTransientTaskbar(mActivity)) {
|
||||
mTaskbarDragLayer.setIsAnimatingTransientTaskbarBackground(true);
|
||||
} else {
|
||||
mTaskbarDragLayer.setIsAnimatingPersistentTaskbarBackground(true);
|
||||
}
|
||||
|
||||
float desiredValue = DisplayController.isTransientTaskbar(mActivity)
|
||||
? PINNING_TRANSIENT
|
||||
: PINNING_PERSISTENT;
|
||||
|
||||
float nonDesiredvalue = !DisplayController.isTransientTaskbar(mActivity)
|
||||
? PINNING_TRANSIENT
|
||||
: PINNING_PERSISTENT;
|
||||
|
||||
ObjectAnimator objectAnimator = mTaskbarBackgroundProgress.animateToValue(
|
||||
nonDesiredvalue, desiredValue);
|
||||
objectAnimator.setInterpolator(EMPHASIZED);
|
||||
startAnimation.play(objectAnimator);
|
||||
startAnimation.addListener(AnimatorListeners.forEndCallback(()-> {
|
||||
// reset taskbar background render animation boolean
|
||||
mTaskbarDragLayer.setIsAnimatingPersistentTaskbarBackground(false);
|
||||
mTaskbarDragLayer.setIsAnimatingTransientTaskbarBackground(false);
|
||||
}));
|
||||
|
||||
} else {
|
||||
mTaskbarBackgroundProgress.updateValue(DisplayController.isTransientTaskbar(mActivity)
|
||||
? PINNING_TRANSIENT
|
||||
: PINNING_PERSISTENT);
|
||||
}
|
||||
|
||||
mBgTaskbar.value = 1;
|
||||
mKeyguardBgTaskbar.value = 1;
|
||||
mNotificationShadeBgTaskbar.value = 1;
|
||||
mImeBgTaskbar.value = 1;
|
||||
mAssistantBgTaskbar.value = 1;
|
||||
mBgTaskbarRecreate.value = 1;
|
||||
mBgOverride.value = 1;
|
||||
updateBackgroundAlpha();
|
||||
|
||||
@@ -112,6 +151,13 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
updateTaskbarAlpha();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when destroying Taskbar with animation.
|
||||
*/
|
||||
public void onDestroyAnimation(AnimatorSet animatorSet) {
|
||||
animatorSet.play(mBgTaskbarRecreate.animateToValue(0f));
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
mTaskbarDragLayer.onDestroy();
|
||||
}
|
||||
@@ -172,14 +218,14 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
|
||||
private void updateBackgroundAlpha() {
|
||||
if (mActivity.isPhoneMode()) {
|
||||
if (mActivity.isPhoneMode() || mActivity.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final float bgNavbar = mBgNavbar.value;
|
||||
final float bgTaskbar = mBgTaskbar.value * mKeyguardBgTaskbar.value
|
||||
* mNotificationShadeBgTaskbar.value * mImeBgTaskbar.value
|
||||
* mAssistantBgTaskbar.value;
|
||||
* mAssistantBgTaskbar.value * mBgTaskbarRecreate.value;
|
||||
mLastSetBackgroundAlpha = mBgOverride.value * Math.max(bgNavbar, bgTaskbar);
|
||||
mBackgroundRendererAlpha.setValue(mLastSetBackgroundAlpha);
|
||||
|
||||
@@ -266,6 +312,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
pw.println(prefix + "\t\tmNotificationShadeBgTaskbar=" + mNotificationShadeBgTaskbar.value);
|
||||
pw.println(prefix + "\t\tmImeBgTaskbar=" + mImeBgTaskbar.value);
|
||||
pw.println(prefix + "\t\tmAssistantBgTaskbar=" + mAssistantBgTaskbar.value);
|
||||
pw.println(prefix + "\t\tmBgTaskbarRecreate=" + mBgTaskbarRecreate.value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,6 +39,7 @@ import androidx.core.view.updateLayoutParams
|
||||
import com.airbnb.lottie.LottieAnimationView
|
||||
import com.android.launcher3.LauncherPrefs
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.RemoveAnimationSettingsTracker
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.config.FeatureFlags.enableTaskbarPinning
|
||||
import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_EDU_OPEN
|
||||
@@ -128,6 +129,26 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
activityContext.dragLayer.post { maybeShowSearchEdu() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off auto play of lottie animations if user has opted to remove animation else attaches
|
||||
* click listener to allow user to play or pause animations.
|
||||
*/
|
||||
fun handleEduAnimations(animationViews: List<LottieAnimationView>) {
|
||||
for (animationView in animationViews) {
|
||||
if (
|
||||
RemoveAnimationSettingsTracker.INSTANCE.get(animationView.context)
|
||||
.isRemoveAnimationEnabled()
|
||||
) {
|
||||
animationView.pauseAnimation()
|
||||
} else {
|
||||
animationView.setOnClickListener {
|
||||
if (animationView.isAnimating) animationView.pauseAnimation()
|
||||
else animationView.playAnimation()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Shows swipe EDU tooltip if it is the current [tooltipStep]. */
|
||||
fun maybeShowSwipeEdu() {
|
||||
if (
|
||||
@@ -141,7 +162,13 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
tooltipStep = TOOLTIP_STEP_FEATURES
|
||||
inflateTooltip(R.layout.taskbar_edu_swipe)
|
||||
tooltip?.run {
|
||||
requireViewById<LottieAnimationView>(R.id.swipe_animation).supportLightTheme()
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.taskbar_edu_title),
|
||||
TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED,
|
||||
)
|
||||
val swipeAnimation = requireViewById<LottieAnimationView>(R.id.swipe_animation)
|
||||
swipeAnimation.supportLightTheme()
|
||||
handleEduAnimations(listOf(swipeAnimation))
|
||||
show()
|
||||
}
|
||||
}
|
||||
@@ -170,6 +197,7 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
splitscreenAnim.supportLightTheme()
|
||||
suggestionsAnim.supportLightTheme()
|
||||
pinningAnim.supportLightTheme()
|
||||
handleEduAnimations(listOf(splitscreenAnim, suggestionsAnim, pinningAnim))
|
||||
if (DisplayController.isTransientTaskbar(activityContext)) {
|
||||
splitscreenAnim.setAnimation(R.raw.taskbar_edu_splitscreen_transient)
|
||||
suggestionsAnim.setAnimation(R.raw.taskbar_edu_suggestions_transient)
|
||||
@@ -180,6 +208,23 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
pinningEdu.visibility = GONE
|
||||
}
|
||||
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.taskbar_edu_title),
|
||||
TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED,
|
||||
)
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.splitscreen_text),
|
||||
TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE,
|
||||
)
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.suggestions_text),
|
||||
TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE,
|
||||
)
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.pinning_text),
|
||||
TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE,
|
||||
)
|
||||
|
||||
// Set up layout parameters.
|
||||
content.updateLayoutParams { width = MATCH_PARENT }
|
||||
updateLayoutParams<MarginLayoutParams> {
|
||||
@@ -228,9 +273,19 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
|
||||
tooltip?.run {
|
||||
allowTouchDismissal = true
|
||||
requireViewById<LottieAnimationView>(R.id.standalone_pinning_animation)
|
||||
.supportLightTheme()
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.taskbar_edu_title),
|
||||
TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED,
|
||||
)
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.pinning_text),
|
||||
TypefaceUtils.FONT_FAMILY_BODY_MEDIUM_BASELINE,
|
||||
)
|
||||
|
||||
val pinningAnim =
|
||||
requireViewById<LottieAnimationView>(R.id.standalone_pinning_animation)
|
||||
pinningAnim.supportLightTheme()
|
||||
handleEduAnimations(listOf(pinningAnim))
|
||||
updateLayoutParams<BaseDragLayer.LayoutParams> {
|
||||
if (DisplayController.isTransientTaskbar(activityContext)) {
|
||||
bottomMargin += activityContext.deviceProfile.taskbarHeight
|
||||
@@ -274,8 +329,17 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
inflateTooltip(R.layout.taskbar_edu_search)
|
||||
tooltip?.run {
|
||||
allowTouchDismissal = true
|
||||
requireViewById<LottieAnimationView>(R.id.search_edu_animation).supportLightTheme()
|
||||
val searchEdu = requireViewById<LottieAnimationView>(R.id.search_edu_animation)
|
||||
searchEdu.supportLightTheme()
|
||||
handleEduAnimations(listOf(searchEdu))
|
||||
val eduSubtitle: TextView = requireViewById(R.id.search_edu_text)
|
||||
|
||||
TypefaceUtils.setTypeface(
|
||||
requireViewById(R.id.taskbar_edu_title),
|
||||
TypefaceUtils.FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED,
|
||||
)
|
||||
TypefaceUtils.setTypeface(eduSubtitle, TypefaceUtils.FONT_FAMILY_BODY_SMALL_BASELINE)
|
||||
|
||||
showDisclosureText(eduSubtitle)
|
||||
updateLayoutParams<BaseDragLayer.LayoutParams> {
|
||||
if (DisplayController.isTransientTaskbar(activityContext)) {
|
||||
|
||||
@@ -223,9 +223,13 @@ public class TaskbarLauncherStateController {
|
||||
updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, true);
|
||||
if (!mShouldDelayLauncherStateAnim) {
|
||||
if (toState == LauncherState.NORMAL) {
|
||||
applyState(QuickstepTransitionManager.getTaskbarToHomeDuration(
|
||||
boolean isPinnedTaskbarAndNotInDesktopMode =
|
||||
DisplayController.isPinnedTaskbar(
|
||||
mControllers.taskbarActivityContext)));
|
||||
mControllers.taskbarActivityContext)
|
||||
&& !DisplayController.isInDesktopMode(
|
||||
mControllers.taskbarActivityContext);
|
||||
applyState(QuickstepTransitionManager.getTaskbarToHomeDuration(
|
||||
isPinnedTaskbarAndNotInDesktopMode));
|
||||
} else {
|
||||
applyState();
|
||||
}
|
||||
@@ -680,8 +684,11 @@ public class TaskbarLauncherStateController {
|
||||
} else if (mIconAlignment.isAnimatingToValue(toAlignment)
|
||||
|| mIconAlignment.isSettledOnValue(toAlignment)) {
|
||||
// Already at desired value, but make sure we run the callback at the end.
|
||||
animatorSet.addListener(AnimatorListeners.forEndCallback(
|
||||
this::onIconAlignmentRatioChanged));
|
||||
animatorSet.addListener(AnimatorListeners.forEndCallback(() -> {
|
||||
if (!mIconAlignment.isAnimating()) {
|
||||
onIconAlignmentRatioChanged();
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
mIconAlignment.cancelAnimation();
|
||||
ObjectAnimator iconAlignAnim = mIconAlignment
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -61,6 +61,7 @@ public class TaskbarModelCallbacks implements
|
||||
// Used to defer any UI updates during the SUW unstash animation.
|
||||
private boolean mDeferUpdatesForSUW;
|
||||
private Runnable mDeferredUpdates;
|
||||
private boolean mBindingItems = false;
|
||||
|
||||
public TaskbarModelCallbacks(
|
||||
TaskbarActivityContext context, TaskbarView container) {
|
||||
@@ -74,14 +75,14 @@ public class TaskbarModelCallbacks implements
|
||||
|
||||
@Override
|
||||
public void startBinding() {
|
||||
mContext.setBindingItems(true);
|
||||
mBindingItems = true;
|
||||
mHotseatItems.clear();
|
||||
mPredictedItems = Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishBindingItems(IntSet pagesBoundFirst) {
|
||||
mContext.setBindingItems(false);
|
||||
mBindingItems = false;
|
||||
commitItemsToUI();
|
||||
}
|
||||
|
||||
@@ -167,7 +168,7 @@ public class TaskbarModelCallbacks implements
|
||||
}
|
||||
|
||||
private void commitItemsToUI() {
|
||||
if (mContext.isBindingItems()) {
|
||||
if (mBindingItems) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,7 @@ import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dot.FolderDotInfo;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.notification.NotificationListener;
|
||||
@@ -49,8 +45,6 @@ import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.splitscreen.SplitShortcut;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.ShortcutUtil;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
@@ -65,7 +59,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -93,7 +86,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
public TaskbarPopupController(TaskbarActivityContext context) {
|
||||
mContext = context;
|
||||
mPopupDataProvider = new PopupDataProvider(this::updateNotificationDots);
|
||||
mPopupDataProvider = new PopupDataProvider(mContext);
|
||||
}
|
||||
|
||||
public void init(TaskbarControllers controllers) {
|
||||
@@ -132,39 +125,6 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
mAllowInitialSplitSelection = allowInitialSplitSelection;
|
||||
}
|
||||
|
||||
private void updateNotificationDots(Predicate<PackageUserKey> updatedDots) {
|
||||
final PackageUserKey packageUserKey = new PackageUserKey(null, null);
|
||||
Predicate<ItemInfo> matcher = info -> !packageUserKey.updateFromItemInfo(info)
|
||||
|| updatedDots.test(packageUserKey);
|
||||
|
||||
LauncherBindableItemsContainer.ItemOperator op = (info, v) -> {
|
||||
if (info instanceof WorkspaceItemInfo && v instanceof BubbleTextView) {
|
||||
if (matcher.test(info)) {
|
||||
((BubbleTextView) v).applyDotState(info, true /* animate */);
|
||||
}
|
||||
} else if (info instanceof FolderInfo && v instanceof FolderIcon) {
|
||||
FolderInfo fi = (FolderInfo) info;
|
||||
if (fi.anyMatch(matcher)) {
|
||||
FolderDotInfo folderDotInfo = new FolderDotInfo();
|
||||
for (ItemInfo si : fi.getContents()) {
|
||||
folderDotInfo.addDotInfo(mPopupDataProvider.getDotInfoForItem(si));
|
||||
}
|
||||
((FolderIcon) v).setDotInfo(folderDotInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// process all the shortcuts
|
||||
return false;
|
||||
};
|
||||
|
||||
mControllers.taskbarViewController.mapOverItems(op);
|
||||
Folder folder = Folder.getOpen(mContext);
|
||||
if (folder != null) {
|
||||
folder.iterateOverItems(op);
|
||||
}
|
||||
mControllers.taskbarAllAppsController.updateNotificationDots(updatedDots);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the notifications and deep shortcuts associated with a Taskbar {@param icon}.
|
||||
* @return the container if shown or null.
|
||||
|
||||
@@ -104,6 +104,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
private static final int FLAG_DELAY_TASKBAR_BG_TAG = 1 << 12;
|
||||
public static final int FLAG_STASHED_FOR_BUBBLES = 1 << 13; // show handle for stashed hotseat
|
||||
public static final int FLAG_TASKBAR_HIDDEN = 1 << 14; // taskbar hidden during dream, etc...
|
||||
// taskbar should always be stashed for bubble bar on phone
|
||||
public static final int FLAG_STASHED_BUBBLE_BAR_ON_PHONE = 1 << 15;
|
||||
|
||||
// If any of these flags are enabled, isInApp should return true.
|
||||
private static final int FLAGS_IN_APP = FLAG_IN_APP | FLAG_IN_SETUP;
|
||||
@@ -126,7 +128,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
// If any of these flags are enabled, the taskbar must be stashed.
|
||||
private static final int FLAGS_FORCE_STASHED = FLAG_STASHED_SYSUI | FLAG_STASHED_DEVICE_LOCKED
|
||||
| FLAG_STASHED_IN_TASKBAR_ALL_APPS | FLAG_STASHED_SMALL_SCREEN
|
||||
| FLAG_STASHED_FOR_BUBBLES;
|
||||
| FLAG_STASHED_FOR_BUBBLES | FLAG_STASHED_BUBBLE_BAR_ON_PHONE;
|
||||
|
||||
/**
|
||||
* How long to stash/unstash when manually invoked via long press.
|
||||
@@ -359,6 +361,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
// For now, assume we're in an app, since LauncherTaskbarUIController won't be able to tell
|
||||
// us that we're paused until a bit later. This avoids flickering upon recreating taskbar.
|
||||
updateStateForFlag(FLAG_IN_APP, true);
|
||||
updateStateForFlag(FLAG_STASHED_BUBBLE_BAR_ON_PHONE, mActivity.isBubbleBarOnPhone());
|
||||
|
||||
applyState(/* duration = */ 0);
|
||||
|
||||
@@ -574,7 +577,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
*/
|
||||
public void updateAndAnimateTransientTaskbar(boolean stash, boolean shouldBubblesFollow,
|
||||
boolean delayTaskbarBackground) {
|
||||
if (!DisplayController.isTransientTaskbar(mActivity)) {
|
||||
if (!DisplayController.isTransientTaskbar(mActivity)
|
||||
|| mActivity.isBubbleBarOnPhone()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,9 +207,18 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns {@code true} if Home All Apps available instead of Taskbar All Apps. */
|
||||
protected boolean canToggleHomeAllApps() {
|
||||
return false;
|
||||
|
||||
/**
|
||||
* Toggles all apps UI. Default implementation opens Taskbar All Apps, but may be overridden to
|
||||
* open different Alls Apps variant depending on the context.
|
||||
* @param focusSearch indicates whether All Apps should be opened with search input focused.
|
||||
*/
|
||||
protected void toggleAllApps(boolean focusSearch) {
|
||||
if (focusSearch) {
|
||||
mControllers.taskbarAllAppsController.toggleSearch();
|
||||
} else {
|
||||
mControllers.taskbarAllAppsController.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
|
||||
@@ -62,7 +62,6 @@ import com.android.launcher3.taskbar.customization.TaskbarAllAppsButtonContainer
|
||||
import com.android.launcher3.taskbar.customization.TaskbarDividerContainer;
|
||||
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
@@ -392,6 +391,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
|
||||
/** Inflates/binds the hotseat items and recent tasks to the view. */
|
||||
protected void updateItems(ItemInfo[] hotseatItemInfos, List<GroupTask> recentTasks) {
|
||||
if (mActivityContext.isDestroyed()) return;
|
||||
// Filter out unsupported items.
|
||||
hotseatItemInfos = Arrays.stream(hotseatItemInfos)
|
||||
.filter(Objects::nonNull)
|
||||
@@ -1096,20 +1096,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
return mAllAppsButtonTranslationOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps {@code op} over all the child views.
|
||||
*/
|
||||
public void mapOverItems(LauncherBindableItemsContainer.ItemOperator op) {
|
||||
// map over all the shortcuts on the taskbar
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View item = getChildAt(i);
|
||||
// TODO(b/344657629): Support GroupTask as well for notification dots/popup
|
||||
if (item.getTag() instanceof ItemInfo itemInfo && op.evaluate(itemInfo, item)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first icon to match one of the given matchers, from highest to lowest priority.
|
||||
*
|
||||
|
||||
@@ -66,7 +66,16 @@ public class TaskbarViewCallbacks {
|
||||
InteractionJankMonitorWrapper.begin(v, Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS,
|
||||
/* tag= */ "TASKBAR_BUTTON");
|
||||
mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP);
|
||||
mControllers.taskbarAllAppsController.toggle();
|
||||
if (DisplayController.showLockedTaskbarOnHome(mActivity)
|
||||
|| DisplayController.showDesktopTaskbarForFreeformDisplay(mActivity)) {
|
||||
// If the taskbar can be shown on the home screen, use mAllAppsToggler to toggle all
|
||||
// apps, which will toggle the launcher activity all apps when on home screen.
|
||||
// TODO(b/395913143): Reconsider this if a gap in taskbar all apps functionality that
|
||||
// prevents users to drag items to workspace is addressed.
|
||||
mControllers.uiController.toggleAllApps(false);
|
||||
} else {
|
||||
mControllers.taskbarAllAppsController.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
/** Trigger All Apps button long click action. */
|
||||
|
||||
@@ -83,14 +83,16 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.TaskItemInfo;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarController;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleControllers;
|
||||
import com.android.launcher3.taskbar.customization.TaskbarAllAppsButtonContainer;
|
||||
import com.android.launcher3.taskbar.customization.TaskbarDividerContainer;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject.SandboxContext;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
||||
import com.android.launcher3.util.MultiTranslateDelegate;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.SandboxContext;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.SingleTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
@@ -121,9 +123,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
public static final int ALPHA_INDEX_NOTIFICATION_EXPANDED = 4;
|
||||
public static final int ALPHA_INDEX_ASSISTANT_INVOKED = 5;
|
||||
public static final int ALPHA_INDEX_SMALL_SCREEN = 6;
|
||||
|
||||
public static final int ALPHA_INDEX_BUBBLE_BAR = 7;
|
||||
private static final int NUM_ALPHA_CHANNELS = 8;
|
||||
public static final int ALPHA_INDEX_RECREATE = 8;
|
||||
|
||||
private static final int NUM_ALPHA_CHANNELS = 9;
|
||||
|
||||
/** Only used for animation purposes, to position the divider between two item indices. */
|
||||
public static final float DIVIDER_VIEW_POSITION_OFFSET = 0.5f;
|
||||
@@ -238,9 +241,22 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
R.dimen.transient_taskbar_padding);
|
||||
}
|
||||
|
||||
public void init(TaskbarControllers controllers) {
|
||||
/**
|
||||
* Init of taskbar view controller.
|
||||
*/
|
||||
public void init(TaskbarControllers controllers, AnimatorSet startAnimation) {
|
||||
mControllers = controllers;
|
||||
controllers.bubbleControllers.ifPresent(bc -> mBubbleControllers = bc);
|
||||
|
||||
if (startAnimation != null) {
|
||||
MultiPropertyFactory<View>.MultiProperty multiProperty =
|
||||
mTaskbarIconAlpha.get(ALPHA_INDEX_RECREATE);
|
||||
multiProperty.setValue(0f);
|
||||
Animator animator = multiProperty.animateToValue(1f);
|
||||
animator.setInterpolator(EMPHASIZED);
|
||||
startAnimation.play(animator);
|
||||
}
|
||||
|
||||
mTaskbarView.init(TaskbarViewCallbacksFactory.newInstance(mActivity).create(
|
||||
mActivity, mControllers, mTaskbarView));
|
||||
mTaskbarView.getLayoutParams().height = mActivity.isPhoneMode()
|
||||
@@ -362,6 +378,15 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
mTaskbarView.announceAccessibilityChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called with destroying Taskbar with animation.
|
||||
*/
|
||||
public void onDestroyAnimation(AnimatorSet animatorSet) {
|
||||
animatorSet.play(
|
||||
mTaskbarIconAlpha.get(TaskbarViewController.ALPHA_INDEX_RECREATE).animateToValue(
|
||||
0f));
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if (enableTaskbarPinning()) {
|
||||
mTaskbarView.removeOnLayoutChangeListener(mTaskbarViewLayoutChangeListener);
|
||||
@@ -712,10 +737,21 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
for (View iconView : getIconViews()) {
|
||||
if (iconView instanceof BubbleTextView btv) {
|
||||
btv.updateRunningState(getRunningAppState(btv));
|
||||
if (shouldUpdateIconContentDescription(btv)) {
|
||||
btv.setContentDescription(
|
||||
btv.getContentDescription() + " " + btv.getIconStateDescription());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldUpdateIconContentDescription(BubbleTextView btv) {
|
||||
boolean isInDesktopMode = mControllers.taskbarDesktopModeController.isInDesktopMode();
|
||||
boolean isAllAppsButton = btv instanceof TaskbarAllAppsButtonContainer;
|
||||
boolean isDividerButton = btv instanceof TaskbarDividerContainer;
|
||||
return isInDesktopMode && !isAllAppsButton && !isDividerButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A set of Task ids of running apps that are pinned in the taskbar.
|
||||
*/
|
||||
@@ -1144,11 +1180,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
mTaskbarNavButtonTranslationY.updateValue(-deviceProfile.getTaskbarOffsetY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps the given operator to all the top-level children of TaskbarView.
|
||||
*/
|
||||
public void mapOverItems(LauncherBindableItemsContainer.ItemOperator op) {
|
||||
mTaskbarView.mapOverItems(op);
|
||||
public LauncherBindableItemsContainer getContent() {
|
||||
return mModelCallbacks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1299,7 +1332,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
ObjectAnimator animator = mIconsTranslationXForNavbar.animateToValue(translationX);
|
||||
animator.setStartDelay(FADE_OUT_ANIM_POSITION_DURATION_MS);
|
||||
animator.setDuration(FADE_IN_ANIM_ALPHA_DURATION_MS);
|
||||
animator.setInterpolator(Interpolators.EMPHASIZED);
|
||||
animator.setInterpolator(EMPHASIZED);
|
||||
return animator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2025 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.graphics.Typeface
|
||||
import android.widget.TextView
|
||||
import com.android.launcher3.Flags
|
||||
|
||||
/**
|
||||
* Helper util class to set pre-defined typefaces to textviews
|
||||
*
|
||||
* If the typeface font family is already defined here, you can just reuse it directly. Otherwise,
|
||||
* please define it here for future use. You do not need to define the font style. If you need
|
||||
* anything other than [Typeface.NORMAL], pass it inline when calling [setTypeface]
|
||||
*/
|
||||
class TypefaceUtils {
|
||||
|
||||
companion object {
|
||||
const val FONT_FAMILY_BODY_SMALL_BASELINE = "variable-body-small"
|
||||
const val FONT_FAMILY_BODY_MEDIUM_BASELINE = "variable-body-medium"
|
||||
const val FONT_FAMILY_BODY_LARGE_BASELINE = "variable-body-large"
|
||||
const val FONT_FAMILY_LABEL_LARGE_BASELINE = "variable-label-large"
|
||||
const val FONT_FAMILY_DISPLAY_SMALL_EMPHASIZED = "variable-display-small-emphasized"
|
||||
const val FONT_FAMILY_DISPLAY_MEDIUM_EMPHASIZED = "variable-display-medium-emphasized"
|
||||
const val FONT_FAMILY_HEADLINE_SMALL_EMPHASIZED = "variable-headline-small-emphasized"
|
||||
const val FONT_FAMILY_HEADLINE_LARGE_EMPHASIZED = "variable-headline-large-emphasized"
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun setTypeface(
|
||||
textView: TextView?,
|
||||
fontFamilyName: String,
|
||||
fontStyle: Int = Typeface.NORMAL,
|
||||
) {
|
||||
if (!Flags.expressiveThemeInTaskbarAndNavigation()) return
|
||||
textView?.typeface = Typeface.create(fontFamilyName, fontStyle)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ import com.android.launcher3.util.PackageUserKey;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
/**
|
||||
* Handles the all apps overlay window initialization, updates, and its data.
|
||||
* <p>
|
||||
@@ -120,13 +119,6 @@ public final class TaskbarAllAppsController {
|
||||
mZeroStateSearchSuggestions = zeroStateSearchSuggestions;
|
||||
}
|
||||
|
||||
/** Updates the current notification dots. */
|
||||
public void updateNotificationDots(Predicate<PackageUserKey> updatedDots) {
|
||||
if (mAppsView != null) {
|
||||
mAppsView.getAppsStore().updateNotificationDots(updatedDots);
|
||||
}
|
||||
}
|
||||
|
||||
/** Toggles visibility of {@link TaskbarAllAppsContainerView} in the overlay window. */
|
||||
public void toggle() {
|
||||
toggle(false);
|
||||
@@ -218,6 +210,11 @@ public final class TaskbarAllAppsController {
|
||||
mAppsView = null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TaskbarAllAppsContainerView getAppsView() {
|
||||
return mAppsView;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public int getTaskbarAllAppsTopPadding() {
|
||||
// Allow null-pointer since this should only be null if the apps view is not showing.
|
||||
|
||||
@@ -44,10 +44,13 @@ class BubbleBarBackground(context: Context, private var backgroundHeight: Float)
|
||||
private val arrowVisibleHeight: Float
|
||||
|
||||
private val strokeAlpha: Int
|
||||
private val strokeColor: Int
|
||||
private val strokeColorDropTarget: Int
|
||||
private val shadowAlpha: Int
|
||||
private val shadowBlur: Float
|
||||
private val keyShadowDistance: Float
|
||||
private var arrowHeightFraction = 1f
|
||||
private var isShowingDropTarget: Boolean = false
|
||||
|
||||
var arrowPositionX: Float = 0f
|
||||
private set
|
||||
@@ -100,7 +103,9 @@ class BubbleBarBackground(context: Context, private var backgroundHeight: Float)
|
||||
fillPaint.flags = Paint.ANTI_ALIAS_FLAG
|
||||
fillPaint.style = Paint.Style.FILL
|
||||
// configure stroke paint
|
||||
strokePaint.color = context.getColor(R.color.taskbar_stroke)
|
||||
strokeColor = context.getColor(R.color.taskbar_stroke)
|
||||
strokeColorDropTarget = context.getColor(com.android.internal.R.color.system_primary_fixed)
|
||||
strokePaint.color = strokeColor
|
||||
strokePaint.flags = Paint.ANTI_ALIAS_FLAG
|
||||
strokePaint.style = Paint.Style.STROKE
|
||||
strokePaint.strokeWidth = res.getDimension(R.dimen.transient_taskbar_stroke_width)
|
||||
@@ -235,9 +240,25 @@ class BubbleBarBackground(context: Context, private var backgroundHeight: Float)
|
||||
return max(0f, getScaledArrowHeight() - (arrowHeight - arrowVisibleHeight))
|
||||
}
|
||||
|
||||
/** Set whether the background should show the drop target */
|
||||
fun showDropTarget(isDropTarget: Boolean) {
|
||||
if (isShowingDropTarget == isDropTarget) {
|
||||
return
|
||||
}
|
||||
isShowingDropTarget = isDropTarget
|
||||
val strokeColor = if (isDropTarget) strokeColorDropTarget else strokeColor
|
||||
val alpha = if (isDropTarget) DRAG_STROKE_ALPHA else strokeAlpha
|
||||
strokePaint.color = strokeColor
|
||||
strokePaint.alpha = alpha
|
||||
invalidateSelf()
|
||||
}
|
||||
|
||||
fun isShowingDropTarget() = isShowingDropTarget
|
||||
|
||||
companion object {
|
||||
private const val DARK_THEME_STROKE_ALPHA = 51
|
||||
private const val LIGHT_THEME_STROKE_ALPHA = 41
|
||||
private const val DRAG_STROKE_ALPHA = 255
|
||||
private const val DARK_THEME_SHADOW_ALPHA = 51
|
||||
private const val LIGHT_THEME_SHADOW_ALPHA = 25
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.taskbar.TaskbarSharedState;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
|
||||
@@ -589,15 +590,24 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragItemOverBubbleBarDragZone(BubbleBarLocation location) {
|
||||
//TODO(b/388894910): add meaningful implementation
|
||||
MAIN_EXECUTOR.execute(() ->
|
||||
Toast.makeText(mContext, "onDragItemOver " + location, Toast.LENGTH_SHORT).show());
|
||||
public void onDragItemOverBubbleBarDragZone(@NonNull BubbleBarLocation bubbleBarLocation) {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
mBubbleBarViewController.onDragItemOverBubbleBarDragZone(bubbleBarLocation);
|
||||
if (mBubbleBarViewController.isLocationUpdatedForDropTarget()) {
|
||||
mBubbleBarLocationListener.onBubbleBarLocationAnimated(bubbleBarLocation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDraggedOutsideBubbleBarDropZone() {
|
||||
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
if (mBubbleBarViewController.isLocationUpdatedForDropTarget()) {
|
||||
BubbleBarLocation original = mBubbleBarViewController.getBubbleBarLocation();
|
||||
mBubbleBarLocationListener.onBubbleBarLocationAnimated(original);
|
||||
}
|
||||
mBubbleBarViewController.onItemDraggedOutsideBubbleBarDropZone();
|
||||
});
|
||||
}
|
||||
|
||||
/** Notifies WMShell to show the expanded view. */
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (C) 2025 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.bubbles
|
||||
|
||||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
import com.android.launcher3.DropTarget
|
||||
import com.android.launcher3.dragndrop.DragOptions
|
||||
import com.android.launcher3.model.data.ItemInfo
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation
|
||||
|
||||
/**
|
||||
* Implementation of the {@link DropTarget} that handles drag and drop events over the bubble bar
|
||||
* locations.
|
||||
*/
|
||||
class BubbleBarLocationDropTarget(
|
||||
private val bubbleBarLocation: BubbleBarLocation,
|
||||
private val bubbleBarDragListener: BubbleBarDragListener,
|
||||
) : DropTarget {
|
||||
|
||||
/** Controller that takes care of the bubble bar drag events inside launcher process. */
|
||||
interface BubbleBarDragListener {
|
||||
|
||||
/** Called when the drag event is over the bubble bar drop zone. */
|
||||
fun onLauncherItemDraggedOverBubbleBarDragZone(location: BubbleBarLocation)
|
||||
|
||||
/** Called when the drag event leaves the bubble bar drop zone. */
|
||||
fun onLauncherItemDraggedOutsideBubbleBarDropZone()
|
||||
|
||||
/** Called when the drop event happens over the bubble bar drop zone. */
|
||||
fun onLauncherItemDroppedOverBubbleBarDragZone(
|
||||
location: BubbleBarLocation,
|
||||
itemInfo: ItemInfo,
|
||||
)
|
||||
|
||||
/** Gets the hit [rect][android.graphics.Rect] of the bubble bar location. */
|
||||
fun getBubbleBarLocationHitRect(bubbleBarLocation: BubbleBarLocation, outRect: Rect)
|
||||
|
||||
/** Provides the view that will accept the drop. */
|
||||
fun getDropView(): View
|
||||
}
|
||||
|
||||
private var isShowingDropTarget = false
|
||||
|
||||
override fun isDropEnabled(): Boolean = true
|
||||
|
||||
override fun onDrop(dragObject: DropTarget.DragObject, options: DragOptions) {
|
||||
val itemInfo = dragObject.dragInfo ?: return
|
||||
// TODO(b/397459664) : fix task bar icon animation after drop
|
||||
// TODO(b/397459664) : update bubble bar location
|
||||
bubbleBarDragListener.onLauncherItemDroppedOverBubbleBarDragZone(
|
||||
bubbleBarLocation,
|
||||
itemInfo,
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDragEnter(dragObject: DropTarget.DragObject) {}
|
||||
|
||||
override fun onDragOver(dragObject: DropTarget.DragObject) {
|
||||
if (isShowingDropTarget) return
|
||||
isShowingDropTarget = true
|
||||
bubbleBarDragListener.onLauncherItemDraggedOverBubbleBarDragZone(bubbleBarLocation)
|
||||
}
|
||||
|
||||
override fun onDragExit(dragObject: DropTarget.DragObject) {
|
||||
// TODO(b/397459664) : fix the issue for no bubbles, when moving task bar icon out of
|
||||
// the bubble bar drag zone drag ends and swipes gesture swipes the overview
|
||||
if (!isShowingDropTarget) return
|
||||
isShowingDropTarget = false
|
||||
bubbleBarDragListener.onLauncherItemDraggedOutsideBubbleBarDropZone()
|
||||
}
|
||||
|
||||
override fun acceptDrop(dragObject: DropTarget.DragObject): Boolean = true
|
||||
|
||||
override fun prepareAccessibilityDrop() {}
|
||||
|
||||
override fun getHitRectRelativeToDragLayer(outRect: Rect) {
|
||||
bubbleBarDragListener.getBubbleBarLocationHitRect(bubbleBarLocation, outRect)
|
||||
}
|
||||
|
||||
override fun getDropView(): View = bubbleBarDragListener.getDropView()
|
||||
}
|
||||
@@ -536,6 +536,16 @@ public class BubbleBarView extends FrameLayout {
|
||||
return (float) (displayWidth - getWidth() - margin);
|
||||
}
|
||||
|
||||
/** Set whether the background should show the drop target */
|
||||
public void showDropTarget(boolean isDropTarget) {
|
||||
mBubbleBarBackground.showDropTarget(isDropTarget);
|
||||
}
|
||||
|
||||
/** Returns whether the Bubble Bar is currently displaying a drop target. */
|
||||
public boolean isShowingDropTarget() {
|
||||
return mBubbleBarBackground.isShowingDropTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Animate bubble bar to the given location transiently. Does not modify the layout or the value
|
||||
* returned by {@link #getBubbleBarLocation()}.
|
||||
|
||||
@@ -24,6 +24,8 @@ import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_TRA
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
@@ -43,11 +45,15 @@ import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext;
|
||||
import com.android.launcher3.taskbar.TaskbarControllers;
|
||||
import com.android.launcher3.taskbar.TaskbarDragController;
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController;
|
||||
import com.android.launcher3.taskbar.TaskbarSharedState;
|
||||
import com.android.launcher3.taskbar.TaskbarStashController;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarLocationDropTarget.BubbleBarDragListener;
|
||||
import com.android.launcher3.taskbar.bubbles.animation.BubbleBarViewAnimator;
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController;
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutPositioner;
|
||||
@@ -59,6 +65,7 @@ import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.wm.shell.Flags;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
import com.android.wm.shell.shared.bubbles.DeviceConfig;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
@@ -117,6 +124,61 @@ public class BubbleBarViewController {
|
||||
updateTranslationY();
|
||||
setBubbleBarScaleAndPadding(pinningProgress);
|
||||
});
|
||||
private final BubbleBarDragListener mDragListener = new BubbleBarDragListener() {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public void getBubbleBarLocationHitRect(@NonNull BubbleBarLocation bubbleBarLocation,
|
||||
Rect outRect) {
|
||||
Point screenSize = DisplayController.INSTANCE.get(mActivity).getInfo().currentSize;
|
||||
outRect.top = screenSize.y - mBubbleBarDropTargetSize;
|
||||
outRect.bottom = screenSize.y;
|
||||
if (bubbleBarLocation.isOnLeft(mBarView.isLayoutRtl())) {
|
||||
outRect.left = 0;
|
||||
outRect.right = mBubbleBarDropTargetSize;
|
||||
} else {
|
||||
outRect.left = screenSize.x - mBubbleBarDropTargetSize;
|
||||
outRect.right = screenSize.x;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherItemDroppedOverBubbleBarDragZone(@NonNull BubbleBarLocation location,
|
||||
@NonNull ItemInfo itemInfo) {
|
||||
//TODO(b/397459664) : fix drag interruption when there are no bubbles
|
||||
//TODO(b/397459664) : update bubble bar location
|
||||
ShortcutInfo shortcutInfo = null;
|
||||
if (itemInfo instanceof WorkspaceItemInfo) {
|
||||
shortcutInfo = ((WorkspaceItemInfo) itemInfo).getDeepShortcutInfo();
|
||||
}
|
||||
Intent itemIntent = itemInfo.getIntent();
|
||||
SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(mActivity);
|
||||
if (shortcutInfo != null) {
|
||||
systemUiProxy.showShortcutBubble(shortcutInfo);
|
||||
} else if (itemIntent != null && itemIntent.getComponent() != null) {
|
||||
systemUiProxy.showAppBubble(itemIntent, itemInfo.user);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherItemDraggedOutsideBubbleBarDropZone() {
|
||||
//TODO(b/397459664) : hide expanded view drop target
|
||||
onItemDraggedOutsideBubbleBarDropZone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherItemDraggedOverBubbleBarDragZone(
|
||||
@NonNull BubbleBarLocation location) {
|
||||
//TODO(b/397459664) : show expanded view drop target
|
||||
onDragItemOverBubbleBarDragZone(location);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getDropView() {
|
||||
return mBarView;
|
||||
}
|
||||
};
|
||||
|
||||
// Modified when swipe up is happening on the bubble bar or task bar.
|
||||
private float mBubbleBarSwipeUpTranslationY;
|
||||
@@ -131,15 +193,20 @@ public class BubbleBarViewController {
|
||||
// Whether the bar is hidden when stashed
|
||||
private boolean mHiddenForStashed;
|
||||
private boolean mShouldShowEducation;
|
||||
|
||||
public boolean mOverflowAdded;
|
||||
private boolean mIsLocationUpdatedForDropTarget = false;
|
||||
|
||||
private BubbleBarViewAnimator mBubbleBarViewAnimator;
|
||||
private final FrameLayout mBubbleBarContainer;
|
||||
private BubbleBarFlyoutController mBubbleBarFlyoutController;
|
||||
private BubbleBarPinController mBubbleBarPinController;
|
||||
private TaskbarSharedState mTaskbarSharedState;
|
||||
private TaskbarDragController mTaskbarDragController;
|
||||
private final BubbleBarLocationDropTarget mBubbleBarLeftDropTarget;
|
||||
private final BubbleBarLocationDropTarget mBubbleBarRightDropTarget;
|
||||
private final TimeSource mTimeSource = System::currentTimeMillis;
|
||||
private final int mTaskbarTranslationDelta;
|
||||
private final int mBubbleBarDropTargetSize;
|
||||
|
||||
@Nullable
|
||||
private BubbleBarBoundsChangeListener mBoundsChangeListener;
|
||||
@@ -157,15 +224,26 @@ public class BubbleBarViewController {
|
||||
R.dimen.bubblebar_transient_taskbar_min_distance);
|
||||
mDragElevation = res.getDimensionPixelSize(R.dimen.bubblebar_drag_elevation);
|
||||
mTaskbarTranslationDelta = getBubbleBarTranslationDeltaForTaskbar(activity);
|
||||
if (DeviceConfig.isSmallTablet(mActivity)) {
|
||||
mBubbleBarDropTargetSize = res.getDimensionPixelSize(R.dimen.drag_zone_bubble_fold);
|
||||
} else {
|
||||
mBubbleBarDropTargetSize = res.getDimensionPixelSize(R.dimen.drag_zone_bubble_tablet);
|
||||
}
|
||||
mBubbleBarLeftDropTarget = new BubbleBarLocationDropTarget(BubbleBarLocation.LEFT,
|
||||
mDragListener);
|
||||
mBubbleBarRightDropTarget = new BubbleBarLocationDropTarget(BubbleBarLocation.RIGHT,
|
||||
mDragListener);
|
||||
}
|
||||
|
||||
/** Initializes controller. */
|
||||
public void init(TaskbarControllers controllers, BubbleControllers bubbleControllers,
|
||||
TaskbarViewPropertiesProvider taskbarViewPropertiesProvider) {
|
||||
mTaskbarDragController = controllers.taskbarDragController;
|
||||
mTaskbarSharedState = controllers.getSharedState();
|
||||
mBubbleStashController = bubbleControllers.bubbleStashController;
|
||||
mBubbleBarController = bubbleControllers.bubbleBarController;
|
||||
mBubbleDragController = bubbleControllers.bubbleDragController;
|
||||
mBubbleBarPinController = bubbleControllers.bubbleBarPinController;
|
||||
mTaskbarStashController = controllers.taskbarStashController;
|
||||
mTaskbarInsetsController = controllers.taskbarInsetsController;
|
||||
mBubbleBarFlyoutController = new BubbleBarFlyoutController(
|
||||
@@ -262,6 +340,8 @@ public class BubbleBarViewController {
|
||||
mBubbleBarController.updateBubbleBarLocation(location, source);
|
||||
}
|
||||
};
|
||||
mTaskbarDragController.addDropTarget(mBubbleBarLeftDropTarget);
|
||||
mTaskbarDragController.addDropTarget(mBubbleBarRightDropTarget);
|
||||
}
|
||||
|
||||
/** Returns animated float property responsible for pinning transition animation. */
|
||||
@@ -274,7 +354,10 @@ public class BubbleBarViewController {
|
||||
|
||||
@Override
|
||||
public boolean isOnLeft() {
|
||||
return mBarView.getBubbleBarLocation().isOnLeft(mBarView.isLayoutRtl());
|
||||
boolean shouldRevertLocation =
|
||||
mBarView.isShowingDropTarget() && mIsLocationUpdatedForDropTarget;
|
||||
boolean isOnLeft = mBarView.getBubbleBarLocation().isOnLeft(mBarView.isLayoutRtl());
|
||||
return shouldRevertLocation != isOnLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -524,6 +607,63 @@ public class BubbleBarViewController {
|
||||
mBarView.animateToBubbleBarLocation(bubbleBarLocation);
|
||||
}
|
||||
|
||||
/** Returns whether the Bubble Bar is currently displaying a drop target. */
|
||||
public boolean isShowingDropTarget() {
|
||||
return mBarView.isShowingDropTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the controller that a drag event is over the Bubble Bar drop zone. The controller
|
||||
* will display the appropriate drop target and enter drop target mode. The controller will also
|
||||
* update the return value of {@link #isLocationUpdatedForDropTarget()} to true if location was
|
||||
* updated.
|
||||
*/
|
||||
public void onDragItemOverBubbleBarDragZone(@NonNull BubbleBarLocation bubbleBarLocation) {
|
||||
mBarView.showDropTarget(/* isDropTarget = */ true);
|
||||
boolean isRtl = mBarView.isLayoutRtl();
|
||||
mIsLocationUpdatedForDropTarget = getBubbleBarLocation().isOnLeft(isRtl)
|
||||
!= bubbleBarLocation.isOnLeft(isRtl);
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
animateBubbleBarLocation(bubbleBarLocation);
|
||||
}
|
||||
if (!hasBubbles()) {
|
||||
mBubbleBarPinController.showDropTarget(bubbleBarLocation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if location was updated after most recent
|
||||
* {@link #onDragItemOverBubbleBarDragZone}}.
|
||||
*/
|
||||
public boolean isLocationUpdatedForDropTarget() {
|
||||
return mIsLocationUpdatedForDropTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the controller that the drag event is outside the Bubble Bar drop zone.
|
||||
* This will hide the drop target zone if there are no bubbles or return the
|
||||
* Bubble Bar to its original location. The controller will also exit drop target
|
||||
* mode and reset the value returned from {@link #isLocationUpdatedForDropTarget()} to false.
|
||||
*/
|
||||
public void onItemDraggedOutsideBubbleBarDropZone() {
|
||||
mBarView.showDropTarget(/* isDropTarget = */ false);
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
animateBubbleBarLocation(getBubbleBarLocation());
|
||||
}
|
||||
mBubbleBarPinController.hideDropTarget();
|
||||
mIsLocationUpdatedForDropTarget = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the controller that the drag has completed over the Bubble Bar drop zone.
|
||||
* The controller will hide the drop target if there are no bubbles and exit drop target mode.
|
||||
*/
|
||||
public void onItemDroppedInBubbleBarDragZone() {
|
||||
mBarView.showDropTarget(/* isDropTarget = */ false);
|
||||
mBubbleBarPinController.hideDropTarget();
|
||||
mIsLocationUpdatedForDropTarget = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The bounds of the bubble bar.
|
||||
*/
|
||||
@@ -996,7 +1136,12 @@ public class BubbleBarViewController {
|
||||
boolean isInApp = mTaskbarStashController.isInApp();
|
||||
// if this is the first bubble, animate to the initial state.
|
||||
if (mBarView.getBubbleChildCount() == 1 && !isUpdate) {
|
||||
mBubbleBarViewAnimator.animateToInitialState(bubble, isInApp, isExpanding);
|
||||
// If a drop target is visible and the first bubble is added, hide the empty drop target
|
||||
if (mBarView.isShowingDropTarget()) {
|
||||
mBubbleBarPinController.hideDropTarget();
|
||||
}
|
||||
mBubbleBarViewAnimator.animateToInitialState(bubble, isInApp, isExpanding,
|
||||
mBarView.isShowingDropTarget());
|
||||
return;
|
||||
}
|
||||
// if we're not stashed or we're in persistent taskbar, animate for collapsed state.
|
||||
@@ -1213,6 +1358,8 @@ public class BubbleBarViewController {
|
||||
/** Called when the controller is destroyed. */
|
||||
public void onDestroy() {
|
||||
adjustTaskbarAndHotseatToBubbleBarState(/*isBubbleBarExpanded = */false);
|
||||
mTaskbarDragController.removeDropTarget(mBubbleBarLeftDropTarget);
|
||||
mTaskbarDragController.removeDropTarget(mBubbleBarRightDropTarget);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+18
-12
@@ -365,7 +365,12 @@ constructor(
|
||||
}
|
||||
|
||||
/** Animates to the initial state of the bubble bar, when there are no previous bubbles. */
|
||||
fun animateToInitialState(b: BubbleBarBubble, isInApp: Boolean, isExpanding: Boolean) {
|
||||
fun animateToInitialState(
|
||||
b: BubbleBarBubble,
|
||||
isInApp: Boolean,
|
||||
isExpanding: Boolean,
|
||||
isDragging: Boolean = false,
|
||||
) {
|
||||
val bubbleView = b.view
|
||||
val animator = PhysicsAnimator.getInstance(bubbleView)
|
||||
if (animator.isRunning()) animator.cancel()
|
||||
@@ -374,15 +379,12 @@ constructor(
|
||||
// bubble bar to the handle if we're in an app.
|
||||
val showAnimation = buildBubbleBarSpringInAnimation()
|
||||
val hideAnimation =
|
||||
if (isInApp && !isExpanding) {
|
||||
if (isInApp && !isExpanding && !isDragging) {
|
||||
buildBubbleBarToHandleAnimation()
|
||||
} else {
|
||||
Runnable {
|
||||
moveToState(AnimatingBubble.State.ANIMATING_OUT)
|
||||
bubbleBarFlyoutController.collapseFlyout {
|
||||
onFlyoutRemoved()
|
||||
clearAnimatingBubble()
|
||||
}
|
||||
collapseFlyoutAndUpdateState()
|
||||
if (isDragging) return@Runnable
|
||||
bubbleStashController.showBubbleBarImmediate()
|
||||
bubbleStashController.updateTaskbarTouchRegion()
|
||||
}
|
||||
@@ -440,11 +442,7 @@ constructor(
|
||||
// first bounce the bubble bar and show the flyout. Then hide the flyout.
|
||||
val showAnimation = buildBubbleBarBounceAnimation()
|
||||
val hideAnimation = Runnable {
|
||||
moveToState(AnimatingBubble.State.ANIMATING_OUT)
|
||||
bubbleBarFlyoutController.collapseFlyout {
|
||||
onFlyoutRemoved()
|
||||
clearAnimatingBubble()
|
||||
}
|
||||
collapseFlyoutAndUpdateState()
|
||||
bubbleStashController.showBubbleBarImmediate()
|
||||
bubbleStashController.updateTaskbarTouchRegion()
|
||||
}
|
||||
@@ -454,6 +452,14 @@ constructor(
|
||||
scheduler.postDelayed(FLYOUT_DELAY_MS, hideAnimation)
|
||||
}
|
||||
|
||||
private fun collapseFlyoutAndUpdateState() {
|
||||
moveToState(AnimatingBubble.State.ANIMATING_OUT)
|
||||
bubbleBarFlyoutController.collapseFlyout {
|
||||
onFlyoutRemoved()
|
||||
clearAnimatingBubble()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The bubble bar animation when it is collapsed is divided into 2 chained animations. The first
|
||||
* animation is a regular accelerate animation that moves the bubble bar upwards. When it ends
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2025 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.growth;
|
||||
|
||||
/**
|
||||
* Constants for registering Growth framework.
|
||||
*/
|
||||
public final class GrowthConstants {
|
||||
/**
|
||||
* For Taskbar broadcast intent filter.
|
||||
*/
|
||||
public static final String BROADCAST_SHOW_NUDGE =
|
||||
"com.android.launcher3.growth.BROADCAST_SHOW_NUDGE";
|
||||
private GrowthConstants() {}
|
||||
}
|
||||
@@ -18,12 +18,11 @@ package com.android.launcher3.taskbar.overlay;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dot.DotInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.popup.PopupDataProvider;
|
||||
import com.android.launcher3.taskbar.BaseTaskbarContext;
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext;
|
||||
@@ -115,11 +114,6 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
return mDragLayer.findViewById(R.id.apps_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBindingItems() {
|
||||
return mTaskbarContext.isBindingItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View.OnClickListener getItemOnClickListener() {
|
||||
return mTaskbarContext.getItemOnClickListener();
|
||||
@@ -130,6 +124,7 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
return mDragController::startDragOnLongClick;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PopupDataProvider getPopupDataProvider() {
|
||||
return mTaskbarContext.getPopupDataProvider();
|
||||
@@ -140,11 +135,6 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
mUiController.startSplitSelection(splitSelectSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DotInfo getDotInfoForItem(ItemInfo info) {
|
||||
return mTaskbarContext.getDotInfoForItem(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragStart() {}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.app.animation.Interpolators.ACCELERATE_DECELERATE;
|
||||
import static com.android.launcher3.icons.FastBitmapDrawable.getDisabledColorFilter;
|
||||
import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -51,9 +52,8 @@ import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.celllayout.DelegatedCellDrawing;
|
||||
import com.android.launcher3.graphics.IconShape;
|
||||
import com.android.launcher3.graphics.ThemeManager;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
@@ -138,11 +138,11 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
public PredictedAppIcon(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
mDeviceProfile = ActivityContext.lookupContext(context).getDeviceProfile();
|
||||
mNormalizedIconSize = IconNormalizer.getNormalizedCircleSize(getIconSize());
|
||||
mNormalizedIconSize = Math.round(getIconSize() * ICON_VISIBLE_AREA_FACTOR);
|
||||
int shadowSize = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.blur_size_thin_outline);
|
||||
mShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.OUTER);
|
||||
mShapePath = IconShape.INSTANCE.get(context).getShape().getPath(mNormalizedIconSize);
|
||||
mShapePath = ThemeManager.INSTANCE.get(context).getIconShape().getPath(mNormalizedIconSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1380,7 +1380,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
SystemUiProxy.INSTANCE.get(this).setLauncherAppIconSize(mDeviceProfile.iconSizePx);
|
||||
TaskbarManager taskbarManager = mTISBindHelper.getTaskbarManager();
|
||||
if (taskbarManager != null) {
|
||||
taskbarManager.debugWhyTaskbarNotDestroyed("QuickstepLauncher#onDeviceProfileChanged");
|
||||
taskbarManager.debugPrimaryTaskbar("QuickstepLauncher#onDeviceProfileChanged",
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,24 +20,24 @@ import com.android.app.animation.Interpolators.AGGRESSIVE_EASE_IN_OUT
|
||||
import com.android.app.animation.Interpolators.FINAL_FRAME
|
||||
import com.android.app.animation.Interpolators.INSTANT
|
||||
import com.android.app.animation.Interpolators.LINEAR
|
||||
import com.android.launcher3.Flags.enableDesktopExplodedView
|
||||
import com.android.launcher3.Flags.enableLargeDesktopWindowingTile
|
||||
import com.android.launcher3.LauncherState
|
||||
import com.android.launcher3.anim.AnimatedFloat
|
||||
import com.android.launcher3.anim.AnimatorListeners.forSuccessCallback
|
||||
import com.android.launcher3.anim.PendingAnimation
|
||||
import com.android.launcher3.anim.PropertySetter
|
||||
import com.android.launcher3.logging.StatsLogManager.LauncherEvent
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler
|
||||
import com.android.launcher3.states.StateAnimationConfig
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SPLIT_SELECT_INSTRUCTIONS_FADE
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y
|
||||
import com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW
|
||||
import com.android.quickstep.util.AnimUtils
|
||||
import com.android.quickstep.views.AddDesktopButton
|
||||
import com.android.quickstep.views.ClearAllButton
|
||||
import com.android.quickstep.views.RecentsView
|
||||
import com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET
|
||||
@@ -51,6 +51,7 @@ import com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION
|
||||
import com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION
|
||||
import com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION
|
||||
import com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA
|
||||
import com.android.quickstep.views.RecentsViewUtils.Companion.DESK_EXPLODE_PROGRESS
|
||||
import com.android.quickstep.views.TaskView.Companion.FLAG_UPDATE_ALL
|
||||
|
||||
/**
|
||||
@@ -74,6 +75,13 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) :
|
||||
recentsView,
|
||||
if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f,
|
||||
)
|
||||
if (enableDesktopExplodedView()) {
|
||||
DESK_EXPLODE_PROGRESS.set(
|
||||
recentsView,
|
||||
if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f,
|
||||
)
|
||||
}
|
||||
|
||||
TASK_THUMBNAIL_SPLASH_ALPHA.set(
|
||||
recentsView,
|
||||
if (state.showTaskThumbnailSplash()) 1f else 0f,
|
||||
@@ -156,6 +164,15 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) :
|
||||
getOverviewInterpolator(fromState, toState),
|
||||
)
|
||||
|
||||
if (enableDesktopExplodedView()) {
|
||||
builder.setFloat(
|
||||
recentsView,
|
||||
DESK_EXPLODE_PROGRESS,
|
||||
if (toState.isRecentsViewVisible) 1f else 0f,
|
||||
getOverviewInterpolator(fromState, toState),
|
||||
)
|
||||
}
|
||||
|
||||
if (enableLargeDesktopWindowingTile()) {
|
||||
builder.setFloat(
|
||||
recentsView,
|
||||
@@ -208,8 +225,8 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) :
|
||||
builder: PendingAnimation,
|
||||
animate: Boolean,
|
||||
) {
|
||||
val goingToOverviewFromWorkspaceContextual = toState == LauncherState.OVERVIEW &&
|
||||
launcher.isSplitSelectionActive
|
||||
val goingToOverviewFromWorkspaceContextual =
|
||||
toState == LauncherState.OVERVIEW && launcher.isSplitSelectionActive
|
||||
if (
|
||||
toState != LauncherState.OVERVIEW_SPLIT_SELECT &&
|
||||
!goingToOverviewFromWorkspaceContextual
|
||||
@@ -284,6 +301,14 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) :
|
||||
overviewButtonAlpha,
|
||||
config.getInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, LINEAR),
|
||||
)
|
||||
recentsView.addDeskButton?.let {
|
||||
propertySetter.setFloat(
|
||||
it,
|
||||
AddDesktopButton.VISIBILITY_ALPHA,
|
||||
if (state.areElementsVisible(launcher, LauncherState.ADD_DESK_BUTTON)) 1f else 0f,
|
||||
LINEAR,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOverviewInterpolator(fromState: LauncherState, toState: LauncherState) =
|
||||
|
||||
@@ -144,7 +144,7 @@ open class SystemApiWrapper @Inject constructor(@ApplicationContext context: Con
|
||||
override fun isNonResizeableActivity(lai: LauncherActivityInfo) =
|
||||
lai.activityInfo.resizeMode == ActivityInfo.RESIZE_MODE_UNRESIZEABLE
|
||||
|
||||
override fun supportsMultiInstance(lai: LauncherActivityInfo) : Boolean {
|
||||
override fun supportsMultiInstance(lai: LauncherActivityInfo): Boolean {
|
||||
return try {
|
||||
super.supportsMultiInstance(lai) || lai.supportsMultiInstance()
|
||||
} catch (e: Exception) {
|
||||
@@ -202,4 +202,7 @@ open class SystemApiWrapper @Inject constructor(@ApplicationContext context: Con
|
||||
(appInfo.sourceDir?.hashCode() ?: 0).toString() + " " + appInfo.longVersionCode
|
||||
|
||||
override fun getRoundIconRes(appInfo: ApplicationInfo) = appInfo.roundIconRes
|
||||
|
||||
override fun isFileDrawable(shortcutInfo: ShortcutInfo) =
|
||||
shortcutInfo.hasIconFile() || shortcutInfo.hasIconUri()
|
||||
}
|
||||
@@ -315,6 +315,12 @@ class DevOptionsUiHelper(c: Context, attr: AttributeSet?) : PreferenceGroup(c, a
|
||||
intent = Intent(launchSandboxIntent).putExtra("use_tutorial_menu", true)
|
||||
}
|
||||
)
|
||||
addPreference(
|
||||
Preference(context).apply {
|
||||
title = "Launch Full Gesture Tutorial"
|
||||
intent = Intent(launchSandboxIntent).putExtra("use_tutorial_menu", false)
|
||||
}
|
||||
)
|
||||
addPreference(
|
||||
Preference(context).apply {
|
||||
title = "Launch Back Tutorial"
|
||||
|
||||
@@ -153,7 +153,7 @@ public class AllAppsState extends LauncherState {
|
||||
return new PageAlphaProvider(DECELERATE_2) {
|
||||
@Override
|
||||
public float getPageAlpha(int pageIndex) {
|
||||
return launcher.getDeviceProfile().shouldShowAllAppsOnSheet()
|
||||
return launcher.getDeviceProfile().isTablet
|
||||
? superPageAlphaProvider.getPageAlpha(pageIndex)
|
||||
: 0;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class AllAppsState extends LauncherState {
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
int elements = ALL_APPS_CONTENT | FLOATING_SEARCH_BAR;
|
||||
// When All Apps is presented on a bottom sheet, HOTSEAT_ICONS are visible.
|
||||
if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
if (launcher.getDeviceProfile().isTablet) {
|
||||
elements |= HOTSEAT_ICONS;
|
||||
}
|
||||
return elements;
|
||||
|
||||
@@ -77,7 +77,8 @@ public class BackgroundAppState extends OverviewState {
|
||||
return super.getVisibleElements(launcher)
|
||||
& ~OVERVIEW_ACTIONS
|
||||
& ~CLEAR_ALL_BUTTON
|
||||
& ~VERTICAL_SWIPE_INDICATOR;
|
||||
& ~VERTICAL_SWIPE_INDICATOR
|
||||
& ~ADD_DESK_BUTTON;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,7 @@ public class OverviewModalTaskState extends OverviewState {
|
||||
|
||||
@Override
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
return OVERVIEW_ACTIONS | CLEAR_ALL_BUTTON;
|
||||
return OVERVIEW_ACTIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -110,7 +110,7 @@ public class OverviewState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
int elements = CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS;
|
||||
int elements = CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS | ADD_DESK_BUTTON;
|
||||
DeviceProfile dp = launcher.getDeviceProfile();
|
||||
boolean showFloatingSearch;
|
||||
if (dp.isPhone) {
|
||||
@@ -124,7 +124,7 @@ public class OverviewState extends LauncherState {
|
||||
elements |= FLOATING_SEARCH_BAR;
|
||||
}
|
||||
if (launcher.isSplitSelectionActive()) {
|
||||
elements &= ~CLEAR_ALL_BUTTON;
|
||||
elements &= ~CLEAR_ALL_BUTTON & ~ADD_DESK_BUTTON;
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
+6
-2
@@ -109,8 +109,11 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
|
||||
// We sync the scrim fade with the taskbar animation duration to avoid any flickers for
|
||||
// taskbar icons disappearing before hotseat icons show up.
|
||||
boolean isPinnedTaskbarAndNotInDesktopMode =
|
||||
isPinnedTaskbar && !DisplayController.isInDesktopMode(mContainer);
|
||||
float scrimUpperBoundFromSplit =
|
||||
QuickstepTransitionManager.getTaskbarToHomeDuration(isPinnedTaskbar)
|
||||
QuickstepTransitionManager.getTaskbarToHomeDuration(
|
||||
isPinnedTaskbarAndNotInDesktopMode)
|
||||
/ (float) config.duration;
|
||||
scrimUpperBoundFromSplit = Math.min(scrimUpperBoundFromSplit, 1f);
|
||||
config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR, 0, 0.25f));
|
||||
@@ -142,7 +145,8 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
if (mContainer.getDeviceProfile().isTaskbarPresent) {
|
||||
config.duration = Math.min(
|
||||
config.duration,
|
||||
QuickstepTransitionManager.getTaskbarToHomeDuration(isPinnedTaskbar));
|
||||
QuickstepTransitionManager.getTaskbarToHomeDuration(
|
||||
isPinnedTaskbarAndNotInDesktopMode));
|
||||
}
|
||||
overview.snapToPage(DEFAULT_PAGE, Math.toIntExact(config.duration));
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -64,6 +64,7 @@ import android.animation.ValueAnimator;
|
||||
import android.graphics.PointF;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.window.DesktopModeFlags;
|
||||
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.LauncherState;
|
||||
@@ -86,7 +87,6 @@ import com.android.quickstep.util.MotionPauseDetector;
|
||||
import com.android.quickstep.util.WorkspaceRevealAnim;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.window.flags.Flags;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
|
||||
|
||||
/**
|
||||
@@ -188,7 +188,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
|
||||
}
|
||||
if (DesktopModeStatus.canEnterDesktopMode(mLauncher)
|
||||
//TODO(b/345296916): replace with dev option once in teamfood
|
||||
&& Flags.enableQuickswitchDesktopSplitBugfix()
|
||||
&& DesktopModeFlags.ENABLE_QUICKSWITCH_DESKTOP_SPLIT_BUGFIX.isTrue()
|
||||
&& mRecentsView.getNonDesktopTaskViewCount() < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+84
-20
@@ -16,9 +16,11 @@
|
||||
package com.android.launcher3.uioverrides.touchcontrollers
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.view.MotionEvent
|
||||
import androidx.dynamicanimation.animation.SpringAnimation
|
||||
import com.android.app.animation.Interpolators.DECELERATE
|
||||
import com.android.app.animation.Interpolators.LINEAR
|
||||
import com.android.launcher3.AbstractFloatingView
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities.EDGE_NAV_BAR
|
||||
@@ -29,11 +31,11 @@ import com.android.launcher3.touch.SingleAxisSwipeDetector
|
||||
import com.android.launcher3.util.MSDLPlayerWrapper
|
||||
import com.android.launcher3.util.TouchController
|
||||
import com.android.quickstep.views.RecentsView
|
||||
import com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY
|
||||
import com.android.quickstep.views.RecentsViewContainer
|
||||
import com.android.quickstep.views.TaskView
|
||||
import com.google.android.msdl.data.model.MSDLToken
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.sign
|
||||
|
||||
/** Touch controller for handling task view card dismiss swipes */
|
||||
class TaskViewDismissTouchController<CONTAINER>(
|
||||
@@ -50,6 +52,9 @@ CONTAINER : RecentsViewContainer {
|
||||
recentsView.pagedOrientationHandler.upDownSwipeDirection,
|
||||
)
|
||||
private val isRtl = isRtl(container.resources)
|
||||
private val upDirection: Int = recentsView.pagedOrientationHandler.getUpDirection(isRtl)
|
||||
|
||||
private val tempTaskThumbnailBounds = Rect()
|
||||
|
||||
private var taskBeingDragged: TaskView? = null
|
||||
private var springAnimation: SpringAnimation? = null
|
||||
@@ -57,6 +62,7 @@ CONTAINER : RecentsViewContainer {
|
||||
private var verticalFactor: Int = 0
|
||||
private var hasDismissThresholdHapticRun = false
|
||||
private var initialDisplacement: Float = 0f
|
||||
private var recentsScaleAnimation: SpringAnimation? = null
|
||||
|
||||
private fun canInterceptTouch(ev: MotionEvent): Boolean =
|
||||
when {
|
||||
@@ -91,33 +97,42 @@ CONTAINER : RecentsViewContainer {
|
||||
}
|
||||
|
||||
onControllerTouchEvent(ev)
|
||||
return detector.isDraggingState && detector.wasInitialTouchPositive()
|
||||
val upDirectionIsPositive = upDirection == SingleAxisSwipeDetector.DIRECTION_POSITIVE
|
||||
val wasInitialTouchUp =
|
||||
(upDirectionIsPositive && detector.wasInitialTouchPositive()) ||
|
||||
(!upDirectionIsPositive && !detector.wasInitialTouchPositive())
|
||||
return detector.isDraggingState && wasInitialTouchUp
|
||||
}
|
||||
|
||||
override fun onControllerTouchEvent(ev: MotionEvent?): Boolean = detector.onTouchEvent(ev)
|
||||
|
||||
private fun onActionDown(ev: MotionEvent): Boolean {
|
||||
springAnimation?.cancel()
|
||||
recentsScaleAnimation?.cancel()
|
||||
if (!canInterceptTouch(ev)) {
|
||||
return false
|
||||
}
|
||||
|
||||
taskBeingDragged =
|
||||
recentsView.taskViews
|
||||
.firstOrNull {
|
||||
recentsView.isTaskViewVisible(it) && container.dragLayer.isEventOverView(it, ev)
|
||||
}
|
||||
?.also {
|
||||
dismissLength = recentsView.pagedOrientationHandler.getSecondaryDimension(it)
|
||||
val secondaryLayerDimension =
|
||||
recentsView.pagedOrientationHandler.getSecondaryDimension(
|
||||
container.dragLayer
|
||||
)
|
||||
// Dismiss length as bottom of task so it is fully off screen when dismissed.
|
||||
it.getThumbnailBounds(tempTaskThumbnailBounds, relativeToDragLayer = true)
|
||||
dismissLength =
|
||||
recentsView.pagedOrientationHandler.getTaskDismissLength(
|
||||
secondaryLayerDimension,
|
||||
tempTaskThumbnailBounds,
|
||||
)
|
||||
verticalFactor =
|
||||
recentsView.pagedOrientationHandler.secondaryTranslationDirectionFactor
|
||||
recentsView.pagedOrientationHandler.getTaskDismissVerticalDirection()
|
||||
}
|
||||
|
||||
detector.setDetectableScrollConditions(
|
||||
recentsView.pagedOrientationHandler.getUpDirection(isRtl),
|
||||
/* ignoreSlop = */ false,
|
||||
)
|
||||
|
||||
detector.setDetectableScrollConditions(upDirection, /* ignoreSlop= */ false)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -140,8 +155,8 @@ CONTAINER : RecentsViewContainer {
|
||||
boundToRange(abs(currentDisplacement), 0f, dismissLength.toFloat())
|
||||
// When swiping below origin, allow slight undershoot to simulate resisting the movement.
|
||||
val totalDisplacement =
|
||||
if (isDisplacementPositiveDirection(currentDisplacement))
|
||||
boundedDisplacement * sign(currentDisplacement)
|
||||
if (recentsView.pagedOrientationHandler.isGoingUp(currentDisplacement, isRtl))
|
||||
boundedDisplacement * verticalFactor
|
||||
else
|
||||
mapToRange(
|
||||
boundedDisplacement,
|
||||
@@ -150,7 +165,7 @@ CONTAINER : RecentsViewContainer {
|
||||
0f,
|
||||
container.resources.getDimension(R.dimen.task_dismiss_max_undershoot),
|
||||
DECELERATE,
|
||||
)
|
||||
) * -verticalFactor
|
||||
taskBeingDragged.secondaryDismissTranslationProperty.setValue(
|
||||
taskBeingDragged,
|
||||
totalDisplacement,
|
||||
@@ -162,6 +177,8 @@ CONTAINER : RecentsViewContainer {
|
||||
}
|
||||
recentsView.redrawLiveTile()
|
||||
}
|
||||
val dismissFraction = displacement / (dismissLength * verticalFactor).toFloat()
|
||||
RECENTS_SCALE_PROPERTY.setValue(recentsView, getRecentsScale(dismissFraction))
|
||||
playDismissThresholdHaptic(displacement)
|
||||
return true
|
||||
}
|
||||
@@ -197,8 +214,9 @@ CONTAINER : RecentsViewContainer {
|
||||
}
|
||||
val isBeyondDismissThreshold =
|
||||
abs(currentDisplacement) > abs(DISMISS_THRESHOLD_FRACTION * dismissLength)
|
||||
val isFlingingTowardsDismiss = detector.isFling(velocity) && velocity < 0
|
||||
val isFlingingTowardsRestState = detector.isFling(velocity) && velocity > 0
|
||||
val velocityIsGoingUp = recentsView.pagedOrientationHandler.isGoingUp(velocity, isRtl)
|
||||
val isFlingingTowardsDismiss = detector.isFling(velocity) && velocityIsGoingUp
|
||||
val isFlingingTowardsRestState = detector.isFling(velocity) && !velocityIsGoingUp
|
||||
val isDismissing =
|
||||
isFlingingTowardsDismiss || (isBeyondDismissThreshold && !isFlingingTowardsRestState)
|
||||
springAnimation =
|
||||
@@ -216,12 +234,12 @@ CONTAINER : RecentsViewContainer {
|
||||
if (isDismissing) (dismissLength * verticalFactor).toFloat() else 0f
|
||||
)
|
||||
}
|
||||
recentsScaleAnimation =
|
||||
recentsView.animateRecentsScale(RECENTS_SCALE_DEFAULT).addEndListener { _, _, _, _ ->
|
||||
recentsScaleAnimation = null
|
||||
}
|
||||
}
|
||||
|
||||
// Returns if the current task being dragged is towards "positive" (e.g. dismissal).
|
||||
private fun isDisplacementPositiveDirection(displacement: Float): Boolean =
|
||||
sign(displacement) == sign(verticalFactor.toFloat())
|
||||
|
||||
private fun clearState() {
|
||||
detector.finishedScrolling()
|
||||
detector.setDetectableScrollConditions(0, false)
|
||||
@@ -230,8 +248,54 @@ CONTAINER : RecentsViewContainer {
|
||||
springAnimation = null
|
||||
}
|
||||
|
||||
private fun getRecentsScale(dismissFraction: Float): Float {
|
||||
return when {
|
||||
// Do not scale recents when dragging below origin.
|
||||
dismissFraction <= 0 -> {
|
||||
RECENTS_SCALE_DEFAULT
|
||||
}
|
||||
// Initially scale recents as the drag begins, up to the first threshold.
|
||||
dismissFraction < RECENTS_SCALE_FIRST_THRESHOLD_FRACTION -> {
|
||||
mapToRange(
|
||||
dismissFraction,
|
||||
0f,
|
||||
RECENTS_SCALE_FIRST_THRESHOLD_FRACTION,
|
||||
RECENTS_SCALE_DEFAULT,
|
||||
RECENTS_SCALE_ON_DISMISS_CANCEL,
|
||||
LINEAR,
|
||||
)
|
||||
}
|
||||
// Keep scale consistent until dragging to the dismiss threshold.
|
||||
dismissFraction < RECENTS_SCALE_DISMISS_THRESHOLD_FRACTION -> {
|
||||
RECENTS_SCALE_ON_DISMISS_CANCEL
|
||||
}
|
||||
// Scale beyond the dismiss threshold again, to indicate dismiss will occur on release.
|
||||
dismissFraction < RECENTS_SCALE_SECOND_THRESHOLD_FRACTION -> {
|
||||
mapToRange(
|
||||
dismissFraction,
|
||||
RECENTS_SCALE_DISMISS_THRESHOLD_FRACTION,
|
||||
RECENTS_SCALE_SECOND_THRESHOLD_FRACTION,
|
||||
RECENTS_SCALE_ON_DISMISS_CANCEL,
|
||||
RECENTS_SCALE_ON_DISMISS_SUCCESS,
|
||||
LINEAR,
|
||||
)
|
||||
}
|
||||
// Keep scale beyond the dismiss threshold scaling consistent.
|
||||
else -> {
|
||||
RECENTS_SCALE_ON_DISMISS_SUCCESS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val DISMISS_THRESHOLD_FRACTION = 0.5f
|
||||
private const val DISMISS_THRESHOLD_HAPTIC_RANGE = 10f
|
||||
|
||||
private const val RECENTS_SCALE_ON_DISMISS_CANCEL = 0.9875f
|
||||
private const val RECENTS_SCALE_ON_DISMISS_SUCCESS = 0.975f
|
||||
private const val RECENTS_SCALE_DEFAULT = 1f
|
||||
private const val RECENTS_SCALE_FIRST_THRESHOLD_FRACTION = 0.2f
|
||||
private const val RECENTS_SCALE_DISMISS_THRESHOLD_FRACTION = 0.5f
|
||||
private const val RECENTS_SCALE_SECOND_THRESHOLD_FRACTION = 0.575f
|
||||
}
|
||||
}
|
||||
+15
-9
@@ -53,6 +53,7 @@ CONTAINER : RecentsViewContainer {
|
||||
recentsView.pagedOrientationHandler.upDownSwipeDirection,
|
||||
)
|
||||
private val isRtl = isRtl(container.resources)
|
||||
private val downDirection = recentsView.pagedOrientationHandler.getDownDirection(isRtl)
|
||||
|
||||
private var taskBeingDragged: TaskView? = null
|
||||
private var launchEndDisplacement: Float = 0f
|
||||
@@ -104,7 +105,11 @@ CONTAINER : RecentsViewContainer {
|
||||
}
|
||||
}
|
||||
onControllerTouchEvent(ev)
|
||||
return detector.isDraggingState && !detector.wasInitialTouchPositive()
|
||||
val downDirectionIsNegative = downDirection == SingleAxisSwipeDetector.DIRECTION_NEGATIVE
|
||||
val wasInitialTouchDown =
|
||||
(downDirectionIsNegative && !detector.wasInitialTouchPositive()) ||
|
||||
(!downDirectionIsNegative && detector.wasInitialTouchPositive())
|
||||
return detector.isDraggingState && wasInitialTouchDown
|
||||
}
|
||||
|
||||
override fun onControllerTouchEvent(ev: MotionEvent) = detector.onTouchEvent(ev)
|
||||
@@ -120,15 +125,12 @@ CONTAINER : RecentsViewContainer {
|
||||
}
|
||||
?.also {
|
||||
verticalFactor =
|
||||
recentsView.pagedOrientationHandler.secondaryTranslationDirectionFactor
|
||||
recentsView.pagedOrientationHandler.getTaskDragDisplacementFactor(isRtl)
|
||||
}
|
||||
if (!canTaskLaunchTaskView(taskBeingDragged)) {
|
||||
return false
|
||||
}
|
||||
detector.setDetectableScrollConditions(
|
||||
recentsView.pagedOrientationHandler.getDownDirection(isRtl),
|
||||
/* ignoreSlop = */ false,
|
||||
)
|
||||
detector.setDetectableScrollConditions(downDirection, /* ignoreSlop= */ false)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -143,7 +145,10 @@ CONTAINER : RecentsViewContainer {
|
||||
recentsView.createTaskLaunchAnimation(taskBeingDragged, maxDuration, ZOOM_IN)
|
||||
// Since the thumbnail is what is filling the screen, based the end displacement on it.
|
||||
taskBeingDragged.getThumbnailBounds(tempRect, /* relativeToDragLayer= */ true)
|
||||
launchEndDisplacement = (secondaryLayerDimension - tempRect.bottom).toFloat()
|
||||
launchEndDisplacement =
|
||||
recentsView.pagedOrientationHandler
|
||||
.getTaskLaunchLength(secondaryLayerDimension, tempRect)
|
||||
.toFloat() * verticalFactor
|
||||
playbackController =
|
||||
pendingAnimation.createPlaybackController()?.apply {
|
||||
taskViewRecentsTouchContext.onUserControlledAnimationCreated(this)
|
||||
@@ -163,8 +168,9 @@ CONTAINER : RecentsViewContainer {
|
||||
|
||||
val isBeyondLaunchThreshold =
|
||||
abs(playbackController.progressFraction) > abs(LAUNCH_THRESHOLD_FRACTION)
|
||||
val isFlingingTowardsLaunch = detector.isFling(velocity) && velocity > 0
|
||||
val isFlingingTowardsRestState = detector.isFling(velocity) && velocity < 0
|
||||
val velocityIsNegative = !recentsView.pagedOrientationHandler.isGoingUp(velocity, isRtl)
|
||||
val isFlingingTowardsLaunch = detector.isFling(velocity) && velocityIsNegative
|
||||
val isFlingingTowardsRestState = detector.isFling(velocity) && !velocityIsNegative
|
||||
val isLaunching =
|
||||
isFlingingTowardsLaunch || (isBeyondLaunchThreshold && !isFlingingTowardsRestState)
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.statemanager.BaseState;
|
||||
import com.android.launcher3.statemanager.StatefulContainer;
|
||||
import com.android.launcher3.taskbar.TaskbarThresholdUtils;
|
||||
@@ -223,6 +224,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
mRecentsView = null;
|
||||
mContainer = null;
|
||||
mStateCallback.clearState(STATE_LAUNCHER_PRESENT);
|
||||
mRecentsAnimationStartCallbacks.clear();
|
||||
};
|
||||
|
||||
private static int FLAG_COUNT = 0;
|
||||
@@ -1112,6 +1114,9 @@ public abstract class AbsSwipeUpHandler<
|
||||
public void onGestureEnded(float endVelocityPxPerMs, PointF velocityPxPerMs) {
|
||||
float flingThreshold = mContext.getResources()
|
||||
.getDimension(R.dimen.quickstep_fling_threshold_speed);
|
||||
Log.d(TAG, "onGestureEnded: mGestureStarted=" + mGestureStarted
|
||||
+ ", mIsMotionPaused=" + mIsMotionPaused
|
||||
+ ", flingThresholdPassed=" + (Math.abs(endVelocityPxPerMs) > flingThreshold));
|
||||
boolean isFling = mGestureStarted && !mIsMotionPaused
|
||||
&& Math.abs(endVelocityPxPerMs) > flingThreshold;
|
||||
mStateCallback.setStateOnUiThread(STATE_GESTURE_COMPLETED);
|
||||
@@ -1260,12 +1265,12 @@ public abstract class AbsSwipeUpHandler<
|
||||
dpiFromPx(velocityPxPerMs.x),
|
||||
dpiFromPx(velocityPxPerMs.y),
|
||||
Math.toDegrees(Math.atan2(-velocityPxPerMs.y, velocityPxPerMs.x)));
|
||||
|
||||
if (mGestureState.isHandlingAtomicEvent()) {
|
||||
// Button mode, this is only used to go to recents.
|
||||
return RECENTS;
|
||||
}
|
||||
|
||||
Log.d(TAG, "calculateEndTarget: isCancel=" + isCancel + ", isFlingY=" + isFlingY);
|
||||
GestureEndTarget endTarget;
|
||||
if (isCancel) {
|
||||
endTarget = LAST_TASK;
|
||||
@@ -1275,6 +1280,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
endTarget = calculateEndTargetForNonFling(velocityPxPerMs);
|
||||
}
|
||||
|
||||
Log.d(TAG, "calculateEndTarget: endTarget(1)=" + endTarget);
|
||||
if (mDeviceState.isOverviewDisabled() && endTarget == RECENTS) {
|
||||
return LAST_TASK;
|
||||
}
|
||||
@@ -1293,6 +1299,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
return LAST_TASK;
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "calculateEndTarget: endTarget(2)=" + endTarget);
|
||||
return endTarget;
|
||||
}
|
||||
|
||||
@@ -1301,9 +1308,12 @@ public abstract class AbsSwipeUpHandler<
|
||||
final boolean willGoToNewTask =
|
||||
isScrollingToNewTask() && Math.abs(velocity.x) > Math.abs(endVelocity);
|
||||
final boolean isSwipeUp = endVelocity < 0;
|
||||
Log.d(TAG, "calculateEndTargetForFlingY: willGoToNewTask=" + willGoToNewTask
|
||||
+ ", isSwipeUp=" + isSwipeUp);
|
||||
if (!isSwipeUp) {
|
||||
final boolean isCenteredOnNewTask = mRecentsView != null
|
||||
&& mRecentsView.getDestinationPage() != mRecentsView.getRunningTaskIndex();
|
||||
Log.d(TAG, "calculateEndTargetForFlingY: isCenteredOnNewTask=" + isCenteredOnNewTask);
|
||||
return willGoToNewTask || isCenteredOnNewTask ? NEW_TASK : LAST_TASK;
|
||||
}
|
||||
|
||||
@@ -1316,6 +1326,9 @@ public abstract class AbsSwipeUpHandler<
|
||||
// Fully gestural mode.
|
||||
final boolean isFlingX = Math.abs(velocity.x) > mContext.getResources()
|
||||
.getDimension(R.dimen.quickstep_fling_threshold_speed);
|
||||
Log.d(TAG, "calculateEndTargetForNonFling: isScrollingToNewTask=" + isScrollingToNewTask
|
||||
+ ", isFlingX=" + isFlingX
|
||||
+ ", mIsMotionPaused=" + mIsMotionPaused);
|
||||
if (isScrollingToNewTask && isFlingX) {
|
||||
// Flinging towards new task takes precedence over mIsMotionPaused (which only
|
||||
// checks y-velocity).
|
||||
@@ -1325,6 +1338,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
} else if (isScrollingToNewTask) {
|
||||
return NEW_TASK;
|
||||
}
|
||||
Log.d(TAG, "calculateEndTargetForNonFling: mCanSlowSwipeGoHome=" + mCanSlowSwipeGoHome);
|
||||
return velocity.y < 0 && mCanSlowSwipeGoHome ? HOME : LAST_TASK;
|
||||
}
|
||||
|
||||
@@ -1408,8 +1422,10 @@ public abstract class AbsSwipeUpHandler<
|
||||
}
|
||||
if (endTarget == HOME) {
|
||||
boolean isPinnedTaskbar = DisplayController.isPinnedTaskbar(mContext);
|
||||
boolean isNotInDesktop = !DisplayController.isInDesktopMode(mContext);
|
||||
duration = mContainer != null && mContainer.getDeviceProfile().isTaskbarPresent
|
||||
? QuickstepTransitionManager.getTaskbarToHomeDuration(isPinnedTaskbar)
|
||||
? QuickstepTransitionManager.getTaskbarToHomeDuration(
|
||||
isPinnedTaskbar && isNotInDesktop)
|
||||
: StaggeredWorkspaceAnim.DURATION_MS;
|
||||
SystemUiProxy.INSTANCE.get(mContext).updateContextualEduStats(
|
||||
mGestureState.isTrackpadGesture(), GestureType.HOME);
|
||||
@@ -1588,10 +1604,28 @@ public abstract class AbsSwipeUpHandler<
|
||||
mTaskAnimationManager.getCurrentCallbacks());
|
||||
if (mParallelRunningAnim != null) {
|
||||
mParallelRunningAnim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
if (DisplayController.isInDesktopMode(mContext)
|
||||
&& mGestureState.getEndTarget() == HOME) {
|
||||
// Set launcher animation started, so we don't notify from
|
||||
// desktop visibility controller
|
||||
DesktopVisibilityController.INSTANCE.get(
|
||||
mContext).setLauncherAnimationRunning(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mParallelRunningAnim = null;
|
||||
mStateCallback.setStateOnUiThread(STATE_PARALLEL_ANIM_FINISHED);
|
||||
// Swipe to home animation finished, notify DesktopVisibilityController
|
||||
// to recreate Taskbar
|
||||
if (DisplayController.isInDesktopMode(mContext)
|
||||
&& mGestureState.getEndTarget() == HOME) {
|
||||
DesktopVisibilityController.INSTANCE.get(
|
||||
mContext).onLauncherAnimationFromDesktopEnd();
|
||||
}
|
||||
}
|
||||
});
|
||||
mParallelRunningAnim.start();
|
||||
@@ -1678,7 +1712,6 @@ public abstract class AbsSwipeUpHandler<
|
||||
if (mHandOffAnimationToHome) {
|
||||
handOffAnimation(velocityPxPerMs);
|
||||
}
|
||||
|
||||
windowAnim[0].addAnimatorListener(new AnimationSuccessListener() {
|
||||
@Override
|
||||
public void onAnimationSuccess(Animator animator) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.android.quickstep
|
||||
|
||||
import android.content.Context
|
||||
import com.android.systemui.shared.system.QuickStepContract
|
||||
import com.android.launcher3.R
|
||||
|
||||
// DesktopTaskView thumbnail's corner radius is independent of fullscreenProgress.
|
||||
open class DesktopFullscreenDrawParams
|
||||
@@ -28,6 +28,6 @@ constructor(context: Context, cornerRadiusProvider: (Context) -> Float = ::compu
|
||||
// computeCornerRadius is used as cornerRadiusProvider, so
|
||||
// QuickStepContract::getWindowCornerRadius can be mocked properly.
|
||||
private fun computeCornerRadius(context: Context): Float =
|
||||
QuickStepContract.getWindowCornerRadius(context)
|
||||
context.resources.getDimension(R.dimen.desktop_windowing_freeform_rounded_corner_radius)
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,13 @@ public class LauncherBackAnimationController {
|
||||
|
||||
private void finishAnimation() {
|
||||
mLauncher.setPredictiveBackToHomeInProgress(false);
|
||||
if (mBackTarget != null && mBackTarget.leash.isValid()) {
|
||||
mBackTarget.leash.release();
|
||||
}
|
||||
mBackTarget = null;
|
||||
if (mLauncherTarget != null && mLauncherTarget.leash.isValid()) {
|
||||
mLauncherTarget.leash.release();
|
||||
}
|
||||
mLauncherTarget = null;
|
||||
mBackInProgress = false;
|
||||
mBackProgress = 0;
|
||||
|
||||
@@ -293,10 +293,6 @@ constructor(
|
||||
val recentsView: RecentsView<*, *>? = recentsViewContainer?.getOverviewPanel()
|
||||
val deviceProfile = recentsViewContainer?.getDeviceProfile()
|
||||
val uiController = containerInterface.getTaskbarController()
|
||||
val allowQuickSwitch =
|
||||
uiController != null &&
|
||||
deviceProfile != null &&
|
||||
(deviceProfile.isTablet || deviceProfile.isTwoPanels)
|
||||
|
||||
val focusedDisplayId = focusState.focusedDisplayId
|
||||
val focusedDisplayUIController: TaskbarUIController? =
|
||||
@@ -322,26 +318,26 @@ constructor(
|
||||
|
||||
when (command.type) {
|
||||
HIDE -> {
|
||||
if (!allowQuickSwitch) return true
|
||||
if (uiController == null || deviceProfile?.isTablet == false) return true
|
||||
keyboardTaskFocusIndex =
|
||||
if (
|
||||
enableAltTabKqsOnConnectedDisplays() && focusedDisplayUIController != null
|
||||
) {
|
||||
focusedDisplayUIController.launchFocusedTask()
|
||||
} else {
|
||||
uiController!!.launchFocusedTask()
|
||||
uiController.launchFocusedTask()
|
||||
}
|
||||
|
||||
if (keyboardTaskFocusIndex == -1) return true
|
||||
}
|
||||
KEYBOARD_INPUT ->
|
||||
if (allowQuickSwitch) {
|
||||
if (uiController != null && deviceProfile?.isTablet == true) {
|
||||
if (
|
||||
enableAltTabKqsOnConnectedDisplays() && focusedDisplayUIController != null
|
||||
) {
|
||||
focusedDisplayUIController.openQuickSwitchView()
|
||||
} else {
|
||||
uiController!!.openQuickSwitchView()
|
||||
uiController.openQuickSwitchView()
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
@@ -365,7 +361,11 @@ constructor(
|
||||
TOGGLE -> {}
|
||||
}
|
||||
|
||||
recentsView?.setKeyboardTaskFocusIndex(keyboardTaskFocusIndex)
|
||||
recentsView?.setKeyboardTaskFocusIndex(
|
||||
recentsView.indexOfChild(recentsView.taskViews.elementAtOrNull(keyboardTaskFocusIndex))
|
||||
?: -1
|
||||
)
|
||||
|
||||
// Handle recents view focus when launching from home
|
||||
val animatorListener: Animator.AnimatorListener =
|
||||
object : AnimatorListenerAdapter() {
|
||||
@@ -526,7 +526,7 @@ constructor(
|
||||
// Stops requesting focused after first view gets focused.
|
||||
recentsView.getTaskViewAt(keyboardTaskFocusIndex).requestFocus() ||
|
||||
recentsView.nextTaskView.requestFocus() ||
|
||||
recentsView.getFirstTaskView().requestFocus() ||
|
||||
recentsView.firstTaskView.requestFocus() ||
|
||||
recentsView.requestFocus()
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
|
||||
case TestProtocol.REQUEST_RECREATE_TASKBAR:
|
||||
// Allow null-pointer to catch illegal states.
|
||||
runOnTISBinder(tisBinder -> tisBinder.getTaskbarManager().recreateTaskbar());
|
||||
runOnTISBinder(tisBinder -> tisBinder.getTaskbarManager().recreateTaskbars());
|
||||
return response;
|
||||
case TestProtocol.REQUEST_TASKBAR_IME_DOCKED:
|
||||
return getTISBinderUIProperty(Bundle::putBoolean, tisBinder ->
|
||||
|
||||
@@ -21,7 +21,7 @@ import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
|
||||
import static com.android.launcher3.Flags.enableSeparateExternalDisplayTasks;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.quickstep.util.SplitScreenUtils.convertShellSplitBoundsToLauncher;
|
||||
import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_FREEFORM;
|
||||
import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_DESK;
|
||||
import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_SPLIT;
|
||||
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
@@ -32,10 +32,12 @@ import android.content.Context;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.window.DesktopExperienceFlags;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.util.LooperExecutor;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.quickstep.util.DesktopTask;
|
||||
@@ -351,15 +353,23 @@ public class RecentTasksList {
|
||||
|
||||
TaskLoadResult allTasks = new TaskLoadResult(requestId, loadKeysOnly, rawTasks.size());
|
||||
|
||||
int numVisibleTasks = 0;
|
||||
boolean isFirstVisibleTaskFound = false;
|
||||
for (GroupedTaskInfo rawTask : rawTasks) {
|
||||
if (rawTask.isBaseType(TYPE_FREEFORM)) {
|
||||
// TYPE_FREEFORM tasks is only created when desktop mode can be entered,
|
||||
// leftover TYPE_FREEFORM tasks created when flag was on should be ignored.
|
||||
if (rawTask.isBaseType(TYPE_DESK)) {
|
||||
// TYPE_DESK tasks is only created when desktop mode can be entered,
|
||||
// leftover TYPE_DESK tasks created when flag was on should be ignored.
|
||||
if (DesktopModeStatus.canEnterDesktopMode(mContext)) {
|
||||
List<DesktopTask> desktopTasks = createDesktopTasks(
|
||||
rawTask.getBaseGroupedTask());
|
||||
allTasks.addAll(desktopTasks);
|
||||
|
||||
// If any task in desktop group task is visible, set isFirstVisibleTaskFound to
|
||||
// true. This way if there is a transparent task in the list later on, it does
|
||||
// not get its own tile in Overview.
|
||||
if (rawTask.getBaseGroupedTask().getTaskInfoList().stream().anyMatch(
|
||||
taskInfo -> taskInfo.isVisible)) {
|
||||
isFirstVisibleTaskFound = true;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -400,7 +410,7 @@ public class RecentTasksList {
|
||||
tmpLockedUsers.get(task2Key.userId) /* isLocked */);
|
||||
} else {
|
||||
// Is fullscreen task
|
||||
if (numVisibleTasks > 0) {
|
||||
if (isFirstVisibleTaskFound) {
|
||||
boolean isExcluded = (taskInfo1.baseIntent.getFlags()
|
||||
& FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
|
||||
if (taskInfo1.isTopActivityTransparent && isExcluded) {
|
||||
@@ -411,7 +421,7 @@ public class RecentTasksList {
|
||||
}
|
||||
}
|
||||
if (taskInfo1.isVisible) {
|
||||
numVisibleTasks++;
|
||||
isFirstVisibleTaskFound = true;
|
||||
}
|
||||
if (task2 != null) {
|
||||
Objects.requireNonNull(rawTask.getSplitBounds());
|
||||
@@ -442,7 +452,11 @@ public class RecentTasksList {
|
||||
Set<Integer> minimizedTaskIds = minimizedTaskIdArray != null
|
||||
? CollectionsKt.toSet(ArraysKt.asIterable(minimizedTaskIdArray))
|
||||
: Collections.emptySet();
|
||||
if (enableSeparateExternalDisplayTasks()) {
|
||||
if (enableSeparateExternalDisplayTasks()
|
||||
&& !DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue()) {
|
||||
// This code is not needed when the multiple desktop feature is enabled, since Shell
|
||||
// will send a single `GroupedTaskInfo` for each desk with a unique `deskId` across
|
||||
// all displays.
|
||||
Map<Integer, List<Task>> perDisplayTasks = new HashMap<>();
|
||||
for (TaskInfo taskInfo : recentTaskInfo.getTaskInfoList()) {
|
||||
Task task = createTask(taskInfo, minimizedTaskIds);
|
||||
@@ -450,11 +464,16 @@ public class RecentTasksList {
|
||||
k -> new ArrayList<>());
|
||||
tasks.add(task);
|
||||
}
|
||||
return MapsKt.map(perDisplayTasks, it -> new DesktopTask(it.getValue()));
|
||||
// When the multiple desktop feature is disabled, there can only be up to a single desk
|
||||
// on each display, The desk ID doesn't matter and should not be used.
|
||||
return MapsKt.map(perDisplayTasks,
|
||||
it -> new DesktopTask(DesktopVisibilityController.INACTIVE_DESK_ID,
|
||||
it.getValue()));
|
||||
} else {
|
||||
final int deskId = recentTaskInfo.getDeskId();
|
||||
List<Task> tasks = CollectionsKt.map(recentTaskInfo.getTaskInfoList(),
|
||||
it -> createTask(it, minimizedTaskIds));
|
||||
return List.of(new DesktopTask(tasks));
|
||||
return List.of(new DesktopTask(deskId, tasks));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,9 @@ import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -119,6 +122,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
InputMethodService.canImeRenderGesturalNavButtons();
|
||||
|
||||
private @SystemUiStateFlags long mSystemUiStateFlags = QuickStepContract.SYSUI_STATE_AWAKE;
|
||||
private final Map<Integer, Long> mSysUIStateFlagsPerDisplay = new ConcurrentHashMap<>();
|
||||
private NavigationMode mMode = THREE_BUTTONS;
|
||||
private NavBarPosition mNavBarPosition;
|
||||
|
||||
@@ -353,21 +357,50 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the system ui state flags from SystemUI.
|
||||
* Updates the system ui state flags from SystemUI for a specific display.
|
||||
*
|
||||
* @param stateFlags the current {@link SystemUiStateFlags} for the display.
|
||||
* @param displayId the display's ID.
|
||||
*/
|
||||
public void setSystemUiFlags(@SystemUiStateFlags long stateFlags) {
|
||||
mSystemUiStateFlags = stateFlags;
|
||||
public void setSysUIStateFlagsForDisplay(@SystemUiStateFlags long stateFlags,
|
||||
int displayId) {
|
||||
mSysUIStateFlagsPerDisplay.put(displayId, stateFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the system ui state flags.
|
||||
* Clears the system ui state flags for a specific display. This is called when the display is
|
||||
* destroyed.
|
||||
*
|
||||
* @param displayId the display's ID.
|
||||
*/
|
||||
public void clearSysUIStateFlagsForDisplay(int displayId) {
|
||||
mSysUIStateFlagsPerDisplay.remove(displayId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the system ui state flags for the default display.
|
||||
*/
|
||||
// TODO(141886704): See if we can remove this
|
||||
@SystemUiStateFlags
|
||||
public long getSystemUiStateFlags() {
|
||||
return mSystemUiStateFlags;
|
||||
public long getSysuiStateFlag() {
|
||||
return getSystemUiStateFlags(DEFAULT_DISPLAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the system ui state flags for a given display ID.
|
||||
*/
|
||||
@SystemUiStateFlags
|
||||
public long getSystemUiStateFlags(int displayId) {
|
||||
return mSysUIStateFlagsPerDisplay.getOrDefault(displayId,
|
||||
QuickStepContract.SYSUI_STATE_AWAKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the display ids that have sysui state.
|
||||
*/
|
||||
public Set<Integer> getDisplaysWithSysUIState() {
|
||||
return mSysUIStateFlagsPerDisplay.keySet();
|
||||
}
|
||||
/**
|
||||
* Sets the flag that indicates whether a predictive back-to-home animation is in progress
|
||||
*/
|
||||
@@ -386,8 +419,8 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
* @return whether SystemUI is in a state where we can start a system gesture.
|
||||
*/
|
||||
public boolean canStartSystemGesture() {
|
||||
boolean canStartWithNavHidden = (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
|
||||
|| (mSystemUiStateFlags & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) != 0
|
||||
boolean canStartWithNavHidden = (getSysuiStateFlag() & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
|
||||
|| (getSysuiStateFlag() & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) != 0
|
||||
|| mRotationTouchHelper.isTaskListFrozen();
|
||||
return canStartWithNavHidden && canStartAnyGesture();
|
||||
}
|
||||
@@ -399,7 +432,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
*/
|
||||
public boolean canStartTrackpadGesture() {
|
||||
boolean trackpadGesturesEnabled =
|
||||
(mSystemUiStateFlags & SYSUI_STATE_TOUCHPAD_GESTURES_DISABLED) == 0;
|
||||
(getSysuiStateFlag() & SYSUI_STATE_TOUCHPAD_GESTURES_DISABLED) == 0;
|
||||
return trackpadGesturesEnabled && canStartAnyGesture();
|
||||
}
|
||||
|
||||
@@ -407,8 +440,8 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
* Common logic to determine if either trackpad or finger gesture can be started
|
||||
*/
|
||||
private boolean canStartAnyGesture() {
|
||||
boolean homeOrOverviewEnabled = (mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0
|
||||
|| (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0;
|
||||
boolean homeOrOverviewEnabled = (getSysuiStateFlag() & SYSUI_STATE_HOME_DISABLED) == 0
|
||||
|| (getSysuiStateFlag() & SYSUI_STATE_OVERVIEW_DISABLED) == 0;
|
||||
long gestureDisablingStates = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
||||
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING
|
||||
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED
|
||||
@@ -416,7 +449,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
| SYSUI_STATE_DEVICE_DREAMING
|
||||
| SYSUI_STATE_DISABLE_GESTURE_SPLIT_INVOCATION
|
||||
| SYSUI_STATE_DISABLE_GESTURE_PIP_ANIMATING;
|
||||
return (gestureDisablingStates & mSystemUiStateFlags) == 0 && homeOrOverviewEnabled;
|
||||
return (gestureDisablingStates & getSysuiStateFlag()) == 0 && homeOrOverviewEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -424,35 +457,35 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
* (like camera or maps)
|
||||
*/
|
||||
public boolean isKeyguardShowingOccluded() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether screen pinning is enabled and active
|
||||
*/
|
||||
public boolean isScreenPinningActive() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_SCREEN_PINNING) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_SCREEN_PINNING) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether assistant gesture is constraint
|
||||
*/
|
||||
public boolean isAssistantGestureIsConstrained() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the bubble stack is expanded
|
||||
*/
|
||||
public boolean isBubblesExpanded() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_BUBBLES_EXPANDED) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_BUBBLES_EXPANDED) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the global actions dialog is showing
|
||||
*/
|
||||
public boolean isSystemUiDialogShowing() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_DIALOG_SHOWING) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_DIALOG_SHOWING) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -466,35 +499,35 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
* @return whether the accessibility menu is available.
|
||||
*/
|
||||
public boolean isAccessibilityMenuAvailable() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the accessibility menu shortcut is available.
|
||||
*/
|
||||
public boolean isAccessibilityMenuShortcutAvailable() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether home is disabled (either by SUW/SysUI/device policy)
|
||||
*/
|
||||
public boolean isHomeDisabled() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_HOME_DISABLED) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether overview is disabled (either by SUW/SysUI/device policy)
|
||||
*/
|
||||
public boolean isOverviewDisabled() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_OVERVIEW_DISABLED) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether one-handed mode is enabled and active
|
||||
*/
|
||||
public boolean isOneHandedModeActive() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_ONE_HANDED_ACTIVE) != 0;
|
||||
return (getSysuiStateFlag() & SYSUI_STATE_ONE_HANDED_ACTIVE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,7 +590,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
*/
|
||||
public boolean canTriggerAssistantAction(MotionEvent ev) {
|
||||
return mAssistantAvailable
|
||||
&& !QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags)
|
||||
&& !QuickStepContract.isAssistantGestureDisabled(getSysuiStateFlag())
|
||||
&& mRotationTouchHelper.touchInAssistantRegion(ev)
|
||||
&& !isTrackpadScroll(ev)
|
||||
&& !isLockToAppActive();
|
||||
@@ -597,7 +630,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
/** Returns whether IME is rendering nav buttons, and IME is currently showing. */
|
||||
public boolean isImeRenderingNavButtons() {
|
||||
return mCanImeRenderGesturalNavButtons && mMode == NO_BUTTON
|
||||
&& ((mSystemUiStateFlags & SYSUI_STATE_IME_VISIBLE) != 0);
|
||||
&& ((getSysuiStateFlag() & SYSUI_STATE_IME_VISIBLE) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -629,24 +662,37 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
return touchSlop * touchSlop;
|
||||
}
|
||||
|
||||
/** Returns a string representation of the system ui state flags for the default display. */
|
||||
public String getSystemUiStateString() {
|
||||
return QuickStepContract.getSystemUiStateString(mSystemUiStateFlags);
|
||||
return getSystemUiStateString(getSysuiStateFlag());
|
||||
}
|
||||
|
||||
/** Returns a string representation of the system ui state flags. */
|
||||
public String getSystemUiStateString(long flags) {
|
||||
return QuickStepContract.getSystemUiStateString(flags);
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println("DeviceState:");
|
||||
pw.println(" canStartSystemGesture=" + canStartSystemGesture());
|
||||
pw.println(" systemUiFlags=" + mSystemUiStateFlags);
|
||||
pw.println(" systemUiFlagsForDefaultDisplay=" + getSysuiStateFlag());
|
||||
pw.println(" systemUiFlagsDesc=" + getSystemUiStateString());
|
||||
pw.println(" assistantAvailable=" + mAssistantAvailable);
|
||||
pw.println(" assistantDisabled="
|
||||
+ QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags));
|
||||
+ QuickStepContract.isAssistantGestureDisabled(getSysuiStateFlag()));
|
||||
pw.println(" isOneHandedModeEnabled=" + mIsOneHandedModeEnabled);
|
||||
pw.println(" isSwipeToNotificationEnabled=" + mIsSwipeToNotificationEnabled);
|
||||
pw.println(" deferredGestureRegion=" + mDeferredGestureRegion.getBounds());
|
||||
pw.println(" exclusionRegion=" + mExclusionRegion.getBounds());
|
||||
pw.println(" pipIsActive=" + mPipIsActive);
|
||||
pw.println(" predictiveBackToHomeInProgress=" + mIsPredictiveBackToHomeInProgress);
|
||||
for (int displayId : mSysUIStateFlagsPerDisplay.keySet()) {
|
||||
pw.println(" systemUiFlagsForDisplay" + displayId + "=" + getSystemUiStateFlags(
|
||||
displayId));
|
||||
pw.println(" systemUiFlagsForDisplay" + displayId + "Desc=" + getSystemUiStateString(
|
||||
getSystemUiStateFlags(displayId)));
|
||||
}
|
||||
pw.println(" RotationTouchHelper:");
|
||||
mRotationTouchHelper.dump(pw);
|
||||
}
|
||||
}
|
||||
@@ -142,15 +142,17 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
mContext = context;
|
||||
mDisplayController = displayController;
|
||||
mSystemUiProxy = systemUiProxy;
|
||||
// TODO (b/398195845): this needs updating so non-default displays do not rotate with the
|
||||
// default display.
|
||||
mDisplayId = DEFAULT_DISPLAY;
|
||||
|
||||
Resources resources = mContext.getResources();
|
||||
mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode,
|
||||
() -> QuickStepContract.getWindowCornerRadius(mContext));
|
||||
|
||||
// Register for navigation mode changes
|
||||
mDisplayController.addChangeListener(this);
|
||||
DisplayController.Info info = mDisplayController.getInfo();
|
||||
// Register for navigation mode and rotation changes
|
||||
mDisplayController.addChangeListenerForDisplay(this, mDisplayId);
|
||||
DisplayController.Info info = mDisplayController.getInfoForDisplay(mDisplayId);
|
||||
onDisplayInfoChanged(context, info, CHANGE_ALL);
|
||||
|
||||
mOrientationListener = new OrientationEventListener(mContext) {
|
||||
@@ -174,7 +176,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
};
|
||||
|
||||
lifeCycle.addCloseable(() -> {
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mDisplayController.removeChangeListenerForDisplay(this, mDisplayId);
|
||||
mOrientationListener.disable();
|
||||
TaskStackChangeListeners.getInstance()
|
||||
.unregisterTaskStackListener(mFrozenTaskListener);
|
||||
@@ -201,7 +203,8 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
return;
|
||||
}
|
||||
|
||||
mOrientationTouchTransformer.createOrAddTouchRegion(mDisplayController.getInfo(),
|
||||
mOrientationTouchTransformer.createOrAddTouchRegion(
|
||||
mDisplayController.getInfoForDisplay(mDisplayId),
|
||||
"RTH.updateGestureTouchRegions");
|
||||
}
|
||||
|
||||
@@ -258,7 +261,8 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
|
||||
if ((flags & CHANGE_NAVIGATION_MODE) != 0) {
|
||||
NavigationMode newMode = info.getNavigationMode();
|
||||
mOrientationTouchTransformer.setNavigationMode(newMode, mDisplayController.getInfo(),
|
||||
mOrientationTouchTransformer.setNavigationMode(newMode,
|
||||
mDisplayController.getInfoForDisplay(mDisplayId),
|
||||
mContext.getResources());
|
||||
|
||||
TaskStackChangeListeners.getInstance()
|
||||
@@ -280,7 +284,8 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
*/
|
||||
void setGesturalHeight(int newGesturalHeight) {
|
||||
mOrientationTouchTransformer.setGesturalHeight(
|
||||
newGesturalHeight, mDisplayController.getInfo(), mContext.getResources());
|
||||
newGesturalHeight, mDisplayController.getInfoForDisplay(mDisplayId),
|
||||
mContext.getResources());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -296,7 +301,8 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
}
|
||||
|
||||
private void enableMultipleRegions(boolean enable) {
|
||||
mOrientationTouchTransformer.enableMultipleRegions(enable, mDisplayController.getInfo());
|
||||
mOrientationTouchTransformer.enableMultipleRegions(enable,
|
||||
mDisplayController.getInfoForDisplay(mDisplayId));
|
||||
notifySysuiOfCurrentRotation(mOrientationTouchTransformer.getQuickStepStartingRotation());
|
||||
if (enable && !mInOverview && !TestProtocol.sDisableSensorRotation) {
|
||||
// Clear any previous state from sensor manager
|
||||
@@ -359,7 +365,8 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
* notifies system UI of the primary rotation the user is interacting with
|
||||
*/
|
||||
private void toggleSecondaryNavBarsForRotation() {
|
||||
mOrientationTouchTransformer.setSingleActiveRegion(mDisplayController.getInfo());
|
||||
mOrientationTouchTransformer.setSingleActiveRegion(
|
||||
mDisplayController.getInfoForDisplay(mDisplayId));
|
||||
notifySysuiOfCurrentRotation(mOrientationTouchTransformer.getCurrentActiveRotation());
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION;
|
||||
@@ -42,15 +44,20 @@ public class SimpleOrientationTouchTransformer implements
|
||||
private OrientationRectF mOrientationRectF;
|
||||
private OrientationRectF mTouchingOrientationRectF;
|
||||
private int mViewRotation;
|
||||
private final int mDisplayId;
|
||||
|
||||
@Inject
|
||||
public SimpleOrientationTouchTransformer(@ApplicationContext Context context,
|
||||
DisplayController displayController,
|
||||
DaggerSingletonTracker tracker) {
|
||||
displayController.addChangeListener(this);
|
||||
tracker.addCloseable(() -> displayController.removeChangeListener(this));
|
||||
// TODO (b/398195845): make sure non-default displays don't get affected by default display
|
||||
// changes.
|
||||
mDisplayId = DEFAULT_DISPLAY;
|
||||
displayController.addChangeListenerForDisplay(this, mDisplayId);
|
||||
tracker.addCloseable(
|
||||
() -> displayController.removeChangeListenerForDisplay(this, mDisplayId));
|
||||
|
||||
onDisplayInfoChanged(context, displayController.getInfo(), CHANGE_ALL);
|
||||
onDisplayInfoChanged(context, displayController.getInfoForDisplay(mDisplayId), CHANGE_ALL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -655,20 +655,28 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context:
|
||||
* Tells SysUI to show a shortcut bubble.
|
||||
*
|
||||
* @param info the shortcut info used to create or identify the bubble.
|
||||
* @param bubbleBarLocation the optional location of the bubble bar.
|
||||
*/
|
||||
fun showShortcutBubble(info: ShortcutInfo?) =
|
||||
@JvmOverloads
|
||||
fun showShortcutBubble(info: ShortcutInfo?, bubbleBarLocation: BubbleBarLocation? = null) =
|
||||
executeWithErrorLog({ "Failed call showShortcutBubble" }) {
|
||||
bubbles?.showShortcutBubble(info)
|
||||
bubbles?.showShortcutBubble(info, bubbleBarLocation)
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells SysUI to show a bubble of an app.
|
||||
*
|
||||
* @param intent the intent used to create the bubble.
|
||||
* @param bubbleBarLocation the optional location of the bubble bar.
|
||||
*/
|
||||
fun showAppBubble(intent: Intent?, user: UserHandle) =
|
||||
@JvmOverloads
|
||||
fun showAppBubble(
|
||||
intent: Intent?,
|
||||
user: UserHandle,
|
||||
bubbleBarLocation: BubbleBarLocation? = null,
|
||||
) =
|
||||
executeWithErrorLog({ "Failed call showAppBubble" }) {
|
||||
bubbles?.showAppBubble(intent, user)
|
||||
bubbles?.showAppBubble(intent, user, bubbleBarLocation)
|
||||
}
|
||||
|
||||
/** Tells SysUI to show the expanded view. */
|
||||
|
||||
@@ -286,8 +286,32 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
mCallbacks.addListener(listener);
|
||||
|
||||
final ActivityOptions options = ActivityOptions.makeBasic();
|
||||
options.setPendingIntentBackgroundActivityStartMode(
|
||||
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS);
|
||||
options.setTransientLaunch();
|
||||
options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
|
||||
|
||||
// Notify taskbar that we should skip reacting to launcher visibility change to
|
||||
// avoid a jumping taskbar.
|
||||
TaskbarUIController taskbarUIController = containerInterface.getTaskbarController();
|
||||
if (enableScalingRevealHomeAnimation() && taskbarUIController != null) {
|
||||
taskbarUIController.setSkipLauncherVisibilityChange(true);
|
||||
|
||||
mCallbacks.addListener(new RecentsAnimationCallbacks.RecentsAnimationListener() {
|
||||
@Override
|
||||
public void onRecentsAnimationCanceled(
|
||||
@NonNull HashMap<Integer, ThumbnailData> thumbnailDatas) {
|
||||
taskbarUIController.setSkipLauncherVisibilityChange(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationFinished(
|
||||
@NonNull RecentsAnimationController controller) {
|
||||
taskbarUIController.setSkipLauncherVisibilityChange(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO:(b/365777482) if flag is enabled, but on launcher it will crash.
|
||||
if(containerInterface.getCreatedContainer() instanceof RecentsWindowManager
|
||||
&& (Flags.enableFallbackOverviewInWindow()
|
||||
|| Flags.enableLauncherOverviewInWindow())) {
|
||||
@@ -297,32 +321,6 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
.getRecentsWindowManager(mDeviceState.getDisplayId())
|
||||
.startRecentsWindow(mCallbacks);
|
||||
} else {
|
||||
options.setPendingIntentBackgroundActivityStartMode(
|
||||
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS);
|
||||
options.setTransientLaunch();
|
||||
options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
|
||||
|
||||
// Notify taskbar that we should skip reacting to launcher visibility change to
|
||||
// avoid a jumping taskbar.
|
||||
TaskbarUIController taskbarUIController = containerInterface.getTaskbarController();
|
||||
if (enableScalingRevealHomeAnimation() && taskbarUIController != null) {
|
||||
taskbarUIController.setSkipLauncherVisibilityChange(true);
|
||||
|
||||
mCallbacks.addListener(new RecentsAnimationCallbacks.RecentsAnimationListener() {
|
||||
@Override
|
||||
public void onRecentsAnimationCanceled(
|
||||
@NonNull HashMap<Integer, ThumbnailData> thumbnailDatas) {
|
||||
taskbarUIController.setSkipLauncherVisibilityChange(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationFinished(
|
||||
@NonNull RecentsAnimationController controller) {
|
||||
taskbarUIController.setSkipLauncherVisibilityChange(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mRecentsAnimationStartPending = getSystemUiProxy().startRecentsActivity(intent,
|
||||
options, mCallbacks, false /* useSyntheticRecentsTransition */);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ class TaskIconCache(
|
||||
var taskVisualsChangeListener: TaskVisualsChangeListener? = null
|
||||
|
||||
init {
|
||||
// TODO (b/397205964): this will need to be updated when we support caches for different
|
||||
// displays.
|
||||
displayController.addChangeListener(this)
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ public interface TaskShortcutFactory {
|
||||
RecentsView<?, ?> recentsView = taskView.getRecentsView();
|
||||
if (recentsView != null) {
|
||||
dismissTaskMenuView();
|
||||
recentsView.dismissTask(taskView, true, true);
|
||||
recentsView.dismissTaskView(taskView, true, true);
|
||||
mTarget.getStatsLogManager().logger().withItemInfo(mTaskContainer.getItemInfo())
|
||||
.log(LAUNCHER_SYSTEM_SHORTCUT_CLOSE_APP_TAP);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import static com.android.launcher3.QuickstepTransitionManager.SPLIT_DIVIDER_ANI
|
||||
import static com.android.launcher3.QuickstepTransitionManager.SPLIT_LAUNCH_DURATION;
|
||||
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
|
||||
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
|
||||
import static com.android.quickstep.BaseContainerInterface.getTaskDimension;
|
||||
import static com.android.quickstep.util.AnimUtils.clampToDuration;
|
||||
import static com.android.wm.shell.shared.TransitionUtil.TYPE_SPLIT_SCREEN_DIM_LAYER;
|
||||
|
||||
@@ -65,6 +66,7 @@ import androidx.annotation.Nullable;
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
@@ -102,6 +104,11 @@ public final class TaskViewUtils {
|
||||
|
||||
private TaskViewUtils() {}
|
||||
|
||||
private static final Rect TEMP_THUMBNAIL_BOUNDS = new Rect();
|
||||
private static final Rect TEMP_FULLSCREEN_BOUNDS = new Rect();
|
||||
private static final PointF TEMP_TASK_DIMENSION = new PointF();
|
||||
private static final PointF TEMP_PIVOT = new PointF();
|
||||
|
||||
/**
|
||||
* Try to find a TaskView that corresponds with the component of the launched view.
|
||||
*
|
||||
@@ -164,7 +171,7 @@ public final class TaskViewUtils {
|
||||
public static <T extends Context & RecentsViewContainer & StatefulContainer<?>>
|
||||
void createRecentsWindowAnimator(
|
||||
@NonNull RecentsView<T, ?> recentsView,
|
||||
@NonNull TaskView v,
|
||||
@NonNull TaskView taskView,
|
||||
boolean skipViewChanges,
|
||||
@NonNull RemoteAnimationTarget[] appTargets,
|
||||
@NonNull RemoteAnimationTarget[] wallpaperTargets,
|
||||
@@ -172,31 +179,31 @@ public final class TaskViewUtils {
|
||||
@Nullable DepthController depthController,
|
||||
@Nullable TransitionInfo transitionInfo,
|
||||
PendingAnimation out) {
|
||||
boolean isQuickSwitch = v.isEndQuickSwitchCuj();
|
||||
v.setEndQuickSwitchCuj(false);
|
||||
boolean isQuickSwitch = taskView.isEndQuickSwitchCuj();
|
||||
taskView.setEndQuickSwitchCuj(false);
|
||||
|
||||
final RemoteAnimationTargets targets =
|
||||
new RemoteAnimationTargets(appTargets, wallpaperTargets, nonAppTargets,
|
||||
MODE_OPENING);
|
||||
final RemoteAnimationTarget navBarTarget = targets.getNavBarRemoteAnimationTarget();
|
||||
|
||||
SurfaceTransactionApplier applier = new SurfaceTransactionApplier(v);
|
||||
SurfaceTransactionApplier applier = new SurfaceTransactionApplier(taskView);
|
||||
targets.addReleaseCheck(applier);
|
||||
|
||||
RemoteTargetHandle[] remoteTargetHandles;
|
||||
RemoteTargetHandle[] recentsViewHandles = recentsView.getRemoteTargetHandles();
|
||||
if (v.isRunningTask() && recentsViewHandles != null) {
|
||||
if (taskView.isRunningTask() && recentsViewHandles != null) {
|
||||
// Re-use existing handles
|
||||
remoteTargetHandles = recentsViewHandles;
|
||||
} else {
|
||||
boolean forDesktop = v instanceof DesktopTaskView;
|
||||
RemoteTargetGluer gluer = new RemoteTargetGluer(v.getContext(),
|
||||
boolean forDesktop = taskView instanceof DesktopTaskView;
|
||||
RemoteTargetGluer gluer = new RemoteTargetGluer(taskView.getContext(),
|
||||
recentsView.getSizeStrategy(), targets, forDesktop);
|
||||
if (forDesktop) {
|
||||
remoteTargetHandles = gluer.assignTargetsForDesktop(targets, transitionInfo);
|
||||
} else if (v.containsMultipleTasks()) {
|
||||
} else if (taskView.containsMultipleTasks()) {
|
||||
remoteTargetHandles = gluer.assignTargetsForSplitScreen(targets,
|
||||
((GroupedTaskView) v).getSplitBoundsConfig());
|
||||
((GroupedTaskView) taskView).getSplitBoundsConfig());
|
||||
} else {
|
||||
remoteTargetHandles = gluer.assignTargets(targets);
|
||||
}
|
||||
@@ -210,8 +217,8 @@ public final class TaskViewUtils {
|
||||
remoteTargetHandle.getTransformParams().setSyncTransactionApplier(applier);
|
||||
}
|
||||
|
||||
int taskIndex = recentsView.indexOfChild(v);
|
||||
Context context = v.getContext();
|
||||
int taskIndex = recentsView.indexOfChild(taskView);
|
||||
Context context = taskView.getContext();
|
||||
|
||||
T container = RecentsViewContainer.containerFromContext(context);
|
||||
DeviceProfile dp = container.getDeviceProfile();
|
||||
@@ -219,11 +226,11 @@ public final class TaskViewUtils {
|
||||
boolean parallaxCenterAndAdjacentTask =
|
||||
!showAsGrid && taskIndex != recentsView.getCurrentPage();
|
||||
int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex);
|
||||
int taskRectTranslationSecondary = showAsGrid ? (int) v.getGridTranslationY() : 0;
|
||||
int taskRectTranslationSecondary = showAsGrid ? (int) taskView.getGridTranslationY() : 0;
|
||||
|
||||
RemoteTargetHandle[] topMostSimulators = null;
|
||||
|
||||
if (!v.isRunningTask()) {
|
||||
if (!taskView.isRunningTask()) {
|
||||
// TVSs already initialized from the running task, no need to re-init
|
||||
for (RemoteTargetHandle targetHandle : remoteTargetHandles) {
|
||||
TaskViewSimulator tvsLocal = targetHandle.getTaskViewSimulator();
|
||||
@@ -237,13 +244,13 @@ public final class TaskViewUtils {
|
||||
tvsLocal.fullScreenProgress.value = 0;
|
||||
tvsLocal.recentsViewScale.value = 1;
|
||||
if (!enableGridOnlyOverview()) {
|
||||
tvsLocal.setIsGridTask(v.isGridTask());
|
||||
tvsLocal.setIsGridTask(taskView.isGridTask());
|
||||
}
|
||||
tvsLocal.getOrientationState().getOrientationHandler().set(tvsLocal,
|
||||
TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary,
|
||||
taskRectTranslationSecondary);
|
||||
|
||||
if (v instanceof DesktopTaskView) {
|
||||
if (taskView instanceof DesktopTaskView) {
|
||||
targetHandle.getTransformParams().setTargetAlpha(1f);
|
||||
} else {
|
||||
// Fade in the task during the initial 20% of the animation
|
||||
@@ -260,8 +267,11 @@ public final class TaskViewUtils {
|
||||
out.setFloat(tvsLocal.recentsViewScale,
|
||||
AnimatedFloat.VALUE, tvsLocal.getFullScreenScale(),
|
||||
TOUCH_RESPONSE);
|
||||
out.setFloat(tvsLocal.recentsViewScroll, AnimatedFloat.VALUE, 0,
|
||||
TOUCH_RESPONSE);
|
||||
if (!enableGridOnlyOverview()) {
|
||||
out.setFloat(tvsLocal.recentsViewScroll, AnimatedFloat.VALUE, 0,
|
||||
TOUCH_RESPONSE);
|
||||
}
|
||||
|
||||
out.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -271,6 +281,18 @@ public final class TaskViewUtils {
|
||||
showTransaction.getTransaction().show(targets.apps[i].leash);
|
||||
}
|
||||
applier.scheduleApply(showTransaction);
|
||||
|
||||
if (enableGridOnlyOverview()) {
|
||||
taskView.getThumbnailBounds(TEMP_THUMBNAIL_BOUNDS, /*relativeToDragLayer=*/
|
||||
true);
|
||||
getTaskDimension(context, container.getDeviceProfile(),
|
||||
TEMP_TASK_DIMENSION);
|
||||
TEMP_FULLSCREEN_BOUNDS.set(0, 0, (int) TEMP_TASK_DIMENSION.x,
|
||||
(int) TEMP_TASK_DIMENSION.y);
|
||||
Utilities.getPivotsForScalingRectToRect(TEMP_THUMBNAIL_BOUNDS,
|
||||
TEMP_FULLSCREEN_BOUNDS, TEMP_PIVOT);
|
||||
tvsLocal.setPivotOverride(TEMP_PIVOT);
|
||||
}
|
||||
}
|
||||
});
|
||||
out.addOnFrameCallback(() -> {
|
||||
@@ -321,7 +343,7 @@ public final class TaskViewUtils {
|
||||
|
||||
if (!skipViewChanges && parallaxCenterAndAdjacentTask && topMostSimulators != null
|
||||
&& topMostSimulators.length > 0) {
|
||||
out.addFloat(v, VIEW_ALPHA, 1, 0, clampToProgress(LINEAR, 0.2f, 0.4f));
|
||||
out.addFloat(taskView, VIEW_ALPHA, 1, 0, clampToProgress(LINEAR, 0.2f, 0.4f));
|
||||
|
||||
RemoteTargetHandle[] simulatorCopies = topMostSimulators;
|
||||
for (RemoteTargetHandle handle : simulatorCopies) {
|
||||
@@ -340,7 +362,7 @@ public final class TaskViewUtils {
|
||||
// During animation we apply transformation on the thumbnailView (and not the rootView)
|
||||
// to follow the TaskViewSimulator. So the final matrix applied on the thumbnailView is:
|
||||
// Mt K(0)` K(t) Mt`
|
||||
View[] thumbnails = v.getSnapshotViews();
|
||||
View[] thumbnails = taskView.getSnapshotViews();
|
||||
|
||||
// In case simulator copies and thumbnail size do no match, ensure we get the lesser.
|
||||
// This ensures we do not create arrays with empty elements or attempt to references
|
||||
|
||||
@@ -53,6 +53,7 @@ import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.Choreographer;
|
||||
import android.view.Display;
|
||||
import android.view.InputDevice;
|
||||
import android.view.InputEvent;
|
||||
import android.view.MotionEvent;
|
||||
@@ -274,11 +275,12 @@ public class TouchInteractionService extends Service {
|
||||
}
|
||||
|
||||
@BinderThread
|
||||
public void onSystemUiStateChanged(@SystemUiStateFlags long stateFlags) {
|
||||
public void onSystemUiStateChanged(@SystemUiStateFlags long stateFlags, int displayId) {
|
||||
MAIN_EXECUTOR.execute(() -> executeForTouchInteractionService(tis -> {
|
||||
long lastFlags = tis.mDeviceState.getSystemUiStateFlags();
|
||||
tis.mDeviceState.setSystemUiFlags(stateFlags);
|
||||
tis.onSystemUiFlagsChanged(lastFlags);
|
||||
// Last flags is only used for the default display case.
|
||||
long lastFlags = tis.mDeviceState.getSysuiStateFlag();
|
||||
tis.mDeviceState.setSysUIStateFlagsForDisplay(stateFlags, displayId);
|
||||
tis.onSystemUiFlagsChanged(lastFlags, displayId);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -312,6 +314,9 @@ public class TouchInteractionService extends Service {
|
||||
public void onDisplayRemoved(int displayId) {
|
||||
executeForTaskbarManager(taskbarManager ->
|
||||
taskbarManager.onDisplayRemoved(displayId));
|
||||
executeForTouchInteractionService(tis -> {
|
||||
tis.mDeviceState.clearSysUIStateFlagsForDisplay(displayId);
|
||||
});
|
||||
}
|
||||
|
||||
@BinderThread
|
||||
@@ -649,7 +654,9 @@ public class TouchInteractionService extends Service {
|
||||
mResetGestureInputConsumer = new ResetGestureInputConsumer(
|
||||
mTaskAnimationManager, mTaskbarManager::getCurrentActivityContext);
|
||||
mInputConsumer.registerInputConsumer();
|
||||
onSystemUiFlagsChanged(mDeviceState.getSystemUiStateFlags());
|
||||
for (int displayId : mDeviceState.getDisplaysWithSysUIState()) {
|
||||
onSystemUiFlagsChanged(mDeviceState.getSystemUiStateFlags(displayId), displayId);
|
||||
}
|
||||
onAssistantVisibilityChanged();
|
||||
|
||||
// Initialize the task tracker
|
||||
@@ -705,19 +712,25 @@ public class TouchInteractionService extends Service {
|
||||
public void send(int code, Intent intent, String resolvedType,
|
||||
IBinder allowlistToken, IIntentReceiver finishedReceiver,
|
||||
String requiredPermission, Bundle options) {
|
||||
MAIN_EXECUTOR.execute(() -> mTaskbarManager.toggleAllApps());
|
||||
MAIN_EXECUTOR.execute(() -> mTaskbarManager.toggleAllAppsSearch());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@UiThread
|
||||
private void onSystemUiFlagsChanged(@SystemUiStateFlags long lastSysUIFlags) {
|
||||
private void onSystemUiFlagsChanged(@SystemUiStateFlags long lastSysUIFlags, int displayId) {
|
||||
if (LockedUserState.get(this).isUserUnlocked()) {
|
||||
long systemUiStateFlags = mDeviceState.getSystemUiStateFlags();
|
||||
SystemUiProxy.INSTANCE.get(this).setLastSystemUiStateFlags(systemUiStateFlags);
|
||||
mOverviewComponentObserver.setHomeDisabled(mDeviceState.isHomeDisabled());
|
||||
mTaskbarManager.onSystemUiFlagsChanged(systemUiStateFlags);
|
||||
mTaskAnimationManager.onSystemUiFlagsChanged(lastSysUIFlags, systemUiStateFlags);
|
||||
long systemUiStateFlags = mDeviceState.getSystemUiStateFlags(displayId);
|
||||
mTaskbarManager.onSystemUiFlagsChanged(systemUiStateFlags, displayId);
|
||||
if (displayId == Display.DEFAULT_DISPLAY) {
|
||||
// The following don't care about non-default displays, at least for now. If they
|
||||
// ever will, they should be taken care of.
|
||||
SystemUiProxy.INSTANCE.get(this).setLastSystemUiStateFlags(systemUiStateFlags);
|
||||
mOverviewComponentObserver.setHomeDisabled(mDeviceState.isHomeDisabled());
|
||||
// TODO b/399371607 - Propagate to taskAnimationManager once overview is multi
|
||||
// display.
|
||||
mTaskAnimationManager.onSystemUiFlagsChanged(lastSysUIFlags, systemUiStateFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.quickstep.fallback;
|
||||
import static com.android.app.animation.Interpolators.FINAL_FRAME;
|
||||
import static com.android.app.animation.Interpolators.INSTANT;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.Flags.enableDesktopExplodedView;
|
||||
import static com.android.launcher3.Flags.enableLargeDesktopWindowingTile;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
|
||||
@@ -36,6 +37,7 @@ import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLA
|
||||
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA;
|
||||
import static com.android.quickstep.views.RecentsViewUtils.DESK_EXPLODE_PROGRESS;
|
||||
import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL;
|
||||
|
||||
import android.util.FloatProperty;
|
||||
@@ -49,6 +51,7 @@ import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.quickstep.views.AddDesktopButton;
|
||||
import com.android.quickstep.views.ClearAllButton;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.RecentsViewContainer;
|
||||
@@ -95,8 +98,13 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
|
||||
private void setProperties(RecentsState state, StateAnimationConfig config,
|
||||
PropertySetter setter) {
|
||||
float clearAllButtonAlpha = state.hasClearAllButton() ? 1 : 0;
|
||||
setter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
|
||||
clearAllButtonAlpha, LINEAR);
|
||||
setter.setFloat(mRecentsView.getClearAllButton(),
|
||||
ClearAllButton.VISIBILITY_ALPHA, clearAllButtonAlpha, LINEAR);
|
||||
if (mRecentsView.getAddDeskButton() != null) {
|
||||
float addDeskButtonAlpha = state.hasAddDeskButton() ? 1 : 0;
|
||||
setter.setFloat(mRecentsView.getAddDeskButton(), AddDesktopButton.VISIBILITY_ALPHA,
|
||||
addDeskButtonAlpha, LINEAR);
|
||||
}
|
||||
float overviewButtonAlpha = state.hasOverviewActions() ? 1 : 0;
|
||||
setter.setFloat(mRecentsViewContainer.getActionsView().getVisibilityAlpha(),
|
||||
AnimatedFloat.VALUE, overviewButtonAlpha, LINEAR);
|
||||
@@ -123,6 +131,10 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
|
||||
state.detachDesktopCarousel() ? 1f : 0f,
|
||||
getOverviewInterpolator(state));
|
||||
}
|
||||
if (enableDesktopExplodedView()) {
|
||||
setter.setFloat(mRecentsView, DESK_EXPLODE_PROGRESS, showAsGrid ? 1f : 0f,
|
||||
getOverviewInterpolator(state));
|
||||
}
|
||||
|
||||
setter.setViewBackgroundColor(mRecentsViewContainer.getScrimView(),
|
||||
state.getScrimColor(mRecentsViewContainer.asContext()),
|
||||
|
||||
@@ -45,14 +45,16 @@ public class RecentsState implements BaseState<RecentsState> {
|
||||
private static final int FLAG_RECENTS_VIEW_VISIBLE = BaseState.getFlag(7);
|
||||
private static final int FLAG_TASK_THUMBNAIL_SPLASH = BaseState.getFlag(8);
|
||||
private static final int FLAG_DETACH_DESKTOP_CAROUSEL = BaseState.getFlag(9);
|
||||
private static final int FLAG_ADD_DESK_BUTTON = BaseState.getFlag(10);
|
||||
|
||||
private static final RecentsState[] sAllStates = new RecentsState[6];
|
||||
|
||||
public static final RecentsState DEFAULT = new RecentsState(0,
|
||||
FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID
|
||||
| FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE);
|
||||
| FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE
|
||||
| FLAG_ADD_DESK_BUTTON);
|
||||
public static final RecentsState MODAL_TASK = new ModalState(1,
|
||||
FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL
|
||||
FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL
|
||||
| FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE);
|
||||
public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2,
|
||||
FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN
|
||||
@@ -121,6 +123,13 @@ public class RecentsState implements BaseState<RecentsState> {
|
||||
return hasFlag(FLAG_CLEAR_ALL_BUTTON);
|
||||
}
|
||||
|
||||
/**
|
||||
* For this state, whether add desk button should be shown.
|
||||
*/
|
||||
public boolean hasAddDeskButton() {
|
||||
return hasFlag(FLAG_ADD_DESK_BUTTON);
|
||||
}
|
||||
|
||||
/**
|
||||
* For this state, whether overview actions should be shown.
|
||||
*/
|
||||
|
||||
Loaded 100 of 324 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user