Merge "Expose removed permissions flag as system API" into nyc-dev

This commit is contained in:
Svetoslav Ganov
2016-02-23 02:21:00 +00:00
committed by Android (Google) Code Review
5 changed files with 28 additions and 22 deletions

View File

@@ -10283,6 +10283,7 @@ package android.content.pm {
field public static final android.os.Parcelable.Creator<android.content.pm.PermissionInfo> CREATOR; field public static final android.os.Parcelable.Creator<android.content.pm.PermissionInfo> CREATOR;
field public static final int FLAG_COSTS_MONEY = 1; // 0x1 field public static final int FLAG_COSTS_MONEY = 1; // 0x1
field public static final int FLAG_INSTALLED = 1073741824; // 0x40000000 field public static final int FLAG_INSTALLED = 1073741824; // 0x40000000
field public static final int FLAG_REMOVED = 2; // 0x2
field public static final int PROTECTION_DANGEROUS = 1; // 0x1 field public static final int PROTECTION_DANGEROUS = 1; // 0x1
field public static final int PROTECTION_FLAG_APPOP = 64; // 0x40 field public static final int PROTECTION_FLAG_APPOP = 64; // 0x40
field public static final int PROTECTION_FLAG_DEVELOPMENT = 32; // 0x20 field public static final int PROTECTION_FLAG_DEVELOPMENT = 32; // 0x20

View File

@@ -16,6 +16,7 @@
package android.content.pm; package android.content.pm;
import android.annotation.SystemApi;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.text.TextUtils; import android.text.TextUtils;
@@ -145,11 +146,12 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
public static final int FLAG_COSTS_MONEY = 1<<0; public static final int FLAG_COSTS_MONEY = 1<<0;
/** /**
* Flag for {@link #flags}, corresponding to <code>hidden</code> * Flag for {@link #flags}, corresponding to <code>removed</code>
* value of {@link android.R.attr#permissionFlags}. * value of {@link android.R.attr#permissionFlags}.
* @hide * @hide
*/ */
public static final int FLAG_HIDDEN = 1<<1; @SystemApi
public static final int FLAG_REMOVED = 1<<1;
/** /**
* Flag for {@link #flags}, indicating that this permission has been * Flag for {@link #flags}, indicating that this permission has been

View File

@@ -889,77 +889,77 @@
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.READ_PROFILE" <permission android:name="android.permission.READ_PROFILE"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.WRITE_PROFILE" <permission android:name="android.permission.WRITE_PROFILE"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.READ_SOCIAL_STREAM" <permission android:name="android.permission.READ_SOCIAL_STREAM"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.WRITE_SOCIAL_STREAM" <permission android:name="android.permission.WRITE_SOCIAL_STREAM"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.READ_USER_DICTIONARY" <permission android:name="android.permission.READ_USER_DICTIONARY"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.WRITE_USER_DICTIONARY" <permission android:name="android.permission.WRITE_USER_DICTIONARY"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.WRITE_SMS" <permission android:name="android.permission.WRITE_SMS"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" <permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" <permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" <permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.MANAGE_ACCOUNTS" <permission android:name="android.permission.MANAGE_ACCOUNTS"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.USE_CREDENTIALS" <permission android:name="android.permission.USE_CREDENTIALS"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.SUBSCRIBED_FEEDS_READ" <permission android:name="android.permission.SUBSCRIBED_FEEDS_READ"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.SUBSCRIBED_FEEDS_WRITE" <permission android:name="android.permission.SUBSCRIBED_FEEDS_WRITE"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- @hide We need to keep this around for backwards compatibility --> <!-- @hide We need to keep this around for backwards compatibility -->
<permission android:name="android.permission.FLASHLIGHT" <permission android:name="android.permission.FLASHLIGHT"
android:protectionLevel="normal" android:protectionLevel="normal"
android:permissionFlags="hidden"/> android:permissionFlags="removed"/>
<!-- ====================================================================== --> <!-- ====================================================================== -->
<!-- INSTALL PERMISSIONS --> <!-- INSTALL PERMISSIONS -->

View File

@@ -248,9 +248,12 @@
may cost the user money. Such permissions may be highlighted may cost the user money. Such permissions may be highlighted
when shown to the user with this additional information. --> when shown to the user with this additional information. -->
<flag name="costsMoney" value="0x0001" /> <flag name="costsMoney" value="0x0001" />
<!-- Additional flag from base permission type: this permission is hidden <!-- Additional flag from base permission type: this permission has been
and should not show in the UI. --> removed and it is no longer enforced. It shouldn't be shown in the
<flag name="hidden" value="0x2" /> UI. Removed permissions are kept as normal permissions for backwards
compatibility as apps may be checking them before calling an API.
-->
<flag name="removed" value="0x2" />
</attr> </attr>
<!-- Specified the name of a group that this permission is associated <!-- Specified the name of a group that this permission is associated

View File

@@ -4434,7 +4434,7 @@ final class Settings {
if ((perm.info.flags&PermissionInfo.FLAG_COSTS_MONEY) != 0) { if ((perm.info.flags&PermissionInfo.FLAG_COSTS_MONEY) != 0) {
pw.print(", COSTS_MONEY"); pw.print(", COSTS_MONEY");
} }
if ((perm.info.flags&PermissionInfo.FLAG_HIDDEN) != 0) { if ((perm.info.flags&PermissionInfo.FLAG_REMOVED) != 0) {
pw.print(", HIDDEN"); pw.print(", HIDDEN");
} }
if ((perm.info.flags&PermissionInfo.FLAG_INSTALLED) != 0) { if ((perm.info.flags&PermissionInfo.FLAG_INSTALLED) != 0) {
@@ -4611,7 +4611,7 @@ final class Settings {
if (p.perm != null) { if (p.perm != null) {
pw.print(" perm="); pw.println(p.perm); pw.print(" perm="); pw.println(p.perm);
if ((p.perm.info.flags & PermissionInfo.FLAG_INSTALLED) == 0 if ((p.perm.info.flags & PermissionInfo.FLAG_INSTALLED) == 0
|| (p.perm.info.flags & PermissionInfo.FLAG_HIDDEN) != 0) { || (p.perm.info.flags & PermissionInfo.FLAG_REMOVED) != 0) {
pw.print(" flags=0x"); pw.println(Integer.toHexString(p.perm.info.flags)); pw.print(" flags=0x"); pw.println(Integer.toHexString(p.perm.info.flags));
} }
} }