Auto-generate docs based on annotations.
We have a handful of annotations that we've been sprinkling across
the platform APIs, such as @Nullable, @NonNull, @IntDef, etc. It
would be really helpful to surface these contracts to developers
through the SDK docs.
This change allows annotations like those mentioned above to declare
the following new javadoc fields:
@memberDoc: docs to append to a field or method definition.
@paramDoc: docs to append to a @param definition.
@returnDoc: docs to append to a @return definition.
This change also builds a docstring to describe the list of all
constants listed in an @IntDef annotation. Sadly AnnotationDesc
only passes along raw constant values, so we need the help of the
new "prefix" annotation argument to help find the field names.
Test: builds
Bug: 37526420
Change-Id: I4cfc00dd904e5dfa945b406d546e36846b7c0c28
diff --git a/core/java/android/annotation/BytesLong.java b/core/java/android/annotation/BytesLong.java
new file mode 100644
index 0000000..f5e1a9c
--- /dev/null
+++ b/core/java/android/annotation/BytesLong.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 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.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * @memberDoc Value is a non-negative number of bytes.
+ * @paramDoc Value is a non-negative number of bytes.
+ * @returnDoc Value is a non-negative number of bytes.
+ * @hide
+ */
+@Retention(SOURCE)
+@Target({METHOD, PARAMETER, FIELD})
+public @interface BytesLong {
+}
diff --git a/core/java/android/annotation/CurrentTimeMillisLong.java b/core/java/android/annotation/CurrentTimeMillisLong.java
new file mode 100644
index 0000000..9846cce
--- /dev/null
+++ b/core/java/android/annotation/CurrentTimeMillisLong.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 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.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * @memberDoc Value is a non-negative timestamp in the
+ * {@link System#currentTimeMillis()} time base.
+ * @paramDoc Value is a non-negative timestamp in the
+ * {@link System#currentTimeMillis()} time base.
+ * @returnDoc Value is a non-negative timestamp in the
+ * {@link System#currentTimeMillis()} time base.
+ * @hide
+ */
+@Retention(SOURCE)
+@Target({METHOD, PARAMETER, FIELD})
+public @interface CurrentTimeMillisLong {
+}
diff --git a/core/java/android/annotation/DurationMillisLong.java b/core/java/android/annotation/DurationMillisLong.java
new file mode 100644
index 0000000..ce77532
--- /dev/null
+++ b/core/java/android/annotation/DurationMillisLong.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 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.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * @memberDoc Value is a non-negative duration in milliseconds.
+ * @paramDoc Value is a non-negative duration in milliseconds.
+ * @returnDoc Value is a non-negative duration in milliseconds.
+ * @hide
+ */
+@Retention(SOURCE)
+@Target({METHOD, PARAMETER, FIELD})
+public @interface DurationMillisLong {
+}
diff --git a/core/java/android/annotation/ElapsedRealtimeLong.java b/core/java/android/annotation/ElapsedRealtimeLong.java
new file mode 100644
index 0000000..f77ff72
--- /dev/null
+++ b/core/java/android/annotation/ElapsedRealtimeLong.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 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.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+import android.os.SystemClock;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * @memberDoc Value is a non-negative timestamp in the
+ * {@link SystemClock#elapsedRealtime()} time base.
+ * @paramDoc Value is a non-negative timestamp in the
+ * {@link SystemClock#elapsedRealtime()} time base.
+ * @returnDoc Value is a non-negative timestamp in the
+ * {@link SystemClock#elapsedRealtime()} time base.
+ * @hide
+ */
+@Retention(SOURCE)
+@Target({METHOD, PARAMETER, FIELD})
+public @interface ElapsedRealtimeLong {
+}
diff --git a/core/java/android/annotation/IntDef.java b/core/java/android/annotation/IntDef.java
index 434a9c7..dd712a6 100644
--- a/core/java/android/annotation/IntDef.java
+++ b/core/java/android/annotation/IntDef.java
@@ -51,6 +51,9 @@
@Retention(CLASS)
@Target({ANNOTATION_TYPE})
public @interface IntDef {
+ /** Defines the constant prefix for this element */
+ String[] prefix() default "";
+
/** Defines the allowed constants for this element */
long[] value() default {};
diff --git a/core/java/android/annotation/MainThread.java b/core/java/android/annotation/MainThread.java
index 52f8dfb..c6ac30c 100644
--- a/core/java/android/annotation/MainThread.java
+++ b/core/java/android/annotation/MainThread.java
@@ -23,20 +23,27 @@
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;
+import android.os.Looper;
+
/**
* Denotes that the annotated method should only be called on the main thread.
- * If the annotated element is a class, then all methods in the class should be called
- * on the main thread.
+ * If the annotated element is a class, then all methods in the class should be
+ * called on the main thread.
* <p>
* Example:
- * <pre><code>
+ *
+ * <pre>
+ * <code>
* @MainThread
* public void deliverResult(D data) { ... }
- * </code></pre>
+ * </code>
+ * </pre>
*
- * {@hide}
+ * @memberDoc This method must be called from the
+ * {@linkplain Looper#getMainLooper() main thread} of your app.
+ * @hide
*/
@Retention(SOURCE)
@Target({METHOD,CONSTRUCTOR,TYPE})
public @interface MainThread {
-}
\ No newline at end of file
+}
diff --git a/core/java/android/annotation/NonNull.java b/core/java/android/annotation/NonNull.java
index 3ca9eea..927f997 100644
--- a/core/java/android/annotation/NonNull.java
+++ b/core/java/android/annotation/NonNull.java
@@ -28,6 +28,8 @@
* <p>
* This is a marker annotation and it has no specific attributes.
*
+ * @paramDoc This value must never be {@code null}.
+ * @returnDoc This value will never be {@code null}.
* @hide
*/
@Retention(SOURCE)
diff --git a/core/java/android/annotation/Nullable.java b/core/java/android/annotation/Nullable.java
index 43f42fa..b60170b 100644
--- a/core/java/android/annotation/Nullable.java
+++ b/core/java/android/annotation/Nullable.java
@@ -35,6 +35,8 @@
* <p>
* This is a marker annotation and it has no specific attributes.
*
+ * @paramDoc This value may be {@code null}.
+ * @returnDoc This value may be {@code null}.
* @hide
*/
@Retention(SOURCE)
diff --git a/core/java/android/annotation/SuppressAutoDoc.java b/core/java/android/annotation/SuppressAutoDoc.java
new file mode 100644
index 0000000..0f8fa6c
--- /dev/null
+++ b/core/java/android/annotation/SuppressAutoDoc.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+/**
+ * Denotes that any automatically generated documentation should be suppressed
+ * for the annotated method, parameter, or field.
+ *
+ * @hide
+ */
+@Retention(SOURCE)
+@Target({METHOD, PARAMETER, FIELD})
+public @interface SuppressAutoDoc {
+}
diff --git a/core/java/android/annotation/WorkerThread.java b/core/java/android/annotation/WorkerThread.java
index 0d2c43e..3eae7aa 100644
--- a/core/java/android/annotation/WorkerThread.java
+++ b/core/java/android/annotation/WorkerThread.java
@@ -25,18 +25,23 @@
/**
* Denotes that the annotated method should only be called on a worker thread.
- * If the annotated element is a class, then all methods in the class should be called
- * on a worker thread.
+ * If the annotated element is a class, then all methods in the class should be
+ * called on a worker thread.
* <p>
* Example:
- * <pre><code>
+ *
+ * <pre>
+ * <code>
* @WorkerThread
* protected abstract FilterResults performFiltering(CharSequence constraint);
- * </code></pre>
+ * </code>
+ * </pre>
*
- * {@hide}
+ * @memberDoc This method may take several seconds to complete, so it should
+ * only be called from a worker thread.
+ * @hide
*/
@Retention(SOURCE)
@Target({METHOD,CONSTRUCTOR,TYPE})
public @interface WorkerThread {
-}
\ No newline at end of file
+}
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index c4b7ed7..f6d42f0 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2720,12 +2720,13 @@
}
/** @hide */
- @IntDef({
+ @IntDef(prefix = { "DEFAULT_KEYS_" }, value = {
DEFAULT_KEYS_DISABLE,
DEFAULT_KEYS_DIALER,
DEFAULT_KEYS_SHORTCUT,
DEFAULT_KEYS_SEARCH_LOCAL,
- DEFAULT_KEYS_SEARCH_GLOBAL})
+ DEFAULT_KEYS_SEARCH_GLOBAL
+ })
@Retention(RetentionPolicy.SOURCE)
@interface DefaultKeyMode {}
@@ -2791,11 +2792,6 @@
*
* @param mode The desired default key mode constant.
*
- * @see #DEFAULT_KEYS_DISABLE
- * @see #DEFAULT_KEYS_DIALER
- * @see #DEFAULT_KEYS_SHORTCUT
- * @see #DEFAULT_KEYS_SEARCH_LOCAL
- * @see #DEFAULT_KEYS_SEARCH_GLOBAL
* @see #onKeyDown
*/
public final void setDefaultKeyMode(@DefaultKeyMode int mode) {
diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java
index e50bc13..9059daa 100644
--- a/core/java/android/app/NotificationChannel.java
+++ b/core/java/android/app/NotificationChannel.java
@@ -21,6 +21,7 @@
import org.xmlpull.v1.XmlSerializer;
import android.annotation.SystemApi;
+import android.app.NotificationManager.Importance;
import android.content.Intent;
import android.media.AudioAttributes;
import android.net.Uri;
@@ -389,16 +390,14 @@
}
/**
- * Sets the level of interruption of this notification channel.
- *
- * Only modifiable before the channel is submitted to
+ * Sets the level of interruption of this notification channel. Only
+ * modifiable before the channel is submitted to
* {@link NotificationManager#notify(String, int, Notification)}.
*
- * @param importance the amount the user should be interrupted by notifications from this
- * channel. See e.g.
- * {@link android.app.NotificationManager#IMPORTANCE_DEFAULT}.
+ * @param importance the amount the user should be interrupted by
+ * notifications from this channel.
*/
- public void setImportance(int importance) {
+ public void setImportance(@Importance int importance) {
this.mImportance = importance;
}
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 242d4a5..58ed587 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -145,8 +145,10 @@
= "android.app.action.INTERRUPTION_FILTER_CHANGED_INTERNAL";
/** @hide */
- @IntDef({INTERRUPTION_FILTER_NONE, INTERRUPTION_FILTER_PRIORITY, INTERRUPTION_FILTER_ALARMS,
- INTERRUPTION_FILTER_ALL, INTERRUPTION_FILTER_UNKNOWN})
+ @IntDef(prefix = { "INTERRUPTION_FILTER_" }, value = {
+ INTERRUPTION_FILTER_NONE, INTERRUPTION_FILTER_PRIORITY, INTERRUPTION_FILTER_ALARMS,
+ INTERRUPTION_FILTER_ALL, INTERRUPTION_FILTER_UNKNOWN
+ })
@Retention(RetentionPolicy.SOURCE)
public @interface InterruptionFilter {}
@@ -186,8 +188,10 @@
public static final int INTERRUPTION_FILTER_UNKNOWN = 0;
/** @hide */
- @IntDef({IMPORTANCE_UNSPECIFIED, IMPORTANCE_NONE,
- IMPORTANCE_MIN, IMPORTANCE_LOW, IMPORTANCE_DEFAULT, IMPORTANCE_HIGH})
+ @IntDef(prefix = { "IMPORTANCE_" }, value = {
+ IMPORTANCE_UNSPECIFIED, IMPORTANCE_NONE,
+ IMPORTANCE_MIN, IMPORTANCE_LOW, IMPORTANCE_DEFAULT, IMPORTANCE_HIGH
+ })
@Retention(RetentionPolicy.SOURCE)
public @interface Importance {}
@@ -717,9 +721,8 @@
}
/**
- * Returns the user specified importance for notifications from the calling package.
- *
- * @return An importance level, such as {@link #IMPORTANCE_DEFAULT}.
+ * Returns the user specified importance for notifications from the calling
+ * package.
*/
public @Importance int getImportance() {
INotificationManager service = getService();
@@ -1095,12 +1098,10 @@
/**
* Gets the current notification interruption filter.
- *
* <p>
- * The interruption filter defines which notifications are allowed to interrupt the user
- * (e.g. via sound & vibration) and is applied globally.
- * @return One of the INTERRUPTION_FILTER_ constants, or INTERRUPTION_FILTER_UNKNOWN when
- * unavailable.
+ * The interruption filter defines which notifications are allowed to
+ * interrupt the user (e.g. via sound & vibration) and is applied
+ * globally.
*/
public final @InterruptionFilter int getCurrentInterruptionFilter() {
final INotificationManager service = getService();
@@ -1113,18 +1114,15 @@
/**
* Sets the current notification interruption filter.
- *
* <p>
- * The interruption filter defines which notifications are allowed to interrupt the user
- * (e.g. via sound & vibration) and is applied globally.
- * @return One of the INTERRUPTION_FILTER_ constants, or INTERRUPTION_FILTER_UNKNOWN when
- * unavailable.
- *
+ * The interruption filter defines which notifications are allowed to
+ * interrupt the user (e.g. via sound & vibration) and is applied
+ * globally.
* <p>
- * Only available if policy access is granted to this package.
- * See {@link #isNotificationPolicyAccessGranted}.
+ * Only available if policy access is granted to this package. See
+ * {@link #isNotificationPolicyAccessGranted}.
*/
- public final void setInterruptionFilter(int interruptionFilter) {
+ public final void setInterruptionFilter(@InterruptionFilter int interruptionFilter) {
final INotificationManager service = getService();
try {
service.setInterruptionFilter(mContext.getOpPackageName(), interruptionFilter);
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index 4fe4f98..0265ea5 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -321,11 +321,10 @@
public static final int STOP_FOREGROUND_DETACH = 1<<1;
/** @hide */
- @IntDef(flag = true,
- value = {
- STOP_FOREGROUND_REMOVE,
- STOP_FOREGROUND_DETACH
- })
+ @IntDef(flag = true, prefix = { "STOP_FOREGROUND_" }, value = {
+ STOP_FOREGROUND_REMOVE,
+ STOP_FOREGROUND_DETACH
+ })
@Retention(RetentionPolicy.SOURCE)
public @interface StopForegroundFlags {}
@@ -423,13 +422,12 @@
public static final int START_REDELIVER_INTENT = 3;
/** @hide */
- @IntDef(flag = false,
- value = {
- START_STICKY_COMPATIBILITY,
- START_STICKY,
- START_NOT_STICKY,
- START_REDELIVER_INTENT,
- })
+ @IntDef(flag = false, prefix = { "START_" }, value = {
+ START_STICKY_COMPATIBILITY,
+ START_STICKY,
+ START_NOT_STICKY,
+ START_REDELIVER_INTENT,
+ })
@Retention(RetentionPolicy.SOURCE)
public @interface StartResult {}
@@ -456,11 +454,10 @@
public static final int START_FLAG_RETRY = 0x0002;
/** @hide */
- @IntDef(flag = true,
- value = {
- START_FLAG_REDELIVERY,
- START_FLAG_RETRY,
- })
+ @IntDef(flag = true, prefix = { "START_FLAG_" }, value = {
+ START_FLAG_REDELIVERY,
+ START_FLAG_RETRY,
+ })
@Retention(RetentionPolicy.SOURCE)
public @interface StartArgFlags {}
@@ -494,8 +491,7 @@
* as given. This may be null if the service is being restarted after
* its process has gone away, and it had previously returned anything
* except {@link #START_STICKY_COMPATIBILITY}.
- * @param flags Additional data about this start request. Currently either
- * 0, {@link #START_FLAG_REDELIVERY}, or {@link #START_FLAG_RETRY}.
+ * @param flags Additional data about this start request.
* @param startId A unique integer representing this specific request to
* start. Use with {@link #stopSelfResult(int)}.
*
@@ -721,8 +717,8 @@
/**
* Remove this service from foreground state, allowing it to be killed if
* more memory is needed.
- * @param flags Additional behavior options: {@link #STOP_FOREGROUND_REMOVE},
- * {@link #STOP_FOREGROUND_DETACH}.
+ *
+ * @param flags additional behavior options.
* @see #startForeground(int, Notification)
*/
public final void stopForeground(@StopForegroundFlags int flags) {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 0adab1a..9d0dcb7 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4071,15 +4071,7 @@
*
* @param toPackage The package you would like to allow to access the Uri.
* @param uri The Uri you would like to grant access to.
- * @param modeFlags The desired access modes. Any combination of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION
- * Intent.FLAG_GRANT_READ_URI_PERMISSION},
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION
- * Intent.FLAG_GRANT_WRITE_URI_PERMISSION},
- * {@link Intent#FLAG_GRANT_PERSISTABLE_URI_PERMISSION
- * Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION}, or
- * {@link Intent#FLAG_GRANT_PREFIX_URI_PERMISSION
- * Intent.FLAG_GRANT_PREFIX_URI_PERMISSION}.
+ * @param modeFlags The desired access modes.
*
* @see #revokeUriPermission
*/
@@ -4110,11 +4102,7 @@
* revoke grants that another app could be strongly expecting to stick around.</p>
*
* @param uri The Uri you would like to revoke access to.
- * @param modeFlags The desired access modes. Any combination of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION
- * Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION
- * Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to revoke.
*
* @see #grantUriPermission
*/
@@ -4137,11 +4125,7 @@
*
* @param toPackage The package you had previously granted access to.
* @param uri The Uri you would like to revoke access to.
- * @param modeFlags The desired access modes. Any combination of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION
- * Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION
- * Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to revoke.
*
* @see #grantUriPermission
*/
@@ -4159,9 +4143,7 @@
* @param pid The process ID being checked against. Must be > 0.
* @param uid The user ID being checked against. A uid of 0 is the root
* user, which will pass every permission check.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to check.
*
* @return {@link PackageManager#PERMISSION_GRANTED} if the given
* pid/uid is allowed to access that uri, or
@@ -4188,9 +4170,7 @@
* will always fail.
*
* @param uri The uri that is being checked.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to check.
*
* @return {@link PackageManager#PERMISSION_GRANTED} if the caller
* is allowed to access that uri, or
@@ -4208,9 +4188,7 @@
* if you are not currently processing an IPC. Use with care!
*
* @param uri The uri that is being checked.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to check.
*
* @return {@link PackageManager#PERMISSION_GRANTED} if the caller
* is allowed to access that uri, or
@@ -4236,9 +4214,7 @@
* @param pid The process ID being checked against. Must be > 0.
* @param uid The user ID being checked against. A uid of 0 is the root
* user, which will pass every permission check.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to check.
*
* @return {@link PackageManager#PERMISSION_GRANTED} if the caller
* is allowed to access that uri or holds one of the given permissions, or
@@ -4261,9 +4237,7 @@
* @param pid The process ID being checked against. Must be > 0.
* @param uid The user ID being checked against. A uid of 0 is the root
* user, which will pass every permission check.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to enforce.
* @param message A message to include in the exception if it is thrown.
*
* @see #checkUriPermission(Uri, int, int, int)
@@ -4283,9 +4257,7 @@
* will always throw a SecurityException.
*
* @param uri The uri that is being checked.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to enforce.
* @param message A message to include in the exception if it is thrown.
*
* @see #checkCallingUriPermission(Uri, int)
@@ -4302,9 +4274,7 @@
* with care!
*
* @param uri The uri that is being checked.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to enforce.
* @param message A message to include in the exception if it is thrown.
*
* @see #checkCallingOrSelfUriPermission(Uri, int)
@@ -4326,9 +4296,7 @@
* @param pid The process ID being checked against. Must be > 0.
* @param uid The user ID being checked against. A uid of 0 is the root
* user, which will pass every permission check.
- * @param modeFlags The type of access to grant. May be one or both of
- * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or
- * {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
+ * @param modeFlags The access modes to enforce.
* @param message A message to include in the exception if it is thrown.
*
* @see #checkUriPermission(Uri, String, String, int, int, int)
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 5ca4fa3..61da4b2 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -4894,14 +4894,14 @@
// Intent flags (see mFlags variable).
/** @hide */
- @IntDef(flag = true, value = {
+ @IntDef(flag = true, prefix = { "FLAG_GRANT_" }, value = {
FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION,
FLAG_GRANT_PERSISTABLE_URI_PERMISSION, FLAG_GRANT_PREFIX_URI_PERMISSION })
@Retention(RetentionPolicy.SOURCE)
public @interface GrantUriMode {}
/** @hide */
- @IntDef(flag = true, value = {
+ @IntDef(flag = true, prefix = { "FLAG_GRANT_" }, value = {
FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION })
@Retention(RetentionPolicy.SOURCE)
public @interface AccessUriMode {}