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

Commit 71bb10f5 authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Don't require unrelated permissions for install archived.

Fixes: 312593468
Test: atest android.content.pm.cts.PackageManagerTest
Change-Id: Ib26f339f46106720540eaf1c9bd8209ab237dc92
parent ee26e36b
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -1672,13 +1672,15 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
                archivedPackageParcel);

        // Create and commit install archived session.
        // Session belongs to the system_server and would not appear anywhere in the Public APIs.
        Binder.withCleanCallingIdentity(() -> {
            PackageInstallerSession session = null;
            try {
            var sessionId = createSessionInternal(params, installerPackageName,
                    null /*installerAttributionTag*/, Binder.getCallingUid(), userId);
                var sessionId = createSessionInternal(params, installerPackageName, null
                        /*installerAttributionTag*/, Binder.getCallingUid(), userId);
                session = openSessionInternal(sessionId);
            session.addFile(LOCATION_DATA_APP, "base", 0 /*lengthBytes*/, metadata.toByteArray(),
                    null /*signature*/);
                session.addFile(LOCATION_DATA_APP, "base", 0 /*lengthBytes*/,
                        metadata.toByteArray(), null /*signature*/);
                session.commit(statusReceiver, false /*forTransfer*/);
            } catch (IOException e) {
                throw ExceptionUtils.wrap(e);
@@ -1687,6 +1689,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
                    session.close();
                }
            }
        });
    }

    private static int getSessionCount(SparseArray<PackageInstallerSession> sessions,