Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8c30b1d authored by Songchun Fan's avatar Songchun Fan Committed by Automerger Merge Worker
Browse files

[incremental/pm] check for incremental apps when LauncherAppsService starts am: d9eaeefb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13819391

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I22deb92dcc8e3b4cfd095a942304d3d7f2f0a302
parents 3d00a700 d9eaeefb
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IInterface;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -114,6 +115,7 @@ public class LauncherAppsService extends SystemService {
    @Override
    public void onStart() {
        publishBinderService(Context.LAUNCHER_APPS_SERVICE, mLauncherAppsImpl);
        mLauncherAppsImpl.registerLoadingProgressForIncrementalApps();
    }

    static class BroadcastCookie {
@@ -1184,6 +1186,30 @@ public class LauncherAppsService extends SystemService {
            mCallbackHandler.post(r);
        }

        /**
         * Check all installed apps and if a package is installed via Incremental and not fully
         * loaded, register loading progress listener.
         */
        void registerLoadingProgressForIncrementalApps() {
            final PackageManagerInternal pmInt =
                    LocalServices.getService(PackageManagerInternal.class);
            final List<UserHandle> users = mUm.getUserProfiles();
            if (users == null) {
                return;
            }
            for (UserHandle user : users) {
                pmInt.forEachInstalledPackage(pkg -> {
                    final String packageName = pkg.getPackageName();
                    if (pmInt.getIncrementalStatesInfo(packageName, Process.myUid(),
                            user.getIdentifier()).isLoading()) {
                        pmInt.registerInstalledLoadingProgressCallback(packageName,
                                new PackageLoadingProgressCallback(packageName, user),
                                user.getIdentifier());
                    }
                }, user.getIdentifier());
            }
        }

        public static class ShortcutChangeHandler implements LauncherApps.ShortcutChangeCallback {
            private final UserManagerInternal mUserManagerInternal;