summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt8
-rw-r--r--core/java/android/content/pm/LauncherApps.java67
2 files changed, 58 insertions, 17 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 4351143a3f93..cb937d200e26 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -12410,7 +12410,7 @@ package android.content.pm {
method public void registerCallback(android.content.pm.LauncherApps.Callback, android.os.Handler);
method public void registerPackageInstallerSessionCallback(@NonNull java.util.concurrent.Executor, @NonNull android.content.pm.PackageInstaller.SessionCallback);
method public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle);
- method @FlaggedApi("android.content.pm.archiving") public void setArchiveCompatibilityOptions(boolean, boolean);
+ method @FlaggedApi("android.content.pm.archiving") public void setArchiveCompatibility(@NonNull android.content.pm.LauncherApps.ArchiveCompatibilityParams);
method public boolean shouldHideFromSuggestions(@NonNull String, @NonNull android.os.UserHandle);
method public void startAppDetailsActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle);
method public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle);
@@ -12424,6 +12424,12 @@ package android.content.pm {
field public static final String EXTRA_PIN_ITEM_REQUEST = "android.content.pm.extra.PIN_ITEM_REQUEST";
}
+ @FlaggedApi("android.content.pm.archiving") public static class LauncherApps.ArchiveCompatibilityParams {
+ ctor public LauncherApps.ArchiveCompatibilityParams();
+ method public void setEnableIconOverlay(boolean);
+ method public void setEnableUnarchivalConfirmation(boolean);
+ }
+
public abstract static class LauncherApps.Callback {
ctor public LauncherApps.Callback();
method public abstract void onPackageAdded(String, android.os.UserHandle);
diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java
index 50be983ec938..7c264f65d471 100644
--- a/core/java/android/content/pm/LauncherApps.java
+++ b/core/java/android/content/pm/LauncherApps.java
@@ -1802,25 +1802,16 @@ public class LauncherApps {
}
/**
- * Enable or disable different archive compatibility options of the launcher.
- *
- * @param enableIconOverlay Provides a cloud overlay for archived apps to ensure users are aware
- * that a certain app is archived. True by default.
- * Launchers might want to disable this operation if they want to provide custom user experience
- * to differentiate archived apps.
- * @param enableUnarchivalConfirmation If true, the user is shown a confirmation dialog when
- * they click an archived app, which explains that the app will be downloaded and restored in
- * the background. True by default.
- * Launchers might want to disable this operation if they provide sufficient, alternative user
- * guidance to highlight that an unarchival is starting and ongoing once an archived app is
- * tapped. E.g., this could be achieved by showing the unarchival progress around the icon.
+ * Disable different archive compatibility options of the launcher for the caller of this
+ * method.
+ *
+ * @see ArchiveCompatibilityParams for individual options.
*/
@FlaggedApi(android.content.pm.Flags.FLAG_ARCHIVING)
- public void setArchiveCompatibilityOptions(boolean enableIconOverlay,
- boolean enableUnarchivalConfirmation) {
+ public void setArchiveCompatibility(@NonNull ArchiveCompatibilityParams params) {
try {
- mService.setArchiveCompatibilityOptions(enableIconOverlay,
- enableUnarchivalConfirmation);
+ mService.setArchiveCompatibilityOptions(params.isEnableIconOverlay(),
+ params.isEnableUnarchivalConfirmation());
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
@@ -1982,6 +1973,50 @@ public class LauncherApps {
}
};
+ /**
+ * Used to enable Archiving compatibility options with {@link #setArchiveCompatibility}.
+ */
+ @FlaggedApi(android.content.pm.Flags.FLAG_ARCHIVING)
+ public static class ArchiveCompatibilityParams {
+ private boolean mEnableIconOverlay = true;
+
+ private boolean mEnableUnarchivalConfirmation = true;
+
+ /** @hide */
+ public boolean isEnableIconOverlay() {
+ return mEnableIconOverlay;
+ }
+
+ /** @hide */
+ public boolean isEnableUnarchivalConfirmation() {
+ return mEnableUnarchivalConfirmation;
+ }
+
+ /**
+ * If true, provides a cloud overlay for archived apps to ensure users are aware that a
+ * certain app is archived. True by default.
+ *
+ * <p> Launchers might want to disable this operation if they want to provide custom user
+ * experience to differentiate archived apps.
+ */
+ public void setEnableIconOverlay(boolean enableIconOverlay) {
+ this.mEnableIconOverlay = enableIconOverlay;
+ }
+
+ /**
+ * If true, the user is shown a confirmation dialog when they click an archived app, which
+ * explains that the app will be downloaded and restored in the background. True by default.
+ *
+ * <p> Launchers might want to disable this operation if they provide sufficient,
+ * alternative user guidance to highlight that an unarchival is starting and ongoing once an
+ * archived app is tapped. E.g., this could be achieved by showing the unarchival progress
+ * around the icon.
+ */
+ public void setEnableUnarchivalConfirmation(boolean enableUnarchivalConfirmation) {
+ this.mEnableUnarchivalConfirmation = enableUnarchivalConfirmation;
+ }
+ }
+
private static class CallbackMessageHandler extends Handler {
private static final int MSG_ADDED = 1;
private static final int MSG_REMOVED = 2;