[Launcher/Archive] remove all checks for the archiving system property

No longer needed

Change-Id: I62c8843aa04a245d1dcc30f7787c71d17993f5d1
BUG: 331165939
Test: builds
This commit is contained in:
Song Chun Fan
2024-04-08 18:20:10 +00:00
parent adbdfe2ac7
commit e5ad96ce10
14 changed files with 27 additions and 24 deletions
@@ -110,7 +110,7 @@ public class LauncherAppState implements SafeCloseable {
mOnTerminateCallback.add(() ->
mContext.getSystemService(LauncherApps.class).unregisterCallback(callbacks));
if (Utilities.enableSupportForArchiving()) {
if (Flags.enableSupportForArchiving()) {
ArchiveCompatibilityParams params = new ArchiveCompatibilityParams();
params.setEnableUnarchivalConfirmation(false);
launcherApps.setArchiveCompatibility(params);
-6
View File
@@ -830,10 +830,4 @@ public final class Utilities {
// No-Op
}
}
/** Encapsulates two flag checks into a single one. */
public static boolean enableSupportForArchiving() {
return Flags.enableSupportForArchiving()
|| getSystemProperty("pm.archiving.enabled", "false").equals("true");
}
}
@@ -51,6 +51,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.core.util.Pair;
import com.android.launcher3.Flags;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Utilities;
import com.android.launcher3.icons.ComponentWithLabel.ComponentCachingLogic;
@@ -248,7 +249,7 @@ public class IconCache extends BaseIconCache {
@SuppressWarnings("NewApi")
public synchronized void getTitleAndIcon(ItemInfoWithIcon info,
LauncherActivityInfo activityInfo, boolean useLowResIcon) {
boolean isAppArchived = Utilities.enableSupportForArchiving() && activityInfo != null
boolean isAppArchived = Flags.enableSupportForArchiving() && activityInfo != null
&& activityInfo.getActivityInfo().isArchived;
// If we already have activity info, no need to use package icon
getTitleAndIcon(info, () -> activityInfo, isAppArchived, useLowResIcon,
@@ -33,6 +33,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.AppFilter;
import com.android.launcher3.Flags;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AlphabeticIndexCompat;
import com.android.launcher3.icons.IconCache;
@@ -330,7 +331,7 @@ public class AllAppsList {
PackageManagerHelper.getLoadingProgress(info),
PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING);
applicationInfo.intent = launchIntent;
if (Utilities.enableSupportForArchiving()) {
if (Flags.enableSupportForArchiving()) {
// In case an app is archived, the respective item flag corresponding to
// archiving should also be applied during package updates
if (info.getActivityInfo().isArchived) {
@@ -40,6 +40,7 @@ import android.util.Pair;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import com.android.launcher3.Flags;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
@@ -300,7 +301,7 @@ public class ItemInstallQueue {
} else {
lai = laiList.get(0);
si.intent = makeLaunchIntent(lai);
if (Utilities.enableSupportForArchiving()
if (Flags.enableSupportForArchiving()
&& lai.getActivityInfo().isArchived) {
si.runtimeStatusFlags |= FLAG_ARCHIVED;
}
@@ -421,7 +421,7 @@ public class LoaderTask implements Runnable {
final HashMap<PackageUserKey, SessionInfo> installingPkgs =
mSessionHelper.getActiveSessions();
if (Utilities.enableSupportForArchiving()) {
if (Flags.enableSupportForArchiving()) {
mInstallingPkgsCached = installingPkgs;
}
installingPkgs.forEach(mApp.getIconCache()::updateSessionCache);
@@ -695,7 +695,7 @@ public class LoaderTask implements Runnable {
for (int i = 0; i < apps.size(); i++) {
LauncherActivityInfo app = apps.get(i);
AppInfo appInfo = new AppInfo(app, mUserCache.getUserInfo(user), quietMode);
if (Utilities.enableSupportForArchiving() && app.getApplicationInfo().isArchived) {
if (Flags.enableSupportForArchiving() && app.getApplicationInfo().isArchived) {
// For archived apps, include progress info in case there is a pending
// install session post restart of device.
String appPackageName = app.getApplicationInfo().packageName;
@@ -276,7 +276,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING);
// In case an app is archived, we need to make sure that archived state
// in WorkspaceItemInfo is refreshed.
if (Utilities.enableSupportForArchiving() && !activities.isEmpty()) {
if (Flags.enableSupportForArchiving() && !activities.isEmpty()) {
boolean newArchivalState = activities.get(
0).getActivityInfo().isArchived;
if (newArchivalState != si.isArchived()) {
@@ -26,6 +26,7 @@ import android.graphics.Point
import android.text.TextUtils
import android.util.Log
import android.util.LongSparseArray
import com.android.launcher3.Flags
import com.android.launcher3.InvariantDeviceProfile
import com.android.launcher3.LauncherAppState
import com.android.launcher3.LauncherSettings.Favorites
@@ -334,7 +335,7 @@ class WorkspaceItemProcessor(
}
if (
(c.restoreFlag != 0 ||
Utilities.enableSupportForArchiving() &&
Flags.enableSupportForArchiving() &&
activityInfo != null &&
activityInfo.applicationInfo.isArchived) && !TextUtils.isEmpty(targetPkg)
) {
@@ -346,7 +347,7 @@ class WorkspaceItemProcessor(
ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE.inv()
} else if (
activityInfo == null ||
(Utilities.enableSupportForArchiving() &&
(Flags.enableSupportForArchiving() &&
activityInfo.applicationInfo.isArchived)
) {
// For archived apps, include progress info in case there is
@@ -472,7 +473,7 @@ class WorkspaceItemProcessor(
!isSafeMode &&
(si == null) &&
(lapi == null) &&
!(Utilities.enableSupportForArchiving() &&
!(Flags.enableSupportForArchiving() &&
pmHelper.isAppArchived(component.packageName))
) {
// Restore never started
@@ -181,7 +181,7 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory {
if (PackageManagerHelper.isAppSuspended(appInfo)) {
info.runtimeStatusFlags |= FLAG_DISABLED_SUSPENDED;
}
if (Utilities.enableSupportForArchiving() && lai.getActivityInfo().isArchived) {
if (Flags.enableSupportForArchiving() && lai.getActivityInfo().isArchived) {
info.runtimeStatusFlags |= FLAG_ARCHIVED;
}
info.runtimeStatusFlags |= (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0
@@ -22,6 +22,7 @@ import android.os.Process;
import androidx.annotation.Nullable;
import com.android.launcher3.Flags;
import com.android.launcher3.Utilities;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BitmapInfo.DrawableCreationFlags;
@@ -162,7 +163,7 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
* Returns true if the app corresponding to the item is archived.
*/
public boolean isArchived() {
if (!Utilities.enableSupportForArchiving()) {
if (!Flags.enableSupportForArchiving()) {
return false;
}
return (runtimeStatusFlags & FLAG_ARCHIVED) != 0;
@@ -29,6 +29,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import com.android.launcher3.Flags;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.SessionCommitReceiver;
import com.android.launcher3.Utilities;
@@ -217,7 +218,7 @@ public class InstallSessionHelper {
&& !promiseIconAddedForId(sessionInfo.getSessionId())) {
// In case of unarchival, we do not want to add a workspace promise icon if one is
// not already present. For general app installations however, we do support it.
if (!Utilities.enableSupportForArchiving() || !sessionInfo.isUnarchival()) {
if (!Flags.enableSupportForArchiving() || !sessionInfo.isUnarchival()) {
FileLog.d(LOG, "Adding package name to install queue: "
+ sessionInfo.getAppPackageName());
@@ -232,7 +233,7 @@ public class InstallSessionHelper {
public boolean verifySessionInfo(@Nullable final PackageInstaller.SessionInfo sessionInfo) {
// For archived apps we always want to show promise icons and the checks below don't apply.
if (Utilities.enableSupportForArchiving() && sessionInfo != null
if (Flags.enableSupportForArchiving() && sessionInfo != null
&& sessionInfo.isUnarchival()) {
return true;
}
@@ -31,6 +31,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import com.android.launcher3.Flags;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.PackageUserKey;
@@ -80,7 +81,7 @@ public class InstallSessionTracker extends PackageInstaller.SessionCallback {
helper.tryQueuePromiseAppIcon(sessionInfo);
if (Utilities.enableSupportForArchiving() && sessionInfo != null
if (Flags.enableSupportForArchiving() && sessionInfo != null
&& sessionInfo.isUnarchival()) {
// For archived apps, icon could already be present on the workspace. To make sure
// the icon state is updated, we send a change event.
@@ -41,6 +41,7 @@ import android.widget.Toast;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.BuildConfig;
import com.android.launcher3.Flags;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings;
@@ -346,7 +347,7 @@ public class ItemClickHandler {
// Check for abandoned promise
if ((v instanceof BubbleTextView) && shortcut.hasPromiseIconUi()
&& (!Utilities.enableSupportForArchiving() || !shortcut.isArchived())) {
&& (!Flags.enableSupportForArchiving() || !shortcut.isArchived())) {
String packageName = shortcut.getIntent().getComponent() != null
? shortcut.getIntent().getComponent().getPackageName()
: shortcut.getIntent().getPackage();
@@ -38,6 +38,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.Flags;
import com.android.launcher3.PendingAddItemInfo;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -109,7 +110,7 @@ public class PackageManagerHelper {
@SuppressWarnings("NewApi")
public boolean isAppArchivedForUser(@NonNull final String packageName,
@NonNull final UserHandle user) {
if (!Utilities.enableSupportForArchiving()) {
if (!Flags.enableSupportForArchiving()) {
return false;
}
final ApplicationInfo info = getApplicationInfo(
@@ -274,6 +275,6 @@ public class PackageManagerHelper {
@SuppressWarnings("NewApi")
private boolean isPackageInstalledOrArchived(ApplicationInfo info) {
return (info.flags & ApplicationInfo.FLAG_INSTALLED) != 0 || (
Utilities.enableSupportForArchiving() && info.isArchived);
Flags.enableSupportForArchiving() && info.isArchived);
}
}