diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-11 15:49:17 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-11 15:49:17 +0000 |
commit | a351fcf66ed527b48d4ec001c1785a99d122a4b8 (patch) | |
tree | 54208e313dc3730ce7ea3f44482cbb4c56b552aa | |
parent | a5c94ab19da53586acbadac96177ee4b17f28ce6 (diff) | |
parent | a500cde8f2d661562ea4a2c6572c1278df31c619 (diff) | |
download | Launcher3-a351fcf66ed527b48d4ec001c1785a99d122a4b8.tar.gz |
Snap for 8712302 from a500cde8f2d661562ea4a2c6572c1278df31c619 to tm-frc-permission-release
Change-Id: If34c995c46818cf05f14b3a3f84eceb30a2f5085
14 files changed, 88 insertions, 31 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/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/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/layout/all_apps_fast_scroller.xml b/res/layout/all_apps_fast_scroller.xml index f6a61569ee..0f1d9330a6 100644 --- a/res/layout/all_apps_fast_scroller.xml +++ b/res/layout/all_apps_fast_scroller.xml @@ -22,6 +22,7 @@ style="@style/FastScrollerPopup" android:layout_alignParentEnd="true" android:layout_alignTop="@+id/all_apps_header" + android:layout_marginTop="@dimen/all_apps_header_bottom_padding" android:layout_marginEnd="@dimen/fastscroll_popup_margin" /> <com.android.launcher3.views.RecyclerViewFastScroller @@ -31,6 +32,7 @@ android:layout_alignParentBottom="true" android:layout_alignParentEnd="true" android:layout_alignTop="@+id/all_apps_header" + android:layout_marginTop="@dimen/all_apps_header_bottom_padding" android:layout_marginEnd="@dimen/fastscroll_end_margin" launcher:canThumbDetach="true" /> 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/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d26e1aba56..ebed31bd54 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2776,7 +2776,7 @@ public class Launcher extends StatefulActivity<LauncherState> View v = getFirstMatch(Collections.singletonList(activeRecyclerView), preferredItem, packageAndUserAndApp); - if (activeRecyclerView.getCurrentScrollY() > 0) { + if (v != null && activeRecyclerView.getCurrentScrollY() > 0) { RectF locationBounds = new RectF(); FloatingIconView.getLocationBoundsForView(this, v, false, locationBounds, new Rect()); @@ -2804,6 +2804,7 @@ public class Launcher extends StatefulActivity<LauncherState> * @param containers List of ViewGroups to scan, in order of preference. * @param operators List of operators, in order starting from best matching operator. */ + @Nullable private static View getFirstMatch(Iterable<ViewGroup> containers, final Predicate<ItemInfo>... operators) { for (Predicate<ItemInfo> operator : operators) { @@ -2821,6 +2822,7 @@ public class Launcher extends StatefulActivity<LauncherState> * Returns the first view matching the operator in the given ViewGroups, or null if none. * Forward iteration matters. */ + @Nullable private static View mapOverViewGroup(ViewGroup container, Predicate<ItemInfo> op) { final int itemCount = container.getChildCount(); for (int itemIdx = 0; itemIdx < itemCount; itemIdx++) { diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java index b84768cb97..87e6b188b4 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -128,6 +128,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte private final int mScrimColor; private final int mHeaderProtectionColor; protected final float mHeaderThreshold; + private int mHeaderBottomAdjustment; private ScrimView mScrimView; private int mHeaderColor; private int mTabsProtectionAlpha; @@ -140,6 +141,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte mScrimColor = Themes.getAttrColor(context, R.attr.allAppsScrimColor); mHeaderThreshold = getResources().getDimensionPixelSize( R.dimen.dynamic_grid_cell_border_spacing); + mHeaderBottomAdjustment = getResources().getDimensionPixelSize( + R.dimen.all_apps_header_bottom_adjustment); mHeaderProtectionColor = Themes.getAttrColor(context, R.attr.allappsHeaderProtectionColor); mWorkManager = new WorkProfileManager( @@ -722,6 +725,9 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor))); if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) { int bottom = getHeaderBottom(); + if (!mUsingTabs) { + bottom += getFloatingHeaderView().getPaddingBottom() - mHeaderBottomAdjustment; + } canvas.drawRect(0, 0, canvas.getWidth(), bottom, mHeaderPaint); int tabsHeight = getFloatingHeaderView().getPeripheralProtectionHeight(); if (mTabsProtectionAlpha > 0 && tabsHeight != 0) { diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 515f80af01..6ecbad24e8 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -81,7 +81,6 @@ public class FloatingHeaderView extends LinearLayout implements protected final Map<AllAppsRow, PluginHeaderRow> mPluginRows = new ArrayMap<>(); - private final int mHeaderTopPadding; // These two values are necessary to ensure that the header protection is drawn correctly. private final int mHeaderTopAdjustment; private final int mHeaderBottomAdjustment; @@ -118,8 +117,6 @@ public class FloatingHeaderView extends LinearLayout implements public FloatingHeaderView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); - mHeaderTopPadding = context.getResources() - .getDimensionPixelSize(R.dimen.all_apps_header_top_padding); mHeaderTopAdjustment = context.getResources() .getDimensionPixelSize(R.dimen.all_apps_header_top_adjustment); mHeaderBottomAdjustment = context.getResources() @@ -209,7 +206,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(); @@ -326,7 +323,7 @@ public class FloatingHeaderView extends LinearLayout implements int uncappedTranslationY = mTranslationY; mTranslationY = Math.max(mTranslationY, -mMaxTranslation); - if (mCollapsed || uncappedTranslationY < mTranslationY - mHeaderTopPadding) { + if (mCollapsed || uncappedTranslationY < mTranslationY - getPaddingTop()) { // we hide it completely if already capped (for opening search anim) for (FloatingHeaderRow row : mAllRows) { row.setVerticalScroll(0, true /* isScrolledOut */); @@ -339,7 +336,10 @@ public class FloatingHeaderView extends LinearLayout implements mTabLayout.setTranslationY(mTranslationY); - int clipTop = mHeaderTopPadding - mHeaderTopAdjustment; + int clipTop = getPaddingTop() - mHeaderTopAdjustment; + if (mTabsHidden) { + clipTop += getPaddingBottom() - mHeaderBottomAdjustment; + } mRVClip.top = mTabsHidden ? clipTop : 0; mHeaderClip.top = clipTop; // clipping on a draw might cause additional redraw diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 838564d935..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 = new DeviceFlag( - "ENABLE_SHOW_KEYBOARD_IN_ALL_APPS", true, + 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..c4ec4e36fd 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -735,7 +735,9 @@ public class StatsLogManager implements ResourceBasedOverride { UNKNOWN(0), COLD(1), HOT(2), - TIMEOUT(3); + TIMEOUT(3), + FAIL(4), + COLD_USERWAITING(5); private final int mId; @@ -772,6 +774,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/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(); + } } diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index acdd9a19df..efc83ebcc9 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -58,6 +58,8 @@ import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.shortcuts.DeepShortcutView; +import java.util.function.Supplier; + /** * A view that is created to look like another view with the purpose of creating fluid animations. */ @@ -295,9 +297,11 @@ public class FloatingIconView extends FrameLayout implements drawable = drawable == null ? null : drawable.getConstantState().newDrawable(); int iconOffset = getOffsetForIconBounds(l, drawable, pos); + // Clone right away as we are on the background thread instead of blocking the + // main thread later + Drawable btvClone = btvIcon == null ? null : btvIcon.getConstantState().newDrawable(); synchronized (outIconLoadResult) { - outIconLoadResult.btvDrawable = btvIcon == null || drawable == btvIcon - ? null : btvIcon.getConstantState().newDrawable(); + outIconLoadResult.btvDrawable = () -> btvClone; outIconLoadResult.drawable = drawable; outIconLoadResult.badge = badge; outIconLoadResult.iconOffset = iconOffset; @@ -318,7 +322,7 @@ public class FloatingIconView extends FrameLayout implements */ @UiThread private void setIcon(@Nullable Drawable drawable, @Nullable Drawable badge, - @Nullable Drawable btvIcon, int iconOffset) { + @Nullable Supplier<Drawable> btvIcon, int iconOffset) { final DeviceProfile dp = mLauncher.getDeviceProfile(); final InsettableFrameLayout.LayoutParams lp = (InsettableFrameLayout.LayoutParams) getLayoutParams(); @@ -361,9 +365,9 @@ public class FloatingIconView extends FrameLayout implements * * Allows nullable as this may be cleared when drawing is deferred to ClipIconView. */ - private void setOriginalDrawableBackground(@Nullable Drawable btvIcon) { + private void setOriginalDrawableBackground(@Nullable Supplier<Drawable> btvIcon) { if (!mIsOpening) { - mBtvDrawable.setBackground(btvIcon); + mBtvDrawable.setBackground(btvIcon == null ? null : btvIcon.get()); } } @@ -518,21 +522,26 @@ public class FloatingIconView extends FrameLayout implements getLocationBoundsForView(l, v, isOpening, position); final FastBitmapDrawable btvIcon; + final Supplier<Drawable> btvDrawableSupplier; if (v instanceof BubbleTextView) { BubbleTextView btv = (BubbleTextView) v; if (info instanceof ItemInfoWithIcon && (((ItemInfoWithIcon) info).runtimeStatusFlags & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) { btvIcon = btv.makePreloadIcon(); + btvDrawableSupplier = () -> btvIcon; } else { - btvIcon = (FastBitmapDrawable) btv.getIcon().getConstantState().newDrawable(); + btvIcon = btv.getIcon(); + // Clone when needed + btvDrawableSupplier = () -> btvIcon.getConstantState().newDrawable(); } } else { btvIcon = null; + btvDrawableSupplier = null; } IconLoadResult result = new IconLoadResult(info, btvIcon != null && btvIcon.isThemed()); - result.btvDrawable = btvIcon; + result.btvDrawable = btvDrawableSupplier; final long fetchIconId = sFetchIconId++; MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(() -> { @@ -647,7 +656,7 @@ public class FloatingIconView extends FrameLayout implements private static class IconLoadResult { final ItemInfo itemInfo; final boolean isThemed; - Drawable btvDrawable; + Supplier<Drawable> btvDrawable; Drawable drawable; Drawable badge; int iconOffset; diff --git a/src/com/android/launcher3/views/RecyclerViewFastScroller.java b/src/com/android/launcher3/views/RecyclerViewFastScroller.java index cc2b440ce3..11ca130179 100644 --- a/src/com/android/launcher3/views/RecyclerViewFastScroller.java +++ b/src/com/android/launcher3/views/RecyclerViewFastScroller.java @@ -285,8 +285,6 @@ public class RecyclerViewFastScroller extends View { } break; case MotionEvent.ACTION_UP: - hideKeyboardAsync(ActivityContext.lookupContext(getContext()), - getApplicationWindowToken()); case MotionEvent.ACTION_CANCEL: mRv.onFastScrollCompleted(); mTouchOffsetY = 0; @@ -310,6 +308,7 @@ public class RecyclerViewFastScroller extends View { } private void calcTouchOffsetAndPrepToFastScroll(int downY, int lastY) { + hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getWindowToken()); mIsDragging = true; if (mCanThumbDetach) { mIsThumbDetached = true; |