Revert "Introduce a manifest flag for auto-revoke exemption request"
This reverts commit 76badfcf14.
Reason for revert: Superceded by ag/10519773
Test: presubmit
Bug: 146513245
Change-Id: If7320c44cd774093ddd62a45e0fd01c528dc6499
This commit is contained in:
@@ -290,7 +290,6 @@ package android {
|
||||
field public static final int allowAudioPlaybackCapture = 16844289; // 0x1010601
|
||||
field public static final int allowBackup = 16843392; // 0x1010280
|
||||
field public static final int allowClearUserData = 16842757; // 0x1010005
|
||||
field public static final int allowDontAutoRevokeWhenUnused = 16844310; // 0x1010616
|
||||
field public static final int allowEmbedded = 16843765; // 0x10103f5
|
||||
field public static final int allowNativeHeapPointerTagging = 16844307; // 0x1010613
|
||||
field public static final int allowParallelSyncs = 16843570; // 0x1010332
|
||||
@@ -539,7 +538,6 @@ package android {
|
||||
field public static final int dividerPadding = 16843562; // 0x101032a
|
||||
field public static final int dividerVertical = 16843530; // 0x101030a
|
||||
field public static final int documentLaunchMode = 16843845; // 0x1010445
|
||||
field public static final int dontAutoRevokeWhenUnused = 16844311; // 0x1010617
|
||||
field public static final int drawSelectorOnTop = 16843004; // 0x10100fc
|
||||
field public static final int drawable = 16843161; // 0x1010199
|
||||
field public static final int drawableBottom = 16843118; // 0x101016e
|
||||
@@ -574,7 +572,7 @@ package android {
|
||||
field public static final int elevation = 16843840; // 0x1010440
|
||||
field public static final int ellipsize = 16842923; // 0x10100ab
|
||||
field public static final int ems = 16843096; // 0x1010158
|
||||
field public static final int enableGwpAsan = 16844312; // 0x1010618
|
||||
field public static final int enableGwpAsan = 16844310; // 0x1010616
|
||||
field public static final int enableVrMode = 16844069; // 0x1010525
|
||||
field public static final int enabled = 16842766; // 0x101000e
|
||||
field public static final int end = 16843996; // 0x10104dc
|
||||
@@ -82244,3 +82242,4 @@ package org.xmlpull.v1.sax2 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8954,8 +8954,6 @@ package android.permission {
|
||||
}
|
||||
|
||||
public final class PermissionManager {
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY) public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAutoRevokeExemptionGrantedPermissions();
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY) public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAutoRevokeExemptionRequestedPermissions();
|
||||
method @IntRange(from=0) @RequiresPermission(anyOf={android.Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY, android.Manifest.permission.UPGRADE_RUNTIME_PERMISSIONS}) public int getRuntimePermissionsVersion();
|
||||
method @NonNull public java.util.List<android.permission.PermissionManager.SplitPermissionInfo> getSplitPermissions();
|
||||
method @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS) public void grantDefaultPermissionsToEnabledCarrierApps(@NonNull String[], @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
|
||||
|
||||
@@ -85,10 +85,6 @@ public interface ParsingPackage extends ParsingPackageRead {
|
||||
|
||||
ParsingPackage addRequestedPermission(String permission);
|
||||
|
||||
ParsingPackage addAutoRevokeExemptionRequestedPermission(String permission);
|
||||
|
||||
ParsingPackage addAutoRevokeExemptionGrantedPermission(String permission);
|
||||
|
||||
ParsingPackage addService(ParsedService parsedService);
|
||||
|
||||
ParsingPackage addUsesLibrary(String libraryName);
|
||||
|
||||
@@ -218,15 +218,6 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(ForInternedStringList.class)
|
||||
private List<String> requestedPermissions = emptyList();
|
||||
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(ForInternedStringList.class)
|
||||
private List<String> autoRevokeExemptionRequestedPermissions = emptyList();
|
||||
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(ForInternedStringList.class)
|
||||
private List<String> autoRevokeExemptionGrantedPermissions = emptyList();
|
||||
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(ForInternedStringList.class)
|
||||
private List<String> implicitPermissions = emptyList();
|
||||
@@ -587,20 +578,6 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl addAutoRevokeExemptionRequestedPermission(String permission) {
|
||||
this.autoRevokeExemptionRequestedPermissions = CollectionUtils.add(
|
||||
this.autoRevokeExemptionRequestedPermissions, TextUtils.safeIntern(permission));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl addAutoRevokeExemptionGrantedPermission(String permission) {
|
||||
this.autoRevokeExemptionGrantedPermissions = CollectionUtils.add(
|
||||
this.autoRevokeExemptionGrantedPermissions, TextUtils.safeIntern(permission));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl addImplicitPermission(String permission) {
|
||||
this.implicitPermissions = CollectionUtils.add(this.implicitPermissions,
|
||||
@@ -1483,19 +1460,10 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return adoptPermissions;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<String> getRequestedPermissions() {
|
||||
return CollectionUtils.emptyIfNull(requestedPermissions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAutoRevokeExemptionRequestedPermissions() {
|
||||
return CollectionUtils.emptyIfNull(autoRevokeExemptionRequestedPermissions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAutoRevokeExemptionGrantedPermissions() {
|
||||
return CollectionUtils.emptyIfNull(autoRevokeExemptionGrantedPermissions);
|
||||
return requestedPermissions;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -202,20 +202,6 @@ public interface ParsingPackageRead extends Parcelable {
|
||||
@NonNull
|
||||
List<String> getRequestedPermissions();
|
||||
|
||||
/**
|
||||
* Permissions that specified {@code allowDontAutoRevokeWhenUnused=true}
|
||||
* in their {@code uses-permission} requests.
|
||||
*/
|
||||
@NonNull
|
||||
List<String> getAutoRevokeExemptionRequestedPermissions();
|
||||
|
||||
/**
|
||||
* Permissions that specified {@code dontAutoRevokeWhenUnused=true}
|
||||
* in their {@code uses-permission} requests.
|
||||
*/
|
||||
@NonNull
|
||||
List<String> getAutoRevokeExemptionGrantedPermissions();
|
||||
|
||||
/**
|
||||
* Whether or not the app requested explicitly resizeable Activities.
|
||||
* A null value means nothing was explicitly requested.
|
||||
|
||||
@@ -986,14 +986,6 @@ public class ParsingPackageUtils {
|
||||
R.styleable.AndroidManifestUsesPermission_requiredNotFeature,
|
||||
0);
|
||||
|
||||
final boolean dontAutoRevoke = sa.getBoolean(
|
||||
R.styleable.AndroidManifestUsesPermission_allowDontAutoRevokeWhenUnused,
|
||||
false);
|
||||
|
||||
final boolean dontAutoRevokeApproved = sa.getBoolean(
|
||||
R.styleable.AndroidManifestUsesPermission_dontAutoRevokeWhenUnused,
|
||||
false);
|
||||
|
||||
XmlUtils.skipCurrentTag(parser);
|
||||
|
||||
// Can only succeed from here on out
|
||||
@@ -1003,14 +995,6 @@ public class ParsingPackageUtils {
|
||||
return success;
|
||||
}
|
||||
|
||||
if (dontAutoRevoke) {
|
||||
pkg.addAutoRevokeExemptionRequestedPermission(name);
|
||||
}
|
||||
|
||||
if (dontAutoRevokeApproved) {
|
||||
pkg.addAutoRevokeExemptionGrantedPermission(name);
|
||||
}
|
||||
|
||||
if ((maxSdkVersion != 0) && (maxSdkVersion < Build.VERSION.RESOURCES_SDK_INT)) {
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -106,10 +106,4 @@ interface IPermissionManager {
|
||||
int importanceToResetTimer, int importanceToKeepSessionAlive);
|
||||
|
||||
void stopOneTimePermissionSession(String packageName, int userId);
|
||||
|
||||
/** Map<String, List<String>> */
|
||||
Map getAutoRevokeExemptionRequestedPermissions(int userId);
|
||||
|
||||
/** Map<String, List<String>> */
|
||||
Map getAutoRevokeExemptionGrantedPermissions(int userId);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ import com.android.internal.annotations.Immutable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Consumer;
|
||||
@@ -300,54 +299,6 @@ public final class PermissionManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map of:
|
||||
*
|
||||
* packageName -> [permissionName]
|
||||
*
|
||||
* Of packages that have permissions that specified {@code allowDontAutoRevokeWhenUnused=true}
|
||||
* in their {@code uses-permission} requests.
|
||||
*
|
||||
* @return the map of values for current user
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@NonNull
|
||||
@RequiresPermission(Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY)
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, List<String>> getAutoRevokeExemptionRequestedPermissions() {
|
||||
try {
|
||||
return mPermissionManager.getAutoRevokeExemptionRequestedPermissions(
|
||||
mContext.getUser().getIdentifier());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map of:
|
||||
*
|
||||
* packageName -> [permissionName]
|
||||
*
|
||||
* Of packages that have permissions that specified {@code dontAutoRevokeWhenUnused=true}
|
||||
* in their {@code uses-permission} requests.
|
||||
*
|
||||
* @return the map of values for current user
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@NonNull
|
||||
@RequiresPermission(Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY)
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, List<String>> getAutoRevokeExemptionGrantedPermissions() {
|
||||
try {
|
||||
return mPermissionManager.getAutoRevokeExemptionGrantedPermissions(
|
||||
mContext.getUser().getIdentifier());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
private List<SplitPermissionInfo> splitPermissionInfoListToNonParcelableList(
|
||||
List<SplitPermissionInfoParcelable> parcelableList) {
|
||||
final int size = parcelableList.size();
|
||||
|
||||
@@ -1983,14 +1983,6 @@
|
||||
requested. If it does support the feature, it will be as if the manifest didn't
|
||||
request it at all. -->
|
||||
<attr name="requiredNotFeature" format="string" />
|
||||
<!-- Optional: Whether to allow requesting that this permission don't get automatically
|
||||
revoked when the app is unused for an extended amount of time.
|
||||
Defaults to false. -->
|
||||
<attr name="allowDontAutoRevokeWhenUnused" format="boolean" />
|
||||
<!-- Optional: Whether this permission shouldn't get automatically
|
||||
revoked when the app is unused for an extended amount of time.
|
||||
Defaults to false. -->
|
||||
<attr name="dontAutoRevokeWhenUnused" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- The <code>uses-configuration</code> tag specifies
|
||||
|
||||
@@ -3015,8 +3015,6 @@
|
||||
<public name="allowNativeHeapPointerTagging" />
|
||||
<public name="preserveLegacyExternalStorage" />
|
||||
<public name="mimeGroup" />
|
||||
<public name="allowDontAutoRevokeWhenUnused" />
|
||||
<public name="dontAutoRevokeWhenUnused" />
|
||||
<public name="enableGwpAsan" />
|
||||
</public-group>
|
||||
|
||||
|
||||
@@ -822,7 +822,7 @@ public abstract class PackageManagerInternal {
|
||||
|
||||
/**
|
||||
* Perform the given action for each installed package for a user.
|
||||
* Note that packages lock will be held while performing the actions.
|
||||
* Note that packages lock will be held while performin the actions.
|
||||
*/
|
||||
public abstract void forEachInstalledPackage(
|
||||
@NonNull Consumer<AndroidPackage> actionLocked, @UserIdInt int userId);
|
||||
|
||||
@@ -38,7 +38,6 @@ import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
|
||||
import static android.permission.PermissionManager.KILL_APP_REASON_GIDS_CHANGED;
|
||||
import static android.permission.PermissionManager.KILL_APP_REASON_PERMISSIONS_REVOKED;
|
||||
|
||||
import static com.android.internal.util.CollectionUtils.isEmpty;
|
||||
import static com.android.server.pm.PackageManagerService.DEBUG_INSTALL;
|
||||
import static com.android.server.pm.PackageManagerService.DEBUG_PACKAGE_SCANNING;
|
||||
import static com.android.server.pm.PackageManagerService.DEBUG_PERMISSIONS;
|
||||
@@ -3094,36 +3093,6 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getAutoRevokeExemptionRequestedPermissions(int userId) {
|
||||
mContext.enforceCallingPermission(Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY,
|
||||
"Must hold " + Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY);
|
||||
|
||||
ArrayMap<String, List<String>> result = new ArrayMap<>();
|
||||
mPackageManagerInt.forEachInstalledPackage(pkg -> {
|
||||
List<String> perms = pkg.getAutoRevokeExemptionRequestedPermissions();
|
||||
if (!isEmpty(perms)) {
|
||||
result.put(pkg.getPackageName(), perms);
|
||||
}
|
||||
}, userId);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getAutoRevokeExemptionGrantedPermissions(int userId) {
|
||||
mContext.enforceCallingPermission(Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY,
|
||||
"Must hold " + Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY);
|
||||
|
||||
ArrayMap<String, List<String>> result = new ArrayMap<>();
|
||||
mPackageManagerInt.forEachInstalledPackage(pkg -> {
|
||||
List<String> perms = pkg.getAutoRevokeExemptionGrantedPermissions();
|
||||
if (!isEmpty(perms)) {
|
||||
result.put(pkg.getPackageName(), perms);
|
||||
}
|
||||
}, userId);
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isNewPlatformPermissionForPackage(String perm, AndroidPackage pkg) {
|
||||
boolean allowed = false;
|
||||
final int NP = PackageParser.NEW_PERMISSIONS.length;
|
||||
|
||||
Reference in New Issue
Block a user