Add support for progress bar for archived apps in AllApps view.
Working Video: https://drive.google.com/file/d/1-cSD63FQLmqyeTkUuXqcSsjb03m31ULO/view?usp=sharing
Test: TaplPromiseIconUiTest
Bug: 302115555
Bug: 317108448
Flag: ACONFIG com.android.launcher3.enable_support_for_archiving DEVELOPMENT
Change-Id: Iebaa338789430c5e0a004bd8b05bdbda87cd986e
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 5b497f2..ba65bea 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -933,9 +933,7 @@
if (mIcon instanceof PreloadIconDrawable) {
preloadIconDrawable = (PreloadIconDrawable) mIcon;
preloadIconDrawable.setLevel(progressLevel);
- // TODO(b/302115555): For archived apps, show icon as disabled if active session
- // exists.
- preloadIconDrawable.setIsDisabled(info.getProgressLevel() == 0);
+ preloadIconDrawable.setIsDisabled(isIconDisabled(info));
} else {
preloadIconDrawable = makePreloadIcon();
setIcon(preloadIconDrawable);
@@ -960,11 +958,18 @@
final PreloadIconDrawable preloadDrawable = newPendingIcon(getContext(), info);
preloadDrawable.setLevel(progressLevel);
- // TODO(b/302115555): For archived apps, show icon as disabled if active session exists.
- preloadDrawable.setIsDisabled(info.getProgressLevel() == 0);
+ preloadDrawable.setIsDisabled(isIconDisabled(info));
return preloadDrawable;
}
+ private boolean isIconDisabled(ItemInfoWithIcon info) {
+ if (info.isArchived()) {
+ return info.getProgressLevel() == 0
+ && (info.runtimeStatusFlags & FLAG_INSTALL_SESSION_ACTIVE) != 0;
+ }
+ return info.getProgressLevel() == 0;
+ }
+
public void applyDotState(ItemInfo itemInfo, boolean animate) {
if (mIcon instanceof FastBitmapDrawable) {
boolean wasDotted = mDotInfo != null;