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

Commit b137c806 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "More adjustments to permissions." into jb-mr1-dev

parents a40b2b34 2ca2c878
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -164,7 +164,6 @@ package android {
    field public static final java.lang.String PERSONAL_INFO = "android.permission-group.PERSONAL_INFO";
    field public static final java.lang.String PHONE_CALLS = "android.permission-group.PHONE_CALLS";
    field public static final java.lang.String SCREENLOCK = "android.permission-group.SCREENLOCK";
    field public static final java.lang.String SHORTRANGE_NETWORK = "android.permission-group.SHORTRANGE_NETWORK";
    field public static final java.lang.String SOCIAL_INFO = "android.permission-group.SOCIAL_INFO";
    field public static final java.lang.String STATUS_BAR = "android.permission-group.STATUS_BAR";
    field public static final java.lang.String STORAGE = "android.permission-group.STORAGE";
@@ -775,6 +774,7 @@ package android {
    field public static final int pathPattern = 16842796; // 0x101002c
    field public static final int pathPrefix = 16842795; // 0x101002b
    field public static final int permission = 16842758; // 0x1010006
    field public static final int permissionFlags = 16843719; // 0x10103c7
    field public static final int permissionGroup = 16842762; // 0x101000a
    field public static final int permissionGroupFlags = 16843717; // 0x10103c5
    field public static final int persistent = 16842765; // 0x101000d
@@ -6743,6 +6743,7 @@ package android.content.pm {
    method public int describeContents();
    method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager);
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static final int FLAG_COSTS_MONEY = 1; // 0x1
    field public static final int PROTECTION_DANGEROUS = 1; // 0x1
    field public static final int PROTECTION_FLAG_DEVELOPMENT = 32; // 0x20
    field public static final int PROTECTION_FLAG_SYSTEM = 16; // 0x10
@@ -6752,6 +6753,7 @@ package android.content.pm {
    field public static final int PROTECTION_SIGNATURE = 2; // 0x2
    field public static final int PROTECTION_SIGNATURE_OR_SYSTEM = 3; // 0x3
    field public int descriptionRes;
    field public int flags;
    field public java.lang.String group;
    field public java.lang.CharSequence nonLocalizedDescription;
    field public int protectionLevel;
+3 −0
Original line number Diff line number Diff line
@@ -1543,6 +1543,9 @@ public class PackageParser {
                com.android.internal.R.styleable.AndroidManifestPermission_protectionLevel,
                PermissionInfo.PROTECTION_NORMAL);

        perm.info.flags = sa.getInt(
                com.android.internal.R.styleable.AndroidManifestPermission_permissionFlags, 0);

        sa.recycle();

        if (perm.info.protectionLevel == -1) {
+30 −15
Original line number Diff line number Diff line
@@ -78,12 +78,35 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int PROTECTION_MASK_FLAGS = 0xf0;

    /**
     * The level of access this permission is protecting, as per
     * {@link android.R.attr#protectionLevel}.  Values may be
     * {@link #PROTECTION_NORMAL}, {@link #PROTECTION_DANGEROUS}, or
     * {@link #PROTECTION_SIGNATURE}.  May also include the additional
     * flags {@link #PROTECTION_FLAG_SYSTEM} or {@link #PROTECTION_FLAG_DEVELOPMENT}
     * (which only make sense in combination with the base
     * {@link #PROTECTION_SIGNATURE}.
     */
    public int protectionLevel;

    /**
     * The group this permission is a part of, as per
     * {@link android.R.attr#permissionGroup}.
     */
    public String group;

    /**
     * Flag for {@link #flags}, corresponding to <code>costsMoney</code>
     * value of {@link android.R.attr#permissionFlags}.
     */
    public static final int FLAG_COSTS_MONEY = 1<<0;

    /**
     * Additional flags about this permission as given by
     * {@link android.R.attr#permissionFlags}.
     */
    public int flags;

    /**
     * A string resource identifier (in the package's resources) of this
     * permission's description.  From the "description" attribute or,
@@ -99,17 +122,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
     */
    public CharSequence nonLocalizedDescription;

    /**
     * The level of access this permission is protecting, as per
     * {@link android.R.attr#protectionLevel}.  Values may be
     * {@link #PROTECTION_NORMAL}, {@link #PROTECTION_DANGEROUS}, or
     * {@link #PROTECTION_SIGNATURE}.  May also include the additional
     * flags {@link #PROTECTION_FLAG_SYSTEM} or {@link #PROTECTION_FLAG_DEVELOPMENT}
     * (which only make sense in combination with the base
     * {@link #PROTECTION_SIGNATURE}.
     */
    public int protectionLevel;

    /** @hide */
    public static int fixProtectionLevel(int level) {
        if (level == PROTECTION_SIGNATURE_OR_SYSTEM) {
@@ -149,9 +161,10 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {

    public PermissionInfo(PermissionInfo orig) {
        super(orig);
        protectionLevel = orig.protectionLevel;
        flags = orig.flags;
        group = orig.group;
        descriptionRes = orig.descriptionRes;
        protectionLevel = orig.protectionLevel;
        nonLocalizedDescription = orig.nonLocalizedDescription;
    }

@@ -191,9 +204,10 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {

    public void writeToParcel(Parcel dest, int parcelableFlags) {
        super.writeToParcel(dest, parcelableFlags);
        dest.writeInt(protectionLevel);
        dest.writeInt(flags);
        dest.writeString(group);
        dest.writeInt(descriptionRes);
        dest.writeInt(protectionLevel);
        TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags);
    }

@@ -209,9 +223,10 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {

    private PermissionInfo(Parcel source) {
        super(source);
        protectionLevel = source.readInt();
        flags = source.readInt();
        group = source.readString();
        descriptionRes = source.readInt();
        protectionLevel = source.readInt();
        nonLocalizedDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
    }
}
+10 −4
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public class AppSecurityPermissions {
    public static final int WHICH_ALL = 0xffff;

    private final static String TAG = "AppSecurityPermissions";
    private boolean localLOGV = false;
    private final static boolean localLOGV = false;
    private Context mContext;
    private LayoutInflater mInflater;
    private PackageManager mPm;
@@ -189,6 +189,8 @@ public class AppSecurityPermissions {
            permGrpIcon.setImageDrawable(icon);
            permNameView.setText(label);
            setOnClickListener(this);
            if (localLOGV) Log.i(TAG, "Made perm item " + perm.name
                    + ": " + label + " in group " + grp.name);
        }

        @Override
@@ -531,7 +533,9 @@ public class AppSecurityPermissions {
            MyPermissionGroupInfo grp, MyPermissionInfo perm, boolean first,
            CharSequence newPermPrefix) {
        PermissionItemView permView = (PermissionItemView)inflater.inflate(
                R.layout.app_permission_item, null);
                (perm.flags & PermissionInfo.FLAG_COSTS_MONEY) != 0
                        ? R.layout.app_permission_item_money : R.layout.app_permission_item,
                null);
        permView.setPermission(grp, perm, first, newPermPrefix);
        return permView;
    }
@@ -568,6 +572,8 @@ public class AppSecurityPermissions {
        // already granted, they will not be granted as part of the install.
        if ((existingReqFlags&PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0
                && (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
            if (localLOGV) Log.i(TAG, "Special perm " + pInfo.name
                    + ": protlevel=0x" + Integer.toHexString(pInfo.protectionLevel));
            return true;
        }
        return false;
@@ -650,9 +656,9 @@ public class AppSecurityPermissions {
            mPermGroupsList.add(pgrp);
        }
        Collections.sort(mPermGroupsList, mPermGroupComparator);
        if (false) {
        if (localLOGV) {
            for (MyPermissionGroupInfo grp : mPermGroupsList) {
                Log.i("foo", "Group " + grp.name + " personal="
                Log.i(TAG, "Group " + grp.name + " personal="
                        + ((grp.flags&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0)
                        + " priority=" + grp.priority);
            }
+15 −23
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@
    <permission android:name="android.permission.SEND_SMS"
        android:permissionGroup="android.permission-group.MESSAGES"
        android:protectionLevel="dangerous"
        android:permissionFlags="costsMoney"
        android:label="@string/permlab_sendSms"
        android:description="@string/permdesc_sendSms" />

@@ -404,7 +405,6 @@
        android:label="@string/permgrouplab_writeDictionary"
        android:icon="@drawable/perm_group_user_dictionary_write"
        android:description="@string/permgroupdesc_writeDictionary"
        android:permissionGroupFlags="personalInfo"
        android:priority="160" />

    <!-- Allows an application to write to the user dictionary. -->
@@ -515,14 +515,14 @@

    <!-- Allows an application to create mock location providers for testing -->
    <permission android:name="android.permission.ACCESS_MOCK_LOCATION"
        android:permissionGroup="android.permission-group.LOCATION"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="dangerous"
        android:label="@string/permlab_accessMockLocation"
        android:description="@string/permdesc_accessMockLocation" />

    <!-- Allows an application to access extra location provider commands -->
    <permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
        android:permissionGroup="android.permission-group.LOCATION"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="normal"
        android:label="@string/permlab_accessLocationExtraCommands"
        android:description="@string/permdesc_accessLocationExtraCommands" />
@@ -616,24 +616,14 @@
        android:description="@string/permdesc_bluetoothAdmin"
        android:label="@string/permlab_bluetoothAdmin" />
   
    <!-- Used for permissions that provide access to network services that
         are for peripherals and other nearby devices.  These networks
         generally do not provide IP based networking or internet access.-->
    <permission-group android:name="android.permission-group.SHORTRANGE_NETWORK"
        android:label="@string/permgrouplab_shortrangeNetwork"
        android:icon="@drawable/perm_group_shortrange_network"
        android:description="@string/permgroupdesc_shortrangeNetwork"
        android:priority="250" />

    <!-- Allows applications to perform I/O operations over NFC -->
    <permission android:name="android.permission.NFC"
        android:permissionGroup="android.permission-group.SHORTRANGE_NETWORK"
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="dangerous"
        android:description="@string/permdesc_nfc"
        android:label="@string/permlab_nfc" />

    <!-- Allows an internal user to use privileged ConnectivityManager
    APIs.
    <!-- Allows an internal user to use privileged ConnectivityManager APIs.
        @hide -->
    <permission android:name="android.permission.CONNECTIVITY_INTERNAL"
        android:permissionGroup="android.permission-group.NETWORK"
@@ -904,6 +894,7 @@
    <permission android:name="android.permission.CALL_PHONE"
        android:permissionGroup="android.permission-group.PHONE_CALLS"
        android:protectionLevel="dangerous"
        android:permissionFlags="costsMoney"
        android:label="@string/permlab_callPhone"
        android:description="@string/permdesc_callPhone" />

@@ -929,7 +920,7 @@

    <!-- Allows an application to read from external storage -->
    <permission android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:label="@string/permlab_sdcardRead"
        android:description="@string/permdesc_sdcardRead"
        android:protectionLevel="normal" />
@@ -1227,7 +1218,7 @@
    <!-- Allows an application to modify the current configuration, such
         as locale. -->
    <permission android:name="android.permission.CHANGE_CONFIGURATION"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
        android:protectionLevel="signature|system|development"
        android:label="@string/permlab_changeConfiguration"
        android:description="@string/permdesc_changeConfiguration" />
@@ -1287,7 +1278,7 @@
    <!-- @deprecated This functionality will be removed in the future; please do
         not use. Allow an application to make its activities persistent. -->
    <permission android:name="android.permission.PERSISTENT_ACTIVITY"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:permissionGroup="android.permission-group.APP_INFO"
        android:protectionLevel="normal"
        android:label="@string/permlab_persistentActivity"
        android:description="@string/permdesc_persistentActivity" />
@@ -1320,7 +1311,7 @@
         explicitly declare your use of this facility to make that visible
         to the user. -->
    <permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:permissionGroup="android.permission-group.APP_INFO"
        android:protectionLevel="normal"
        android:label="@string/permlab_receiveBootCompleted"
        android:description="@string/permdesc_receiveBootCompleted" />
@@ -1411,7 +1402,7 @@

    <!-- Allows applications to change network connectivity state -->
    <permission android:name="android.permission.CHANGE_NETWORK_STATE"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="normal"
        android:description="@string/permdesc_changeNetworkState"
        android:label="@string/permlab_changeNetworkState" />
@@ -1535,8 +1526,8 @@
    <!-- Allows an application to update device statistics. Not for
         use by third party apps. -->
    <permission android:name="android.permission.UPDATE_DEVICE_STATS"
        android:label="@string/permlab_batteryStats"
        android:description="@string/permdesc_batteryStats"
        android:label="@string/permlab_updateBatteryStats"
        android:description="@string/permdesc_updateBatteryStats"
        android:protectionLevel="signature|system" />

    <!-- Allows an application to open windows that are for use by parts
@@ -1854,9 +1845,10 @@

    <!-- Allows an application to collect battery statistics -->
    <permission android:name="android.permission.BATTERY_STATS"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:label="@string/permlab_batteryStats"
        android:description="@string/permdesc_batteryStats"
        android:protectionLevel="normal" />
        android:protectionLevel="dangerous" />

    <!-- Allows an application to control the backup and restore process
         @hide pending API council -->
Loading