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

Commit 4065d443 authored by Chandan Nath's avatar Chandan Nath
Browse files

[Multi-user] Change PackageManagerService to pass in userId to

restoreAtInstall.

Bug: 121198024

Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) atest GtsBackupTestCases
6) atest GtsBackupHostTestCases

Change-Id: I880bff4903b373888a1031bda60ef43ecf448420
parent d5186844
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -13713,14 +13713,15 @@ public class PackageManagerService extends IPackageManager.Stub
            IBackupManager bm = IBackupManager.Stub.asInterface(
                    ServiceManager.getService(Context.BACKUP_SERVICE));
            if (bm != null) {
                int userId = args.user.getIdentifier();
                if (DEBUG_INSTALL) {
                    Log.v(TAG, "token " + token + " to BM for possible restore");
                    Log.v(TAG, "token " + token + " to BM for possible restore for user " + userId);
                }
                Trace.asyncTraceBegin(TRACE_TAG_PACKAGE_MANAGER, "restore", token);
                try {
                    // TODO: http://b/22388012
                    if (bm.isBackupServiceActive(UserHandle.USER_SYSTEM)) {
                        bm.restoreAtInstall(res.pkg.applicationInfo.packageName, token);
                    if (bm.isBackupServiceActive(userId)) {
                        bm.restoreAtInstallForUser(
                                userId, res.pkg.applicationInfo.packageName, token);
                    } else {
                        doRestore = false;
                    }