Add support for progress bar during unarchival of app.

* With this change, progress bar should appear whenever app update for archived app reaches non-zero progress.
* Once the update is cancelled, the progress bar should also disappear.

Test: PromiseIconUiTest and manually tested the progress bar using Play Store
Bug: 302115555
Flag: ACONFIG com.android.launcher3.enable_support_for_archiving DEVELOPMENT
Change-Id: Iacf7a0fd865dba34915fa09f59c63a1da6e47315
This commit is contained in:
Rohit Goyal
2024-01-03 23:41:06 +05:30
parent 97eee72e6e
commit 2e6010c421
14 changed files with 174 additions and 12 deletions

View File

@@ -17,6 +17,7 @@
package com.android.launcher3.model;
import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN;
import static com.android.launcher3.Flags.enableSupportForArchiving;
import static com.android.launcher3.LauncherPrefs.IS_FIRST_LOAD_AFTER_RESTORE;
import static com.android.launcher3.LauncherPrefs.SHOULD_SHOW_SMARTSPACE;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR;
@@ -131,6 +132,7 @@ import java.util.concurrent.CancellationException;
* - all apps icons
* - deep shortcuts within apps
*/
@SuppressWarnings("NewApi")
public class LoaderTask implements Runnable {
private static final String TAG = "LoaderTask";
public static final String SMARTSPACE_ON_HOME_SCREEN = "pref_smartspace_home_screen";
@@ -772,13 +774,21 @@ public class LoaderTask implements Runnable {
PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING);
}
if (c.restoreFlag != 0 && !TextUtils.isEmpty(targetPkg)) {
if ((c.restoreFlag != 0
|| (enableSupportForArchiving()
&& activityInfo != null
&& activityInfo.getApplicationInfo().isArchived))
&& !TextUtils.isEmpty(targetPkg)) {
tempPackageKey.update(targetPkg, c.user);
SessionInfo si = installingPkgs.get(tempPackageKey);
if (si == null) {
info.runtimeStatusFlags
&= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
} else if (activityInfo == null) {
} else if (activityInfo == null
// For archived apps, include progress info in case there is
// a pending install session post restart of device.
|| (enableSupportForArchiving()
&& activityInfo.getApplicationInfo().isArchived)) {
int installProgress = (int) (si.getProgress() * 100);
info.setProgressLevel(installProgress,
@@ -1095,6 +1105,8 @@ public class LoaderTask implements Runnable {
for (int i = 0; i < apps.size(); i++) {
LauncherActivityInfo app = apps.get(i);
AppInfo appInfo = new AppInfo(app, user, quietMode);
// TODO(b/302115555): Handle the case when archived apps with active sessions are
// loaded.
iconRequestInfos.add(new IconRequestInfo<>(
appInfo, app, /* useLowResIcon= */ false));