From 19f7a8a5edad37e46c9035beece0b06edd26b953 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Tue, 6 Feb 2024 19:20:17 +0000 Subject: [PATCH] Refreshin App Market Intent on Plus Icon Click Currently the App Market intent is loaded statically into Launcher, once during start. Sometimes, this causes the app market activity start to be blocked, resulting in no action from button tap. To fix this, we hot-reload the intent when the plus button is clicked. Bug: 323189130 Test: Launcher3 test. Flag: ACONFIG com.android.launcher3.Flags.enable_private_space TRUNKFOOD Change-Id: I563d29838a43644ba8e0830b39d4f4ef8c60aeb6 --- .../launcher3/touch/ItemClickHandler.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java index f47ab90822..e0566da362 100644 --- a/src/com/android/launcher3/touch/ItemClickHandler.java +++ b/src/com/android/launcher3/touch/ItemClickHandler.java @@ -41,6 +41,7 @@ import android.view.View.OnClickListener; import android.widget.Toast; import com.android.launcher3.BubbleTextView; +import com.android.launcher3.BuildConfig; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; @@ -353,18 +354,18 @@ public class ItemClickHandler { private static void startAppShortcutOrInfoActivity(View v, ItemInfo item, Launcher launcher) { TestLogging.recordEvent( TestProtocol.SEQUENCE_MAIN, "start: startAppShortcutOrInfoActivity"); - Intent intent; - if (item instanceof ItemInfoWithIcon - && (((ItemInfoWithIcon) item).runtimeStatusFlags - & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) { - ItemInfoWithIcon appInfo = (ItemInfoWithIcon) item; - intent = ApiWrapper.getAppMarketActivityIntent(launcher, - appInfo.getTargetComponent().getPackageName(), Process.myUserHandle()); - } else { - intent = item.getIntent(); - if (item instanceof AppInfo - && (((ItemInfoWithIcon) item).runtimeStatusFlags + Intent intent = item.getIntent(); + if (item instanceof ItemInfoWithIcon itemInfoWithIcon) { + if ((itemInfoWithIcon.runtimeStatusFlags + & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) { + intent = ApiWrapper.getAppMarketActivityIntent(launcher, + itemInfoWithIcon.getTargetComponent().getPackageName(), + Process.myUserHandle()); + } else if ((itemInfoWithIcon.runtimeStatusFlags & ItemInfoWithIcon.FLAG_PRIVATE_SPACE_INSTALL_APP) != 0) { + intent = ApiWrapper.getAppMarketActivityIntent(launcher, + BuildConfig.APPLICATION_ID, + launcher.getAppsView().getPrivateProfileManager().getProfileUser()); launcher.getStatsLogManager().logger().log( LAUNCHER_PRIVATE_SPACE_INSTALL_APP_BUTTON_TAP); }