Initialize the archiving compat options during launcher3 startup.
This just sets an OP_CODE (cheap operation). It disables a help-dialog
for launchers who have not implemented archiving.
Test: PackageInstallerArchiveTest and also manually
Bug: 302114748
Flag: ACONFIG com.android.launcher3.enable_support_for_archiving DEVELOPMENT
Change-Id: Ifa9335d7ad250218eec3863dcdd986118bba007c
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index e015021..1b2cebd 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -89,6 +89,7 @@
return mContext;
}
+ @SuppressWarnings("NewApi")
public LauncherAppState(Context context) {
this(context, LauncherFiles.APP_ICONS_DB);
Log.v(Launcher.TAG, "LauncherAppState initiated");
@@ -103,9 +104,14 @@
});
ModelLauncherCallbacks callbacks = mModel.newModelCallbacks();
- mContext.getSystemService(LauncherApps.class).registerCallback(callbacks);
+ LauncherApps launcherApps = mContext.getSystemService(LauncherApps.class);
+ launcherApps.registerCallback(callbacks);
mOnTerminateCallback.add(() ->
mContext.getSystemService(LauncherApps.class).unregisterCallback(callbacks));
+ if (Flags.enableSupportForArchiving()) {
+ launcherApps.setArchiveCompatibilityOptions(/* enableIconOverlay= */ true,
+ /* enableUnarchivalConfirmation= */ false);
+ }
SimpleBroadcastReceiver modelChangeReceiver =
new SimpleBroadcastReceiver(mModel::onBroadcastIntent);