diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-10 16:39:44 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-10 16:39:44 +0000 |
commit | a9f2ce96ad070014053932cf1d9f1118a15548ad (patch) | |
tree | eaad30ea646ab0e9e42ada8e5a0368384b3458ee | |
parent | 541cb1618554c4499147d8876051310e5207b182 (diff) | |
parent | ecea734d9f3c7353db06fa660512b4f86fd400f6 (diff) | |
download | Launcher3-a9f2ce96ad070014053932cf1d9f1118a15548ad.tar.gz |
Snap for 8708169 from ecea734d9f3c7353db06fa660512b4f86fd400f6 to mainline-go-adservices-releaseaml_go_ads_330915100aml_go_ads_330915000aml_go_ads_330913000android13-mainline-go-adservices-release
Change-Id: Ica10452b7ecb1739fcf0b31b09858d34f3f88c3a
23 files changed, 140 insertions, 47 deletions
diff --git a/quickstep/protos_overrides/launcher_atom_extension.proto b/quickstep/protos_overrides/launcher_atom_extension.proto index a1566f064d..f5a277bb95 100644 --- a/quickstep/protos_overrides/launcher_atom_extension.proto +++ b/quickstep/protos_overrides/launcher_atom_extension.proto @@ -22,6 +22,7 @@ option java_outer_classname = "LauncherAtomExtensions"; // Wrapper message for containers used at the quickstep level. // Message name should match with launcher_atom_extension.proto message at // the AOSP level. +// Next ID = 3 message ExtendedContainers { reserved 2; // Deleted fields @@ -31,10 +32,16 @@ message ExtendedContainers { } // Represents on-device search result container. +// Next ID = 4 message DeviceSearchResultContainer{ optional int32 query_length = 1; optional SearchAttributes search_attributes = 2; + // [0, m], m varies based on the display density and resolution + // To indicate the location of the tapped on-device search result. + // For application, it will be the column number in the apps row. + optional int32 grid_x = 3; + // Next ID = 4 message SearchAttributes{ // True if results are based on spell corrected query diff --git a/quickstep/res/values-hi/strings.xml b/quickstep/res/values-hi/strings.xml index 3a0adc9c2a..643b1d5af5 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 9f35401df0..e1a3b729c1 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -483,6 +483,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener ? 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 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } } - // 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); @@ -1698,15 +1698,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener return; } - if (!mLauncher.hasBeenResumed()) { - // If launcher is not resumed, wait until new async-frame after resume - mLauncher.addOnResumeCallback(() -> - postAsyncCallback(mHandler, () -> - onCreateAnimation(transit, appTargets, wallpaperTargets, - nonAppTargets, result))); - return; - } - if (mLauncher.hasSomeInvisibleFlag(PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION)) { mLauncher.addForceInvisibleFlag(INVISIBLE_BY_PENDING_FLAGS); mLauncher.getStateManager().moveToRestState(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index 4da1d41091..8faabc9561 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 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch @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/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 6179b81b7c..db402aff85 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -514,9 +514,6 @@ public final class TaskViewUtils { for (SurfaceControl leash: openingTargets) { t.setAlpha(leash, progress); } - for (SurfaceControl leash: closingTargets) { - t.setAlpha(leash, 1 - progress); - } t.apply(); }); animator.addListener(new AnimatorListenerAdapter() { diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index 85ef6cb16e..45c80366f4 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -462,6 +462,7 @@ public class StatsLogCompatManager extends StatsLogManager { private LatencyType mType = LatencyType.UNKNOWN; private int mPackageId = 0; private long mLatencyInMillis; + private int mQueryLength = -1; StatsCompatLatencyLogger(Context context, ActivityContext activityContext) { mContext = context; @@ -493,6 +494,12 @@ public class StatsLogCompatManager extends StatsLogManager { } @Override + public StatsLatencyLogger withQueryLength(int queryLength) { + this.mQueryLength = queryLength; + return this; + } + + @Override public void log(EventEnum event) { if (IS_VERBOSE) { String name = (event instanceof Enum) ? ((Enum) event).name() : @@ -508,7 +515,8 @@ public class StatsLogCompatManager extends StatsLogManager { mInstanceId.getId(), // instance_id mPackageId, // package_id mLatencyInMillis, // latency_in_millis - mType.getId() //type + mType.getId(), //type + mQueryLength // query_length ); } } @@ -574,14 +582,18 @@ public class StatsLogCompatManager extends StatsLogManager { } private static int getGridX(LauncherAtom.ItemInfo info, boolean parent) { - if (info.getContainerInfo().getContainerCase() == FOLDER) { + LauncherAtom.ContainerInfo containerInfo = info.getContainerInfo(); + if (containerInfo.getContainerCase() == FOLDER) { if (parent) { - return info.getContainerInfo().getFolder().getWorkspace().getGridX(); + return containerInfo.getFolder().getWorkspace().getGridX(); } else { - return info.getContainerInfo().getFolder().getGridX(); + return containerInfo.getFolder().getGridX(); } + } else if (containerInfo.getContainerCase() == EXTENDED_CONTAINERS) { + return containerInfo.getExtendedContainers() + .getDeviceSearchResultContainer().getGridX(); } else { - return info.getContainerInfo().getWorkspace().getGridX(); + return containerInfo.getWorkspace().getGridX(); } } diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index b1e2eacadd..32e08ffa8d 100644 --- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -18,6 +18,7 @@ package com.android.quickstep.util; 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 @@ public class StaggeredWorkspaceAnim { }); } + launcher.pauseExpensiveViewUpdates(); + mAnimators.addListener(forEndCallback(launcher::resumeExpensiveViewUpdates)); + if (animateOverviewScrim) { PendingAnimation pendingAnimation = new PendingAnimation(DURATION_MS); launcher.getWorkspace().getStateTransitionAnimation() diff --git a/quickstep/src/com/android/quickstep/util/SystemWindowManagerProxy.java b/quickstep/src/com/android/quickstep/util/SystemWindowManagerProxy.java index 19a48dbf20..9bb3d56556 100644 --- a/quickstep/src/com/android/quickstep/util/SystemWindowManagerProxy.java +++ b/quickstep/src/com/android/quickstep/util/SystemWindowManagerProxy.java @@ -16,6 +16,7 @@ package com.android.quickstep.util; import android.content.Context; +import android.hardware.display.DisplayManager; import android.view.Display; import com.android.launcher3.util.window.WindowManagerProxy; @@ -43,4 +44,10 @@ public class SystemWindowManagerProxy extends WindowManagerProxy { public int getRotation(Context context) { return context.getResources().getConfiguration().windowConfiguration.getRotation(); } + + @Override + protected Display[] getDisplays(Context context) { + return context.getSystemService(DisplayManager.class).getDisplays( + DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED); + } } diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index 37ca89a3cf..d23eac21c0 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -161,12 +161,12 @@ <string name="all_apps_personal_tab" msgid="4190252696685155002">"شخصی"</string> <string name="all_apps_work_tab" msgid="4884822796154055118">"کاری"</string> <string name="work_profile_toggle_label" msgid="3081029915775481146">"نمایه کاری"</string> - <string name="work_profile_edu_work_apps" msgid="7895468576497746520">"برنامههای کاری دارای نشان هستند و سرپرست سیستم میتواند آنها را ببیند"</string> + <string name="work_profile_edu_work_apps" msgid="7895468576497746520">"برنامههای کاری نشاندار هستند و سرپرست فناوری اطلاعات میتواند آنها را ببیند"</string> <string name="work_profile_edu_accept" msgid="6069788082535149071">"متوجهام"</string> <string name="work_apps_paused_title" msgid="3040901117349444598">"برنامههای کاری موقتاً متوقف شدهاند."</string> <string name="work_apps_paused_body" msgid="261634750995824906">"برنامههای کاری نمیتوانند برای شما اعلان ارسال کنند، از باتری استفاده کنند، یا به مکانتان دسترسی داشته باشند"</string> <string name="work_apps_paused_content_description" msgid="5149623040804051095">"برنامههای کاری خاموش است. برنامههای کاری نمیتوانند برای شما اعلان ارسال کنند، از باتری استفاده کنند، یا به مکانتان دسترسی داشته باشند"</string> - <string name="work_apps_paused_edu_banner" msgid="8872412121608402058">"برنامههای کاری دارای نشان هستند و سرپرست سیستم میتواند آنها را ببیند."</string> + <string name="work_apps_paused_edu_banner" msgid="8872412121608402058">"برنامههای کاری نشاندار هستند و سرپرست فناوری اطلاعات میتواند آنها را ببیند."</string> <string name="work_apps_paused_edu_accept" msgid="6377476824357318532">"متوجهام"</string> <string name="work_apps_pause_btn_text" msgid="4669288269140620646">"توقف موقت برنامههای کاری"</string> <string name="work_apps_enable_btn_text" msgid="1156432622148413741">"روشن کردن برنامههای کاری"</string> diff --git a/res/values-ta/strings.xml b/res/values-ta/strings.xml index aea8195ebb..fa2b789676 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 878ac3b22b..5fb892554a 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -376,7 +376,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, 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 3b5b454bc1..4629ca7a2b 100644 --- a/src/com/android/launcher3/ExtendedEditText.java +++ b/src/com/android/launcher3/ExtendedEditText.java @@ -104,6 +104,7 @@ public class ExtendedEditText extends EditText { 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 18463839b2..d26e1aba56 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -124,6 +124,7 @@ import com.android.launcher3.DropTarget.DragObject; 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.TraceHelper; 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 @@ public class Launcher extends StatefulActivity<LauncherState> * @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 @@ public class Launcher extends StatefulActivity<LauncherState> 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 class Launcher extends StatefulActivity<LauncherState> 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 93f3d9f061..4903d7758a 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -3265,7 +3265,11 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> } } - 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 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> 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 2368cf7ce1..53a6fd7edb 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -239,7 +239,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher } @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 2c04fc7753..b84768cb97 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -761,7 +761,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte 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/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 515f80af01..641161b9c5 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -209,7 +209,7 @@ public class FloatingHeaderView extends LinearLayout implements int oldMaxHeight = mMaxTranslation; updateExpectedHeight(); - if (mMaxTranslation != oldMaxHeight) { + if (mMaxTranslation != oldMaxHeight || mCollapsed) { BaseAllAppsContainerView<?> parent = (BaseAllAppsContainerView<?>) getParent(); if (parent != null) { parent.setupHeader(); diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java index 6299657a55..6138bc4a9d 100644 --- a/src/com/android/launcher3/allapps/SearchUiManager.java +++ b/src/com/android/launcher3/allapps/SearchUiManager.java @@ -68,4 +68,9 @@ public interface SearchUiManager { /** 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 9775b878cc..33beacd4c0 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -265,8 +265,8 @@ public final class FeatureFlags { 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_OPTION_IN_ALL_APPS = new DeviceFlag( + "ENABLE_SHOW_KEYBOARD_OPTION_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/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 5dcd48cbb3..3d7d23517b 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -735,7 +735,8 @@ public class StatsLogManager implements ResourceBasedOverride { UNKNOWN(0), COLD(1), HOT(2), - TIMEOUT(3); + TIMEOUT(3), + FAIL(4); private final int mId; @@ -772,6 +773,13 @@ public class StatsLogManager implements ResourceBasedOverride { } /** + * Sets query length of the event. + */ + default StatsLatencyLogger withQueryLength(int queryLength) { + return this; + } + + /** * Sets packageId of log message. */ default StatsLatencyLogger withPackageId(int packageId) { diff --git a/src/com/android/launcher3/util/OnboardingPrefs.java b/src/com/android/launcher3/util/OnboardingPrefs.java index 64aeceb359..f4cf21efe5 100644 --- a/src/com/android/launcher3/util/OnboardingPrefs.java +++ b/src/com/android/launcher3/util/OnboardingPrefs.java @@ -142,16 +142,11 @@ public class OnboardingPrefs<T extends ActivityContext> { } /** - * 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 a1f31fe459..8df3f8a129 100644 --- a/src/com/android/launcher3/util/UiThreadHelper.java +++ b/src/com/android/launcher3/util/UiThreadHelper.java @@ -25,9 +25,13 @@ import android.os.Bundle; 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 class UiThreadHelper { 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 @@ public class UiThreadHelper { STATS_LOGGER_KEY, Message.obtain( HANDLER.get(root.getContext()), - () -> ActivityContext.lookupContext(root.getContext()) + () -> activityContext .getStatsLogManager() .logger() .log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED) diff --git a/src/com/android/launcher3/util/window/WindowManagerProxy.java b/src/com/android/launcher3/util/window/WindowManagerProxy.java index 92f718ef45..9665bf91c5 100644 --- a/src/com/android/launcher3/util/window/WindowManagerProxy.java +++ b/src/com/android/launcher3/util/window/WindowManagerProxy.java @@ -90,7 +90,7 @@ public class WindowManagerProxy implements ResourceBasedOverride { */ public ArrayMap<String, Pair<CachedDisplayInfo, WindowBounds[]>> estimateInternalDisplayBounds( Context context) { - Display[] displays = context.getSystemService(DisplayManager.class).getDisplays(); + Display[] displays = getDisplays(context); ArrayMap<String, Pair<CachedDisplayInfo, WindowBounds[]>> result = new ArrayMap<>(); for (Display display : displays) { if (isInternalDisplay(display)) { @@ -355,4 +355,11 @@ public class WindowManagerProxy implements ResourceBasedOverride { } return d.getRotation(); } + + /** + * Returns all currently valid logical displays. + */ + protected Display[] getDisplays(Context context) { + return context.getSystemService(DisplayManager.class).getDisplays(); + } } |