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

Commit fbd5f87a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Introduce per-app API for installer whitelisting" into rvc-dev am: 41b448e3 am: 013e7892

Change-Id: I89a719797503bb51149c37930ed2facf7f86b767
parents df0f6c11 013e7892
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -11896,6 +11896,7 @@ package android.content.pm {
    method public void setAppIcon(@Nullable android.graphics.Bitmap);
    method public void setAppIcon(@Nullable android.graphics.Bitmap);
    method public void setAppLabel(@Nullable CharSequence);
    method public void setAppLabel(@Nullable CharSequence);
    method public void setAppPackageName(@Nullable String);
    method public void setAppPackageName(@Nullable String);
    method public void setAutoRevokePermissionsMode(boolean);
    method public void setInstallLocation(int);
    method public void setInstallLocation(int);
    method public void setInstallReason(int);
    method public void setInstallReason(int);
    method public void setMultiPackage();
    method public void setMultiPackage();
@@ -12025,6 +12026,7 @@ package android.content.pm {
    method public boolean hasSigningCertificate(int, @NonNull byte[], int);
    method public boolean hasSigningCertificate(int, @NonNull byte[], int);
    method public abstract boolean hasSystemFeature(@NonNull String);
    method public abstract boolean hasSystemFeature(@NonNull String);
    method public abstract boolean hasSystemFeature(@NonNull String, int);
    method public abstract boolean hasSystemFeature(@NonNull String, int);
    method @RequiresPermission(value="android.permission.WHITELIST_AUTO_REVOKE_PERMISSIONS", conditional=true) public boolean isAutoRevokeWhitelisted(@NonNull String);
    method public boolean isAutoRevokeWhitelisted();
    method public boolean isAutoRevokeWhitelisted();
    method public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable);
    method public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable);
    method public boolean isDeviceUpgrading();
    method public boolean isDeviceUpgrading();
@@ -12050,6 +12052,7 @@ package android.content.pm {
    method @Nullable public abstract android.content.pm.ResolveInfo resolveService(@NonNull android.content.Intent, int);
    method @Nullable public abstract android.content.pm.ResolveInfo resolveService(@NonNull android.content.Intent, int);
    method public abstract void setApplicationCategoryHint(@NonNull String, int);
    method public abstract void setApplicationCategoryHint(@NonNull String, int);
    method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setApplicationEnabledSetting(@NonNull String, int, int);
    method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setApplicationEnabledSetting(@NonNull String, int, int);
    method @RequiresPermission(value="android.permission.WHITELIST_AUTO_REVOKE_PERMISSIONS", conditional=true) public boolean setAutoRevokeWhitelisted(@NonNull String, boolean);
    method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setComponentEnabledSetting(@NonNull android.content.ComponentName, int, int);
    method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setComponentEnabledSetting(@NonNull android.content.ComponentName, int, int);
    method public abstract void setInstallerPackageName(@NonNull String, @Nullable String);
    method public abstract void setInstallerPackageName(@NonNull String, @Nullable String);
    method public void setMimeGroup(@NonNull String, @NonNull java.util.Set<java.lang.String>);
    method public void setMimeGroup(@NonNull String, @NonNull java.util.Set<java.lang.String>);
+2 −0
Original line number Original line Diff line number Diff line
@@ -235,6 +235,7 @@ package android {
    field public static final String UPGRADE_RUNTIME_PERMISSIONS = "android.permission.UPGRADE_RUNTIME_PERMISSIONS";
    field public static final String UPGRADE_RUNTIME_PERMISSIONS = "android.permission.UPGRADE_RUNTIME_PERMISSIONS";
    field public static final String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
    field public static final String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
    field public static final String USE_RESERVED_DISK = "android.permission.USE_RESERVED_DISK";
    field public static final String USE_RESERVED_DISK = "android.permission.USE_RESERVED_DISK";
    field public static final String WHITELIST_AUTO_REVOKE_PERMISSIONS = "android.permission.WHITELIST_AUTO_REVOKE_PERMISSIONS";
    field public static final String WHITELIST_RESTRICTED_PERMISSIONS = "android.permission.WHITELIST_RESTRICTED_PERMISSIONS";
    field public static final String WHITELIST_RESTRICTED_PERMISSIONS = "android.permission.WHITELIST_RESTRICTED_PERMISSIONS";
    field public static final String WIFI_SET_DEVICE_MOBILITY_STATE = "android.permission.WIFI_SET_DEVICE_MOBILITY_STATE";
    field public static final String WIFI_SET_DEVICE_MOBILITY_STATE = "android.permission.WIFI_SET_DEVICE_MOBILITY_STATE";
    field public static final String WIFI_UPDATE_USABILITY_STATS_SCORE = "android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE";
    field public static final String WIFI_UPDATE_USABILITY_STATS_SCORE = "android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE";
@@ -2132,6 +2133,7 @@ package android.content.pm {
  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
    method public boolean getAllocateAggressive();
    method public boolean getAllocateAggressive();
    method @Deprecated public boolean getAllowDowngrade();
    method @Deprecated public boolean getAllowDowngrade();
    method public int getAutoRevokePermissionsMode();
    method public boolean getDontKillApp();
    method public boolean getDontKillApp();
    method public boolean getEnableRollback();
    method public boolean getEnableRollback();
    method @Nullable public String[] getGrantedRuntimePermissions();
    method @Nullable public String[] getGrantedRuntimePermissions();
+1 −0
Original line number Original line Diff line number Diff line
@@ -933,6 +933,7 @@ package android.content.pm {
  }
  }


  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
    method public int getAutoRevokePermissionsMode();
    method public int getRollbackDataPolicy();
    method public int getRollbackDataPolicy();
    method @NonNull public java.util.Set<java.lang.String> getWhitelistedRestrictedPermissions();
    method @NonNull public java.util.Set<java.lang.String> getWhitelistedRestrictedPermissions();
  }
  }
+13 −1
Original line number Original line Diff line number Diff line
@@ -1071,9 +1071,17 @@ public class AppOpsManager {
    /** @hide Auto-revoke app permissions if app is unused for an extended period */
    /** @hide Auto-revoke app permissions if app is unused for an extended period */
    public static final int OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED = 97;
    public static final int OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED = 97;


    /**
     * Whether {@link #OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED} is allowed to be changed by
     * the installer
     *
     * @hide
     */
    public static final int OP_AUTO_REVOKE_MANAGED_BY_INSTALLER = 98;

    /** @hide */
    /** @hide */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    public static final int _NUM_OP = 98;
    public static final int _NUM_OP = 99;


    /** Access to coarse location information. */
    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1463,6 +1471,7 @@ public class AppOpsManager {
            OP_LOADER_USAGE_STATS,
            OP_LOADER_USAGE_STATS,
            OP_ACCESS_CALL_AUDIO,
            OP_ACCESS_CALL_AUDIO,
            OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED,
            OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED,
            OP_AUTO_REVOKE_MANAGED_BY_INSTALLER,
    };
    };


    /**
    /**
@@ -1572,6 +1581,7 @@ public class AppOpsManager {
            OP_LOADER_USAGE_STATS,              // LOADER_USAGE_STATS
            OP_LOADER_USAGE_STATS,              // LOADER_USAGE_STATS
            OP_ACCESS_CALL_AUDIO,               // ACCESS_CALL_AUDIO
            OP_ACCESS_CALL_AUDIO,               // ACCESS_CALL_AUDIO
            OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED, //AUTO_REVOKE_PERMISSIONS_IF_UNUSED
            OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED, //AUTO_REVOKE_PERMISSIONS_IF_UNUSED
            OP_AUTO_REVOKE_MANAGED_BY_INSTALLER, //OP_AUTO_REVOKE_MANAGED_BY_INSTALLER
    };
    };


    /**
    /**
@@ -1887,6 +1897,7 @@ public class AppOpsManager {
            android.Manifest.permission.LOADER_USAGE_STATS,
            android.Manifest.permission.LOADER_USAGE_STATS,
            Manifest.permission.ACCESS_CALL_AUDIO,
            Manifest.permission.ACCESS_CALL_AUDIO,
            null, // no permission for OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED
            null, // no permission for OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED
            null, // no permission for OP_AUTO_REVOKE_MANAGED_BY_INSTALLER
    };
    };


    /**
    /**
@@ -2202,6 +2213,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_DEFAULT, // LOADER_USAGE_STATS
            AppOpsManager.MODE_DEFAULT, // LOADER_USAGE_STATS
            AppOpsManager.MODE_DEFAULT, // ACCESS_CALL_AUDIO
            AppOpsManager.MODE_DEFAULT, // ACCESS_CALL_AUDIO
            AppOpsManager.MODE_DEFAULT, // OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED
            AppOpsManager.MODE_DEFAULT, // OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED
            AppOpsManager.MODE_ALLOWED, // OP_AUTO_REVOKE_MANAGED_BY_INSTALLER
    };
    };


    /**
    /**
+21 −0
Original line number Original line Diff line number Diff line
@@ -839,6 +839,27 @@ public class ApplicationPackageManager extends PackageManager {
        }
        }
    }
    }


    @Override
    public boolean setAutoRevokeWhitelisted(
            @NonNull String packageName, boolean whitelisted) {
        try {
            final int userId = getUserId();
            return mPermissionManager.setAutoRevokeWhitelisted(packageName, whitelisted, userId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @Override
    public boolean isAutoRevokeWhitelisted(@NonNull String packageName) {
        try {
            final int userId = getUserId();
            return mPermissionManager.isAutoRevokeWhitelisted(packageName, userId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @Override
    @Override
    public boolean removeWhitelistedRestrictedPermission(@NonNull String packageName,
    public boolean removeWhitelistedRestrictedPermission(@NonNull String packageName,
            @NonNull String permName, @PermissionWhitelistFlags int flags) {
            @NonNull String permName, @PermissionWhitelistFlags int flags) {
Loading