From 47000ae6e6b1d4cf50cfe7379254cb9fb5ca005b Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Mon, 11 Sep 2023 15:28:11 -0700 Subject: [PATCH 1/3] Fix big icon when dragging Toast by isolating the previous QL fix display to SEARCH_RESULT_APP_ROW - Create another icon, "all_apps_predicted_row_icon" that will be the mDisplay for the predicted app row in AllAppsList Bug:299171695 Test: video Before: https://drive.google.com/file/d/1HxNW0015nQHCc7eQiySf-gwsHrLs_JjR/view?usp=sharing after: https://drive.google.com/file/d/1HyEwKI-yumILTCjglKcqovhTlRVjNGxg/view?usp=sharing - making sure that QL is fine and dragging regular Toast results are normal Flag: N/a Change-Id: Ie002cacb168396dbea39f79679bd6a04b80e374b --- .../appprediction/PredictionRowView.java | 5 +---- res/layout/all_apps_prediction_row_icon.xml | 20 +++++++++++++++++++ res/values/attrs.xml | 1 + src/com/android/launcher3/BubbleTextView.java | 15 ++++++++++---- .../graphics/DragPreviewProvider.java | 5 ++++- 5 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 res/layout/all_apps_prediction_row_icon.xml diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java index 4f889c05bc..f82474a8e8 100644 --- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -16,8 +16,6 @@ package com.android.launcher3.appprediction; -import static com.android.launcher3.BubbleTextView.DISPLAY_PREDICTION_ROW; - import android.annotation.TargetApi; import android.content.Context; import android.graphics.Canvas; @@ -189,7 +187,7 @@ public class PredictionRowView LayoutInflater inflater = mActivityContext.getAppsView().getLayoutInflater(); while (getChildCount() < mNumPredictedAppsPerRow) { BubbleTextView icon = (BubbleTextView) inflater.inflate( - R.layout.all_apps_icon, this, false); + R.layout.all_apps_prediction_row_icon, this, false); icon.setOnClickListener(mActivityContext.getItemOnClickListener()); icon.setOnLongClickListener(mActivityContext.getAllAppsItemLongClickListener()); icon.setLongPressTimeoutFactor(1f); @@ -211,7 +209,6 @@ public class PredictionRowView icon.reset(); if (predictionCount > i) { icon.setVisibility(View.VISIBLE); - icon.setDisplay(DISPLAY_PREDICTION_ROW); icon.applyFromWorkspaceItem(mPredictedApps.get(i)); } else { icon.setVisibility(predictionCount == 0 ? GONE : INVISIBLE); diff --git a/res/layout/all_apps_prediction_row_icon.xml b/res/layout/all_apps_prediction_row_icon.xml new file mode 100644 index 0000000000..c9b327542b --- /dev/null +++ b/res/layout/all_apps_prediction_row_icon.xml @@ -0,0 +1,20 @@ + + diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 05eaf88ffb..f046eca3dc 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -86,6 +86,7 @@ + diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index abf84ddcb5..a539148a29 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -99,8 +99,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private static final int DISPLAY_FOLDER = 2; protected static final int DISPLAY_TASKBAR = 5; public static final int DISPLAY_SEARCH_RESULT = 6; - private static final int DISPLAY_SEARCH_RESULT_SMALL = 7; + public static final int DISPLAY_SEARCH_RESULT_SMALL = 7; public static final int DISPLAY_PREDICTION_ROW = 8; + public static final int DISPLAY_SEARCH_RESULT_APP_ROW = 9; private static final float MIN_LETTER_SPACING = -0.05f; private static final int MAX_SEARCH_LOOP_COUNT = 20; @@ -214,7 +215,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, setCompoundDrawablePadding(grid.iconDrawablePaddingPx); defaultIconSize = grid.iconSizePx; setCenterVertically(grid.iconCenterVertically); - } else if (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW) { + } else if (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW + || mDisplay == DISPLAY_SEARCH_RESULT_APP_ROW) { setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx); setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx); defaultIconSize = grid.allAppsIconSizePx; @@ -1104,8 +1106,13 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, } public boolean isDisplaySearchResult() { - return mDisplay == DISPLAY_SEARCH_RESULT || - mDisplay == DISPLAY_SEARCH_RESULT_SMALL; + return mDisplay == DISPLAY_SEARCH_RESULT + || mDisplay == DISPLAY_SEARCH_RESULT_SMALL + || mDisplay == DISPLAY_SEARCH_RESULT_APP_ROW; + } + + public int getIconDisplay() { + return mDisplay; } @Override diff --git a/src/com/android/launcher3/graphics/DragPreviewProvider.java b/src/com/android/launcher3/graphics/DragPreviewProvider.java index b51373cb82..42083431e1 100644 --- a/src/com/android/launcher3/graphics/DragPreviewProvider.java +++ b/src/com/android/launcher3/graphics/DragPreviewProvider.java @@ -16,6 +16,8 @@ package com.android.launcher3.graphics; +import static com.android.launcher3.BubbleTextView.DISPLAY_SEARCH_RESULT_APP_ROW; + import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -100,7 +102,8 @@ public class DragPreviewProvider { height = mView.getHeight(); } - if (mView instanceof BubbleTextView) { + if (mView instanceof BubbleTextView btv + && btv.getIconDisplay() == DISPLAY_SEARCH_RESULT_APP_ROW) { FastBitmapDrawable icon = ((BubbleTextView) mView).getIcon(); Drawable drawable = icon.getConstantState().newDrawable(); float xInset = (float) blurSizeOutline / (float) (width + blurSizeOutline); From 602cb48c72b4384b56214b87268c711aa422e4d8 Mon Sep 17 00:00:00 2001 From: Pinyao Ting Date: Tue, 12 Sep 2023 22:37:16 +0000 Subject: [PATCH 2/3] RESTRICT AUTOMERGE Fix permission bypass in legacy shortcut Intent created for Chooser should not be allowed in legacy shortcuts since it doesn't make sense for user to tap on a shortcut in homescreen to share, the expected share flow started from ShareSheet. Bug: 295334906, 295045199 Test: manual Change-Id: I8d0cbccdc31bd4cb927830e5ecf841147400fdfa --- .../android/launcher3/util/PackageManagerHelper.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java index 586e0c9e89..a6094b68a2 100644 --- a/src/com/android/launcher3/util/PackageManagerHelper.java +++ b/src/com/android/launcher3/util/PackageManagerHelper.java @@ -147,15 +147,8 @@ public class PackageManagerHelper { public boolean hasPermissionForActivity(Intent intent, String srcPackage) { // b/270152142 if (Intent.ACTION_CHOOSER.equals(intent.getAction())) { - final Bundle extras = intent.getExtras(); - if (extras == null) { - return true; - } - // If given intent is ACTION_CHOOSER, verify srcPackage has permission over EXTRA_INTENT - intent = (Intent) extras.getParcelable(Intent.EXTRA_INTENT); - if (intent == null) { - return true; - } + // Chooser shortcuts is not a valid target + return false; } ResolveInfo target = mPm.resolveActivity(intent, 0); if (target == null) { From df2ceac06c592c9084a2e75f7930f6e6712c2863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cosmin=20B=C4=83ie=C8=99?= Date: Thu, 21 Sep 2023 18:08:19 +0200 Subject: [PATCH 3/3] Use stashedTaskbarHeight for IME insets override Previously [1] we removed the explicit insetsSizeOverride from the Taskbar for the IME window, as we now [2] enable hiding the IME nav bar. This would now send the normal insets the taskbar reports. When running on pre/postsubmit, with test harness setup, the non-transient taskbar would show, which is bigger than the IME's navigation bar height. Due to the current logic in InsetsSource#calculateInsets, this leads to the IME window receiving top navigation bar insets instead of bottom. As the IME nav bar is now treated as a (fixed on bottom) caption bar, the two would no longer overlap, and thus lead to a double insets dispatch, and also a (temporarily) bigger IME window, for IMEs that set their decorView height to WRAP_CONTENT (e.g. MockIME used in testing). This instead keeps the previous insetsSizeOverride for IME, and uses the stashedTasbarHeight when in gesture nav, which should account for both transient and normal taskbars. [1]: I86079cb6670a2ae3b6fa883694f8af81df212408 [2]: I8793db69fb846046300d5a56b3b0060138ef4cd5 Bug: 297000797 Test: atest WindowInsetsControllerTests#testDispatchApplyWindowInsetsCount_ime Change-Id: I102a8bc1f8869ebbce9f8f1fefa651d49a9538ec --- .../taskbar/TaskbarInsetsController.kt | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index c51a7ec825..5a4534e651 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -198,24 +198,24 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } - val imeInsetsSize = getInsetsForGravity(taskbarHeightForIme, gravity) + // When in gesture nav, report the stashed height to the IME, to allow hiding the + // IME navigation bar. + val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) { + getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity); + } else { + getInsetsForGravity(taskbarHeightForIme, gravity) + } val imeInsetsSizeOverride = - if (!ENABLE_HIDE_IME_CAPTION_BAR) { - arrayOf( - InsetsFrameProvider.InsetsSizeOverride( - TYPE_INPUT_METHOD, - imeInsetsSize - ), - ) - } else { - arrayOf() - } + arrayOf( + InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), + ) // Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled. val visInsetsSizeForTappableElement = if (context.isGestureNav) getInsetsForGravity(0, gravity) else getInsetsForGravity(tappableHeight, gravity) val insetsSizeOverrideForTappableElement = - imeInsetsSizeOverride + arrayOf( + arrayOf( + InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), InsetsFrameProvider.InsetsSizeOverride( TYPE_VOICE_INTERACTION, visInsetsSizeForTappableElement @@ -224,7 +224,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas if ((context.isGestureNav || TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) && provider.type == tappableElement()) { provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement - } else if (provider.type != systemGestures() && imeInsetsSizeOverride.isNotEmpty()) { + } else if (provider.type != systemGestures()) { // We only override insets at the bottom of the screen provider.insetsSizeOverrides = imeInsetsSizeOverride }