Loading robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class PackageInstallStateChangedTaskTest { for (ItemInfo info : mModelHelper.getBgDataModel().itemsIdMap) { if (info instanceof WorkspaceItemInfo) { assertEquals(updates.contains(info.id) ? progress: 0, ((WorkspaceItemInfo) info).getInstallProgress()); ((WorkspaceItemInfo) info).getProgressLevel()); } else { assertEquals(updates.contains(info.id) ? progress: -1, ((LauncherAppWidgetInfo) info).installProgress); Loading src/com/android/launcher3/BubbleTextView.java +33 −17 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.View; import android.view.ViewDebug; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.core.graphics.ColorUtils; import com.android.launcher3.Launcher.OnResumeCallback; Loading @@ -71,7 +72,6 @@ import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.PackageItemInfo; import com.android.launcher3.model.data.PromiseAppInfo; import com.android.launcher3.model.data.RemoteActionItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.SafeCloseable; Loading Loading @@ -287,10 +287,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) { applyIconAndLabel(info); setTag(info); if (promiseStateChanged || (info.hasPromiseIconUi())) { applyPromiseState(promiseStateChanged); } applyLoadingState(promiseStateChanged); applyDotState(info, false /* animate */); } Loading @@ -303,9 +300,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, // Verify high res immediately verifyHighRes(); if (info instanceof PromiseAppInfo) { PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info; applyProgressLevel(promiseAppInfo.level); if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) { applyProgressLevel(info.getProgressLevel()); } applyDotState(info, false /* animate */); } Loading Loading @@ -335,6 +331,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mDotParams.color = IconPalette.getMutedColor(info.bitmap.color, 0.54f); setIcon(iconDrawable); applyLabel(info); } private void applyLabel(ItemInfoWithIcon info) { setText(info.title); if (info.contentDescription != null) { setContentDescription(info.isDisabled() Loading Loading @@ -595,21 +595,35 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mLongPressHelper.cancelLongPress(); } public void applyPromiseState(boolean promiseStateChanged) { /** Applies the loading progress value to the progress bar. * * If this app is installing, the progress bar will be updated with the installation progress. * If this app is installed and downloading incrementally, the progress bar will be updated * with the total download progress. */ public void applyLoadingState(boolean promiseStateChanged) { if (getTag() instanceof WorkspaceItemInfo) { WorkspaceItemInfo info = (WorkspaceItemInfo) getTag(); final boolean isPromise = info.hasPromiseIconUi(); final int progressLevel = isPromise ? ((info.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE) ? info.getInstallProgress() : 0)) : 100; int progressLevel = info.getProgressLevel(); if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_INCREMENTAL_DOWNLOAD_ACTIVE) != 0) { updateProgressBarUi(progressLevel, progressLevel == 100); } else if (info.hasPromiseIconUi() || (info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) { updateProgressBarUi(progressLevel, promiseStateChanged); } } } private void updateProgressBarUi(int progressLevel, boolean maybePerformFinishedAnimation) { PreloadIconDrawable preloadDrawable = applyProgressLevel(progressLevel); if (preloadDrawable != null && promiseStateChanged) { if (preloadDrawable != null && maybePerformFinishedAnimation) { preloadDrawable.maybePerformFinishedAnimation(); } } } /** Applies the given progress level to the this icon's progress bar. */ @Nullable public PreloadIconDrawable applyProgressLevel(int progressLevel) { if (getTag() instanceof ItemInfoWithIcon) { ItemInfoWithIcon info = (ItemInfoWithIcon) getTag(); Loading @@ -629,9 +643,11 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, if (mIcon instanceof PreloadIconDrawable) { preloadDrawable = (PreloadIconDrawable) mIcon; preloadDrawable.setLevel(progressLevel); preloadDrawable.setIsDisabled(!info.isAppStartable()); } else { preloadDrawable = newPendingIcon(getContext(), info); preloadDrawable.setLevel(progressLevel); preloadDrawable.setIsDisabled(!info.isAppStartable()); setIcon(preloadDrawable); } return preloadDrawable; Loading src/com/android/launcher3/Launcher.java +2 −3 Original line number Diff line number Diff line Loading @@ -137,7 +137,6 @@ import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.model.data.PromiseAppInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.pm.PinRequestHelper; Loading Loading @@ -2517,8 +2516,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche } @Override public void bindPromiseAppProgressUpdated(PromiseAppInfo app) { mAppsView.getAppsStore().updatePromiseAppProgress(app); public void bindIncrementalDownloadProgressUpdated(AppInfo app) { mAppsView.getAppsStore().updateProgressBar(app); } @Override Loading src/com/android/launcher3/LauncherModel.java +10 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.launcher3.model.LoaderResults; import com.android.launcher3.model.LoaderTask; import com.android.launcher3.model.ModelDelegate; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.model.PackageIncrementalDownloadUpdatedTask; import com.android.launcher3.model.PackageInstallStateChangedTask; import com.android.launcher3.model.PackageUpdatedTask; import com.android.launcher3.model.ShortcutsChangedTask; Loading Loading @@ -195,6 +196,15 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi PackageUpdatedTask.OP_UNSUSPEND, user, packageNames)); } @Override public void onPackageLoadingProgressChanged( String packageName, UserHandle user, float progress) { if (Utilities.ATLEAST_S) { enqueueModelUpdateTask(new PackageIncrementalDownloadUpdatedTask( packageName, user, progress)); } } @Override public void onShortcutsChanged(String packageName, List<ShortcutInfo> shortcuts, UserHandle user) { Loading src/com/android/launcher3/Utilities.java +4 −3 Original line number Diff line number Diff line Loading @@ -107,12 +107,13 @@ public final class Utilities { public static final String[] EMPTY_STRING_ARRAY = new String[0]; public static final Person[] EMPTY_PERSON_ARRAY = new Person[0]; public static final boolean ATLEAST_R = BuildCompat.isAtLeastR(); public static final boolean ATLEAST_P = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P; public static final boolean ATLEAST_Q = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; public static final boolean ATLEAST_P = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P; public static final boolean ATLEAST_R = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R; public static final boolean ATLEAST_S = BuildCompat.isAtLeastS(); /** * Set on a motion event dispatched from the nav bar. See {@link MotionEvent#setEdgeFlags(int)}. Loading Loading
robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class PackageInstallStateChangedTaskTest { for (ItemInfo info : mModelHelper.getBgDataModel().itemsIdMap) { if (info instanceof WorkspaceItemInfo) { assertEquals(updates.contains(info.id) ? progress: 0, ((WorkspaceItemInfo) info).getInstallProgress()); ((WorkspaceItemInfo) info).getProgressLevel()); } else { assertEquals(updates.contains(info.id) ? progress: -1, ((LauncherAppWidgetInfo) info).installProgress); Loading
src/com/android/launcher3/BubbleTextView.java +33 −17 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.View; import android.view.ViewDebug; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.core.graphics.ColorUtils; import com.android.launcher3.Launcher.OnResumeCallback; Loading @@ -71,7 +72,6 @@ import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.PackageItemInfo; import com.android.launcher3.model.data.PromiseAppInfo; import com.android.launcher3.model.data.RemoteActionItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.SafeCloseable; Loading Loading @@ -287,10 +287,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) { applyIconAndLabel(info); setTag(info); if (promiseStateChanged || (info.hasPromiseIconUi())) { applyPromiseState(promiseStateChanged); } applyLoadingState(promiseStateChanged); applyDotState(info, false /* animate */); } Loading @@ -303,9 +300,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, // Verify high res immediately verifyHighRes(); if (info instanceof PromiseAppInfo) { PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info; applyProgressLevel(promiseAppInfo.level); if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) { applyProgressLevel(info.getProgressLevel()); } applyDotState(info, false /* animate */); } Loading Loading @@ -335,6 +331,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mDotParams.color = IconPalette.getMutedColor(info.bitmap.color, 0.54f); setIcon(iconDrawable); applyLabel(info); } private void applyLabel(ItemInfoWithIcon info) { setText(info.title); if (info.contentDescription != null) { setContentDescription(info.isDisabled() Loading Loading @@ -595,21 +595,35 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mLongPressHelper.cancelLongPress(); } public void applyPromiseState(boolean promiseStateChanged) { /** Applies the loading progress value to the progress bar. * * If this app is installing, the progress bar will be updated with the installation progress. * If this app is installed and downloading incrementally, the progress bar will be updated * with the total download progress. */ public void applyLoadingState(boolean promiseStateChanged) { if (getTag() instanceof WorkspaceItemInfo) { WorkspaceItemInfo info = (WorkspaceItemInfo) getTag(); final boolean isPromise = info.hasPromiseIconUi(); final int progressLevel = isPromise ? ((info.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE) ? info.getInstallProgress() : 0)) : 100; int progressLevel = info.getProgressLevel(); if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_INCREMENTAL_DOWNLOAD_ACTIVE) != 0) { updateProgressBarUi(progressLevel, progressLevel == 100); } else if (info.hasPromiseIconUi() || (info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) { updateProgressBarUi(progressLevel, promiseStateChanged); } } } private void updateProgressBarUi(int progressLevel, boolean maybePerformFinishedAnimation) { PreloadIconDrawable preloadDrawable = applyProgressLevel(progressLevel); if (preloadDrawable != null && promiseStateChanged) { if (preloadDrawable != null && maybePerformFinishedAnimation) { preloadDrawable.maybePerformFinishedAnimation(); } } } /** Applies the given progress level to the this icon's progress bar. */ @Nullable public PreloadIconDrawable applyProgressLevel(int progressLevel) { if (getTag() instanceof ItemInfoWithIcon) { ItemInfoWithIcon info = (ItemInfoWithIcon) getTag(); Loading @@ -629,9 +643,11 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, if (mIcon instanceof PreloadIconDrawable) { preloadDrawable = (PreloadIconDrawable) mIcon; preloadDrawable.setLevel(progressLevel); preloadDrawable.setIsDisabled(!info.isAppStartable()); } else { preloadDrawable = newPendingIcon(getContext(), info); preloadDrawable.setLevel(progressLevel); preloadDrawable.setIsDisabled(!info.isAppStartable()); setIcon(preloadDrawable); } return preloadDrawable; Loading
src/com/android/launcher3/Launcher.java +2 −3 Original line number Diff line number Diff line Loading @@ -137,7 +137,6 @@ import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.model.data.PromiseAppInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.pm.PinRequestHelper; Loading Loading @@ -2517,8 +2516,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche } @Override public void bindPromiseAppProgressUpdated(PromiseAppInfo app) { mAppsView.getAppsStore().updatePromiseAppProgress(app); public void bindIncrementalDownloadProgressUpdated(AppInfo app) { mAppsView.getAppsStore().updateProgressBar(app); } @Override Loading
src/com/android/launcher3/LauncherModel.java +10 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.launcher3.model.LoaderResults; import com.android.launcher3.model.LoaderTask; import com.android.launcher3.model.ModelDelegate; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.model.PackageIncrementalDownloadUpdatedTask; import com.android.launcher3.model.PackageInstallStateChangedTask; import com.android.launcher3.model.PackageUpdatedTask; import com.android.launcher3.model.ShortcutsChangedTask; Loading Loading @@ -195,6 +196,15 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi PackageUpdatedTask.OP_UNSUSPEND, user, packageNames)); } @Override public void onPackageLoadingProgressChanged( String packageName, UserHandle user, float progress) { if (Utilities.ATLEAST_S) { enqueueModelUpdateTask(new PackageIncrementalDownloadUpdatedTask( packageName, user, progress)); } } @Override public void onShortcutsChanged(String packageName, List<ShortcutInfo> shortcuts, UserHandle user) { Loading
src/com/android/launcher3/Utilities.java +4 −3 Original line number Diff line number Diff line Loading @@ -107,12 +107,13 @@ public final class Utilities { public static final String[] EMPTY_STRING_ARRAY = new String[0]; public static final Person[] EMPTY_PERSON_ARRAY = new Person[0]; public static final boolean ATLEAST_R = BuildCompat.isAtLeastR(); public static final boolean ATLEAST_P = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P; public static final boolean ATLEAST_Q = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; public static final boolean ATLEAST_P = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P; public static final boolean ATLEAST_R = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R; public static final boolean ATLEAST_S = BuildCompat.isAtLeastS(); /** * Set on a motion event dispatched from the nav bar. See {@link MotionEvent#setEdgeFlags(int)}. Loading