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

Commit d58ad802 authored by Yi-an Chen's avatar Yi-an Chen
Browse files

Deprecate permission tree APIs

Deprecate the permission tree APIs. There's no meaningful amount of
usage of dynamic permissions while it being a major source of security
defects.

Bug: 376535612
Test: Build
Flag: android.permission.flags.permission_tree_apis_deprecated
Change-Id: Ie3300614c21e793d7247aa637f5e6ce0f7b7408a
parent f98608d8
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -13217,8 +13217,8 @@ package android.content.pm {
  public abstract class PackageManager {
  public abstract class PackageManager {
    ctor @Deprecated public PackageManager();
    ctor @Deprecated public PackageManager();
    method @Deprecated public abstract void addPackageToPreferred(@NonNull String);
    method @Deprecated public abstract void addPackageToPreferred(@NonNull String);
    method public abstract boolean addPermission(@NonNull android.content.pm.PermissionInfo);
    method @Deprecated @FlaggedApi("android.permission.flags.permission_tree_apis_deprecated") public abstract boolean addPermission(@NonNull android.content.pm.PermissionInfo);
    method public abstract boolean addPermissionAsync(@NonNull android.content.pm.PermissionInfo);
    method @Deprecated @FlaggedApi("android.permission.flags.permission_tree_apis_deprecated") public abstract boolean addPermissionAsync(@NonNull android.content.pm.PermissionInfo);
    method @Deprecated public abstract void addPreferredActivity(@NonNull android.content.IntentFilter, int, @Nullable android.content.ComponentName[], @NonNull android.content.ComponentName);
    method @Deprecated public abstract void addPreferredActivity(@NonNull android.content.IntentFilter, int, @Nullable android.content.ComponentName[], @NonNull android.content.ComponentName);
    method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public boolean addWhitelistedRestrictedPermission(@NonNull String, @NonNull String, int);
    method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public boolean addWhitelistedRestrictedPermission(@NonNull String, @NonNull String, int);
    method public boolean canPackageQuery(@NonNull String, @NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public boolean canPackageQuery(@NonNull String, @NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
@@ -13359,7 +13359,7 @@ package android.content.pm {
    method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryServiceProperty(@NonNull String);
    method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryServiceProperty(@NonNull String);
    method public void relinquishUpdateOwnership(@NonNull String);
    method public void relinquishUpdateOwnership(@NonNull String);
    method @Deprecated public abstract void removePackageFromPreferred(@NonNull String);
    method @Deprecated public abstract void removePackageFromPreferred(@NonNull String);
    method public abstract void removePermission(@NonNull String);
    method @Deprecated @FlaggedApi("android.permission.flags.permission_tree_apis_deprecated") public abstract void removePermission(@NonNull String);
    method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public boolean removeWhitelistedRestrictedPermission(@NonNull String, @NonNull String, int);
    method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public boolean removeWhitelistedRestrictedPermission(@NonNull String, @NonNull String, int);
    method public void requestChecksums(@NonNull String, boolean, int, @NonNull java.util.List<java.security.cert.Certificate>, @NonNull android.content.pm.PackageManager.OnChecksumsReadyListener) throws java.security.cert.CertificateEncodingException, android.content.pm.PackageManager.NameNotFoundException;
    method public void requestChecksums(@NonNull String, boolean, int, @NonNull java.util.List<java.security.cert.Certificate>, @NonNull android.content.pm.PackageManager.OnChecksumsReadyListener) throws java.security.cert.CertificateEncodingException, android.content.pm.PackageManager.NameNotFoundException;
    method @Nullable public abstract android.content.pm.ResolveInfo resolveActivity(@NonNull android.content.Intent, int);
    method @Nullable public abstract android.content.pm.ResolveInfo resolveActivity(@NonNull android.content.Intent, int);
+24 −3
Original line number Original line Diff line number Diff line
@@ -6738,6 +6738,11 @@ public abstract class PackageManager {
     * If the given permission already exists, the info you supply here
     * If the given permission already exists, the info you supply here
     * will be used to update it.
     * will be used to update it.
     *
     *
     * @deprecated Support for dynamic permissions is going to be removed, and apps that use dynamic
     * permissions should declare their permissions statically inside their app manifest instead.
     * This method will become a no-op in a future Android release and eventually be removed from
     * the SDK.
     *
     * @param info Description of the permission to be added.
     * @param info Description of the permission to be added.
     *
     *
     * @return Returns true if a new permission was created, false if an
     * @return Returns true if a new permission was created, false if an
@@ -6748,7 +6753,9 @@ public abstract class PackageManager {
     *
     *
     * @see #removePermission(String)
     * @see #removePermission(String)
     */
     */
    //@Deprecated
    @SuppressWarnings("HiddenAbstractMethod")
    @FlaggedApi(android.permission.flags.Flags.FLAG_PERMISSION_TREE_APIS_DEPRECATED)
    @Deprecated
    public abstract boolean addPermission(@NonNull PermissionInfo info);
    public abstract boolean addPermission(@NonNull PermissionInfo info);


    /**
    /**
@@ -6757,8 +6764,15 @@ public abstract class PackageManager {
     * allowing it to return quicker and batch a series of adds at the
     * allowing it to return quicker and batch a series of adds at the
     * expense of no guarantee the added permission will be retained if
     * expense of no guarantee the added permission will be retained if
     * the device is rebooted before it is written.
     * the device is rebooted before it is written.
     *
     * @deprecated Support for dynamic permissions is going to be removed, and apps that use dynamic
     * permissions should declare their permissions statically inside their app manifest instead.
     * This method will become a no-op in a future Android release and eventually be removed from
     * the SDK.
     */
     */
    //@Deprecated
    @SuppressWarnings("HiddenAbstractMethod")
    @FlaggedApi(android.permission.flags.Flags.FLAG_PERMISSION_TREE_APIS_DEPRECATED)
    @Deprecated
    public abstract boolean addPermissionAsync(@NonNull PermissionInfo info);
    public abstract boolean addPermissionAsync(@NonNull PermissionInfo info);


    /**
    /**
@@ -6767,6 +6781,11 @@ public abstract class PackageManager {
     * -- you are only allowed to remove permissions that you are allowed
     * -- you are only allowed to remove permissions that you are allowed
     * to add.
     * to add.
     *
     *
     * @deprecated Support for dynamic permissions is going to be removed, and apps that use dynamic
     * permissions should declare their permissions statically inside their app manifest instead.
     * This method will become a no-op in a future Android release and eventually be removed from
     * the SDK.
     *
     * @param permName The name of the permission to remove.
     * @param permName The name of the permission to remove.
     *
     *
     * @throws SecurityException if you are not allowed to remove the
     * @throws SecurityException if you are not allowed to remove the
@@ -6774,7 +6793,9 @@ public abstract class PackageManager {
     *
     *
     * @see #addPermission(PermissionInfo)
     * @see #addPermission(PermissionInfo)
     */
     */
    //@Deprecated
    @SuppressWarnings("HiddenAbstractMethod")
    @FlaggedApi(android.permission.flags.Flags.FLAG_PERMISSION_TREE_APIS_DEPRECATED)
    @Deprecated
    public abstract void removePermission(@NonNull String permName);
    public abstract void removePermission(@NonNull String permName);


    /**
    /**