[incremental/pm] check for incremental apps when LauncherAppsService starts
If an incremental app is not fully loaded before reboot, we need to keep showing the loading progress after reboot. Previously we only register the listener callback when the app is installed. Now we also register the listener on reboot in LauncherAppsService. BUG: 182272641 Test: manual Change-Id: I44af6f5958226ccb1a6229ee28db6227df645996
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user