Bugfix: Remove widgets and deep shortcuts of app which gets archived.
* Once app is archived, remove widgets and deep shortcuts corresponding to the app from the home screen. * However during backup & restore, widgets should not be removed if they are being restored. Test: verified bugfix locally. Bug: 326567866 Flag: ACONFIG com.android.launcher3.enable_support_for_archiving DEVELOPMENT Change-Id: Ib3a112aadc7bd901fd6a0ba86f472ec6acf8d626
This commit is contained in:
@@ -104,6 +104,21 @@ public class PackageManagerHelper {
|
||||
return info != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the target app is archived for a given user
|
||||
*/
|
||||
public boolean isAppArchivedForUser(@NonNull final String packageName,
|
||||
@NonNull final UserHandle user) {
|
||||
if (!Utilities.enableSupportForArchiving()) {
|
||||
return false;
|
||||
}
|
||||
final ApplicationInfo info = getApplicationInfo(
|
||||
// LauncherApps does not support long flags currently. Since archived apps are
|
||||
// subset of uninstalled apps, this filter also includes archived apps.
|
||||
packageName, user, PackageManager.MATCH_UNINSTALLED_PACKAGES);
|
||||
return info != null && info.isArchived;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the target app is in archived state
|
||||
*/
|
||||
@@ -172,7 +187,7 @@ public class PackageManagerHelper {
|
||||
public void startDetailsActivityForInfo(ItemInfo info, Rect sourceBounds, Bundle opts) {
|
||||
if (info instanceof ItemInfoWithIcon
|
||||
&& (((ItemInfoWithIcon) info).runtimeStatusFlags
|
||||
& ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
|
||||
& ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
|
||||
ItemInfoWithIcon appInfo = (ItemInfoWithIcon) info;
|
||||
mContext.startActivity(ApiWrapper.getAppMarketActivityIntent(mContext,
|
||||
appInfo.getTargetComponent().getPackageName(), Process.myUserHandle()));
|
||||
@@ -251,6 +266,7 @@ public class PackageManagerHelper {
|
||||
|
||||
/**
|
||||
* Returns true if Launcher has the permission to access shortcuts.
|
||||
*
|
||||
* @see LauncherApps#hasShortcutHostPermission()
|
||||
*/
|
||||
public static boolean hasShortcutsPermission(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user