Merge "Revert "Fix widget restore for pre-archived apps"" into main

This commit is contained in:
Priyanka Advani
2024-02-06 19:11:06 +00:00
committed by Android (Google) Code Review
2 changed files with 1 additions and 22 deletions
@@ -433,9 +433,7 @@ class WorkspaceItemProcessor(
!c.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_RESTORE_STARTED) &&
!isSafeMode &&
(si == null) &&
(lapi == null) &&
!(Flags.enableSupportForArchiving() &&
pmHelper.isAppArchived(component.packageName))
(lapi == null)
) {
// Restore never started
c.markDeleted(
@@ -16,9 +16,6 @@
package com.android.launcher3.util;
import static android.content.pm.PackageManager.MATCH_ARCHIVED_PACKAGES;
import static com.android.launcher3.Flags.enableSupportForArchiving;
import android.content.ActivityNotFoundException;
@@ -109,22 +106,6 @@ public class PackageManagerHelper {
return info != null;
}
/**
* Returns whether the target app is in archived state
*/
@SuppressWarnings("NewApi")
public boolean isAppArchived(@NonNull final String packageName) {
final ApplicationInfo info;
try {
info = mPm.getPackageInfo(packageName,
PackageManager.PackageInfoFlags.of(MATCH_ARCHIVED_PACKAGES)).applicationInfo;
return info.isArchived;
} catch (NameNotFoundException e) {
Log.e(TAG, "Failed to get applicationInfo for package: " + packageName, e);
return false;
}
}
/**
* Returns the application info for the provided package or null
*/