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

Commit 77786d9e authored by Dario Freni's avatar Dario Freni
Browse files

Make SessionParams.setStaged SystemApi.

Bug: 123977800
Test: N/A
Change-Id: If5afd9d559261959b07a4618e7807c82f7643e11
parent 1466e4a4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -11482,7 +11482,6 @@ package android.content.pm {
    method public void setOriginatingUri(@Nullable android.net.Uri);
    method public void setReferrerUri(@Nullable android.net.Uri);
    method public void setSize(long);
    method public void setStaged();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.content.pm.PackageInstaller.SessionParams> CREATOR;
    field public static final int MODE_FULL_INSTALL = 1; // 0x1
+1 −0
Original line number Diff line number Diff line
@@ -1535,6 +1535,7 @@ package android.content.pm {
    method @RequiresPermission(android.Manifest.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS) public void setGrantedRuntimePermissions(String[]);
    method public void setInstallAsInstantApp(boolean);
    method public void setInstallAsVirtualPreload();
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setStaged();
  }
  public class PackageItemInfo {
+4 −5
Original line number Diff line number Diff line
@@ -791,11 +791,6 @@ public class PackageInstaller {
     * individual session IDs can be added with {@link #addChildSessionId(int)}
     * and commit of the multi-package session will result in all child sessions
     * being committed atomically.
     * <p>
     * If a package requires to be installed only at reboot, the session should
     * be marked as a staged session by calling {@link SessionParams#setStaged()}
     * with {@code true}. This can also apply to a multi-package session, in
     * which case all the packages in the session will be applied at reboot.
     */
    public static class Session implements Closeable {
        /** {@hide} */
@@ -1539,7 +1534,11 @@ public class PackageInstaller {
         * Staged sessions are scheduled to be installed at next reboot. Staged sessions can also be
         * multi-package. In that case, if any of the children sessions fail to install at reboot,
         * all the other children sessions are aborted as well.
         *
         * {@hide}
         */
        @SystemApi
        @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
        public void setStaged() {
            this.isStaged = true;
        }
+4 −0
Original line number Diff line number Diff line
@@ -481,6 +481,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
            }
        }

        if (params.isStaged) {
            mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG);
        }

        if (!params.isMultiPackage) {
            // Only system components can circumvent runtime permissions when installing.
            if ((params.installFlags & PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS) != 0