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

Commit 468300fd authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Better translatable msgs for permission requests"

parents 4c99ea6d 27ffeb33
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11639,6 +11639,7 @@ package android.content.pm {
    field public int flags;
    field public java.lang.CharSequence nonLocalizedDescription;
    field public int priority;
    field public int requestRes;
  }
  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
@@ -11672,6 +11673,7 @@ package android.content.pm {
    field public java.lang.String group;
    field public java.lang.CharSequence nonLocalizedDescription;
    field public int protectionLevel;
    field public int requestRes;
  }
  public final class ProviderInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable {
+6 −0
Original line number Diff line number Diff line
@@ -3145,6 +3145,8 @@ public class PackageParser {
        perm.info.descriptionRes = sa.getResourceId(
                com.android.internal.R.styleable.AndroidManifestPermissionGroup_description,
                0);
        perm.info.requestRes = sa.getResourceId(
                com.android.internal.R.styleable.AndroidManifestPermissionGroup_request, 0);
        perm.info.flags = sa.getInt(
                com.android.internal.R.styleable.AndroidManifestPermissionGroup_permissionGroupFlags, 0);
        perm.info.priority = sa.getInt(
@@ -3199,6 +3201,9 @@ public class PackageParser {
                com.android.internal.R.styleable.AndroidManifestPermission_description,
                0);

        perm.info.requestRes = sa.getResourceId(
                com.android.internal.R.styleable.AndroidManifestPermission_request, 0);

        perm.info.protectionLevel = sa.getInt(
                com.android.internal.R.styleable.AndroidManifestPermission_protectionLevel,
                PermissionInfo.PROTECTION_NORMAL);
@@ -3273,6 +3278,7 @@ public class PackageParser {
        }

        perm.info.descriptionRes = 0;
        perm.info.requestRes = 0;
        perm.info.protectionLevel = PermissionInfo.PROTECTION_NORMAL;
        perm.tree = true;

+14 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.content.pm;

import android.annotation.StringRes;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -33,6 +35,15 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
     */
    public int descriptionRes;

    /**
     * A string resource identifier (in the package's resources) used to request the permissions.
     * From the "request" attribute or, if not set, 0.
     *
     * @hide
     */
    @SystemApi
    public @StringRes int requestRes;

    /**
     * The description string provided in the AndroidManifest file, if any.  You
     * probably don't want to use this, since it will be null if the description
@@ -64,6 +75,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
    public PermissionGroupInfo(PermissionGroupInfo orig) {
        super(orig);
        descriptionRes = orig.descriptionRes;
        requestRes = orig.requestRes;
        nonLocalizedDescription = orig.nonLocalizedDescription;
        flags = orig.flags;
        priority = orig.priority;
@@ -106,6 +118,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
    public void writeToParcel(Parcel dest, int parcelableFlags) {
        super.writeToParcel(dest, parcelableFlags);
        dest.writeInt(descriptionRes);
        dest.writeInt(requestRes);
        TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags);
        dest.writeInt(flags);
        dest.writeInt(priority);
@@ -124,6 +137,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
    private PermissionGroupInfo(Parcel source) {
        super(source);
        descriptionRes = source.readInt();
        requestRes = source.readInt();
        nonLocalizedDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
        flags = source.readInt();
        priority = source.readInt();
+12 −0
Original line number Diff line number Diff line
@@ -197,6 +197,15 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
     */
    public int descriptionRes;

    /**
     * A string resource identifier (in the package's resources) used to request the permissions.
     * From the "request" attribute or, if not set, 0.
     *
     * @hide
     */
    @SystemApi
    public int requestRes;

    /**
     * The description string provided in the AndroidManifest file, if any.  You
     * probably don't want to use this, since it will be null if the description
@@ -272,6 +281,7 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
        flags = orig.flags;
        group = orig.group;
        descriptionRes = orig.descriptionRes;
        requestRes = orig.requestRes;
        nonLocalizedDescription = orig.nonLocalizedDescription;
    }

@@ -315,6 +325,7 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
        dest.writeInt(flags);
        dest.writeString(group);
        dest.writeInt(descriptionRes);
        dest.writeInt(requestRes);
        TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags);
    }

@@ -334,6 +345,7 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
        flags = source.readInt();
        group = source.readString();
        descriptionRes = source.readInt();
        requestRes = source.readInt();
        nonLocalizedDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -562,6 +562,7 @@
        android:icon="@drawable/perm_group_contacts"
        android:label="@string/permgrouplab_contacts"
        android:description="@string/permgroupdesc_contacts"
        android:request="@string/permgrouprequest_contacts"
        android:priority="100" />

    <!-- Allows an application to read the user's contacts data.
@@ -592,6 +593,7 @@
        android:icon="@drawable/perm_group_calendar"
        android:label="@string/permgrouplab_calendar"
        android:description="@string/permgroupdesc_calendar"
        android:request="@string/permgrouprequest_calendar"
        android:priority="200" />

    <!-- Allows an application to read the user's calendar data.
@@ -622,6 +624,7 @@
        android:icon="@drawable/perm_group_sms"
        android:label="@string/permgrouplab_sms"
        android:description="@string/permgroupdesc_sms"
        android:request="@string/permgrouprequest_sms"
        android:priority="300" />

    <!-- Allows an application to send SMS messages.
@@ -698,6 +701,7 @@
        android:icon="@drawable/perm_group_storage"
        android:label="@string/permgrouplab_storage"
        android:description="@string/permgroupdesc_storage"
        android:request="@string/permgrouprequest_storage"
        android:priority="900" />

    <!-- Allows an application to read from external storage.
@@ -759,6 +763,7 @@
        android:icon="@drawable/perm_group_location"
        android:label="@string/permgrouplab_location"
        android:description="@string/permgroupdesc_location"
        android:request="@string/permgrouprequest_location"
        android:priority="400" />

    <!-- Allows an app to access precise location.
@@ -791,6 +796,7 @@
        android:icon="@drawable/perm_group_phone_calls"
        android:label="@string/permgrouplab_phone"
        android:description="@string/permgroupdesc_phone"
        android:request="@string/permgrouprequest_phone"
        android:priority="500" />

    <!-- Allows read only access to phone state, including the phone number of the device,
@@ -942,6 +948,7 @@
        android:icon="@drawable/perm_group_microphone"
        android:label="@string/permgrouplab_microphone"
        android:description="@string/permgroupdesc_microphone"
        android:request="@string/permgrouprequest_microphone"
        android:priority="600" />

    <!-- Allows an application to record audio.
@@ -984,6 +991,7 @@
        android:icon="@drawable/perm_group_camera"
        android:label="@string/permgrouplab_camera"
        android:description="@string/permgroupdesc_camera"
        android:request="@string/permgrouprequest_camera"
        android:priority="700" />

    <!-- Required to be able to access the camera device.
@@ -1013,6 +1021,7 @@
        android:icon="@drawable/perm_group_sensors"
        android:label="@string/permgrouplab_sensors"
        android:description="@string/permgroupdesc_sensors"
        android:request="@string/permgrouprequest_sensors"
        android:priority="800" />

    <!-- Allows an application to access data from sensors that the user uses to
Loading