From 139d317f272ed6360b30a4cdc535ce15f3ba0a95 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Mon, 22 Nov 2021 16:00:09 -0800 Subject: [PATCH 1/2] Add ALLOW_SLIPPERY_TOUCHES to make StatusBarTouchController slippery LauncherActivity uses FLAG_SLIPPERY for certain interactions. For example, when home screen is shown, and the user pulls down from not the top of the screen, and notification shade is getting displayed, then the touch should be getting transferred to the NotificationShade using FLAG_SLIPPERY. The newly introduced permission is added to launcher in order for this flag to be applied to the window. Bug: 206188649 Bug: 157929241 Test: reviewed logs, ensure that NexusLauncherActivity has FLAG_SLIPPERY Test: re-ran the performance regression test Merged-In: I8d05fa3663687b5382a59b0d47cdac404844c3b7 Change-Id: I8d05fa3663687b5382a59b0d47cdac404844c3b7 (cherry picked from commit 918776ee51c60a1156600bbbcf5da986ef882a91) Merged-In:I8d05fa3663687b5382a59b0d47cdac404844c3b7 --- quickstep/AndroidManifest.xml | 1 + .../StatusBarTouchController.java | 21 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index 75277a96d0..3e4b3f194b 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -32,6 +32,7 @@ + diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java index 7a7cbb4d9b..6bd5657f86 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java @@ -20,6 +20,7 @@ import static android.view.MotionEvent.ACTION_UP; import static android.view.MotionEvent.ACTION_CANCEL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN; +import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; import android.graphics.PointF; import android.util.SparseArray; @@ -49,17 +50,6 @@ public class StatusBarTouchController implements TouchController { private static final String TAG = "StatusBarController"; - /** - * Window flag: Enable touches to slide out of a window into neighboring - * windows in mid-gesture instead of being captured for the duration of - * the gesture. - * - * This flag changes the behavior of touch focus for this window only. - * Touches can slide out of the window but they cannot necessarily slide - * back in (unless the other window with touch focus permits it). - */ - private static final int FLAG_SLIPPERY = 0x20000000; - private final Launcher mLauncher; private final SystemUiProxy mSystemUiProxy; private final float mTouchSlop; @@ -145,6 +135,15 @@ public final boolean onControllerTouchEvent(MotionEvent ev) { return true; } + /** + * FLAG_SLIPPERY enables touches to slide out of a window into neighboring + * windows in mid-gesture instead of being captured for the duration of + * the gesture. + * + * This flag changes the behavior of touch focus for this window only. + * Touches can slide out of the window but they cannot necessarily slide + * back in (unless the other window with touch focus permits it). + */ private void setWindowSlippery(boolean enable) { Window w = mLauncher.getWindow(); WindowManager.LayoutParams wlp = w.getAttributes(); From d124c5efab7b016f432bb415d413d76d84b9a96a Mon Sep 17 00:00:00 2001 From: Pinyao Ting Date: Thu, 1 Jun 2023 18:12:44 -0700 Subject: [PATCH 2/2] Fix permission issue in legacy shortcut When building legacy shortcut, Launcher calls PackageManager#resolveActivity to retrieve necessary permission to launch the intent. However, when the source app wraps an arbitrary intent within Intent#createChooser, the existing logic will fail because launching Chooser doesn't require additional permission. This CL fixes the security vulnerability by performing the permission check against the intent that is wrapped within. Bug: 270152142 Test: manual (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c53818a16b4322a823497726ac7e7a44501b4442) Merged-In: If35344c08975e35085c7c2b9b814a3c457a144b0 Change-Id: If35344c08975e35085c7c2b9b814a3c457a144b0 --- .../android/launcher3/util/PackageManagerHelper.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java index 8234ee0bf3..041f7aa8dc 100644 --- a/src/com/android/launcher3/util/PackageManagerHelper.java +++ b/src/com/android/launcher3/util/PackageManagerHelper.java @@ -153,6 +153,18 @@ public static boolean isAppSuspended(ApplicationInfo info) { * any permissions */ 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; + } + } ResolveInfo target = mPm.resolveActivity(intent, 0); if (target == null) { // Not a valid target