Merge "Tune AllApps dismiss animation" into tm-dev
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index f80deeb..81b0dd2 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -109,6 +109,8 @@
<string name="back_gesture_intro_title">Swipe to go back</string>
<!-- Introduction subtitle for the Back gesture tutorial. [CHAR LIMIT=200] -->
<string name="back_gesture_intro_subtitle">To go back to the last screen, swipe from the left or right edge to the middle of the screen.</string>
+ <!-- Introduction subtitle for the Back gesture tutorial that will be spoken by screen readers. [CHAR LIMIT=200] -->
+ <string name="back_gesture_spoken_intro_subtitle">To go back to the last screen, swipe with 2 fingers from the left or right edge to the middle of the screen.</string>
<string name="home_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe up from the bottom edge of the screen.</string>
<!-- Feedback shown during interactive parts of Home gesture tutorial when the Overview gesture is detected. [CHAR LIMIT=100] -->
@@ -123,6 +125,8 @@
<string name="home_gesture_intro_title">Swipe to go home</string>
<!-- Introduction subtitle for the Home gesture tutorial. [CHAR LIMIT=100] -->
<string name="home_gesture_intro_subtitle">Swipe up from the bottom of your screen. This gesture always takes you to the Home screen.</string>
+ <!-- Introduction subtitle for the Home gesture tutorial that will be spoken by screen readers. [CHAR LIMIT=100] -->
+ <string name="home_gesture_spoken_intro_subtitle">Swipe up with 2 fingers from the bottom of the screen. This gesture always takes you to the Home screen.</string>
<!-- Feedback shown during interactive parts of Overview gesture tutorial when the gesture is started too far from the edge. [CHAR LIMIT=100] -->
<string name="overview_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe up from the bottom edge of the screen.</string>
@@ -138,6 +142,8 @@
<string name="overview_gesture_intro_title">Swipe to switch apps</string>
<!-- Introduction subtitle for the Overview gesture tutorial. [CHAR LIMIT=100] -->
<string name="overview_gesture_intro_subtitle">To switch between apps, swipe up from the bottom of your screen, hold, then release.</string>
+ <!-- Introduction subtitle for the Overview gesture tutorial that will be spoken by screen readers. [CHAR LIMIT=100] -->
+ <string name="overview_gesture_spoken_intro_subtitle">To switch between apps, swipe up with 2 fingers from the bottom of your screen, hold, then release.</string>
<!-- Title shown during interactive part of Assistant gesture tutorial. [CHAR LIMIT=30] -->
<string name="assistant_gesture_tutorial_playground_title" translatable="false">Tutorial: Assistant</string>
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index 6abcbd5..2239102 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -24,6 +24,9 @@
import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
+import static com.android.launcher3.taskbar.LauncherTaskbarUIController.ALL_APPS_PAGE_PROGRESS_INDEX;
+import static com.android.launcher3.taskbar.LauncherTaskbarUIController.MINUS_ONE_PAGE_PROGRESS_INDEX;
+import static com.android.launcher3.taskbar.LauncherTaskbarUIController.WIDGETS_PAGE_PROGRESS_INDEX;
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.DisplayController.NavigationMode.TWO_BUTTONS;
@@ -229,6 +232,28 @@
public void onScrollChanged(float progress) {
super.onScrollChanged(progress);
mDepthController.onOverlayScrollChanged(progress);
+ onTaskbarInAppDisplayProgressUpdate(progress, MINUS_ONE_PAGE_PROGRESS_INDEX);
+ }
+
+ @Override
+ public void onAllAppsTransition(float progress) {
+ super.onAllAppsTransition(progress);
+ onTaskbarInAppDisplayProgressUpdate(progress, ALL_APPS_PAGE_PROGRESS_INDEX);
+ }
+
+ @Override
+ public void onWidgetsTransition(float progress) {
+ super.onWidgetsTransition(progress);
+ onTaskbarInAppDisplayProgressUpdate(progress, WIDGETS_PAGE_PROGRESS_INDEX);
+ }
+
+ private void onTaskbarInAppDisplayProgressUpdate(float progress, int flag) {
+ if (mTaskbarManager == null
+ || mTaskbarManager.getCurrentActivityContext() == null
+ || mTaskbarUIController == null) {
+ return;
+ }
+ mTaskbarUIController.onTaskbarInAppDisplayProgressUpdate(progress, flag);
}
@Override
diff --git a/quickstep/src/com/android/launcher3/search/SearchSessionManager.java b/quickstep/src/com/android/launcher3/search/SearchSessionManager.java
deleted file mode 100644
index da85793..0000000
--- a/quickstep/src/com/android/launcher3/search/SearchSessionManager.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2022 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.search;
-
-import android.app.search.SearchSession;
-import android.content.Context;
-
-import androidx.annotation.IntDef;
-import androidx.annotation.UiThread;
-
-import com.android.launcher3.R;
-import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.util.ResourceBasedOverride;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.List;
-
-/** Manages an all apps search session. */
-public class SearchSessionManager implements ResourceBasedOverride {
-
- /** Entry state for the search session (e.g. from all apps). */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(value = {ZERO_ALLAPPS, ZERO_QSB})
- public @interface ZeroEntryState {}
- public static final int ZERO_ALLAPPS = 1;
- public static final int ZERO_QSB = 2;
-
- /** Creates a {@link SearchSessionManager} instance. */
- public static SearchSessionManager newInstance(Context context) {
- return Overrides.getObject(
- SearchSessionManager.class, context, R.string.search_session_manager_class);
- }
-
- /** The current {@link SearchSession}. */
- @UiThread
- public void setSearchSession(SearchSession session) {}
-
- /** {@code true} if IME is shown. */
- public void setIsImeShown(boolean value) {}
-
- /** Returns {@code true} if IME is enabled. */
- public boolean getIsImeEnabled() {
- return false;
- }
-
- /** The current entry state for search. */
- public @ZeroEntryState int getEntryState() {
- return ZERO_ALLAPPS;
- }
-
- /**
- * When user enters all apps surface via tap on home widget, set the state to
- * {@code #ZERO_QSB}. When user exits, reset to {@code #ZERO_ALLAPPS}
- */
- public void setEntryState(@ZeroEntryState int state) {}
-
- /** This will be called before opening all apps, to prepare zero state suggestions. */
- public void prepareZeroState() {}
-
- /** Apply predicted items for the search zero state. */
- public void setZeroStatePredictedItems(List<ItemInfo> items) {}
-
- /** Returns {@code true} if the session is valid and should be enabled. */
- public boolean isValidSession() {
- return false;
- }
-
- /** Called when the search session is destroyed. */
- public void onDestroy() {}
-}
diff --git a/quickstep/src/com/android/launcher3/taskbar/DesktopTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/DesktopTaskbarUIController.java
index cf56248..e2359c0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/DesktopTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/DesktopTaskbarUIController.java
@@ -39,4 +39,10 @@
protected void onDestroy() {
mLauncher.getHotseat().setIconsAlpha(1f);
}
+
+ @Override
+ /** Disable taskbar stashing in desktop environment. */
+ public boolean supportsVisualStashing() {
+ return false;
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
index 793d987..a3e8b5c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
@@ -22,6 +22,7 @@
import android.annotation.ColorInt;
import android.os.RemoteException;
import android.util.Log;
+import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.TaskTransitionSpec;
import android.view.WindowManagerGlobal;
@@ -43,6 +44,7 @@
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.RecentsAnimationCallbacks;
+import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Stream;
@@ -54,10 +56,22 @@
private static final String TAG = "TaskbarUIController";
+ public static final int MINUS_ONE_PAGE_PROGRESS_INDEX = 0;
+ public static final int ALL_APPS_PAGE_PROGRESS_INDEX = 1;
+ public static final int WIDGETS_PAGE_PROGRESS_INDEX = 2;
+ public static final int SYSUI_SURFACE_PROGRESS_INDEX = 3;
+
+ private final SparseArray<Float> mTaskbarInAppDisplayProgress = new SparseArray<>(4);
+
private final BaseQuickstepLauncher mLauncher;
private final DeviceProfile.OnDeviceProfileChangeListener mOnDeviceProfileChangeListener =
- this::onStashedInAppChanged;
+ dp -> {
+ onStashedInAppChanged(dp);
+ if (mControllers != null && mControllers.taskbarViewController != null) {
+ mControllers.taskbarViewController.onRotationChanged(dp);
+ }
+ };
// Initialized in init.
private AnimatedFloat mTaskbarOverrideBackgroundAlpha;
@@ -65,15 +79,6 @@
private final TaskbarLauncherStateController
mTaskbarLauncherStateController = new TaskbarLauncherStateController();
- private final DeviceProfile.OnDeviceProfileChangeListener mProfileChangeListener =
- new DeviceProfile.OnDeviceProfileChangeListener() {
- @Override
- public void onDeviceProfileChanged(DeviceProfile dp) {
- mControllers.taskbarViewController.onRotationChanged(
- mLauncher.getDeviceProfile());
- }
- };
-
public LauncherTaskbarUIController(BaseQuickstepLauncher launcher) {
mLauncher = launcher;
}
@@ -93,7 +98,6 @@
onStashedInAppChanged(mLauncher.getDeviceProfile());
mLauncher.addOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
- mLauncher.addOnDeviceProfileChangeListener(mProfileChangeListener);
}
@Override
@@ -102,9 +106,8 @@
onLauncherResumedOrPaused(false);
mTaskbarLauncherStateController.onDestroy();
- mLauncher.removeOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
mLauncher.setTaskbarUIController(null);
- mLauncher.removeOnDeviceProfileChangeListener(mProfileChangeListener);
+ mLauncher.removeOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
updateTaskTransitionSpec(true);
}
@@ -271,4 +274,85 @@
// gesture ends, start drawing taskbar's background again since launcher might stop drawing.
forceHideBackground(inProgress);
}
+
+ /**
+ * Animates Taskbar elements during a transition to a Launcher state that should use in-app
+ * layouts.
+ *
+ * @param progress [0, 1]
+ * 0 => use home layout
+ * 1 => use in-app layout
+ */
+ public void onTaskbarInAppDisplayProgressUpdate(float progress, int progressIndex) {
+ if (mControllers == null) {
+ // This method can be called before init() is called.
+ return;
+ }
+ mTaskbarInAppDisplayProgress.put(progressIndex, progress);
+ if (!mControllers.taskbarStashController.isInApp()
+ && !mTaskbarLauncherStateController.isAnimatingToLauncher()) {
+ // Only animate the nav buttons while home and not animating home, otherwise let
+ // the TaskbarViewController handle it.
+ mControllers.navbarButtonsViewController
+ .getTaskbarNavButtonTranslationYForInAppDisplay()
+ .updateValue(mLauncher.getDeviceProfile().getTaskbarOffsetY()
+ * getInAppDisplayProgress());
+ }
+ }
+
+ /** Returns true iff any in-app display progress > 0. */
+ public boolean shouldUseInAppLayout() {
+ return getInAppDisplayProgress() > 0;
+ }
+
+ private float getInAppDisplayProgress(int index) {
+ if (!mTaskbarInAppDisplayProgress.contains(index)) {
+ mTaskbarInAppDisplayProgress.put(index, 0f);
+ }
+ return mTaskbarInAppDisplayProgress.get(index);
+ }
+
+ private float getInAppDisplayProgress() {
+ return Stream.of(
+ getInAppDisplayProgress(MINUS_ONE_PAGE_PROGRESS_INDEX),
+ getInAppDisplayProgress(ALL_APPS_PAGE_PROGRESS_INDEX),
+ getInAppDisplayProgress(WIDGETS_PAGE_PROGRESS_INDEX),
+ getInAppDisplayProgress(SYSUI_SURFACE_PROGRESS_INDEX))
+ .max(Float::compareTo)
+ .get();
+ }
+
+ @Override
+ public void dumpLogs(String prefix, PrintWriter pw) {
+ super.dumpLogs(prefix, pw);
+
+ pw.println(String.format(
+ "%s\tmTaskbarOverrideBackgroundAlpha=%.2f",
+ prefix,
+ mTaskbarOverrideBackgroundAlpha.value));
+
+ pw.println(String.format("%s\tTaskbar in-app display progress:", prefix));
+ if (mControllers == null) {
+ pw.println(String.format("%s\t\tMissing mControllers", prefix));
+ } else {
+ pw.println(String.format(
+ "%s\t\tprogress at MINUS_ONE_PAGE_PROGRESS_INDEX=%.2f",
+ prefix,
+ getInAppDisplayProgress(MINUS_ONE_PAGE_PROGRESS_INDEX)));
+ pw.println(String.format(
+ "%s\t\tprogress at ALL_APPS_PAGE_PROGRESS_INDEX=%.2f",
+ prefix,
+ getInAppDisplayProgress(ALL_APPS_PAGE_PROGRESS_INDEX)));
+ pw.println(String.format(
+ "%s\t\tprogress at WIDGETS_PAGE_PROGRESS_INDEX=%.2f",
+ prefix,
+ getInAppDisplayProgress(WIDGETS_PAGE_PROGRESS_INDEX)));
+ pw.println(String.format(
+ "%s\t\tprogress at SYSUI_SURFACE_PROGRESS_INDEX=%.2f",
+ prefix,
+ getInAppDisplayProgress(SYSUI_SURFACE_PROGRESS_INDEX)));
+ }
+
+ mTaskbarLauncherStateController.dumpLogs(prefix + "\t", pw);
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index f65b907..349dd0a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -16,6 +16,7 @@
package com.android.launcher3.taskbar;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
+import static com.android.launcher3.taskbar.LauncherTaskbarUIController.SYSUI_SURFACE_PROGRESS_INDEX;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME;
@@ -126,11 +127,13 @@
private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat(
this::updateNavButtonTranslationY);
+ private final AnimatedFloat mTaskbarNavButtonTranslationYForInAppDisplay = new AnimatedFloat(
+ this::updateNavButtonTranslationY);
private final AnimatedFloat mTaskbarNavButtonTranslationYForIme = new AnimatedFloat(
this::updateNavButtonTranslationY);
- // Only applies to mTaskbarNavButtonTranslationY
- private final AnimatedFloat mNavButtonTranslationYMultiplier = new AnimatedFloat(
- this::updateNavButtonTranslationY);
+ // Used for System UI state updates that should translate the nav button for in-app display.
+ private final AnimatedFloat mNavButtonInAppDisplayProgressForSysui = new AnimatedFloat(
+ this::updateNavButtonInAppDisplayProgressForSysui);
private final AnimatedFloat mTaskbarNavButtonDarkIntensity = new AnimatedFloat(
this::updateNavButtonDarkIntensity);
private final AnimatedFloat mNavButtonDarkIntensityMultiplier = new AnimatedFloat(
@@ -173,7 +176,6 @@
public void init(TaskbarControllers controllers) {
mControllers = controllers;
mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize;
- mNavButtonTranslationYMultiplier.value = 1;
boolean isThreeButtonNav = mContext.isThreeButtonNav();
mIsImeRenderingNavButtons =
@@ -205,9 +207,9 @@
// Make sure to remove nav bar buttons translation when notification shade is expanded or
// IME is showing (add separate translation for IME).
int flagsToRemoveTranslation = FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_IME_VISIBLE;
- mPropertyHolders.add(new StatePropertyHolder(mNavButtonTranslationYMultiplier,
+ mPropertyHolders.add(new StatePropertyHolder(mNavButtonInAppDisplayProgressForSysui,
flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE,
- 0, 1));
+ 1, 0));
// Center nav buttons in new height for IME.
float transForIme = (mContext.getDeviceProfile().taskbarSize
- mControllers.taskbarInsetsController.getTaskbarHeightForIme()) / 2f;
@@ -526,6 +528,11 @@
return mTaskbarNavButtonTranslationY;
}
+ /** Use to set the translationY for the all nav+contextual buttons when in Launcher */
+ public AnimatedFloat getTaskbarNavButtonTranslationYForInAppDisplay() {
+ return mTaskbarNavButtonTranslationYForInAppDisplay;
+ }
+
/** Use to set the dark intensity for the all nav+contextual buttons */
public AnimatedFloat getTaskbarNavButtonDarkIntensity() {
return mTaskbarNavButtonDarkIntensity;
@@ -554,11 +561,26 @@
}
}
+ private void updateNavButtonInAppDisplayProgressForSysui() {
+ TaskbarUIController uiController = mControllers.uiController;
+ if (uiController instanceof LauncherTaskbarUIController) {
+ ((LauncherTaskbarUIController) uiController).onTaskbarInAppDisplayProgressUpdate(
+ mNavButtonInAppDisplayProgressForSysui.value, SYSUI_SURFACE_PROGRESS_INDEX);
+ }
+ }
+
private void updateNavButtonTranslationY() {
- float normalTranslationY = mTaskbarNavButtonTranslationY.value
- * mNavButtonTranslationYMultiplier.value;
- float otherTranslationY = mTaskbarNavButtonTranslationYForIme.value;
- mNavButtonsView.setTranslationY(normalTranslationY + otherTranslationY);
+ final float normalTranslationY = mTaskbarNavButtonTranslationY.value;
+ final float imeAdjustmentTranslationY = mTaskbarNavButtonTranslationYForIme.value;
+ TaskbarUIController uiController = mControllers.uiController;
+ final float inAppDisplayAdjustmentTranslationY =
+ (uiController instanceof LauncherTaskbarUIController
+ && ((LauncherTaskbarUIController) uiController).shouldUseInAppLayout())
+ ? mTaskbarNavButtonTranslationYForInAppDisplay.value : 0;
+
+ mNavButtonsView.setTranslationY(normalTranslationY
+ + imeAdjustmentTranslationY
+ + inAppDisplayAdjustmentTranslationY);
}
private void updateNavButtonDarkIntensity() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index b349637..2f32219 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -199,7 +199,7 @@
new TaskbarInsetsController(this));
}
- public void init(TaskbarSharedState sharedState) {
+ public void init(@NonNull TaskbarSharedState sharedState) {
mLastRequestedNonFullscreenHeight = getDefaultTaskbarWindowHeight();
mWindowLayoutParams = createDefaultWindowLayoutParams();
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
index ff08e3d..449e0a7 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
@@ -61,6 +61,8 @@
private boolean mAreAllControllersInitialized;
private final List<Runnable> mPostInitCallbacks = new ArrayList<>();
+ @Nullable private TaskbarSharedState mSharedState = null;
+
public TaskbarControllers(TaskbarActivityContext taskbarActivityContext,
TaskbarDragController taskbarDragController,
TaskbarNavButtonController navButtonController,
@@ -104,8 +106,9 @@
* 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(TaskbarSharedState sharedState) {
+ public void init(@NonNull TaskbarSharedState sharedState) {
mAreAllControllersInitialized = false;
+ mSharedState = sharedState;
taskbarDragController.init(this);
navbarButtonsViewController.init(this);
@@ -116,11 +119,11 @@
taskbarUnfoldAnimationController.init(this);
taskbarKeyguardController.init(navbarButtonsViewController);
stashedHandleViewController.init(this);
- taskbarStashController.init(this, sharedState);
+ taskbarStashController.init(this, sharedState.setupUIVisible);
taskbarEduController.init(this);
taskbarPopupController.init(this);
taskbarForceVisibleImmersiveController.init(this);
- taskbarAllAppsController.init(this, sharedState);
+ taskbarAllAppsController.init(this, sharedState.allAppsVisible);
navButtonController.init(this);
taskbarInsetsController.init(this);
@@ -139,6 +142,12 @@
mPostInitCallbacks.clear();
}
+ @Nullable
+ public TaskbarSharedState getSharedState() {
+ // This should only be null if called before init() and after destroy().
+ return mSharedState;
+ }
+
public void onConfigurationChanged(@Config int configChanges) {
navbarButtonsViewController.onConfigurationChanged(configChanges);
}
@@ -147,6 +156,8 @@
* Cleans up all controllers.
*/
public void onDestroy() {
+ mSharedState = null;
+
navbarButtonsViewController.onDestroy();
uiController.onDestroy();
rotationButtonController.onDestroy();
@@ -187,9 +198,12 @@
return;
}
+ pw.println(String.format(
+ "%s\tmAreAllControllersInitialized=%b", prefix, mAreAllControllersInitialized));
for (LoggableTaskbarController controller : mControllersToLog) {
controller.dumpLogs(prefix + "\t", pw);
}
+ uiController.dumpLogs(prefix + "\t", pw);
rotationButtonController.dumpLogs(prefix + "\t", pw);
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index 36e6420..138fb99 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -42,7 +42,9 @@
import com.android.systemui.animation.ViewRootSync;
import com.android.systemui.shared.recents.model.ThumbnailData;
+import java.io.PrintWriter;
import java.util.HashMap;
+import java.util.StringJoiner;
import java.util.function.Consumer;
import java.util.function.Supplier;
@@ -476,4 +478,48 @@
controller.applyState();
}
}
+
+ private static String getStateString(int flags) {
+ StringJoiner str = new StringJoiner("|");
+ str.add((flags & FLAG_RESUMED) != 0 ? "FLAG_RESUMED" : "");
+ str.add((flags & FLAG_RECENTS_ANIMATION_RUNNING) != 0
+ ? "FLAG_RECENTS_ANIMATION_RUNNING" : "");
+ str.add((flags & FLAG_TRANSITION_STATE_RUNNING) != 0
+ ? "FLAG_TRANSITION_STATE_RUNNING" : "");
+ return str.toString();
+ }
+
+ protected void dumpLogs(String prefix, PrintWriter pw) {
+ pw.println(prefix + "TaskbarLauncherStateController:");
+
+ pw.println(String.format(
+ "%s\tmIconAlignmentForResumedState=%.2f",
+ prefix,
+ mIconAlignmentForResumedState.value));
+ pw.println(String.format(
+ "%s\tmIconAlignmentForGestureState=%.2f",
+ prefix,
+ mIconAlignmentForGestureState.value));
+ pw.println(String.format(
+ "%s\tmIconAlignmentForLauncherState=%.2f",
+ prefix,
+ mIconAlignmentForLauncherState.value));
+ pw.println(String.format(
+ "%s\tmTaskbarBackgroundAlpha=%.2f", prefix, mTaskbarBackgroundAlpha.value));
+ pw.println(String.format(
+ "%s\tmIconAlphaForHome=%.2f", prefix, mIconAlphaForHome.getValue()));
+ pw.println(String.format("%s\tmPrevState=%s", prefix, getStateString(mPrevState)));
+ pw.println(String.format("%s\tmState=%s", prefix, getStateString(mState)));
+ pw.println(String.format("%s\tmLauncherState=%s", prefix, mLauncherState));
+ pw.println(String.format(
+ "%s\tmIsAnimatingToLauncherViaGesture=%b",
+ prefix,
+ mIsAnimatingToLauncherViaGesture));
+ pw.println(String.format(
+ "%s\tmIsAnimatingToLauncherViaResume=%b",
+ prefix,
+ mIsAnimatingToLauncherViaResume));
+ pw.println(String.format(
+ "%s\tmShouldDelayLauncherStateAnim=%b", prefix, mShouldDelayLauncherStateAnim));
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index e02a9d7..2e37170 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -194,6 +194,9 @@
* Sets a {@link StatefulActivity} to act as taskbar callback
*/
public void setActivity(@NonNull StatefulActivity activity) {
+ if (mActivity == activity) {
+ return;
+ }
mActivity = activity;
mUnfoldProgressProvider.setSourceProvider(getUnfoldTransitionProgressProviderForActivity(
activity));
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java
index a5c55b0..87b3789 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java
@@ -25,5 +25,4 @@
public boolean setupUIVisible = false;
public boolean allAppsVisible = false;
-
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 3489ae6..7d95743 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -167,7 +167,7 @@
mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarSize;
}
- public void init(TaskbarControllers controllers, TaskbarSharedState sharedState) {
+ public void init(TaskbarControllers controllers, boolean setupUIVisible) {
mControllers = controllers;
TaskbarDragLayerController dragLayerController = controllers.taskbarDragLayerController;
@@ -188,7 +188,7 @@
boolean isManuallyStashedInApp = supportsManualStashing()
&& mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF);
- boolean isInSetup = !mActivity.isUserSetupComplete() || sharedState.setupUIVisible;
+ boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible;
updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp);
updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup);
updateStateForFlag(FLAG_IN_SETUP, isInSetup);
@@ -202,7 +202,7 @@
* state.
*/
public boolean supportsVisualStashing() {
- return !mActivity.isThreeButtonNav();
+ return mControllers.uiController.supportsVisualStashing();
}
/**
@@ -275,7 +275,7 @@
return !mIsStashed && isInApp();
}
- private boolean isInApp() {
+ public boolean isInApp() {
return hasAnyFlag(FLAGS_IN_APP);
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index d5c399b..fcc34c6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -22,6 +22,7 @@
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
+import java.io.PrintWriter;
import java.util.stream.Stream;
/**
@@ -48,6 +49,11 @@
return true;
}
+ public boolean supportsVisualStashing() {
+ if (mControllers == null) return false;
+ return !mControllers.taskbarActivityContext.isThreeButtonNav();
+ }
+
protected void onStashedInAppChanged() { }
public Stream<ItemInfoWithIcon> getAppIconsForEdu() {
@@ -86,4 +92,12 @@
stashController.applyState();
}
}
+
+ @CallSuper
+ protected void dumpLogs(String prefix, PrintWriter pw) {
+ pw.println(String.format(
+ "%sTaskbarUIController: using an instance of %s",
+ prefix,
+ getClass().getSimpleName()));
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 6416720..9b6cc66 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -73,6 +73,7 @@
private final AnimatedFloat mTaskbarIconTranslationYForStash = new AnimatedFloat(
this::updateTranslationY);
private AnimatedFloat mTaskbarNavButtonTranslationY;
+ private AnimatedFloat mTaskbarNavButtonTranslationYForInAppDisplay;
private final AnimatedFloat mThemeIconsBackground = new AnimatedFloat(
this::updateIconsBackground);
@@ -112,6 +113,8 @@
}
mTaskbarNavButtonTranslationY =
controllers.navbarButtonsViewController.getTaskbarNavButtonTranslationY();
+ mTaskbarNavButtonTranslationYForInAppDisplay = controllers.navbarButtonsViewController
+ .getTaskbarNavButtonTranslationYForInAppDisplay();
}
public void onDestroy() {
@@ -242,6 +245,7 @@
int offsetY = launcherDp.getTaskbarOffsetY();
setter.setFloat(mTaskbarIconTranslationYForHome, VALUE, -offsetY, LINEAR);
setter.setFloat(mTaskbarNavButtonTranslationY, VALUE, -offsetY, LINEAR);
+ setter.setFloat(mTaskbarNavButtonTranslationYForInAppDisplay, VALUE, offsetY, LINEAR);
if (Utilities.isDarkTheme(mTaskbarView.getContext())) {
setter.addFloat(mThemeIconsBackground, VALUE, 0f, 1f, LINEAR);
@@ -289,10 +293,12 @@
}
public void onRotationChanged(DeviceProfile deviceProfile) {
- if (areIconsVisible()) {
+ if (mControllers.taskbarStashController.isInApp()) {
// We only translate on rotation when on home
return;
}
+ mActivity.setTaskbarWindowHeight(
+ deviceProfile.taskbarSize + deviceProfile.getTaskbarOffsetY());
mTaskbarNavButtonTranslationY.updateValue(-deviceProfile.getTaskbarOffsetY());
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java
index 9fca8eb..eaf9384 100644
--- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java
@@ -38,7 +38,6 @@
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.launcher3.taskbar.TaskbarControllers;
-import com.android.launcher3.taskbar.TaskbarSharedState;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
@@ -72,7 +71,6 @@
};
private TaskbarControllers mControllers;
- private TaskbarSharedState mSharedState;
/** Window context for all apps if it is open. */
private @Nullable TaskbarAllAppsContext mAllAppsContext;
@@ -88,18 +86,17 @@
}
/** Initialize the controller. */
- public void init(TaskbarControllers controllers, TaskbarSharedState sharedState) {
+ public void init(TaskbarControllers controllers, boolean allAppsVisible) {
if (!FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
return;
}
mControllers = controllers;
- mSharedState = sharedState;
/*
* Recreate All Apps if it was open in the previous Taskbar instance (e.g. the configuration
* changed).
*/
- if (mSharedState.allAppsVisible) {
+ if (allAppsVisible) {
show(false);
}
}
@@ -141,7 +138,9 @@
return;
}
mProxyView.show();
- mSharedState.allAppsVisible = true;
+ // mControllers and getSharedState should never be null here. Do not handle null-pointer
+ // to catch invalid states.
+ mControllers.getSharedState().allAppsVisible = true;
mAllAppsContext = new TaskbarAllAppsContext(mTaskbarContext,
this,
@@ -176,7 +175,9 @@
return;
}
mProxyView.close(false);
- mSharedState.allAppsVisible = false;
+ // mControllers and getSharedState should never be null here. Do not handle null-pointer
+ // to catch invalid states.
+ mControllers.getSharedState().allAppsVisible = false;
onDestroy();
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index 44583f1..c25a815 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -30,7 +30,8 @@
*/
public class AllAppsState extends LauncherState {
- private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS;
+ private static final int STATE_FLAGS =
+ FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS | FLAG_HOTSEAT_INACCESSIBLE;
public AllAppsState(int id) {
super(id, LAUNCHER_STATE_ALLAPPS, STATE_FLAGS);
@@ -88,7 +89,9 @@
@Override
public int getVisibleElements(Launcher launcher) {
- return ALL_APPS_CONTENT | HOTSEAT_ICONS;
+ // Don't add HOTSEAT_ICONS for phones in ALL_APPS state.
+ return launcher.getDeviceProfile().isPhone ? ALL_APPS_CONTENT
+ : ALL_APPS_CONTENT | HOTSEAT_ICONS;
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
index 53a5444..699ce97 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -22,10 +22,12 @@
import android.graphics.Rect;
import android.os.SystemProperties;
+import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
+import com.android.launcher3.taskbar.LauncherTaskbarUIController;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Themes;
import com.android.quickstep.util.LayoutUtils;
@@ -93,7 +95,13 @@
@Override
public boolean isTaskbarStashed(Launcher launcher) {
- return true;
+ if (launcher instanceof BaseQuickstepLauncher) {
+ LauncherTaskbarUIController uiController =
+ ((BaseQuickstepLauncher) launcher).getTaskbarUIController();
+
+ return uiController != null && uiController.supportsVisualStashing();
+ }
+ return super.isTaskbarStashed(launcher);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
index 6e81b6f..dc65b50 100644
--- a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
+++ b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
@@ -45,6 +45,7 @@
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
+
/**
* Controls the animation of swiping back and returning to launcher.
*
@@ -87,6 +88,7 @@
private boolean mAnimatorSetInProgress = false;
private float mBackProgress = 0;
private boolean mBackInProgress = false;
+ private IOnBackInvokedCallback mBackCallback;
public LauncherBackAnimationController(
BaseQuickstepLauncher launcher,
@@ -112,34 +114,35 @@
* @param handler Handler to the thread to run the animations on.
*/
public void registerBackCallbacks(Handler handler) {
- SystemUiProxy.INSTANCE.get(mLauncher).setBackToLauncherCallback(
- new IOnBackInvokedCallback.Stub() {
- @Override
- public void onBackCancelled() {
- handler.post(() -> resetPositionAnimated());
- }
+ mBackCallback = new IOnBackInvokedCallback.Stub() {
+ @Override
+ public void onBackCancelled() {
+ handler.post(() -> resetPositionAnimated());
+ }
- @Override
- public void onBackInvoked() {
- handler.post(() -> startTransition());
- }
+ @Override
+ public void onBackInvoked() {
+ handler.post(() -> startTransition());
+ }
- @Override
- public void onBackProgressed(BackEvent backEvent) {
- mBackProgress = backEvent.getProgress();
- // TODO: Update once the interpolation curve spec is finalized.
- mBackProgress =
- 1 - (1 - mBackProgress) * (1 - mBackProgress) * (1
- - mBackProgress);
- if (!mBackInProgress) {
- startBack(backEvent);
- } else {
- updateBackProgress(mBackProgress, backEvent);
- }
- }
+ @Override
+ public void onBackProgressed(BackEvent backEvent) {
+ mBackProgress = backEvent.getProgress();
+ // TODO: Update once the interpolation curve spec is finalized.
+ mBackProgress =
+ 1 - (1 - mBackProgress) * (1 - mBackProgress) * (1
+ - mBackProgress);
+ if (!mBackInProgress) {
+ startBack(backEvent);
+ } else {
+ updateBackProgress(mBackProgress, backEvent);
+ }
+ }
- public void onBackStarted() { }
- });
+ @Override
+ public void onBackStarted() { }
+ };
+ SystemUiProxy.INSTANCE.get(mLauncher).setBackToLauncherCallback(mBackCallback);
}
private void resetPositionAnimated() {
@@ -162,7 +165,10 @@
/** Unregisters the back to launcher callback in shell. */
public void unregisterBackCallbacks() {
- SystemUiProxy.INSTANCE.get(mLauncher).clearBackToLauncherCallback();
+ if (mBackCallback != null) {
+ SystemUiProxy.INSTANCE.get(mLauncher).clearBackToLauncherCallback(mBackCallback);
+ }
+ mBackCallback = null;
}
private void startBack(BackEvent backEvent) {
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 5ef89d3..fc4c23f 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -847,8 +847,14 @@
}
}
- /** Clears the previously registered {@link IOnBackInvokedCallback}. */
- public void clearBackToLauncherCallback() {
+ /** Clears the previously registered {@link IOnBackInvokedCallback}.
+ *
+ * @param callback The previously registered callback instance.
+ */
+ public void clearBackToLauncherCallback(IOnBackInvokedCallback callback) {
+ if (mBackToLauncherCallback != callback) {
+ return;
+ }
mBackToLauncherCallback = null;
if (mBackAnimation == null) {
return;
diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index d94e5f1..f53491b 100644
--- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -320,6 +320,10 @@
Toast.LENGTH_LONG).show();
}
+ /** Called when the snapshot has updated its full screen drawing parameters. */
+ public void setFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams) {
+ }
+
private class ScreenshotSystemShortcut extends SystemShortcut {
private final BaseDraggingActivity mActivity;
diff --git a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java
index 9ba5577..35d9f22 100644
--- a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java
@@ -33,17 +33,22 @@
}
@Override
- public Integer getIntroductionTitle() {
+ public int getIntroductionTitle() {
return R.string.back_gesture_intro_title;
}
@Override
- public Integer getIntroductionSubtitle() {
+ public int getIntroductionSubtitle() {
return R.string.back_gesture_intro_subtitle;
}
@Override
- public Integer getSuccessFeedbackSubtitle() {
+ public int getSpokenIntroductionSubtitle() {
+ return R.string.back_gesture_spoken_intro_subtitle;
+ }
+
+ @Override
+ public int getSuccessFeedbackSubtitle() {
return mTutorialFragment.isAtFinalStep()
? R.string.back_gesture_feedback_complete_without_follow_up
: R.string.back_gesture_feedback_complete_with_overview_follow_up;
diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
index 6254313..f519d50 100644
--- a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
@@ -32,17 +32,22 @@
}
@Override
- public Integer getIntroductionTitle() {
+ public int getIntroductionTitle() {
return R.string.home_gesture_intro_title;
}
@Override
- public Integer getIntroductionSubtitle() {
+ public int getIntroductionSubtitle() {
return R.string.home_gesture_intro_subtitle;
}
@Override
- public Integer getSuccessFeedbackSubtitle() {
+ public int getSpokenIntroductionSubtitle() {
+ return R.string.home_gesture_spoken_intro_subtitle;
+ }
+
+ @Override
+ public int getSuccessFeedbackSubtitle() {
return mTutorialFragment.isAtFinalStep()
? R.string.home_gesture_feedback_complete_without_follow_up
: R.string.home_gesture_feedback_complete_with_follow_up;
diff --git a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
index 09640c6..6b016ce 100644
--- a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
@@ -42,17 +42,22 @@
}
@Override
- public Integer getIntroductionTitle() {
+ public int getIntroductionTitle() {
return R.string.overview_gesture_intro_title;
}
@Override
- public Integer getIntroductionSubtitle() {
+ public int getIntroductionSubtitle() {
return R.string.overview_gesture_intro_subtitle;
}
@Override
- public Integer getSuccessFeedbackSubtitle() {
+ public int getSpokenIntroductionSubtitle() {
+ return R.string.overview_gesture_spoken_intro_subtitle;
+ }
+
+ @Override
+ public int getSuccessFeedbackSubtitle() {
return mTutorialFragment.getNumSteps() > 1 && mTutorialFragment.isAtFinalStep()
? R.string.overview_gesture_feedback_complete_with_follow_up
: R.string.overview_gesture_feedback_complete_without_follow_up;
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
index 6a8894e..fa7d848 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
@@ -62,7 +62,7 @@
abstract class TutorialController implements BackGestureAttemptCallback,
NavBarGestureAttemptCallback {
- private static final String TAG = "TutorialController";
+ private static final String LOG_TAG = "TutorialController";
private static final float FINGER_DOT_VISIBLE_ALPHA = 0.7f;
private static final float FINGER_DOT_SMALL_SCALE = 0.7f;
@@ -217,18 +217,23 @@
}
@StringRes
- public Integer getIntroductionTitle() {
- return null;
+ public int getIntroductionTitle() {
+ return NO_ID;
}
@StringRes
- public Integer getIntroductionSubtitle() {
- return null;
+ public int getIntroductionSubtitle() {
+ return NO_ID;
}
@StringRes
- public Integer getSuccessFeedbackSubtitle() {
- return null;
+ public int getSpokenIntroductionSubtitle() {
+ return NO_ID;
+ }
+
+ @StringRes
+ public int getSuccessFeedbackSubtitle() {
+ return NO_ID;
}
void showFeedback() {
@@ -247,7 +252,16 @@
* Show feedback reflecting a successful gesture attempt.
**/
void showSuccessFeedback() {
- showFeedback(getSuccessFeedbackSubtitle(), true);
+ int successSubtitleResId = getSuccessFeedbackSubtitle();
+ if (successSubtitleResId == NO_ID) {
+ // Allow crash since this should never be reached with a tutorial controller used in
+ // production.
+ Log.e(LOG_TAG,
+ "Cannot show success feedback for tutorial step: " + mTutorialType
+ + ", no success feedback subtitle",
+ new IllegalStateException());
+ }
+ showFeedback(successSubtitleResId, true);
}
/**
@@ -269,6 +283,7 @@
isGestureSuccessful
? R.string.gesture_tutorial_nice : R.string.gesture_tutorial_try_again,
subtitleResId,
+ NO_ID,
isGestureSuccessful,
false);
}
@@ -276,6 +291,7 @@
void showFeedback(
int titleResId,
int subtitleResId,
+ int spokenSubtitleResId,
boolean isGestureSuccessful,
boolean useGestureAnimationDelay) {
mFeedbackTitleView.removeCallbacks(mTitleViewCallback);
@@ -287,7 +303,10 @@
mFeedbackTitleView.setText(titleResId);
TextView subtitle =
mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_subtitle);
- subtitle.setText(subtitleResId);
+ subtitle.setText(spokenSubtitleResId == NO_ID
+ ? mContext.getText(subtitleResId)
+ : Utilities.wrapForTts(
+ mContext.getText(subtitleResId), mContext.getString(spokenSubtitleResId)));
if (isGestureSuccessful) {
if (mTutorialFragment.isAtFinalStep()) {
showActionButton();
@@ -580,7 +599,7 @@
packageManager.getApplicationInfo(
PIXEL_TIPS_APP_PACKAGE_NAME, PackageManager.GET_META_DATA));
} catch (PackageManager.NameNotFoundException e) {
- Log.e(TAG,
+ Log.e(LOG_TAG,
"Could not find app label for package name: "
+ PIXEL_TIPS_APP_PACKAGE_NAME
+ ". Defaulting to 'Pixel Tips.'",
@@ -593,7 +612,7 @@
subtitleTextView.setText(
mContext.getString(R.string.skip_tutorial_dialog_subtitle, tipsAppName));
} else {
- Log.w(TAG, "No subtitle view in the skip tutorial dialog to update.");
+ Log.w(LOG_TAG, "No subtitle view in the skip tutorial dialog to update.");
}
Button cancelButton = (Button) contentView.findViewById(
@@ -602,7 +621,7 @@
cancelButton.setOnClickListener(
v -> tutorialDialog.dismiss());
} else {
- Log.w(TAG, "No cancel button in the skip tutorial dialog to update.");
+ Log.w(LOG_TAG, "No cancel button in the skip tutorial dialog to update.");
}
Button confirmButton = contentView.findViewById(
@@ -613,7 +632,7 @@
tutorialDialog.dismiss();
});
} else {
- Log.w(TAG, "No confirm button in the skip tutorial dialog to update.");
+ Log.w(LOG_TAG, "No confirm button in the skip tutorial dialog to update.");
}
tutorialDialog.getWindow().setBackgroundDrawable(
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
index 33e800d..1599c8c 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
@@ -15,6 +15,8 @@
*/
package com.android.quickstep.interaction;
+import static android.view.View.NO_ID;
+
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
@@ -211,13 +213,31 @@
if (isGestureComplete()) {
mTutorialController.showSuccessFeedback();
} else if (!mIntroductionShown) {
- Integer introTileStringResId = mTutorialController.getIntroductionTitle();
- Integer introSubtitleResId = mTutorialController.getIntroductionSubtitle();
- if (introTileStringResId != null && introSubtitleResId != null) {
- mTutorialController.showFeedback(
- introTileStringResId, introSubtitleResId, false, true);
- mIntroductionShown = true;
+ int introTitleResId = mTutorialController.getIntroductionTitle();
+ int introSubtitleResId = mTutorialController.getIntroductionSubtitle();
+ if (introTitleResId == NO_ID) {
+ // Allow crash since this should never be reached with a tutorial controller used in
+ // production.
+ Log.e(LOG_TAG,
+ "Cannot show introduction feedback for tutorial step: " + mTutorialType
+ + ", no introduction feedback title",
+ new IllegalStateException());
}
+ if (introTitleResId == NO_ID) {
+ // Allow crash since this should never be reached with a tutorial controller used in
+ // production.
+ Log.e(LOG_TAG,
+ "Cannot show introduction feedback for tutorial step: " + mTutorialType
+ + ", no introduction feedback subtitle",
+ new IllegalStateException());
+ }
+ mTutorialController.showFeedback(
+ introTitleResId,
+ introSubtitleResId,
+ mTutorialController.getSpokenIntroductionSubtitle(),
+ false,
+ true);
+ mIntroductionShown = true;
}
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index bff8651..d8120ff 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -283,6 +283,7 @@
public void setFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams) {
mFullscreenParams = fullscreenParams;
+ getTaskOverlay().setFullscreenParams(fullscreenParams);
invalidate();
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 8869ff1..b5971f2 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -1022,7 +1022,7 @@
}
public float getTaskCornerRadius() {
- return TaskCornerRadius.get(mActivity);
+ return mCurrentFullscreenParams.mCornerRadius;
}
@Override
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 4b42ecb..1c62ded 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3168,6 +3168,24 @@
return new DragOptions();
}
+ /**
+ * Animates Launcher elements during a transition to the All Apps page.
+ *
+ * @param progress Transition progress from 0 to 1; where 0 => home and 1 => all apps.
+ */
+ public void onAllAppsTransition(float progress) {
+ // No-Op
+ }
+
+ /**
+ * Animates Launcher elements during a transition to the Widgets pages.
+ *
+ * @param progress Transition progress from 0 to 1; where 0 => home and 1 => widgets.
+ */
+ public void onWidgetsTransition(float progress) {
+ // No-Op
+ }
+
private static class NonConfigInstance {
public Configuration config;
public Bitmap snapshot;
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 4d21508..ea6a919 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -80,6 +80,9 @@
public static final int FLAG_CLOSE_POPUPS = BaseState.getFlag(6);
public static final int FLAG_OVERVIEW_UI = BaseState.getFlag(7);
+ // Flag indicating that hotseat and its contents are not accessible.
+ public static final int FLAG_HOTSEAT_INACCESSIBLE = BaseState.getFlag(8);
+
public static final float NO_OFFSET = 0;
public static final float NO_SCALE = 1;
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 84b95ec..bf56ac0 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -25,6 +25,7 @@
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
import static com.android.launcher3.LauncherAnimUtils.WORKSPACE_SCALE_PROPERTY_FACTORY;
import static com.android.launcher3.LauncherState.FLAG_HAS_SYS_UI_SCRIM;
+import static com.android.launcher3.LauncherState.FLAG_HOTSEAT_INACCESSIBLE;
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
@@ -151,6 +152,12 @@
propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(),
workspacePageIndicatorAlpha, fadeInterpolator);
+ // Update the accessibility flags for hotseat based on launcher state.
+ hotseat.setImportantForAccessibility(
+ state.hasFlag(FLAG_HOTSEAT_INACCESSIBLE)
+ ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
+ : View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
+
Interpolator translationInterpolator =
config.getInterpolator(ANIM_WORKSPACE_TRANSLATE, ZOOM_OUT);
propertySetter.setFloat(mWorkspace, VIEW_TRANSLATE_X,
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 8d2b268..3600bd2 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -190,6 +190,7 @@
public void setProgress(float progress) {
mProgress = progress;
getAppsViewProgressTranslationY().set(mAppsView, mProgress * mShiftRange);
+ mLauncher.onAllAppsTransition(1 - progress);
}
public float getProgress() {
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 9f0c1cc..2a16210 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -192,27 +192,6 @@
return true;
}
- public boolean appendSearchResults(ArrayList<AdapterItem> results) {
- if (hasFilter() && results != null && results.size() > 0) {
- updateSearchAdapterItems(results, mSearchResults.size());
- refreshRecyclerView();
- return true;
- }
- return false;
- }
-
- void updateSearchAdapterItems(ArrayList<AdapterItem> list, int offset) {
- for (int i = 0; i < list.size(); i++) {
- AdapterItem adapterItem = list.get(i);
- adapterItem.position = offset + i;
- mAdapterItems.add(adapterItem);
-
- if (adapterItem.isCountedForAccessibility()) {
- mAccessibilityResultsCount++;
- }
- }
- }
-
/**
* Updates internals when the set of apps are updated.
*/
@@ -282,7 +261,6 @@
String lastSectionName = null;
FastScrollSectionInfo lastFastScrollerSectionInfo = null;
int position = 0;
- int appIndex = 0;
// Prepare to update the list of sections, filtered apps, etc.
mAccessibilityResultsCount = 0;
@@ -319,7 +297,16 @@
mAdapterItems.add(appItem);
}
} else {
- updateSearchAdapterItems(mSearchResults, 0);
+ int count = mSearchResults.size();
+ for (int i = 0; i < count; i++) {
+ AdapterItem adapterItem = mSearchResults.get(i);
+ adapterItem.position = i;
+ mAdapterItems.add(adapterItem);
+
+ if (adapterItem.isCountedForAccessibility()) {
+ mAccessibilityResultsCount++;
+ }
+ }
if (!FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
// Append the search market item
if (hasNoFilteredResults()) {
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index 893e547..bc2c318 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -177,14 +177,6 @@
}
@Override
- public void onAppendSearchResult(String query, ArrayList<AdapterItem> items) {
- if (items != null) {
- mApps.appendSearchResults(items);
- notifyResultChanged();
- }
- }
-
- @Override
public void clearSearchResult() {
if (mApps.setSearchResults(null)) {
notifyResultChanged();
diff --git a/src/com/android/launcher3/search/SearchCallback.java b/src/com/android/launcher3/search/SearchCallback.java
index 5796116..495a303 100644
--- a/src/com/android/launcher3/search/SearchCallback.java
+++ b/src/com/android/launcher3/search/SearchCallback.java
@@ -32,13 +32,6 @@
void onSearchResult(String query, ArrayList<T> items);
/**
- * Called when the search from secondary source is complete.
- *
- * @param items list of search results
- */
- void onAppendSearchResult(String query, ArrayList<T> items);
-
- /**
* Called when the search results should be cleared.
*/
void clearSearchResult();
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index b12574f..c7bb612 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -44,6 +44,7 @@
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.AbstractSlideInView;
+import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.ArrowTipView;
/**
@@ -306,4 +307,11 @@
return mActivityContext.getSharedPrefs().getBoolean(KEY_WIDGETS_EDUCATION_TIP_SEEN, false)
|| Utilities.IS_RUNNING_IN_TEST_HARNESS;
}
+
+ @Override
+ protected void setTranslationShift(float translationShift) {
+ super.setTranslationShift(translationShift);
+ Launcher launcher = ActivityContext.lookupContext(getContext());
+ launcher.onWidgetsTransition(1 - translationShift);
+ }
}
diff --git a/src/com/android/launcher3/widget/picker/search/WidgetsSearchBarController.java b/src/com/android/launcher3/widget/picker/search/WidgetsSearchBarController.java
index 2751a52..a15508a 100644
--- a/src/com/android/launcher3/widget/picker/search/WidgetsSearchBarController.java
+++ b/src/com/android/launcher3/widget/picker/search/WidgetsSearchBarController.java
@@ -95,11 +95,6 @@
}
@Override
- public void onAppendSearchResult(String query, ArrayList<WidgetsListBaseEntry> items) {
- // Not needed.
- }
-
- @Override
public void clearSearchResult() {
// Any existing search session will be cancelled by setting text to empty.
mInput.setText("");