Merge "Revert changes waiting for launcher to resume when transitioning to home" into tm-dev
diff --git a/quickstep/res/values-hi/strings.xml b/quickstep/res/values-hi/strings.xml
index 3a0adc9..643b1d5 100644
--- a/quickstep/res/values-hi/strings.xml
+++ b/quickstep/res/values-hi/strings.xml
@@ -89,7 +89,7 @@
<string name="blocked_by_policy" msgid="2071401072261365546">"ऐप्लिकेशन या आपका संगठन इस कार्रवाई की अनुमति नहीं देता"</string>
<string name="skip_tutorial_dialog_title" msgid="2725643161260038458">"क्या आपको नेविगेशन ट्यूटोरियल छोड़ना है?"</string>
<string name="skip_tutorial_dialog_subtitle" msgid="544063326241955662">"इसे बाद में <xliff:g id="NAME">%1$s</xliff:g> ऐप्लिकेशन पर देखा जा सकता है"</string>
- <string name="gesture_tutorial_action_button_label_cancel" msgid="3809842569351264108">"अभी नहीं"</string>
+ <string name="gesture_tutorial_action_button_label_cancel" msgid="3809842569351264108">"रद्द करें"</string>
<string name="gesture_tutorial_action_button_label_skip" msgid="394452764989751960">"छोड़ें"</string>
<string name="accessibility_rotate_button" msgid="4771825231336502943">"स्क्रीन घुमाएं"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"टास्कबार ट्यूटोरियल दिखाया गया"</string>
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index de745b9..e1a3b72 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -483,6 +483,9 @@
? new float[]{1, mContentScale}
: new float[]{mContentScale, 1};
+ // Pause expensive view updates as they can lead to layer thrashing and skipped frames.
+ mLauncher.pauseExpensiveViewUpdates();
+
if (mLauncher.isInState(ALL_APPS)) {
// All Apps in portrait mode is full screen, so we only animate AllAppsContainerView.
final View appsView = mLauncher.getAppsView();
@@ -581,9 +584,6 @@
}
}
- // Pause expensive view updates as they can lead to layer thrashing and skipped frames.
- mLauncher.pauseExpensiveViewUpdates();
-
endListener = () -> {
viewsToAnimate.forEach(view -> {
SCALE_PROPERTY.set(view, 1f);
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
index 4da1d41..8faabc9 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
@@ -86,7 +86,7 @@
@Override
protected boolean canInterceptTouch(MotionEvent ev) {
mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0;
- return super.canInterceptTouch(ev);
+ return super.canInterceptTouch(ev) && !mLauncher.isInState(HINT_STATE);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index b1e2eac..32e08ff 100644
--- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.NORMAL;
+import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
@@ -148,6 +149,9 @@
});
}
+ launcher.pauseExpensiveViewUpdates();
+ mAnimators.addListener(forEndCallback(launcher::resumeExpensiveViewUpdates));
+
if (animateOverviewScrim) {
PendingAnimation pendingAnimation = new PendingAnimation(DURATION_MS);
launcher.getWorkspace().getStateTransitionAnimation()
diff --git a/res/values-ta/strings.xml b/res/values-ta/strings.xml
index aea8195..fa2b789 100644
--- a/res/values-ta/strings.xml
+++ b/res/values-ta/strings.xml
@@ -75,7 +75,7 @@
<string name="uninstall_drop_target_label" msgid="4722034217958379417">"நிறுவல் நீக்கு"</string>
<string name="app_info_drop_target_label" msgid="692894985365717661">"ஆப்ஸ் தகவல்"</string>
<string name="install_drop_target_label" msgid="2539096853673231757">"நிறுவு"</string>
- <string name="dismiss_prediction_label" msgid="3357562989568808658">"ஆப்ஸைப் பரிந்துரைக்க வேண்டாம்"</string>
+ <string name="dismiss_prediction_label" msgid="3357562989568808658">"ஆப்ஸ் பரிந்துரைக்காதே"</string>
<string name="pin_prediction" msgid="4196423321649756498">"கணிக்கப்பட்ட ஆப்ஸைப் பின் செய்தல்"</string>
<string name="permlab_install_shortcut" msgid="5632423390354674437">"குறுக்குவழிகளை நிறுவுதல்"</string>
<string name="permdesc_install_shortcut" msgid="923466509822011139">"பயனரின் அனுமதி இல்லாமல் குறுக்குவழிகளைச் சேர்க்கப் ஆப்ஸை அனுமதிக்கிறது."</string>
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 878ac3b..5fb8925 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -376,7 +376,7 @@
FastBitmapDrawable iconDrawable = info.newIcon(getContext(), flags);
mDotParams.appColor = iconDrawable.getIconColor();
mDotParams.dotColor = getContext().getResources()
- .getColor(android.R.color.system_accent3_100, getContext().getTheme());
+ .getColor(android.R.color.system_accent3_200, getContext().getTheme());
setIcon(iconDrawable);
applyLabel(info);
}
diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java
index 3b5b454..4629ca7 100644
--- a/src/com/android/launcher3/ExtendedEditText.java
+++ b/src/com/android/launcher3/ExtendedEditText.java
@@ -104,6 +104,7 @@
public void hideKeyboard() {
hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getWindowToken());
+ clearFocus();
}
private boolean showSoftInput() {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1846383..d26e1ab 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -124,6 +124,7 @@
import com.android.launcher3.accessibility.BaseAccessibilityDelegate.LauncherAction;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
+import com.android.launcher3.allapps.AllAppsRecyclerView;
import com.android.launcher3.allapps.AllAppsStore;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.BaseAllAppsContainerView;
@@ -196,6 +197,7 @@
import com.android.launcher3.util.UiThreadHelper;
import com.android.launcher3.util.ViewOnDrawExecutor;
import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.FloatingIconView;
import com.android.launcher3.views.FloatingSurfaceView;
import com.android.launcher3.views.OptionsPopupView;
import com.android.launcher3.views.ScrimView;
@@ -2757,8 +2759,8 @@
* @param supportsAllAppsState If true and we are in All Apps state, looks for view in All Apps.
* Else we only looks on the workspace.
*/
- public View getFirstMatchForAppClose(int preferredItemId, String packageName, UserHandle user,
- boolean supportsAllAppsState) {
+ public @Nullable View getFirstMatchForAppClose(int preferredItemId, String packageName,
+ UserHandle user, boolean supportsAllAppsState) {
final Predicate<ItemInfo> preferredItem = info ->
info != null && info.id == preferredItemId;
final Predicate<ItemInfo> packageAndUserAndApp = info ->
@@ -2770,8 +2772,21 @@
packageName);
if (supportsAllAppsState && isInState(LauncherState.ALL_APPS)) {
- return getFirstMatch(Collections.singletonList(mAppsView.getActiveRecyclerView()),
+ AllAppsRecyclerView activeRecyclerView = mAppsView.getActiveRecyclerView();
+ View v = getFirstMatch(Collections.singletonList(activeRecyclerView),
preferredItem, packageAndUserAndApp);
+
+ if (activeRecyclerView.getCurrentScrollY() > 0) {
+ RectF locationBounds = new RectF();
+ FloatingIconView.getLocationBoundsForView(this, v, false, locationBounds,
+ new Rect());
+ if (locationBounds.top < mAppsView.getHeaderBottom()) {
+ // Icon is covered by scrim, return null to play fallback animation.
+ return null;
+ }
+ }
+
+ return v;
} else {
List<ViewGroup> containers = new ArrayList<>(mWorkspace.getPanelCount() + 1);
containers.add(mWorkspace.getHotseat().getShortcutsAndWidgets());
@@ -3229,11 +3244,24 @@
public void pauseExpensiveViewUpdates() {
// Pause page indicator animations as they lead to layer trashing.
getWorkspace().getPageIndicator().pauseAnimations();
+
+ getWorkspace().mapOverItems((info, view) -> {
+ if (view instanceof LauncherAppWidgetHostView) {
+ ((LauncherAppWidgetHostView) view).beginDeferringUpdates();
+ }
+ return false; // Return false to continue iterating through all the items.
+ });
}
/** Resumes view updates at the end of the app launch animation. */
public void resumeExpensiveViewUpdates() {
getWorkspace().getPageIndicator().skipAnimationsToEnd();
- }
+ getWorkspace().mapOverItems((info, view) -> {
+ if (view instanceof LauncherAppWidgetHostView) {
+ ((LauncherAppWidgetHostView) view).endDeferringUpdates();
+ }
+ return false; // Return false to continue iterating through all the items.
+ });
+ }
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 93f3d9f..4903d77 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -3265,7 +3265,11 @@
}
}
- private View mapOverCellLayout(CellLayout layout, ItemOperator op) {
+ /**
+ * Perform {param operator} over all the items in a given {param layout}.
+ * @return The first item that satisfies the operator or null.
+ */
+ public View mapOverCellLayout(CellLayout layout, ItemOperator operator) {
// TODO(b/128460496) Potential race condition where layout is not yet loaded
if (layout == null) {
return null;
@@ -3275,7 +3279,7 @@
final int itemCount = container.getChildCount();
for (int itemIdx = 0; itemIdx < itemCount; itemIdx++) {
View item = container.getChildAt(itemIdx);
- if (op.evaluate((ItemInfo) item.getTag(), item)) {
+ if (operator.evaluate((ItemInfo) item.getTag(), item)) {
return item;
}
}
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index 2368cf7..53a6fd7 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -239,7 +239,7 @@
}
@Override
- protected int getHeaderBottom() {
+ public int getHeaderBottom() {
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
return super.getHeaderBottom();
}
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
index 2c04fc7..b84768c 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
@@ -761,7 +761,7 @@
protected abstract BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> mAppsList,
BaseAdapterProvider[] adapterProviders);
- protected int getHeaderBottom() {
+ public int getHeaderBottom() {
return (int) getTranslationY();
}
diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java
index 6299657..6138bc4 100644
--- a/src/com/android/launcher3/allapps/SearchUiManager.java
+++ b/src/com/android/launcher3/allapps/SearchUiManager.java
@@ -68,4 +68,9 @@
/** Refresh the currently displayed list of results. */
default void refreshResults() {}
+
+ /** Returns whether search is in zero state. */
+ default boolean inZeroState() {
+ return false;
+ }
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 9775b87..838564d 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -265,8 +265,8 @@
public static final BooleanFlag ENABLE_ONE_SEARCH_MOTION = new DeviceFlag(
"ENABLE_ONE_SEARCH_MOTION", true, "Enables animations in OneSearch.");
- public static final BooleanFlag ENABLE_SHOW_KEYBOARD_IN_ALL_APPS = getDebugFlag(
- "ENABLE_SHOW_KEYBOARD_IN_ALL_APPS", false,
+ public static final BooleanFlag ENABLE_SHOW_KEYBOARD_IN_ALL_APPS = new DeviceFlag(
+ "ENABLE_SHOW_KEYBOARD_IN_ALL_APPS", true,
"Enable option to show keyboard when going to all-apps");
public static final BooleanFlag USE_LOCAL_ICON_OVERRIDES = getDebugFlag(
diff --git a/src/com/android/launcher3/util/OnboardingPrefs.java b/src/com/android/launcher3/util/OnboardingPrefs.java
index 64aeceb..f4cf21e 100644
--- a/src/com/android/launcher3/util/OnboardingPrefs.java
+++ b/src/com/android/launcher3/util/OnboardingPrefs.java
@@ -142,16 +142,11 @@
}
/**
- * Add "incCountBy" to the given event count, if we haven't already reached the max count.
+ * Sets the event count to the given value.
*
* @return Whether we have now reached the max count.
*/
- public boolean incrementEventCountBy(int incCountBy, @EventCountKey String eventKey) {
- int count = getCount(eventKey);
- if (hasReachedMaxCount(count, eventKey)) {
- return true;
- }
- count += incCountBy;
+ public boolean setEventCount(int count, @EventCountKey String eventKey) {
mSharedPrefs.edit().putInt(eventKey, count).apply();
return hasReachedMaxCount(count, eventKey);
}
diff --git a/src/com/android/launcher3/util/UiThreadHelper.java b/src/com/android/launcher3/util/UiThreadHelper.java
index a1f31fe..8df3f8a 100644
--- a/src/com/android/launcher3/util/UiThreadHelper.java
+++ b/src/com/android/launcher3/util/UiThreadHelper.java
@@ -25,9 +25,13 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
+import android.util.Log;
import android.view.View;
+import android.view.WindowInsets;
+import android.view.WindowInsetsController;
import android.view.inputmethod.InputMethodManager;
+import com.android.launcher3.Utilities;
import com.android.launcher3.views.ActivityContext;
/**
@@ -48,6 +52,29 @@
public static void hideKeyboardAsync(ActivityContext activityContext, IBinder token) {
View root = activityContext.getDragLayer();
+ if (Utilities.ATLEAST_R) {
+ Preconditions.assertUIThread();
+ // Hide keyboard with WindowInsetsController if could. In case
+ // hideSoftInputFromWindow may get ignored by input connection being finished
+ // when the screen is off.
+ //
+ // In addition, inside IMF, the keyboards are closed asynchronously that launcher no
+ // longer need to post to the message queue.
+ final WindowInsetsController wic = root.getWindowInsetsController();
+ WindowInsets insets = root.getRootWindowInsets();
+ boolean isImeShown = insets != null && insets.isVisible(WindowInsets.Type.ime());
+ if (wic != null && isImeShown) {
+ // this method cannot be called cross threads
+ wic.hide(WindowInsets.Type.ime());
+ activityContext.getStatsLogManager().logger()
+ .log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED);
+ return;
+ } else {
+ // print which stack trace failed.
+ Log.e("Launcher", "hideKeyboard ignored.", new Exception());
+ // Then attempt to use the old logic.
+ }
+ }
// Since the launcher context cannot be accessed directly from callback, adding secondary
// message to log keyboard close event asynchronously.
Bundle mHideKeyboardLoggerMsg = new Bundle();
@@ -55,7 +82,7 @@
STATS_LOGGER_KEY,
Message.obtain(
HANDLER.get(root.getContext()),
- () -> ActivityContext.lookupContext(root.getContext())
+ () -> activityContext
.getStatsLogManager()
.logger()
.log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED)