diff options
| author | 2019-02-07 18:08:04 +0000 | |
|---|---|---|
| committer | 2019-02-07 18:08:04 +0000 | |
| commit | 1189c0f9e879dbfc1f16e2bfc087a9cd235a4420 (patch) | |
| tree | b53cb04d90e7238bf2e9495d22eb6036a67e71c1 | |
| parent | 509d87c201bef48752c94af812137712bbdd059b (diff) | |
| parent | e210731480fc8147929cc13d779ae7f417f41986 (diff) | |
Merge "Remove usage info"
| -rw-r--r-- | api/current.txt | 40 | ||||
| -rw-r--r-- | core/java/android/content/Intent.java | 22 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageInfo.java | 18 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 88 | ||||
| -rw-r--r-- | core/java/android/content/pm/PermissionInfo.java | 10 | ||||
| -rw-r--r-- | core/java/android/content/pm/UsesPermissionInfo.java | 275 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 69 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values/attrs_manifest.xml | 79 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 10 | ||||
| -rw-r--r-- | packages/PrintSpooler/AndroidManifest.xml | 12 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 21 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/permission/BasePermission.java | 10 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java | 5 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/permission/PermissionManagerService.java | 7 | ||||
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java | 2 |
16 files changed, 52 insertions, 618 deletions
diff --git a/api/current.txt b/api/current.txt index b321c2248fda..b7577d1e1b85 100644 --- a/api/current.txt +++ b/api/current.txt @@ -224,6 +224,11 @@ package android { public static final class R.attr { ctor public R.attr(); + field public static final int __removed1 = 16844185; // 0x1010599 + field public static final int __removed2 = 16844186; // 0x101059a + field public static final int __removed3 = 16844187; // 0x101059b + field public static final int __removed4 = 16844188; // 0x101059c + field public static final int __removed5 = 16844189; // 0x101059d field public static final int absListViewStyle = 16842858; // 0x101006a field public static final int accessibilityEventTypes = 16843648; // 0x1010380 field public static final int accessibilityFeedbackType = 16843650; // 0x1010382 @@ -484,10 +489,6 @@ package android { field public static final int dashGap = 16843175; // 0x10101a7 field public static final int dashWidth = 16843174; // 0x10101a6 field public static final int data = 16842798; // 0x101002e - field public static final int dataRetentionTime = 16844189; // 0x101059d - field public static final int dataSentOffDevice = 16844186; // 0x101059a - field public static final int dataSharedWithThirdParty = 16844187; // 0x101059b - field public static final int dataUsedForMonetization = 16844188; // 0x101059c field public static final int datePickerDialogTheme = 16843948; // 0x10104ac field public static final int datePickerMode = 16843955; // 0x10104b3 field public static final int datePickerStyle = 16843612; // 0x101035c @@ -1508,7 +1509,6 @@ package android { field @Deprecated public static final int unfocusedMonthDateColor = 16843588; // 0x1010344 field public static final int unselectedAlpha = 16843278; // 0x101020e field public static final int updatePeriodMillis = 16843344; // 0x1010250 - field public static final int usageInfoRequired = 16844185; // 0x1010599 field public static final int use32bitAbi = 16844053; // 0x1010515 field public static final int useAppZygote = 16844184; // 0x1010598 field public static final int useDefaultMargins = 16843641; // 0x1010379 @@ -10265,7 +10265,6 @@ package android.content { field public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; field public static final String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED"; field public static final String ACTION_PASTE = "android.intent.action.PASTE"; - field public static final String ACTION_PERMISSION_USAGE_DETAILS = "android.intent.action.PERMISSION_USAGE_DETAILS"; field public static final String ACTION_PICK = "android.intent.action.PICK"; field public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"; field public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"; @@ -10391,7 +10390,6 @@ package android.content { field public static final String EXTRA_NOT_UNKNOWN_SOURCE = "android.intent.extra.NOT_UNKNOWN_SOURCE"; field public static final String EXTRA_ORIGINATING_URI = "android.intent.extra.ORIGINATING_URI"; field public static final String EXTRA_PACKAGE_NAME = "android.intent.extra.PACKAGE_NAME"; - field public static final String EXTRA_PERMISSION_USAGE_PERMISSIONS = "android.intent.extra.PERMISSION_USAGE_PERMISSIONS"; field public static final String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; field public static final String EXTRA_PROCESS_TEXT = "android.intent.extra.PROCESS_TEXT"; field public static final String EXTRA_PROCESS_TEXT_READONLY = "android.intent.extra.PROCESS_TEXT_READONLY"; @@ -11356,8 +11354,8 @@ package android.content.pm { field public android.content.pm.ProviderInfo[] providers; field public android.content.pm.ActivityInfo[] receivers; field public android.content.pm.FeatureInfo[] reqFeatures; - field @Deprecated public String[] requestedPermissions; - field @Deprecated public int[] requestedPermissionsFlags; + field public String[] requestedPermissions; + field public int[] requestedPermissionsFlags; field public android.content.pm.ServiceInfo[] services; field public String sharedUserId; field public int sharedUserLabel; @@ -11365,7 +11363,6 @@ package android.content.pm { field public android.content.pm.SigningInfo signingInfo; field public String[] splitNames; field public int[] splitRevisionCodes; - field public android.content.pm.UsesPermissionInfo[] usesPermissions; field @Deprecated public int versionCode; field public String versionName; } @@ -11865,7 +11862,6 @@ package android.content.pm { field public String group; field public CharSequence nonLocalizedDescription; field @Deprecated public int protectionLevel; - field public boolean usageInfoRequired; } public final class ProviderInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable { @@ -12057,28 +12053,6 @@ package android.content.pm { field public static final android.os.Parcelable.Creator<android.content.pm.SigningInfo> CREATOR; } - public final class UsesPermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { - method public int describeContents(); - method public int getDataRetention(); - method public int getDataRetentionWeeks(); - method public int getDataSentOffDevice(); - method public int getDataSharedWithThirdParty(); - method public int getDataUsedForMonetization(); - method public int getFlags(); - method public String getPermission(); - field public static final android.os.Parcelable.Creator<android.content.pm.UsesPermissionInfo> CREATOR; - field public static final int FLAG_REQUESTED_PERMISSION_GRANTED = 2; // 0x2 - field public static final int RETENTION_NOT_RETAINED = 1; // 0x1 - field public static final int RETENTION_SPECIFIED = 4; // 0x4 - field public static final int RETENTION_UNDEFINED = 0; // 0x0 - field public static final int RETENTION_UNLIMITED = 3; // 0x3 - field public static final int RETENTION_USER_SELECTED = 2; // 0x2 - field public static final int USAGE_NO = 3; // 0x3 - field public static final int USAGE_UNDEFINED = 0; // 0x0 - field public static final int USAGE_USER_TRIGGERED = 2; // 0x2 - field public static final int USAGE_YES = 1; // 0x1 - } - public final class VersionedPackage implements android.os.Parcelable { ctor public VersionedPackage(@NonNull String, int); ctor public VersionedPackage(@NonNull String, long); diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index a3021f371e19..d781a96420c7 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -817,28 +817,6 @@ public class Intent implements Parcelable, Cloneable { = "android.intent.action.SHOW_APP_INFO"; /** - * Activity Action: Start an activity to show the app's detailed usage information for - * permission protected data. - * - * The Intent contains an extra {@link #EXTRA_PERMISSION_USAGE_PERMISSIONS} that is of - * type {@code String[]} and contains the specific permissions to show information for. - * - * Apps should handle this intent if they want to provide more information about permission - * usage to users beyond the information provided in the manifest. - */ - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) - public static final String ACTION_PERMISSION_USAGE_DETAILS = - "android.intent.action.PERMISSION_USAGE_DETAILS"; - - /** - * The name of the extra used to contain the permissions in - * {@link #ACTION_PERMISSION_USAGE_DETAILS}. - * @see #ACTION_PERMISSION_USAGE_DETAILS - */ - public static final String EXTRA_PERMISSION_USAGE_PERMISSIONS = - "android.intent.extra.PERMISSION_USAGE_PERMISSIONS"; - - /** * Represents a shortcut/live folder icon resource. * * @see Intent#ACTION_CREATE_SHORTCUT diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java index 6d22277a5384..27a5b392855e 100644 --- a/core/java/android/content/pm/PackageInfo.java +++ b/core/java/android/content/pm/PackageInfo.java @@ -204,10 +204,7 @@ public class PackageInfo implements Parcelable { * {@link PackageManager#GET_PERMISSIONS} was set. This list includes * all permissions requested, even those that were not granted or known * by the system at install time. - * - * @deprecated Use {@link #usesPermissions} */ - @Deprecated public String[] requestedPermissions; /** @@ -217,23 +214,10 @@ public class PackageInfo implements Parcelable { * {@link PackageManager#GET_PERMISSIONS} was set. Each value matches * the corresponding entry in {@link #requestedPermissions}, and will have * the flag {@link #REQUESTED_PERMISSION_GRANTED} set as appropriate. - * - * @deprecated Use {@link #usesPermissions} */ - @Deprecated public int[] requestedPermissionsFlags; /** - * Array of all {@link android.R.styleable#AndroidManifestUsesPermission - * <uses-permission>} tags included under <manifest>, - * or null if there were none. This is only filled in if the flag - * {@link PackageManager#GET_PERMISSIONS} was set. This list includes - * all permissions requested, even those that were not granted or known - * by the system at install time. - */ - public UsesPermissionInfo[] usesPermissions; - - /** * Flag for {@link #requestedPermissionsFlags}: the requested permission * is required for the application to run; the user can not optionally * disable it. Currently all permissions are required. @@ -480,7 +464,6 @@ public class PackageInfo implements Parcelable { dest.writeTypedArray(permissions, parcelableFlags); dest.writeStringArray(requestedPermissions); dest.writeIntArray(requestedPermissionsFlags); - dest.writeTypedArray(usesPermissions, parcelableFlags); dest.writeTypedArray(signatures, parcelableFlags); dest.writeTypedArray(configPreferences, parcelableFlags); dest.writeTypedArray(reqFeatures, parcelableFlags); @@ -545,7 +528,6 @@ public class PackageInfo implements Parcelable { permissions = source.createTypedArray(PermissionInfo.CREATOR); requestedPermissions = source.createStringArray(); requestedPermissionsFlags = source.createIntArray(); - usesPermissions = source.createTypedArray(UsesPermissionInfo.CREATOR); signatures = source.createTypedArray(Signature.CREATOR); configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR); reqFeatures = source.createTypedArray(FeatureInfo.CREATOR); diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 81ed110d15ec..5020a94c3469 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -791,23 +791,18 @@ public class PackageParser { pi.permissions[i] = generatePermissionInfo(p.permissions.get(i), flags); } } - N = p.usesPermissionInfos.size(); + N = p.requestedPermissions.size(); if (N > 0) { pi.requestedPermissions = new String[N]; pi.requestedPermissionsFlags = new int[N]; - pi.usesPermissions = new UsesPermissionInfo[N]; for (int i=0; i<N; i++) { - UsesPermissionInfo info = p.usesPermissionInfos.get(i); - final String perm = info.getPermission(); + final String perm = p.requestedPermissions.get(i); pi.requestedPermissions[i] = perm; - int permissionFlags = 0; // The notion of required permissions is deprecated but for compatibility. - permissionFlags |= PackageInfo.REQUESTED_PERMISSION_REQUIRED; + pi.requestedPermissionsFlags[i] |= PackageInfo.REQUESTED_PERMISSION_REQUIRED; if (grantedPermissions != null && grantedPermissions.contains(perm)) { - permissionFlags |= PackageInfo.REQUESTED_PERMISSION_GRANTED; + pi.requestedPermissionsFlags[i] |= PackageInfo.REQUESTED_PERMISSION_GRANTED; } - pi.requestedPermissionsFlags[i] = permissionFlags; - pi.usesPermissions[i] = new UsesPermissionInfo(info, permissionFlags); } } } @@ -2175,12 +2170,12 @@ public class PackageParser { return null; } } else if (tagName.equals(TAG_USES_PERMISSION)) { - if (!parseUsesPermission(pkg, res, parser, outError)) { + if (!parseUsesPermission(pkg, res, parser)) { return null; } } else if (tagName.equals(TAG_USES_PERMISSION_SDK_M) || tagName.equals(TAG_USES_PERMISSION_SDK_23)) { - if (!parseUsesPermission(pkg, res, parser, outError)) { + if (!parseUsesPermission(pkg, res, parser)) { return null; } } else if (tagName.equals(TAG_USES_CONFIGURATION)) { @@ -2498,7 +2493,7 @@ public class PackageParser { newPermsMsg.append(' '); } newPermsMsg.append(npi.name); - addRequestedPermission(pkg, npi.name); + pkg.requestedPermissions.add(npi.name); pkg.implicitPermissions.add(npi.name); } } @@ -2519,7 +2514,7 @@ public class PackageParser { for (int in = 0; in < newPerms.size(); in++) { final String perm = newPerms.get(in); if (!pkg.requestedPermissions.contains(perm)) { - addRequestedPermission(pkg, perm); + pkg.requestedPermissions.add(perm); pkg.implicitPermissions.add(perm); } } @@ -2599,13 +2594,13 @@ public class PackageParser { } } else { if (FORCE_AUDIO_PACKAGES.contains(pkg.packageName)) { - addRequestedPermission(pkg, android.Manifest.permission.READ_MEDIA_AUDIO); + pkg.requestedPermissions.add(android.Manifest.permission.READ_MEDIA_AUDIO); } if (FORCE_VIDEO_PACKAGES.contains(pkg.packageName)) { - addRequestedPermission(pkg, android.Manifest.permission.READ_MEDIA_VIDEO); + pkg.requestedPermissions.add(android.Manifest.permission.READ_MEDIA_VIDEO); } if (FORCE_IMAGES_PACKAGES.contains(pkg.packageName)) { - addRequestedPermission(pkg, android.Manifest.permission.READ_MEDIA_IMAGES); + pkg.requestedPermissions.add(android.Manifest.permission.READ_MEDIA_IMAGES); } } @@ -2645,12 +2640,6 @@ public class PackageParser { } /** - * Helper method for adding a requested permission to a package outside of a uses-permission. - */ - private void addRequestedPermission(Package pkg, String permission) { - pkg.requestedPermissions.add(permission); - pkg.usesPermissionInfos.add(new UsesPermissionInfo(permission)); - } /** * Matches a given {@code targetCode} against a set of release codeNames. Target codes can @@ -2987,8 +2976,8 @@ public class PackageParser { return certSha256Digests; } - private boolean parseUsesPermission(Package pkg, Resources res, XmlResourceParser parser, - String[] outError) throws XmlPullParserException, IOException { + private boolean parseUsesPermission(Package pkg, Resources res, XmlResourceParser parser) + throws XmlPullParserException, IOException { TypedArray sa = res.obtainAttributes(parser, com.android.internal.R.styleable.AndroidManifestUsesPermission); @@ -3012,44 +3001,6 @@ public class PackageParser { final String requiredNotfeature = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestUsesPermission_requiredNotFeature, 0); - int dataSentOffDevice = sa.getInt( - com.android.internal.R.styleable.AndroidManifestUsesPermission_dataSentOffDevice, 0); - - int dataSharedWithThirdParty = sa.getInt( - com.android.internal.R.styleable.AndroidManifestUsesPermission_dataSharedWithThirdParty, 0); - - int dataUsedForMonetization = sa.getInt( - com.android.internal.R.styleable.AndroidManifestUsesPermission_dataUsedForMonetization, 0); - - int retentionWeeks = -1; - int retention; - - String rawRetention = sa.getString( - com.android.internal.R.styleable.AndroidManifestUsesPermission_dataRetentionTime); - - if (rawRetention == null) { - retention = UsesPermissionInfo.RETENTION_UNDEFINED; - } else if ("notRetained".equals(rawRetention)) { - retention = UsesPermissionInfo.RETENTION_NOT_RETAINED; - } else if ("userSelected".equals(rawRetention)) { - retention = UsesPermissionInfo.RETENTION_USER_SELECTED; - } else if ("unlimited".equals(rawRetention)) { - retention = UsesPermissionInfo.RETENTION_UNLIMITED; - } else { - // A number of weeks was specified - retention = UsesPermissionInfo.RETENTION_SPECIFIED; - retentionWeeks = sa.getInt( - com.android.internal.R.styleable.AndroidManifestUsesPermission_dataRetentionTime, - -1); - - if (retentionWeeks < 0) { - outError[0] = "Bad value provided for dataRetentionTime."; - mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED; - XmlUtils.skipCurrentTag(parser); - sa.recycle(); - return false; - } - } sa.recycle(); XmlUtils.skipCurrentTag(parser); @@ -3082,10 +3033,6 @@ public class PackageParser { + parser.getPositionDescription()); } - UsesPermissionInfo info = new UsesPermissionInfo(name, dataSentOffDevice, - dataSharedWithThirdParty, dataUsedForMonetization, retention, retentionWeeks); - pkg.usesPermissionInfos.add(info); - return true; } @@ -3420,10 +3367,6 @@ public class PackageParser { perm.info.flags = sa.getInt( com.android.internal.R.styleable.AndroidManifestPermission_permissionFlags, 0); - perm.info.usageInfoRequired = sa.getInt( - com.android.internal.R.styleable.AndroidManifestPermission_usageInfoRequired, 0) - != 0; - sa.recycle(); if (perm.info.protectionLevel == -1) { @@ -6625,9 +6568,6 @@ public class PackageParser { @UnsupportedAppUsage public final ArrayList<String> requestedPermissions = new ArrayList<String>(); - public final ArrayList<UsesPermissionInfo> usesPermissionInfos = - new ArrayList<>(); - /** Permissions requested but not in the manifest. */ public final ArrayList<String> implicitPermissions = new ArrayList<>(); @@ -7159,7 +7099,6 @@ public class PackageParser { dest.readStringList(requestedPermissions); internStringArrayList(requestedPermissions); - dest.readParcelableList(usesPermissionInfos, boot); dest.readStringList(implicitPermissions); internStringArrayList(implicitPermissions); protectedBroadcasts = dest.createStringArrayList(); @@ -7327,7 +7266,6 @@ public class PackageParser { dest.writeParcelableList(instrumentation, flags); dest.writeStringList(requestedPermissions); - dest.writeParcelableList(usesPermissionInfos, flags); dest.writeStringList(implicitPermissions); dest.writeStringList(protectedBroadcasts); diff --git a/core/java/android/content/pm/PermissionInfo.java b/core/java/android/content/pm/PermissionInfo.java index fb63e0dad9b6..e24523406ab8 100644 --- a/core/java/android/content/pm/PermissionInfo.java +++ b/core/java/android/content/pm/PermissionInfo.java @@ -20,7 +20,6 @@ import android.annotation.IntDef; import android.annotation.SystemApi; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; -import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; @@ -368,12 +367,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { */ public CharSequence nonLocalizedDescription; - /** - * If {@code true} an application targeting {@link Build.VERSION_CODES#Q} <em>must</em> - * include permission data usage information in order to be able to be granted this permission. - */ - public boolean usageInfoRequired; - /** @hide */ public static int fixProtectionLevel(int level) { if (level == PROTECTION_SIGNATURE_OR_SYSTEM) { @@ -475,7 +468,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { descriptionRes = orig.descriptionRes; requestRes = orig.requestRes; nonLocalizedDescription = orig.nonLocalizedDescription; - usageInfoRequired = orig.usageInfoRequired; } /** @@ -540,7 +532,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { dest.writeInt(descriptionRes); dest.writeInt(requestRes); TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags); - dest.writeInt(usageInfoRequired ? 1 : 0); } /** @hide */ @@ -581,6 +572,5 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { descriptionRes = source.readInt(); requestRes = source.readInt(); nonLocalizedDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); - usageInfoRequired = source.readInt() != 0; } } diff --git a/core/java/android/content/pm/UsesPermissionInfo.java b/core/java/android/content/pm/UsesPermissionInfo.java deleted file mode 100644 index d08548fa31a5..000000000000 --- a/core/java/android/content/pm/UsesPermissionInfo.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.content.pm; - -import android.annotation.IntDef; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.RetentionPolicy; -/** - * Information you can retrive about a particular application requested permission. This - * corresponds to information collected from the AndroidManifest.xml's <uses-permission> - * tags. - */ -public final class UsesPermissionInfo extends PackageItemInfo implements Parcelable { - - /** - * Flag for {@link #getFlags()}: the requested permission is currently granted to the - * application. - */ - public static final int FLAG_REQUESTED_PERMISSION_GRANTED = 1 << 1; - - /** @hide */ - @IntDef(flag = true, prefix = {"FLAG_"}, value = {FLAG_REQUESTED_PERMISSION_GRANTED}) - @java.lang.annotation.Retention(RetentionPolicy.SOURCE) - public @interface Flags {} - - /** An unset value for {@link #getDataSentOffDevice()}, - * {@link #getDataSharedWithThirdParty()}, and {@link #getDataUsedForMonetization()} - */ - public static final int USAGE_UNDEFINED = 0; - - /** - * A yes value for {@link #getDataSentOffDevice()}, {@link #getDataSharedWithThirdParty()}, - * and {@link #getDataUsedForMonetization()} corresponding to the <code>yes</code> value of - * {@link android.R.attr#dataSentOffDevice}, {@link android.R.attr#dataSharedWithThirdParty}, - * and {@link android.R.attr#dataUsedForMonetization} attributes. - */ - public static final int USAGE_YES = 1; - - /** - * A user triggered only value for {@link #getDataSentOffDevice()}, - * {@link #getDataSharedWithThirdParty()}, and {@link #getDataUsedForMonetization()} - * corresponding to the <code>userTriggered</code> value of - * {@link android.R.attr#dataSentOffDevice}, {@link android.R.attr#dataSharedWithThirdParty}, - * and {@link android.R.attr#dataUsedForMonetization} attributes. - */ - public static final int USAGE_USER_TRIGGERED = 2; - - /** - * A no value for {@link #getDataSentOffDevice()}, {@link #getDataSharedWithThirdParty()}, - * and {@link #getDataUsedForMonetization()} corresponding to the <code>no</code> value of - * {@link android.R.attr#dataSentOffDevice}, {@link android.R.attr#dataSharedWithThirdParty}, - * and {@link android.R.attr#dataUsedForMonetization} attributes. - */ - public static final int USAGE_NO = 3; - - /** @hide */ - @IntDef(prefix = {"USAGE_"}, value = { - USAGE_UNDEFINED, - USAGE_YES, - USAGE_USER_TRIGGERED, - USAGE_NO}) - @java.lang.annotation.Retention(RetentionPolicy.SOURCE) - public @interface Usage {} - - /** - * An unset value for {@link #getDataRetention}. - */ - public static final int RETENTION_UNDEFINED = 0; - - /** - * A data not retained value for {@link #getDataRetention()} corresponding to the - * <code>notRetained</code> value of {@link android.R.attr#dataRetentionTime}. - */ - public static final int RETENTION_NOT_RETAINED = 1; - - /** - * A user selected value for {@link #getDataRetention()} corresponding to the - * <code>userSelected</code> value of {@link android.R.attr#dataRetentionTime}. - */ - public static final int RETENTION_USER_SELECTED = 2; - - /** - * An unlimited value for {@link #getDataRetention()} corresponding to the - * <code>unlimited</code> value of {@link android.R.attr#dataRetentionTime}. - */ - public static final int RETENTION_UNLIMITED = 3; - - /** - * A specified value for {@link #getDataRetention()} corresponding to providing the number of - * weeks data is retained in {@link android.R.attr#dataRetentionTime}. The number of weeks - * is available in {@link #getDataRetentionWeeks()}. - */ - public static final int RETENTION_SPECIFIED = 4; - - /** @hide */ - @IntDef(prefix = {"RETENTION_"}, value = { - RETENTION_UNDEFINED, - RETENTION_NOT_RETAINED, - RETENTION_USER_SELECTED, - RETENTION_UNLIMITED, - RETENTION_SPECIFIED}) - @java.lang.annotation.Retention(RetentionPolicy.SOURCE) - public @interface Retention {} - - private final String mPermission; - private final @Flags int mFlags; - private final @Usage int mDataSentOffDevice; - private final @Usage int mDataSharedWithThirdParty; - private final @Usage int mDataUsedForMonetization; - private final @Retention int mDataRetention; - private final int mDataRetentionWeeks; - - /** @hide */ - public UsesPermissionInfo(String permission) { - mPermission = permission; - mDataSentOffDevice = USAGE_UNDEFINED; - mDataSharedWithThirdParty = USAGE_UNDEFINED; - mDataUsedForMonetization = USAGE_UNDEFINED; - mDataRetention = RETENTION_UNDEFINED; - mDataRetentionWeeks = -1; - mFlags = 0; - } - - /** @hide */ - public UsesPermissionInfo(String permission, - @Usage int dataSentOffDevice, @Usage int dataSharedWithThirdParty, - @Usage int dataUsedForMonetization, @Retention int dataRetention, - int dataRetentionWeeks) { - mPermission = permission; - mDataSentOffDevice = dataSentOffDevice; - mDataSharedWithThirdParty = dataSharedWithThirdParty; - mDataUsedForMonetization = dataUsedForMonetization; - mDataRetention = dataRetention; - mDataRetentionWeeks = dataRetentionWeeks; - mFlags = 0; - } - - /** @hide */ - public UsesPermissionInfo(UsesPermissionInfo orig) { - this(orig, orig.mFlags); - } - - /** @hide */ - public UsesPermissionInfo(UsesPermissionInfo orig, int flags) { - super(orig); - mPermission = orig.mPermission; - mFlags = flags; - mDataSentOffDevice = orig.mDataSentOffDevice; - mDataSharedWithThirdParty = orig.mDataSharedWithThirdParty; - mDataUsedForMonetization = orig.mDataUsedForMonetization; - mDataRetention = orig.mDataRetention; - mDataRetentionWeeks = orig.mDataRetentionWeeks; - } - - /** - * The name of the requested permission. - */ - public String getPermission() { - return mPermission; - } - - public @Flags int getFlags() { - return mFlags; - } - - /** - * If the application sends the data guarded by this permission off the device. - * - * See {@link android.R.attr#dataSentOffDevice} - */ - public @Usage int getDataSentOffDevice() { - return mDataSentOffDevice; - } - - /** - * If the application or its services shares the data guarded by this permission with third - * parties. - * - * See {@link android.R.attr#dataSharedWithThirdParty} - */ - public @Usage int getDataSharedWithThirdParty() { - return mDataSharedWithThirdParty; - } - - /** - * If the application or its services use the data guarded by this permission for monetization - * purposes. - * - * See {@link android.R.attr#dataUsedForMonetization} - */ - public @Usage int getDataUsedForMonetization() { - return mDataUsedForMonetization; - } - - /** - * How long the application or its services store the data guarded by this permission. - * If set to {@link #RETENTION_SPECIFIED} {@link #getDataRetentionWeeks()} will contain the - * number of weeks the data is stored. - * - * See {@link android.R.attr#dataRetentionTime} - */ - public @Retention int getDataRetention() { - return mDataRetention; - } - - /** - * If {@link #getDataRetention()} is {@link #RETENTION_SPECIFIED} the number of weeks the - * application or its services store data guarded by this permission. - * - * @throws IllegalStateException if {@link #getDataRetention} is not - * {@link #RETENTION_SPECIFIED}. - */ - public int getDataRetentionWeeks() { - if (mDataRetention != RETENTION_SPECIFIED) { - throw new IllegalStateException("Data retention weeks not specified"); - } - return mDataRetentionWeeks; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeString(mPermission); - dest.writeInt(mFlags); - dest.writeInt(mDataSentOffDevice); - dest.writeInt(mDataSharedWithThirdParty); - dest.writeInt(mDataUsedForMonetization); - dest.writeInt(mDataRetention); - dest.writeInt(mDataRetentionWeeks); - } - - private UsesPermissionInfo(Parcel source) { - super(source); - mPermission = source.readString(); - mFlags = source.readInt(); - mDataSentOffDevice = source.readInt(); - mDataSharedWithThirdParty = source.readInt(); - mDataUsedForMonetization = source.readInt(); - mDataRetention = source.readInt(); - mDataRetentionWeeks = source.readInt(); - } - - public static final Creator<UsesPermissionInfo> CREATOR = - new Creator<UsesPermissionInfo>() { - @Override - public UsesPermissionInfo createFromParcel(Parcel source) { - return new UsesPermissionInfo(source); - } - @Override - public UsesPermissionInfo[] newArray(int size) { - return new UsesPermissionInfo[size]; - } - }; -} diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 60b04cf6c77b..07dd26e4969b 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -662,8 +662,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_readContacts" android:description="@string/permdesc_readContacts" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to write the user's contacts data. <p>Protection level: dangerous @@ -694,8 +693,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_readCalendar" android:description="@string/permdesc_readCalendar" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to write the user's calendar data. <p>Protection level: dangerous @@ -736,8 +734,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_receiveSms" android:description="@string/permdesc_receiveSms" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to read SMS messages. <p>Protection level: dangerous @@ -746,8 +743,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_readSms" android:description="@string/permdesc_readSms" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to receive WAP push messages. <p>Protection level: dangerous @@ -756,8 +752,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_receiveWapPush" android:description="@string/permdesc_receiveWapPush" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to monitor incoming MMS messages. <p>Protection level: dangerous @@ -766,8 +761,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_receiveMms" android:description="@string/permdesc_receiveMms" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- @SystemApi @TestApi Allows an application to read previously received cell broadcast messages and to register a content observer to get notifications when @@ -785,8 +779,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_readCellBroadcasts" android:description="@string/permdesc_readCellBroadcasts" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- ====================================================================== --> <!-- Permissions for accessing external storage --> @@ -867,8 +860,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_audioRead" android:description="@string/permdesc_audioRead" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Runtime permission controlling access to the user's shared visual media collection, including images and videos. --> @@ -884,16 +876,14 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_imagesRead" android:description="@string/permdesc_imagesRead" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to read the user's shared video collection. --> <permission android:name="android.permission.READ_MEDIA_VIDEO" android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_videoRead" android:description="@string/permdesc_videoRead" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to access any geographic locations persisted in the user's shared collection. --> @@ -901,8 +891,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_mediaLocation" android:description="@string/permdesc_mediaLocation" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- @hide @SystemApi @TestApi Allows an application to modify OBB files visible to other apps. --> @@ -934,8 +923,7 @@ android:label="@string/permlab_accessFineLocation" android:description="@string/permdesc_accessFineLocation" android:backgroundPermission="android.permission.ACCESS_BACKGROUND_LOCATION" - android:protectionLevel="dangerous|instant" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous|instant" /> <!-- Allows an app to access approximate location. Alternatively, you might want {@link #ACCESS_FINE_LOCATION}. @@ -946,8 +934,7 @@ android:label="@string/permlab_accessCoarseLocation" android:description="@string/permdesc_accessCoarseLocation" android:backgroundPermission="android.permission.ACCESS_BACKGROUND_LOCATION" - android:protectionLevel="dangerous|instant" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous|instant" /> <!-- Allows an app to access location in the background. If you are requesting this, you should also request {@link #ACCESS_FINE_LOCATION}. @@ -959,8 +946,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_accessBackgroundLocation" android:description="@string/permdesc_accessBackgroundLocation" - android:protectionLevel="dangerous|instant" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous|instant" /> <!-- ====================================================================== --> <!-- Permissions for accessing the call log --> @@ -1001,8 +987,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_readCallLog" android:description="@string/permdesc_readCallLog" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an application to write (but not read) the user's call log data. @@ -1032,8 +1017,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_processOutgoingCalls" android:description="@string/permdesc_processOutgoingCalls" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- ====================================================================== --> <!-- Permissions for accessing the device telephony --> @@ -1065,8 +1049,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_readPhoneState" android:description="@string/permdesc_readPhoneState" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows read access to the device's phone number(s). This is a subset of the capabilities granted by {@link #READ_PHONE_STATE} but is exposed to instant applications. @@ -1075,8 +1058,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_readPhoneNumbers" android:description="@string/permdesc_readPhoneNumbers" - android:protectionLevel="dangerous|instant" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous|instant" /> <!-- Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call. @@ -1178,8 +1160,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_recordAudio" android:description="@string/permdesc_recordAudio" - android:protectionLevel="dangerous|instant" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous|instant" /> <!-- ====================================================================== --> <!-- Permissions for activity recognition --> @@ -1202,8 +1183,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_activityRecognition" android:description="@string/permdesc_activityRecognition" - android:protectionLevel="dangerous|instant" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous|instant" /> <!-- ====================================================================== --> <!-- Permissions for accessing the UCE Service --> @@ -1252,8 +1232,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_camera" android:description="@string/permdesc_camera" - android:protectionLevel="dangerous|instant" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous|instant" /> <!-- ====================================================================== --> @@ -1277,8 +1256,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_bodySensors" android:description="@string/permdesc_bodySensors" - android:protectionLevel="dangerous" - android:usageInfoRequired="true" /> + android:protectionLevel="dangerous" /> <!-- Allows an app to use fingerprint hardware. <p>Protection level: normal @@ -1780,8 +1758,7 @@ android:permissionGroup="android.permission-group.UNDEFINED" android:protectionLevel="dangerous" android:description="@string/permdesc_getAccounts" - android:label="@string/permlab_getAccounts" - android:usageInfoRequired="true" /> + android:label="@string/permlab_getAccounts" /> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <!-- Allows applications to call into AccountAuthenticators. diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index fa3a549463f5..46e14b41960c 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2426,6 +2426,8 @@ </attr> <attr name="__removed3" /> + <attr name="__removed4" /> + <attr name="__removed5" /> <!-- Describes the content of a view so that a autofill service can fill in the appropriate data. Multiple hints can be combined in a comma separated list or an array of strings diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 881688bd00c0..53cae638db80 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -1689,10 +1689,6 @@ <attr name="request" /> <attr name="protectionLevel" /> <attr name="permissionFlags" /> - <!-- If {@code true} applications that target Q <em>must</em> specify the permission usage - attributes in their {@code uses-permission} elements or the permission will not be - granted. --> - <attr name="usageInfoRequired" format="boolean" /> </declare-styleable> <!-- The <code>permission-group</code> tag declares a logical grouping of @@ -1792,81 +1788,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" /> - - <!-- Specify if the app uploads data, or derived data, guarded by this permission. - - If the permission is defined with {@link android.R.attr#usageInfoRequired} - {@code true} this <em>must</em> be specified by apps that target Android Q or the - permission will not be granted, it will be as if the manifest didn't request it at all. - --> - <attr name="dataSentOffDevice"> - <!-- The application may send data, or derived data, guarded by this permission off of the - device. --> - <enum name="yes" value="1" /> - <!-- The application may send data, or derived data, guarded by this permission off of the - device, however it will only do so when explicitly triggered by a user action. --> - <enum name="userTriggered" value="2" /> - <!-- The application does not send data, or derived data, guarded by this permission off - of the device. --> - <enum name="no" value="3" /> - </attr> - - <!-- Specify if the application or its related off-device services provide data, - or derived data, guarded by this permission to third parties outside of the developer's - organization that do not qualify as data processors. - - If the permission is defined with {@link android.R.attr#usageInfoRequired} - {@code true} this <em>must</em> be specified by apps that target Android Q or the - permission will not be granted, it will be as if the manifest didn't request it at all. - --> - <attr name="dataSharedWithThirdParty"> - <!-- The application or its services may provide data, or derived data, guarded by this - permission to third party organizations. --> - <enum name="yes" value="1" /> - <!-- The application or its services may provide data, or derived data, guarded by this - permission to third party organizations, however it will only do so when explicitly - triggered by a user action. --> - <enum name="userTriggered" value="2" /> - <!-- The application or its services does not provide data, or derived data, guarded by - this permission to third party organizations. --> - <enum name="no" value="3" /> - </attr> - - <!-- Specify if the application or its related off-device services use data, - or derived data, guarded by this permission for monetization purposes. - - For example, if the data is sold to another party or used for targeting advertisements - this must be set to {@code yes}. - - If the permission is defined with {@link android.R.attr#usageInfoRequired} - {@code true} this <em>must</em> be specified by apps that target Android Q or the - permission will not be granted, it will be as if the manifest didn't request it at all. - --> - <attr name="dataUsedForMonetization"> - <!-- The application or its services may use data, or derived data, guarded by this - permission for monetization purposes. --> - <enum name="yes" value="1" /> - <!-- The application or its services may use data, or derived data, guarded by this - permission for monetization purposes, however it will only do so when explicity - triggered by a user action. --> - <enum name="userTriggered" value="2" /> - <!-- The application or its services does not use data, or derived data, guarded by - this permission for monetization purposes. --> - <enum name="no" value="3" /> - </attr> - - <!-- Specify how long the application or its related off-device services store - data, or derived data, guarded by this permission. - - This can be one of "notRetained", "userSelected", "unlimited", or a number - representing the number of weeks the data is retained. - - If the permission is defined with {@link android.R.attr#usageInfoRequired} - {@code true} this <em>must</em> be specified by apps that target Android Q or the - permission will not be granted, it will be as if the manifest didn't request it at all. - --> - <attr name="dataRetentionTime" format="string" /> - </declare-styleable> <!-- The <code>uses-configuration</code> tag specifies diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index f84f1f1bdb4f..e6d478aadae0 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2925,11 +2925,11 @@ <public name="importantForContentCapture" /> <public name="supportsMultipleDisplays" /> <public name="useAppZygote" /> - <public name="usageInfoRequired" /> - <public name="dataSentOffDevice" /> - <public name="dataSharedWithThirdParty" /> - <public name="dataUsedForMonetization" /> - <public name="dataRetentionTime" /> + <public name="__removed1" /> + <public name="__removed2" /> + <public name="__removed3" /> + <public name="__removed4" /> + <public name="__removed5" /> <public name="selectionDividerHeight" /> <public name="foregroundServiceType" /> <public name="hasFragileUserData" /> diff --git a/packages/PrintSpooler/AndroidManifest.xml b/packages/PrintSpooler/AndroidManifest.xml index 478ee54b40e5..cd6abb267e44 100644 --- a/packages/PrintSpooler/AndroidManifest.xml +++ b/packages/PrintSpooler/AndroidManifest.xml @@ -37,16 +37,8 @@ <uses-permission android:name="android.permission.READ_PRINT_SERVICES" /> <uses-permission android:name="android.permission.READ_PRINT_SERVICE_RECOMMENDATIONS" /> - <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" - android:dataSentOffDevice="no" - android:dataSharedWithThirdParty="no" - android:dataUsedForMonetization="no" - android:dataRetentionTime="unlimited"/> - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" - android:dataSentOffDevice="no" - android:dataSharedWithThirdParty="no" - android:dataUsedForMonetization="no" - android:dataRetentionTime="unlimited"/> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <application android:allowClearUserData="true" diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 32dc98837854..eaedec597359 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -195,7 +195,6 @@ import android.content.pm.SharedLibraryInfo; import android.content.pm.Signature; import android.content.pm.SuspendDialogInfo; import android.content.pm.UserInfo; -import android.content.pm.UsesPermissionInfo; import android.content.pm.VerifierDeviceIdentity; import android.content.pm.VerifierInfo; import android.content.pm.VersionedPackage; @@ -11313,26 +11312,6 @@ public class PackageManagerService extends IPackageManager.Stub } } } - - // Check permission usage info requirements. - if (pkg.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q) { - for (UsesPermissionInfo upi : pkg.usesPermissionInfos) { - if (!mPermissionManager.isPermissionUsageInfoRequired(upi.getPermission())) { - continue; - } - if (upi.getDataSentOffDevice() == UsesPermissionInfo.USAGE_UNDEFINED - || upi.getDataSharedWithThirdParty() - == UsesPermissionInfo.USAGE_UNDEFINED - || upi.getDataUsedForMonetization() - == UsesPermissionInfo.USAGE_UNDEFINED - || upi.getDataRetention() == UsesPermissionInfo.RETENTION_UNDEFINED) { - // STOPSHIP: Make this throw - Slog.e(TAG, "Package " + pkg.packageName + " does not provide usage " - + "information for permission " + upi.getPermission() - + ". This will be a fatal error in Q."); - } - } - } } } diff --git a/services/core/java/com/android/server/pm/permission/BasePermission.java b/services/core/java/com/android/server/pm/permission/BasePermission.java index 173d9a0551df..1957eb89fd0c 100644 --- a/services/core/java/com/android/server/pm/permission/BasePermission.java +++ b/services/core/java/com/android/server/pm/permission/BasePermission.java @@ -105,8 +105,6 @@ public final class BasePermission { */ private boolean perUser; - boolean usageInfoRequired; - public BasePermission(String _name, String _sourcePackageName, @PermissionType int _type) { name = _name; sourcePackageName = _sourcePackageName; @@ -375,7 +373,6 @@ public final class BasePermission { } if (bp.perm == p) { bp.protectionLevel = p.info.protectionLevel; - bp.usageInfoRequired = p.info.usageInfoRequired; } if (PackageManagerService.DEBUG_PACKAGE_SCANNING && r != null) { Log.d(TAG, " Permissions: " + r); @@ -455,7 +452,6 @@ public final class BasePermission { permissionInfo.packageName = sourcePackageName; permissionInfo.nonLocalizedLabel = name; permissionInfo.protectionLevel = protectionLevel; - permissionInfo.usageInfoRequired = usageInfoRequired; return permissionInfo; } @@ -484,7 +480,6 @@ public final class BasePermission { bp.protectionLevel = readInt(parser, null, "protection", PermissionInfo.PROTECTION_NORMAL); bp.protectionLevel = PermissionInfo.fixProtectionLevel(bp.protectionLevel); - bp.usageInfoRequired = readInt(parser, null, "usageInfoRequired", 0) != 0; if (dynamic) { final PermissionInfo pi = new PermissionInfo(); pi.packageName = sourcePackage.intern(); @@ -492,7 +487,6 @@ public final class BasePermission { pi.icon = readInt(parser, null, "icon", 0); pi.nonLocalizedLabel = parser.getAttributeValue(null, "label"); pi.protectionLevel = bp.protectionLevel; - pi.usageInfoRequired = bp.usageInfoRequired; bp.pendingPermissionInfo = pi; } out.put(bp.name, bp); @@ -525,7 +519,6 @@ public final class BasePermission { if (protectionLevel != PermissionInfo.PROTECTION_NORMAL) { serializer.attribute(null, "protection", Integer.toString(protectionLevel)); } - serializer.attribute(null, "usageInfoRequired", usageInfoRequired ? "1" : "0"); if (type == BasePermission.TYPE_DYNAMIC) { final PermissionInfo pi = perm != null ? perm.info : pendingPermissionInfo; if (pi != null) { @@ -562,7 +555,6 @@ public final class BasePermission { if (!compareStrings(pi1.nonLocalizedLabel, pi2.nonLocalizedLabel)) return false; // We'll take care of setting this one. if (!compareStrings(pi1.packageName, pi2.packageName)) return false; - if (pi1.usageInfoRequired != pi2.usageInfoRequired) return false; // These are not currently stored in settings. //if (!compareStrings(pi1.group, pi2.group)) return false; //if (!compareStrings(pi1.nonLocalizedDescription, pi2.nonLocalizedDescription)) return false; @@ -610,8 +602,6 @@ public final class BasePermission { pw.print(" enforced="); pw.println(readEnforced); } - pw.print(" usageInfoRequired="); - pw.println(usageInfoRequired); return true; } } diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java b/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java index 189d0f476a8c..f4979746bae3 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java @@ -181,9 +181,4 @@ public abstract class PermissionManagerInternal { /** HACK HACK methods to allow for partial migration of data to the PermissionManager class */ public abstract @Nullable BasePermission getPermissionTEMP(@NonNull String permName); - - /** - * Returns {@code true} if {@code permName} has {@code usageInfoRequired} set. - */ - public abstract boolean isPermissionUsageInfoRequired(@NonNull String permName); } diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java index a4413f963642..38940d6241a6 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -2737,12 +2737,5 @@ public class PermissionManagerService { return mSettings.getPermissionLocked(permName); } } - @Override - public boolean isPermissionUsageInfoRequired(String permName) { - synchronized (PermissionManagerService.this.mLock) { - BasePermission bp = mSettings.getPermissionLocked(permName); - return bp != null && bp.usageInfoRequired; - } - } } } diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java index 85909d564a7b..72357ceee099 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java @@ -31,7 +31,6 @@ import android.content.pm.ProviderInfo; import android.content.pm.ServiceInfo; import android.content.pm.SharedLibraryInfo; import android.content.pm.Signature; -import android.content.pm.UsesPermissionInfo; import android.os.Bundle; import android.os.Parcel; import android.platform.test.annotations.Presubmit; @@ -466,7 +465,6 @@ public class PackageParserTest { pkg.services.add(new PackageParser.Service(dummy, new ServiceInfo())); pkg.instrumentation.add(new PackageParser.Instrumentation(dummy, new InstrumentationInfo())); pkg.requestedPermissions.add("foo7"); - pkg.usesPermissionInfos.add(new UsesPermissionInfo("foo7")); pkg.implicitPermissions.add("foo25"); pkg.protectedBroadcasts = new ArrayList<>(); |