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

Commit 50fe08d6 authored by Todd Kennedy's avatar Todd Kennedy Committed by Automerger Merge Worker
Browse files

Merge "Define permission for installer API v2" into rvc-dev am: fb590035 am:...

Merge "Define permission for installer API v2" into rvc-dev am: fb590035 am: 1e83e7a9 am: 523d6f4e

Change-Id: Ibf278e1be887c9a2f492a90aa46ad983d3706b54
parents b2c8796f 523d6f4e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2030,10 +2030,10 @@ package android.content.pm {
  }
  public static class PackageInstaller.Session implements java.io.Closeable {
    method public void addFile(int, @NonNull String, long, @NonNull byte[], @Nullable byte[]);
    method @RequiresPermission("com.android.permission.USE_INSTALLER_V2") public void addFile(int, @NonNull String, long, @NonNull byte[], @Nullable byte[]);
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void commitTransferred(@NonNull android.content.IntentSender);
    method @Nullable public android.content.pm.DataLoaderParams getDataLoaderParams();
    method public void removeFile(int, @NonNull String);
    method @Nullable @RequiresPermission("com.android.permission.USE_INSTALLER_V2") public android.content.pm.DataLoaderParams getDataLoaderParams();
    method @RequiresPermission("com.android.permission.USE_INSTALLER_V2") public void removeFile(int, @NonNull String);
  }
  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
@@ -2054,7 +2054,7 @@ package android.content.pm {
  public static class PackageInstaller.SessionParams implements android.os.Parcelable {
    method @RequiresPermission(android.Manifest.permission.ALLOCATE_AGGRESSIVE) public void setAllocateAggressive(boolean);
    method @Deprecated public void setAllowDowngrade(boolean);
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setDataLoaderParams(@NonNull android.content.pm.DataLoaderParams);
    method @RequiresPermission(allOf={android.Manifest.permission.INSTALL_PACKAGES, "com.android.permission.USE_INSTALLER_V2"}) public void setDataLoaderParams(@NonNull android.content.pm.DataLoaderParams);
    method public void setDontKillApp(boolean);
    method public void setEnableRollback(boolean);
    method public void setEnableRollback(boolean, int);
+6 −1
Original line number Diff line number Diff line
@@ -1118,6 +1118,7 @@ public class PackageInstaller {
         * {@hide}
         */
        @SystemApi
        @RequiresPermission(android.Manifest.permission.USE_INSTALLER_V2)
        public @Nullable DataLoaderParams getDataLoaderParams() {
            try {
                DataLoaderParamsParcel data = mSession.getDataLoaderParams();
@@ -1157,6 +1158,7 @@ public class PackageInstaller {
         * {@hide}
         */
        @SystemApi
        @RequiresPermission(android.Manifest.permission.USE_INSTALLER_V2)
        public void addFile(@FileLocation int location, @NonNull String name, long lengthBytes,
                @NonNull byte[] metadata, @Nullable byte[] signature) {
            try {
@@ -1180,6 +1182,7 @@ public class PackageInstaller {
         * {@hide}
         */
        @SystemApi
        @RequiresPermission(android.Manifest.permission.USE_INSTALLER_V2)
        public void removeFile(@FileLocation int location, @NonNull String name) {
            try {
                mSession.removeFile(location, name);
@@ -1927,7 +1930,9 @@ public class PackageInstaller {
         * {@hide}
         */
        @SystemApi
        @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
        @RequiresPermission(allOf = {
                Manifest.permission.INSTALL_PACKAGES,
                Manifest.permission.USE_INSTALLER_V2})
        public void setDataLoaderParams(@NonNull DataLoaderParams dataLoaderParams) {
            this.dataLoaderParams = dataLoaderParams;
        }
+10 −0
Original line number Diff line number Diff line
@@ -3654,6 +3654,16 @@
    <permission android:name="com.android.permission.INSTALL_EXISTING_PACKAGES"
        android:protectionLevel="signature|privileged" />

    <!-- Allows an application to use the package installer v2 APIs.
         <p>The package installer v2 APIs are still a work in progress and we're
         currently validating they work in all scenarios.
         <p>Not for use by third-party applications.
         TODO(b/152310230): remove this permission once the APIs are confirmed to be sufficient.
         @hide
    -->
    <permission android:name="com.android.permission.USE_INSTALLER_V2"
        android:protectionLevel="signature|verifier" />

    <!-- @SystemApi @TestApi Allows an application to clear user data.
         <p>Not for use by third-party applications
         @hide
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@
    <uses-permission android:name="android.permission.READ_INPUT_STATE" />
    <uses-permission android:name="android.permission.SET_ORIENTATION" />
    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
    <!--  TODO(b/152310230): remove once APIs are confirmed to be sufficient -->
    <uses-permission android:name="com.android.permission.USE_INSTALLER_V2" />
    <uses-permission android:name="android.permission.MOVE_PACKAGE" />
    <uses-permission android:name="android.permission.CLEAR_APP_USER_DATA" />
    <uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
+8 −0
Original line number Diff line number Diff line
@@ -490,6 +490,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
            throw new SecurityException("User restriction prevents installing");
        }

        if (params.dataLoaderParams != null
                && mContext.checkCallingOrSelfPermission(Manifest.permission.USE_INSTALLER_V2)
                        != PackageManager.PERMISSION_GRANTED) {
            throw new SecurityException("You need the "
                    + "com.android.permission.USE_INSTALLER_V2 permission "
                    + "to use a data loader");
        }

        String requestedInstallerPackageName = params.installerPackageName != null
                ? params.installerPackageName : installerPackageName;

Loading