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

Commit 264a5f5b authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Treat moving app as installing in new location." into lmp-dev

parents c47b18fb 381d94b7
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -8670,6 +8670,7 @@ package android.content.pm {
  }
  }
  public class PackageInstaller {
  public class PackageInstaller {
    method public void abandonSession(int);
    method public void addSessionCallback(android.content.pm.PackageInstaller.SessionCallback);
    method public void addSessionCallback(android.content.pm.PackageInstaller.SessionCallback);
    method public void addSessionCallback(android.content.pm.PackageInstaller.SessionCallback, android.os.Handler);
    method public void addSessionCallback(android.content.pm.PackageInstaller.SessionCallback, android.os.Handler);
    method public int createSession(android.content.pm.PackageInstaller.SessionParams) throws java.io.IOException;
    method public int createSession(android.content.pm.PackageInstaller.SessionParams) throws java.io.IOException;
+2 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,8 @@ import android.content.IntentSender;
/** {@hide} */
/** {@hide} */
interface IPackageInstaller {
interface IPackageInstaller {
    int createSession(in PackageInstaller.SessionParams params, String installerPackageName, int userId);
    int createSession(in PackageInstaller.SessionParams params, String installerPackageName, int userId);
    void abandonSession(int sessionId);

    IPackageInstallerSession openSession(int sessionId);
    IPackageInstallerSession openSession(int sessionId);


    PackageInstaller.SessionInfo getSessionInfo(int sessionId);
    PackageInstaller.SessionInfo getSessionInfo(int sessionId);
+8 −0
Original line number Original line Diff line number Diff line
@@ -312,6 +312,14 @@ public class PackageInstaller {
        }
        }
    }
    }


    public void abandonSession(int sessionId) {
        try {
            mInstaller.abandonSession(sessionId);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    /**
    /**
     * Return details for a specific session. To succeed, the caller must either
     * Return details for a specific session. To succeed, the caller must either
     * own this session, or be the current home app.
     * own this session, or be the current home app.
+14 −4
Original line number Original line Diff line number Diff line
@@ -456,6 +456,8 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
            throw new SecurityException("User restriction prevents installing");
            throw new SecurityException("User restriction prevents installing");
        }
        }


        // TODO: double check all possible install flags

        if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID)) {
        if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID)) {
            installerPackageName = "com.android.shell";
            installerPackageName = "com.android.shell";


@@ -578,6 +580,17 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
        return sessionId;
        return sessionId;
    }
    }


    @Override
    public void abandonSession(int sessionId) {
        synchronized (mSessions) {
            final PackageInstallerSession session = mSessions.get(sessionId);
            if (session == null || !isCallingUidOwner(session)) {
                throw new SecurityException("Caller has no access to session " + sessionId);
            }
            session.abandon();
        }
    }

    private void checkInternalStorage(long sizeBytes) throws IOException {
    private void checkInternalStorage(long sizeBytes) throws IOException {
        if (sizeBytes <= 0) return;
        if (sizeBytes <= 0) return;


@@ -606,10 +619,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
    public IPackageInstallerSession openSession(int sessionId) {
    public IPackageInstallerSession openSession(int sessionId) {
        synchronized (mSessions) {
        synchronized (mSessions) {
            final PackageInstallerSession session = mSessions.get(sessionId);
            final PackageInstallerSession session = mSessions.get(sessionId);
            if (session == null) {
            if (session == null || !isCallingUidOwner(session)) {
                throw new IllegalStateException("Missing session " + sessionId);
            }
            if (!isCallingUidOwner(session)) {
                throw new SecurityException("Caller has no access to session " + sessionId);
                throw new SecurityException("Caller has no access to session " + sessionId);
            }
            }
            session.open();
            session.open();
+232 −526

File changed.

Preview size limit exceeded, changes collapsed.