diff --git a/core/java/android/annotation/AnyThread.java b/core/java/android/annotation/AnyThread.java index c101548c0c16a..e173bd1448322 100644 --- a/core/java/android/annotation/AnyThread.java +++ b/core/java/android/annotation/AnyThread.java @@ -15,30 +15,34 @@ */ package android.annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + /** - * Denotes that the annotated method can be called from any thread (e.g. it is "thread safe".) - * If the annotated element is a class, then all methods in the class can be called - * from any thread. + * Denotes that the annotated method can be called from any thread (e.g. it is + * "thread safe".) If the annotated element is a class, then all methods in the + * class can be called from any thread. *

- * The main purpose of this method is to indicate that you believe a method can be called - * from any thread; static tools can then check that nothing you call from within this method - * or class have more strict threading requirements. + * The main purpose of this method is to indicate that you believe a method can + * be called from any thread; static tools can then check that nothing you call + * from within this method or class have more strict threading requirements. *

* Example: - *


+ *
+ * 
+ * 
  *  @AnyThread
  *  public void deliverResult(D data) { ... }
- * 
+ *
+ *
* - * {@hide} + * @memberDoc This method is safe to call from any thread. + * @hide */ @Retention(SOURCE) @Target({METHOD,CONSTRUCTOR,TYPE}) diff --git a/core/java/android/annotation/CallSuper.java b/core/java/android/annotation/CallSuper.java index b10a28acf7a4d..c16b51161cac9 100644 --- a/core/java/android/annotation/CallSuper.java +++ b/core/java/android/annotation/CallSuper.java @@ -15,24 +15,29 @@ */ package android.annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.SOURCE; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + /** * Denotes that any overriding methods should invoke this method as well. *

* Example: - *


+ *
+ * 
+ * 
  *  @CallSuper
  *  public abstract void onFocusLost();
- * 
+ *
+ *
* + * @memberDoc If you override this method you must call through to the + * superclass implementation. * @hide */ @Retention(SOURCE) @Target({METHOD}) public @interface CallSuper { -} \ No newline at end of file +} diff --git a/core/java/android/annotation/MainThread.java b/core/java/android/annotation/MainThread.java index c6ac30c5c5da6..d15cfcd94ba7e 100644 --- a/core/java/android/annotation/MainThread.java +++ b/core/java/android/annotation/MainThread.java @@ -15,9 +15,6 @@ */ package android.annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; @@ -25,6 +22,9 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.os.Looper; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + /** * 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 diff --git a/core/java/android/annotation/SuppressAutoDoc.java b/core/java/android/annotation/SuppressAutoDoc.java index 0f8fa6cba0a9b..e34e03bcee29c 100644 --- a/core/java/android/annotation/SuppressAutoDoc.java +++ b/core/java/android/annotation/SuppressAutoDoc.java @@ -16,14 +16,17 @@ package android.annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - +import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + /** * Denotes that any automatically generated documentation should be suppressed * for the annotated method, parameter, or field. @@ -31,6 +34,6 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; * @hide */ @Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE}) public @interface SuppressAutoDoc { } diff --git a/core/java/android/annotation/UiThread.java b/core/java/android/annotation/UiThread.java index 53121e7d532fe..b2778966dacb2 100644 --- a/core/java/android/annotation/UiThread.java +++ b/core/java/android/annotation/UiThread.java @@ -15,28 +15,36 @@ */ package android.annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; +import android.os.Looper; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + /** - * Denotes that the annotated method or constructor should only be called on the UI thread. - * If the annotated element is a class, then all methods in the class should be called - * on the UI thread. + * Denotes that the annotated method or constructor should only be called on the + * UI thread. If the annotated element is a class, then all methods in the class + * should be called on the UI thread. *

* Example: - *


+ *
+ * 
+ * 
  *  @UiThread
  *  public abstract void setText(@NonNull String text) { ... }
- * 
+ *
+ *
* - * {@hide} + * @memberDoc This method must be called on the thread that originally created + * this UI element. This is typically the + * {@linkplain Looper#getMainLooper() main thread} of your app. + * @hide */ @Retention(SOURCE) @Target({METHOD,CONSTRUCTOR,TYPE}) public @interface UiThread { -} \ No newline at end of file +} diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 44c275f421612..62f2144312e24 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -3081,6 +3081,21 @@ public class ActivityManager { */ public int lastTrimLevel; + /** @hide */ + @IntDef(prefix = { "IMPORTANCE_" }, value = { + IMPORTANCE_FOREGROUND, + IMPORTANCE_FOREGROUND_SERVICE, + IMPORTANCE_TOP_SLEEPING, + IMPORTANCE_VISIBLE, + IMPORTANCE_PERCEPTIBLE, + IMPORTANCE_CANT_SAVE_STATE, + IMPORTANCE_SERVICE, + IMPORTANCE_CACHED, + IMPORTANCE_GONE, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface Importance {} + /** * Constant for {@link #importance}: This process is running the * foreground UI; that is, it is the thing currently at the top of the screen @@ -3190,7 +3205,7 @@ public class ActivityManager { * will be passed to a client, use {@link #procStateToImportanceForClient}. * @hide */ - public static int procStateToImportance(int procState) { + public static @Importance int procStateToImportance(int procState) { if (procState == PROCESS_STATE_NONEXISTENT) { return IMPORTANCE_GONE; } else if (procState >= PROCESS_STATE_HOME) { @@ -3219,7 +3234,8 @@ public class ActivityManager { * client's target SDK < {@link VERSION_CODES#O}. * @hide */ - public static int procStateToImportanceForClient(int procState, Context clientContext) { + public static @Importance int procStateToImportanceForClient(int procState, + Context clientContext) { final int importance = procStateToImportance(procState); // For pre O apps, convert to the old, wrong values. @@ -3235,7 +3251,7 @@ public class ActivityManager { } /** @hide */ - public static int importanceToProcState(int importance) { + public static int importanceToProcState(@Importance int importance) { if (importance == IMPORTANCE_GONE) { return PROCESS_STATE_NONEXISTENT; } else if (importance >= IMPORTANCE_CACHED) { @@ -3258,14 +3274,11 @@ public class ActivityManager { } /** - * The relative importance level that the system places on this - * process. May be one of {@link #IMPORTANCE_FOREGROUND}, - * {@link #IMPORTANCE_VISIBLE}, {@link #IMPORTANCE_SERVICE}, or - * {@link #IMPORTANCE_CACHED}. These - * constants are numbered so that "more important" values are always - * smaller than "less important" values. + * The relative importance level that the system places on this process. + * These constants are numbered so that "more important" values are + * always smaller than "less important" values. */ - public int importance; + public @Importance int importance; /** * An additional ordering within a particular {@link #importance} @@ -3459,7 +3472,7 @@ public class ActivityManager { */ @SystemApi @TestApi @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS) - public int getPackageImportance(String packageName) { + public @RunningAppProcessInfo.Importance int getPackageImportance(String packageName) { try { int procState = getService().getPackageProcessState(packageName, mContext.getOpPackageName()); @@ -3479,7 +3492,7 @@ public class ActivityManager { */ @SystemApi @TestApi @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS) - public int getUidImportance(int uid) { + public @RunningAppProcessInfo.Importance int getUidImportance(int uid) { try { int procState = getService().getUidProcessState(uid, mContext.getOpPackageName()); @@ -3505,7 +3518,7 @@ public class ActivityManager { * @param uid The uid whose importance has changed. * @param importance The new importance value as per {@link RunningAppProcessInfo}. */ - void onUidImportance(int uid, int importance); + void onUidImportance(int uid, @RunningAppProcessInfo.Importance int importance); } /** @@ -3527,7 +3540,7 @@ public class ActivityManager { */ @SystemApi @TestApi public void addOnUidImportanceListener(OnUidImportanceListener listener, - int importanceCutpoint) { + @RunningAppProcessInfo.Importance int importanceCutpoint) { synchronized (this) { if (mImportanceListeners.containsKey(listener)) { throw new IllegalArgumentException("Listener already registered: " + listener); @@ -4263,8 +4276,7 @@ public class ActivityManager { /** * Enable more aggressive scheduling for latency-sensitive low-runtime VR threads that persist - * beyond a single process. It requires holding the - * {@link android.Manifest.permission#RESTRICTED_VR_ACCESS} permission. Only one thread can be a + * beyond a single process. Only one thread can be a * persistent VR thread at a time, and that thread may be subject to restrictions on the amount * of time it can run. Calling this method will disable aggressive scheduling for non-persistent * VR threads set via {@link #setVrThread}. If persistent VR mode is disabled then the diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java index c0bf0c46988a5..b8a5f572ccfc8 100644 --- a/core/java/android/app/KeyguardManager.java +++ b/core/java/android/app/KeyguardManager.java @@ -169,9 +169,6 @@ public class KeyguardManager { * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager} * is enabled that requires a password. * - *

This method requires the caller to hold the permission - * {@link android.Manifest.permission#DISABLE_KEYGUARD}. - * * @see #reenableKeyguard() */ @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD) @@ -191,9 +188,6 @@ public class KeyguardManager { * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager} * is enabled that requires a password. * - *

This method requires the caller to hold the permission - * {@link android.Manifest.permission#DISABLE_KEYGUARD}. - * * @see #disableKeyguard() */ @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD) @@ -431,9 +425,6 @@ public class KeyguardManager { * This will, if the keyguard is secure, bring up the unlock screen of * the keyguard. * - *

This method requires the caller to hold the permission - * {@link android.Manifest.permission#DISABLE_KEYGUARD}. - * * @param callback Let's you know whether the operation was succesful and * it is safe to launch anything that would normally be considered safe * once the user has gotten past the keyguard. diff --git a/core/java/android/app/trust/TrustManager.java b/core/java/android/app/trust/TrustManager.java index a64a023fec6b4..06b0aacd86542 100644 --- a/core/java/android/app/trust/TrustManager.java +++ b/core/java/android/app/trust/TrustManager.java @@ -51,8 +51,6 @@ public class TrustManager { * Changes the lock status for the given user. This is only applicable to Managed Profiles, * other users should be handled by Keyguard. * - * Requires the {@link android.Manifest.permission#ACCESS_KEYGUARD_SECURE_STORAGE} permission. - * * @param userId The id for the user to be locked/unlocked. * @param locked The value for that user's locked state. */ diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java index 1ca2be5b2a1f9..d1ad8de0b1132 100644 --- a/core/java/android/bluetooth/BluetoothA2dp.java +++ b/core/java/android/bluetooth/BluetoothA2dp.java @@ -422,8 +422,6 @@ public final class BluetoothA2dp implements BluetoothProfile { * {@link #PRIORITY_AUTO_CONNECT}, {@link #PRIORITY_OFF}, * {@link #PRIORITY_ON}, {@link #PRIORITY_UNDEFINED} * - *

Requires {@link android.Manifest.permission#BLUETOOTH} permission. - * * @param device Bluetooth device * @return priority of the device * @hide diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 735d84e72b675..d60d4db1cab1c 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -697,7 +697,6 @@ public final class BluetoothAdapter { * Return true if Bluetooth is currently enabled and ready for use. *

Equivalent to: * getBluetoothState() == STATE_ON - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @return true if the local adapter is turned on */ @@ -835,7 +834,6 @@ public final class BluetoothAdapter { * {@link #STATE_TURNING_ON}, * {@link #STATE_ON}, * {@link #STATE_TURNING_OFF}. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @return current state of Bluetooth adapter */ @@ -878,7 +876,6 @@ public final class BluetoothAdapter { * {@link #STATE_ON}, * {@link #STATE_TURNING_OFF}, * {@link #STATE_BLE_TURNING_OFF}. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @return current state of Bluetooth adapter * @hide @@ -934,8 +931,6 @@ public final class BluetoothAdapter { * #STATE_ON}. If this call returns false then there was an * immediate problem that will prevent the adapter from being turned on - * such as Airplane mode, or the adapter is already turned on. - *

Requires the {@link android.Manifest.permission#BLUETOOTH_ADMIN} - * permission * * @return true to indicate adapter startup has begun, or false on * immediate error @@ -970,8 +965,6 @@ public final class BluetoothAdapter { * #STATE_ON}. If this call returns false then there was an * immediate problem that will prevent the adapter from being turned off - * such as the adapter already being turned off. - *

Requires the {@link android.Manifest.permission#BLUETOOTH_ADMIN} - * permission * * @return true to indicate adapter shutdown has begun, or false on * immediate error @@ -1005,7 +998,6 @@ public final class BluetoothAdapter { /** * Returns the hardware address of the local Bluetooth adapter. *

For example, "00:11:22:AA:BB:CC". - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @return Bluetooth hardware address as string */ @@ -1109,7 +1101,6 @@ public final class BluetoothAdapter { * will return false. After turning on Bluetooth, * wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON} * to get the updated value. - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} * * @param name a valid Bluetooth name * @return true if the name was set, false otherwise @@ -1140,7 +1131,6 @@ public final class BluetoothAdapter { * will return {@link #SCAN_MODE_NONE}. After turning on Bluetooth, * wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON} * to get the updated value. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @return scan mode */ @@ -1279,7 +1269,6 @@ public final class BluetoothAdapter { * will return false. After turning on Bluetooth, * wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON} * to get the updated value. - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}. * * @return true on success, false on error */ @@ -1299,7 +1288,6 @@ public final class BluetoothAdapter { /** * Cancel the current device discovery process. - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}. *

Because discovery is a heavyweight procedure for the Bluetooth * adapter, this method should always be called before attempting to connect * to a remote device with {@link @@ -1343,7 +1331,6 @@ public final class BluetoothAdapter { * will return false. After turning on Bluetooth, * wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON} * to get the updated value. - *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return true if discovering */ @@ -1610,7 +1597,6 @@ public final class BluetoothAdapter { * will return an empty set. After turning on Bluetooth, * wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON} * to get the updated value. - *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return unmodifiable set of {@link BluetoothDevice}, or null on error */ @@ -1695,8 +1681,6 @@ public final class BluetoothAdapter { * Profile can be one of {@link BluetoothProfile#HEALTH}, {@link BluetoothProfile#HEADSET}, * {@link BluetoothProfile#A2DP}. * - *

Requires {@link android.Manifest.permission#BLUETOOTH}. - * *

Return value can be one of * {@link BluetoothProfile#STATE_DISCONNECTED}, * {@link BluetoothProfile#STATE_CONNECTING}, @@ -1786,7 +1770,6 @@ public final class BluetoothAdapter { * closed, or if this application closes unexpectedly. *

Use {@link BluetoothDevice#createRfcommSocketToServiceRecord} to * connect to this socket from another device using the same {@link UUID}. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * @param name service name for SDP record * @param uuid uuid for SDP record * @return a listening RFCOMM BluetoothServerSocket @@ -1818,7 +1801,6 @@ public final class BluetoothAdapter { * closed, or if this application closes unexpectedly. *

Use {@link BluetoothDevice#createRfcommSocketToServiceRecord} to * connect to this socket from another device using the same {@link UUID}. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * @param name service name for SDP record * @param uuid uuid for SDP record * @return a listening RFCOMM BluetoothServerSocket @@ -2410,8 +2392,6 @@ public final class BluetoothAdapter { *

Results of the scan are reported using the * {@link LeScanCallback#onLeScan} callback. * - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. - * * @param callback the callback LE scan results are delivered * @return true, if the scan was started successfully * @deprecated use {@link BluetoothLeScanner#startScan(List, ScanSettings, ScanCallback)} @@ -2430,8 +2410,6 @@ public final class BluetoothAdapter { *

Devices which advertise all specified services are reported using the * {@link LeScanCallback#onLeScan} callback. * - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. - * * @param serviceUuids Array of services to look for * @param callback the callback LE scan results are delivered * @return true, if the scan was started successfully @@ -2519,8 +2497,6 @@ public final class BluetoothAdapter { /** * Stops an ongoing Bluetooth LE device scan. * - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. - * * @param callback used to identify which scan to stop * must be the same handle used to start the scan * @deprecated Use {@link BluetoothLeScanner#stopScan(ScanCallback)} instead. diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index e6cebc0819f51..639e05622334d 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -762,7 +762,6 @@ public final class BluetoothDevice implements Parcelable { *

The local adapter will automatically retrieve remote names when * performing a device scan, and will cache them. This method just returns * the name for this device from the cache. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @return the Bluetooth name, or null if there was a problem. */ @@ -781,8 +780,6 @@ public final class BluetoothDevice implements Parcelable { /** * Get the Bluetooth device type of the remote device. * - *

Requires {@link android.Manifest.permission#BLUETOOTH} - * * @return the device type {@link #DEVICE_TYPE_CLASSIC}, {@link #DEVICE_TYPE_LE} * {@link #DEVICE_TYPE_DUAL}. * {@link #DEVICE_TYPE_UNKNOWN} if it's not available @@ -862,7 +859,6 @@ public final class BluetoothDevice implements Parcelable { * the bonding process completes, and its result. *

Android system services will handle the necessary user interactions * to confirm and complete the bonding process. - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}. * * @return false on immediate error, true if bonding will begin */ @@ -1022,7 +1018,6 @@ public final class BluetoothDevice implements Parcelable { * {@link #BOND_NONE}, * {@link #BOND_BONDING}, * {@link #BOND_BONDED}. - *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return the bond state */ @@ -1089,7 +1084,6 @@ public final class BluetoothDevice implements Parcelable { /** * Get the Bluetooth class of the remote device. - *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return Bluetooth class object, or null on error */ @@ -1114,7 +1108,6 @@ public final class BluetoothDevice implements Parcelable { * from the remote device. Instead, the local cached copy of the service * UUIDs are returned. *

Use {@link #fetchUuidsWithSdp} if fresh UUIDs are desired. - *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return the supported features (UUIDs) of the remote device, * or null on error @@ -1140,7 +1133,6 @@ public final class BluetoothDevice implements Parcelable { * {@link #ACTION_UUID} intent is sent with the UUIDs that is currently * present in the cache. Clients should use the {@link #getUuids} to get UUIDs * if service discovery is not to be performed. - *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return False if the sanity check fails, True if the process * of initiating an ACL connection to the remote device @@ -1221,7 +1213,6 @@ public final class BluetoothDevice implements Parcelable { /** * Confirm passkey for {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing. - *

Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. * * @return true confirmation has been sent out * false for error @@ -1502,7 +1493,6 @@ public final class BluetoothDevice implements Parcelable { * using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. * However if you are connecting to an Android peer then please generate * your own unique UUID. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @param uuid service record uuid to lookup RFCOMM channel * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection @@ -1541,7 +1531,6 @@ public final class BluetoothDevice implements Parcelable { * using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. * However if you are connecting to an Android peer then please generate * your own unique UUID. - *

Requires {@link android.Manifest.permission#BLUETOOTH} * * @param uuid service record uuid to lookup RFCOMM channel * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection diff --git a/core/java/android/bluetooth/BluetoothManager.java b/core/java/android/bluetooth/BluetoothManager.java index 29283e793ce93..c7191ba2638b7 100644 --- a/core/java/android/bluetooth/BluetoothManager.java +++ b/core/java/android/bluetooth/BluetoothManager.java @@ -85,8 +85,6 @@ public final class BluetoothManager { * This can be used by applications like status bar which would just like * to know the state of Bluetooth. * - *

Requires {@link android.Manifest.permission#BLUETOOTH} permission. - * * @param device Remote bluetooth device. * @param profile GATT or GATT_SERVER * @return State of the profile connection. One of @@ -118,8 +116,6 @@ public final class BluetoothManager { * This can be used by applications like status bar which would just like * to know the state of Bluetooth. * - *

Requires {@link android.Manifest.permission#BLUETOOTH} permission. - * * @param profile GATT or GATT_SERVER * @return List of devices. The list will be empty on error. */ @@ -159,8 +155,6 @@ public final class BluetoothManager { * This can be used by applications like status bar which would just like * to know the state of the local adapter. * - *

Requires {@link android.Manifest.permission#BLUETOOTH} permission. - * * @param profile GATT or GATT_SERVER * @param states Array of states. States can be one of * {@link BluetoothProfile#STATE_CONNECTED}, {@link BluetoothProfile#STATE_CONNECTING}, diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java index 2f64c719ec100..c5b58e97e5287 100644 --- a/core/java/android/bluetooth/BluetoothProfile.java +++ b/core/java/android/bluetooth/BluetoothProfile.java @@ -187,8 +187,6 @@ public interface BluetoothProfile { * *

Return the set of devices which are in state {@link #STATE_CONNECTED} * - *

Requires {@link android.Manifest.permission#BLUETOOTH} permission. - * * @return List of devices. The list will be empty on error. */ @RequiresPermission(Manifest.permission.BLUETOOTH) @@ -201,8 +199,6 @@ public interface BluetoothProfile { *

If none of the devices match any of the given states, * an empty list will be returned. * - *

Requires {@link android.Manifest.permission#BLUETOOTH} permission. - * * @param states Array of states. States can be one of * {@link #STATE_CONNECTED}, {@link #STATE_CONNECTING}, * {@link #STATE_DISCONNECTED}, {@link #STATE_DISCONNECTING}, @@ -214,8 +210,6 @@ public interface BluetoothProfile { /** * Get the current connection state of the profile * - *

Requires {@link android.Manifest.permission#BLUETOOTH} permission. - * * @param device Remote bluetooth device. * @return State of the profile connection. One of * {@link #STATE_CONNECTED}, {@link #STATE_CONNECTING}, diff --git a/core/java/android/bluetooth/le/BluetoothLeScanner.java b/core/java/android/bluetooth/le/BluetoothLeScanner.java index b65a7ad0c017e..8d2c3ec92c0c5 100644 --- a/core/java/android/bluetooth/le/BluetoothLeScanner.java +++ b/core/java/android/bluetooth/le/BluetoothLeScanner.java @@ -100,7 +100,6 @@ public final class BluetoothLeScanner { * Start Bluetooth LE scan with default parameters and no filters. The scan results will be * delivered through {@code callback}. *

- * Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * An app must hold * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or * {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission @@ -117,7 +116,6 @@ public final class BluetoothLeScanner { /** * Start Bluetooth LE scan. The scan results will be delivered through {@code callback}. *

- * Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * An app must hold * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or * {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission @@ -243,8 +241,6 @@ public final class BluetoothLeScanner { /** * Stops an ongoing Bluetooth LE scan. - *

- * Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * * @param callback */ @@ -263,8 +259,6 @@ public final class BluetoothLeScanner { /** * Stops an ongoing Bluetooth LE scan started using a PendingIntent. - *

- * Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * * @param callbackIntent The PendingIntent that was used to start the scan. * @see #startScan(List, ScanSettings, PendingIntent) diff --git a/core/java/android/content/ComponentCallbacks2.java b/core/java/android/content/ComponentCallbacks2.java index b78548b873b12..6576c0f9b388c 100644 --- a/core/java/android/content/ComponentCallbacks2.java +++ b/core/java/android/content/ComponentCallbacks2.java @@ -16,6 +16,11 @@ package android.content; +import android.annotation.IntDef; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + /** * Extended {@link ComponentCallbacks} interface with a new callback for * finer-grained memory management. This interface is available in all application components @@ -83,6 +88,19 @@ package android.content; */ public interface ComponentCallbacks2 extends ComponentCallbacks { + /** @hide */ + @IntDef(prefix = { "TRIM_MEMORY_" }, value = { + TRIM_MEMORY_COMPLETE, + TRIM_MEMORY_MODERATE, + TRIM_MEMORY_BACKGROUND, + TRIM_MEMORY_UI_HIDDEN, + TRIM_MEMORY_RUNNING_CRITICAL, + TRIM_MEMORY_RUNNING_LOW, + TRIM_MEMORY_RUNNING_MODERATE, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface TrimMemoryLevel {} + /** * Level for {@link #onTrimMemory(int)}: the process is nearing the end * of the background LRU list, and if more memory isn't found soon it will @@ -132,7 +150,6 @@ public interface ComponentCallbacks2 extends ComponentCallbacks { */ static final int TRIM_MEMORY_RUNNING_LOW = 10; - /** * Level for {@link #onTrimMemory(int)}: the process is not an expendable * background process, but the device is running moderately low on memory. @@ -155,11 +172,7 @@ public interface ComponentCallbacks2 extends ComponentCallbacks { * ActivityManager.getMyMemoryState(RunningAppProcessInfo)}. * * @param level The context of the trim, giving a hint of the amount of - * trimming the application may like to perform. May be - * {@link #TRIM_MEMORY_COMPLETE}, {@link #TRIM_MEMORY_MODERATE}, - * {@link #TRIM_MEMORY_BACKGROUND}, {@link #TRIM_MEMORY_UI_HIDDEN}, - * {@link #TRIM_MEMORY_RUNNING_CRITICAL}, {@link #TRIM_MEMORY_RUNNING_LOW}, - * or {@link #TRIM_MEMORY_RUNNING_MODERATE}. + * trimming the application may like to perform. */ - void onTrimMemory(int level); + void onTrimMemory(@TrimMemoryLevel int level); } diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java index 9e4a86db86842..aaaff0c059db1 100644 --- a/core/java/android/content/pm/PackageInstaller.java +++ b/core/java/android/content/pm/PackageInstaller.java @@ -1084,8 +1084,6 @@ public class PackageInstaller { /** * Sets which runtime permissions to be granted to the package at installation. - * Using this API requires holding {@link android.Manifest.permission - * #INSTALL_GRANT_RUNTIME_PERMISSIONS} * * @param permissions The permissions to grant or null to grant all runtime * permissions. diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 09affa15ba675..47d79cfba40ca 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -3535,8 +3535,7 @@ public abstract class PackageManager { @ApplicationInfoFlags int flags, @UserIdInt int userId); /** - * Gets the instant applications the user recently used. Requires - * holding "android.permission.ACCESS_INSTANT_APPS". + * Gets the instant applications the user recently used. * * @return The instant app list. * diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 0610499dbce49..86fcfc8fb961b 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -115,8 +115,7 @@ public class Build { public static final String SERIAL = getString("no.such.thing"); /** - * Gets the hardware serial, if available. Requires holding the {@link - * android.Manifest.permission#READ_PHONE_STATE} permission. + * Gets the hardware serial, if available. * @return The serial if specified. */ @RequiresPermission(Manifest.permission.READ_PHONE_STATE) diff --git a/graphics/java/android/graphics/Color.java b/graphics/java/android/graphics/Color.java index 8cbf921f6a34a..bdd828fd5127c 100644 --- a/graphics/java/android/graphics/Color.java +++ b/graphics/java/android/graphics/Color.java @@ -24,7 +24,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Size; - +import android.annotation.SuppressAutoDoc; import android.util.Half; import com.android.internal.util.XmlUtils; @@ -289,6 +289,7 @@ import java.util.function.DoubleUnaryOperator; * and (1.0, 0.0, 0.0, 0.5).

*/ @AnyThread +@SuppressAutoDoc public class Color { @ColorInt public static final int BLACK = 0xFF000000; @ColorInt public static final int DKGRAY = 0xFF444444; diff --git a/graphics/java/android/graphics/ColorSpace.java b/graphics/java/android/graphics/ColorSpace.java index f2957a30b05e0..5814df5b5cc02 100644 --- a/graphics/java/android/graphics/ColorSpace.java +++ b/graphics/java/android/graphics/ColorSpace.java @@ -22,6 +22,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Size; +import android.annotation.SuppressAutoDoc; import android.util.Pair; import java.util.ArrayList; @@ -131,6 +132,7 @@ import java.util.function.DoubleUnaryOperator; */ @AnyThread @SuppressWarnings("StaticInitializerReferencesSubClass") +@SuppressAutoDoc public abstract class ColorSpace { /** * Standard CIE 1931 2° illuminant A, encoded in xyY. diff --git a/keystore/java/android/security/keystore/AttestationUtils.java b/keystore/java/android/security/keystore/AttestationUtils.java index 2ec8d33ca5306..0f983929b7668 100644 --- a/keystore/java/android/security/keystore/AttestationUtils.java +++ b/keystore/java/android/security/keystore/AttestationUtils.java @@ -95,9 +95,6 @@ public abstract class AttestationUtils { * For privacy reasons, you cannot distinguish between (1) and (2). If attestation is * unsuccessful, the device may not support it in general or the user may have permanently * disabled it. - *

- * The caller must hold {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} - * permission. * * @param context the context to use for retrieving device identifiers. * @param idTypes the types of device identifiers to attest. diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 0342da7aa6ef9..0a47a9890c8dd 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -16,6 +16,7 @@ package android.telecom; import android.Manifest; import android.annotation.RequiresPermission; +import android.annotation.SuppressAutoDoc; import android.annotation.SystemApi; import android.content.ComponentName; import android.content.Context; @@ -46,6 +47,7 @@ import java.util.List; * permissions declared in its manifest file. Where permissions apply, they are noted in the method * descriptions. */ +@SuppressAutoDoc public class TelecomManager { /**