Fixed app shortcut widget

- closes : #5101
- closes : #5056
- closes : #5055
This commit is contained in:
MrSluffy
2024-12-26 10:48:38 +08:00
parent eb6e45d7ca
commit c41eb8ac8f
7 changed files with 26 additions and 28 deletions

View File

@@ -731,24 +731,20 @@ public class LoaderTask implements Runnable {
LauncherActivityInfo app = apps.get(i);
AppInfo appInfo = new AppInfo(app, mUserCache.getUserInfo(user),
ApiWrapper.INSTANCE.get(mApp.getContext()), mPmHelper, quietMode);
boolean isArchived;
try {
isArchived = app.getApplicationInfo().isArchived;
} catch (NoSuchFieldError e) {
isArchived = false;
}
if (Flags.enableSupportForArchiving() && isArchived) {
// For archived apps, include progress info in case there is a pending
// install session post restart of device.
String appPackageName = app.getApplicationInfo().packageName;
SessionInfo si = mInstallingPkgsCached != null ? mInstallingPkgsCached.get(
new PackageUserKey(appPackageName, user))
: mSessionHelper.getActiveSessionInfo(user,
appPackageName);
if (si != null) {
appInfo.runtimeStatusFlags |= FLAG_INSTALL_SESSION_ACTIVE;
appInfo.setProgressLevel((int) (si.getProgress() * 100),
PackageInstallInfo.STATUS_INSTALLING);
if (Flags.enableSupportForArchiving()) {
if (app.getApplicationInfo().isArchived) {
// For archived apps, include progress info in case there is a pending
// install session post restart of device.
String appPackageName = app.getApplicationInfo().packageName;
SessionInfo si = mInstallingPkgsCached != null ? mInstallingPkgsCached.get(
new PackageUserKey(appPackageName, user))
: mSessionHelper.getActiveSessionInfo(user,
appPackageName);
if (si != null) {
appInfo.runtimeStatusFlags |= FLAG_INSTALL_SESSION_ACTIVE;
appInfo.setProgressLevel((int) (si.getProgress() * 100),
PackageInstallInfo.STATUS_INSTALLING);
}
}
}