Loading aconfig/launcher_search.aconfig +14 −0 Original line number Diff line number Diff line Loading @@ -13,3 +13,17 @@ flag { description: "This flag enables the animation of the Private Space container" bug: "299294792" } flag { name: "private_space_sys_apps_separation" namespace: "launcher_search" description: "This flag enables showing system apps separate in Private Space container." bug: "308054233" } flag { name: "private_space_app_installer_button" namespace: "launcher_search" description: "This flag enables addition of App Installer button in Private Space container." bug: "308064949" } No newline at end of file quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +3 −3 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.touch.ItemClickHandler.ItemClickProxy; import com.android.launcher3.uioverrides.ApiWrapper; import com.android.launcher3.util.ActivityOptionsWrapper; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.DisplayController; Loading Loading @@ -1056,9 +1057,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } else if (info.isPromise()) { TestLogging.recordEvent( TestProtocol.SEQUENCE_MAIN, "start: taskbarPromiseIcon"); intent = new PackageManagerHelper(this) .getMarketIntent(info.getTargetPackage()) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent = ApiWrapper.getAppMarketActivityIntent(this, info.getTargetPackage(), Process.myUserHandle()); startActivity(intent); } else if (info.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) { Loading quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java +44 −0 Original line number Diff line number Diff line Loading @@ -17,13 +17,16 @@ package com.android.launcher3.uioverrides; import android.app.ActivityOptions; import android.app.PendingIntent; import android.app.Person; import android.content.Context; import android.content.Intent; import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; import android.content.pm.LauncherUserInfo; import android.content.pm.ShortcutInfo; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.UserHandle; import android.os.UserManager; import android.util.ArrayMap; Loading @@ -31,9 +34,12 @@ import android.window.RemoteTransition; import com.android.launcher3.Flags; import com.android.launcher3.Utilities; import com.android.launcher3.proxy.ProxyActivityStarter; import com.android.launcher3.util.StartActivityParams; import com.android.launcher3.util.UserIconInfo; import com.android.quickstep.util.FadeOutRemoteTransition; import java.util.ArrayList; import java.util.List; import java.util.Map; Loading Loading @@ -102,6 +108,44 @@ public class ApiWrapper { return users; } /** * Returns the list of the system packages that are installed at user creation. * An empty list denotes that all system packages are installed for that user at creation. */ public static List<String> getPreInstalledSystemPackages(Context context, UserHandle user) { LauncherApps launcherApps = context.getSystemService(LauncherApps.class); if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpace() && Flags.privateSpaceSysAppsSeparation()) { return launcherApps.getPreInstalledSystemPackages(user); } else { return new ArrayList<>(); } } /** * Returns an intent which can be used to start the App Market activity (Installer * Activity). */ public static Intent getAppMarketActivityIntent(Context context, String packageName, UserHandle user) { LauncherApps launcherApps = context.getSystemService(LauncherApps.class); if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpace() && Flags.privateSpaceAppInstallerButton()) { StartActivityParams params = new StartActivityParams((PendingIntent) null, 0); params.intentSender = launcherApps.getAppMarketActivityIntent(packageName, user); return ProxyActivityStarter.getLaunchIntent(context, params); } else { return new Intent(Intent.ACTION_VIEW) .setData(new Uri.Builder() .scheme("market") .authority("details") .appendQueryParameter("id", packageName) .build()) .putExtra(Intent.EXTRA_REFERRER, new Uri.Builder().scheme("android-app") .authority(context.getPackageName()).build()); } } private static class NoopDrawable extends ColorDrawable { @Override public int getIntrinsicHeight() { Loading src/com/android/launcher3/model/data/ItemInfoWithIcon.java +4 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3.model.data; import android.content.Context; import android.content.Intent; import android.os.Process; import androidx.annotation.Nullable; Loading @@ -26,7 +27,7 @@ import com.android.launcher3.icons.BitmapInfo.DrawableCreationFlags; import com.android.launcher3.icons.FastBitmapDrawable; import com.android.launcher3.logging.FileLog; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.uioverrides.ApiWrapper; /** * Represents an ItemInfo which also holds an icon. Loading Loading @@ -216,7 +217,8 @@ public abstract class ItemInfoWithIcon extends ItemInfo { String targetPackage = getTargetPackage(); return targetPackage != null ? new PackageManagerHelper(context).getMarketIntent(targetPackage) ? ApiWrapper.getAppMarketActivityIntent( context, targetPackage, Process.myUserHandle()) : null; } Loading src/com/android/launcher3/popup/SystemShortcut.java +5 −2 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.app.ActivityOptions; import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.os.Process; import android.view.View; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.ImageView; Loading @@ -22,6 +23,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.uioverrides.ApiWrapper; import com.android.launcher3.util.InstantAppResolver; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.PackageUserKey; Loading Loading @@ -237,8 +239,9 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend @Override public void onClick(View view) { Intent intent = new PackageManagerHelper(view.getContext()).getMarketIntent( mItemInfo.getTargetComponent().getPackageName()); Intent intent = ApiWrapper.getAppMarketActivityIntent(view.getContext(), mItemInfo.getTargetComponent().getPackageName(), Process.myUserHandle()); mTarget.startActivitySafely(view, intent, mItemInfo); AbstractFloatingView.closeAllOpenViews(mTarget); } Loading Loading
aconfig/launcher_search.aconfig +14 −0 Original line number Diff line number Diff line Loading @@ -13,3 +13,17 @@ flag { description: "This flag enables the animation of the Private Space container" bug: "299294792" } flag { name: "private_space_sys_apps_separation" namespace: "launcher_search" description: "This flag enables showing system apps separate in Private Space container." bug: "308054233" } flag { name: "private_space_app_installer_button" namespace: "launcher_search" description: "This flag enables addition of App Installer button in Private Space container." bug: "308064949" } No newline at end of file
quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +3 −3 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.touch.ItemClickHandler.ItemClickProxy; import com.android.launcher3.uioverrides.ApiWrapper; import com.android.launcher3.util.ActivityOptionsWrapper; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.DisplayController; Loading Loading @@ -1056,9 +1057,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } else if (info.isPromise()) { TestLogging.recordEvent( TestProtocol.SEQUENCE_MAIN, "start: taskbarPromiseIcon"); intent = new PackageManagerHelper(this) .getMarketIntent(info.getTargetPackage()) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent = ApiWrapper.getAppMarketActivityIntent(this, info.getTargetPackage(), Process.myUserHandle()); startActivity(intent); } else if (info.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) { Loading
quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java +44 −0 Original line number Diff line number Diff line Loading @@ -17,13 +17,16 @@ package com.android.launcher3.uioverrides; import android.app.ActivityOptions; import android.app.PendingIntent; import android.app.Person; import android.content.Context; import android.content.Intent; import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; import android.content.pm.LauncherUserInfo; import android.content.pm.ShortcutInfo; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.UserHandle; import android.os.UserManager; import android.util.ArrayMap; Loading @@ -31,9 +34,12 @@ import android.window.RemoteTransition; import com.android.launcher3.Flags; import com.android.launcher3.Utilities; import com.android.launcher3.proxy.ProxyActivityStarter; import com.android.launcher3.util.StartActivityParams; import com.android.launcher3.util.UserIconInfo; import com.android.quickstep.util.FadeOutRemoteTransition; import java.util.ArrayList; import java.util.List; import java.util.Map; Loading Loading @@ -102,6 +108,44 @@ public class ApiWrapper { return users; } /** * Returns the list of the system packages that are installed at user creation. * An empty list denotes that all system packages are installed for that user at creation. */ public static List<String> getPreInstalledSystemPackages(Context context, UserHandle user) { LauncherApps launcherApps = context.getSystemService(LauncherApps.class); if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpace() && Flags.privateSpaceSysAppsSeparation()) { return launcherApps.getPreInstalledSystemPackages(user); } else { return new ArrayList<>(); } } /** * Returns an intent which can be used to start the App Market activity (Installer * Activity). */ public static Intent getAppMarketActivityIntent(Context context, String packageName, UserHandle user) { LauncherApps launcherApps = context.getSystemService(LauncherApps.class); if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpace() && Flags.privateSpaceAppInstallerButton()) { StartActivityParams params = new StartActivityParams((PendingIntent) null, 0); params.intentSender = launcherApps.getAppMarketActivityIntent(packageName, user); return ProxyActivityStarter.getLaunchIntent(context, params); } else { return new Intent(Intent.ACTION_VIEW) .setData(new Uri.Builder() .scheme("market") .authority("details") .appendQueryParameter("id", packageName) .build()) .putExtra(Intent.EXTRA_REFERRER, new Uri.Builder().scheme("android-app") .authority(context.getPackageName()).build()); } } private static class NoopDrawable extends ColorDrawable { @Override public int getIntrinsicHeight() { Loading
src/com/android/launcher3/model/data/ItemInfoWithIcon.java +4 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3.model.data; import android.content.Context; import android.content.Intent; import android.os.Process; import androidx.annotation.Nullable; Loading @@ -26,7 +27,7 @@ import com.android.launcher3.icons.BitmapInfo.DrawableCreationFlags; import com.android.launcher3.icons.FastBitmapDrawable; import com.android.launcher3.logging.FileLog; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.uioverrides.ApiWrapper; /** * Represents an ItemInfo which also holds an icon. Loading Loading @@ -216,7 +217,8 @@ public abstract class ItemInfoWithIcon extends ItemInfo { String targetPackage = getTargetPackage(); return targetPackage != null ? new PackageManagerHelper(context).getMarketIntent(targetPackage) ? ApiWrapper.getAppMarketActivityIntent( context, targetPackage, Process.myUserHandle()) : null; } Loading
src/com/android/launcher3/popup/SystemShortcut.java +5 −2 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.app.ActivityOptions; import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.os.Process; import android.view.View; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.ImageView; Loading @@ -22,6 +23,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.uioverrides.ApiWrapper; import com.android.launcher3.util.InstantAppResolver; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.PackageUserKey; Loading Loading @@ -237,8 +239,9 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend @Override public void onClick(View view) { Intent intent = new PackageManagerHelper(view.getContext()).getMarketIntent( mItemInfo.getTargetComponent().getPackageName()); Intent intent = ApiWrapper.getAppMarketActivityIntent(view.getContext(), mItemInfo.getTargetComponent().getPackageName(), Process.myUserHandle()); mTarget.startActivitySafely(view, intent, mItemInfo); AbstractFloatingView.closeAllOpenViews(mTarget); } Loading