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

Commit f51a804b authored by Mathew Inwood's avatar Mathew Inwood Committed by android-build-merger
Browse files

Merge "Add @UnsupportedAppUsage annotations"

am: b40b37910d

Change-Id: Ic3de9e4c6d17687d4a1f64c02026e5c0711e8fd1
parents 8188c561 7d543894
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -117,6 +118,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @UnsupportedAppUsage
    public static final String ACTION_ACTIVE_DEVICE_CHANGED =
            "android.bluetooth.a2dp.profile.action.ACTIVE_DEVICE_CHANGED";

@@ -137,6 +139,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @UnsupportedAppUsage
    public static final String ACTION_CODEC_CONFIG_CHANGED =
            "android.bluetooth.a2dp.profile.action.CODEC_CONFIG_CHANGED";

@@ -160,6 +163,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static final int OPTIONAL_CODECS_SUPPORT_UNKNOWN = -1;

    /**
@@ -167,6 +171,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static final int OPTIONAL_CODECS_NOT_SUPPORTED = 0;

    /**
@@ -174,6 +179,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static final int OPTIONAL_CODECS_SUPPORTED = 1;

    /**
@@ -182,6 +188,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static final int OPTIONAL_CODECS_PREF_UNKNOWN = -1;

    /**
@@ -189,6 +196,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static final int OPTIONAL_CODECS_PREF_DISABLED = 0;

    /**
@@ -196,6 +204,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static final int OPTIONAL_CODECS_PREF_ENABLED = 1;

    private Context mContext;
@@ -268,6 +277,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        return true;
    }

    @UnsupportedAppUsage
    /*package*/ void close() {
        mServiceListener = null;
        IBluetoothManager mgr = mAdapter.getBluetoothManager();
@@ -315,6 +325,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @return false on immediate error, true otherwise
     * @hide
     */
    @UnsupportedAppUsage
    public boolean connect(BluetoothDevice device) {
        if (DBG) log("connect(" + device + ")");
        try {
@@ -357,6 +368,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @return false on immediate error, true otherwise
     * @hide
     */
    @UnsupportedAppUsage
    public boolean disconnect(BluetoothDevice device) {
        if (DBG) log("disconnect(" + device + ")");
        try {
@@ -460,6 +472,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @return false on immediate error, true otherwise
     * @hide
     */
    @UnsupportedAppUsage
    public boolean setActiveDevice(@Nullable BluetoothDevice device) {
        if (DBG) log("setActiveDevice(" + device + ")");
        try {
@@ -490,6 +503,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    @Nullable
    @UnsupportedAppUsage
    public BluetoothDevice getActiveDevice() {
        if (VDBG) log("getActiveDevice()");
        try {
@@ -556,6 +570,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    @UnsupportedAppUsage
    public int getPriority(BluetoothDevice device) {
        if (VDBG) log("getPriority(" + device + ")");
        try {
@@ -671,6 +686,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @return the current codec status
     * @hide
     */
    @UnsupportedAppUsage
    public BluetoothCodecStatus getCodecStatus(BluetoothDevice device) {
        if (DBG) Log.d(TAG, "getCodecStatus(" + device + ")");
        try {
@@ -698,6 +714,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @param codecConfig the codec configuration preference
     * @hide
     */
    @UnsupportedAppUsage
    public void setCodecConfigPreference(BluetoothDevice device,
                                         BluetoothCodecConfig codecConfig) {
        if (DBG) Log.d(TAG, "setCodecConfigPreference(" + device + ")");
@@ -723,6 +740,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * active A2DP Bluetooth device.
     * @hide
     */
    @UnsupportedAppUsage
    public void enableOptionalCodecs(BluetoothDevice device) {
        if (DBG) Log.d(TAG, "enableOptionalCodecs(" + device + ")");
        enableDisableOptionalCodecs(device, true);
@@ -735,6 +753,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * active A2DP Bluetooth device.
     * @hide
     */
    @UnsupportedAppUsage
    public void disableOptionalCodecs(BluetoothDevice device) {
        if (DBG) Log.d(TAG, "disableOptionalCodecs(" + device + ")");
        enableDisableOptionalCodecs(device, false);
@@ -775,6 +794,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_SUPPORTED.
     * @hide
     */
    @UnsupportedAppUsage
    public int supportsOptionalCodecs(BluetoothDevice device) {
        try {
            mServiceLock.readLock().lock();
@@ -799,6 +819,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_PREF_DISABLED.
     * @hide
     */
    @UnsupportedAppUsage
    public int getOptionalCodecsEnabled(BluetoothDevice device) {
        try {
            mServiceLock.readLock().lock();
@@ -824,6 +845,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_PREF_DISABLED.
     * @hide
     */
    @UnsupportedAppUsage
    public void setOptionalCodecsEnabled(BluetoothDevice device, int value) {
        try {
            if (value != BluetoothA2dp.OPTIONAL_CODECS_PREF_UNKNOWN
@@ -854,6 +876,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static String stateToString(int state) {
        switch (state) {
            case STATE_DISCONNECTED:
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.bluetooth;

import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -278,6 +279,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * @return false on immediate error, true otherwise
     * @hide
     */
    @UnsupportedAppUsage
    public boolean disconnect(BluetoothDevice device) {
        if (DBG) log("disconnect(" + device + ")");
        final IBluetoothA2dpSink service = mService;
+15 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
import android.app.ActivityThread;
import android.bluetooth.le.BluetoothLeAdvertiser;
import android.bluetooth.le.BluetoothLeScanner;
@@ -633,6 +634,7 @@ public final class BluetoothAdapter {
    private static PeriodicAdvertisingManager sPeriodicAdvertisingManager;

    private final IBluetoothManager mManagerService;
    @UnsupportedAppUsage
    private IBluetooth mService;
    private final ReentrantReadWriteLock mServiceLock = new ReentrantReadWriteLock();

@@ -988,6 +990,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    @AdapterState
    @UnsupportedAppUsage
    public int getLeState() {
        int state = BluetoothAdapter.STATE_OFF;

@@ -1098,6 +1101,7 @@ public final class BluetoothAdapter {
     * @return true to indicate adapter shutdown has begun, or false on immediate error
     * @hide
     */
    @UnsupportedAppUsage
    public boolean disable(boolean persist) {

        try {
@@ -1149,6 +1153,7 @@ public final class BluetoothAdapter {
     * @return true to indicate that the config file was successfully cleared
     * @hide
     */
    @UnsupportedAppUsage
    public boolean factoryReset() {
        try {
            mServiceLock.readLock().lock();
@@ -1172,6 +1177,7 @@ public final class BluetoothAdapter {
     * @return the UUIDs supported by the local Bluetooth Adapter.
     * @hide
     */
    @UnsupportedAppUsage
    public ParcelUuid[] getUuids() {
        if (getState() != STATE_ON) {
            return null;
@@ -1438,6 +1444,7 @@ public final class BluetoothAdapter {
     * @return true if the scan mode was set, false otherwise
     * @hide
     */
    @UnsupportedAppUsage
    public boolean setScanMode(@ScanMode int mode, int duration) {
        if (getState() != STATE_ON) {
            return false;
@@ -1456,6 +1463,7 @@ public final class BluetoothAdapter {
    }

    /** @hide */
    @UnsupportedAppUsage
    public boolean setScanMode(int mode) {
        if (getState() != STATE_ON) {
            return false;
@@ -1465,6 +1473,7 @@ public final class BluetoothAdapter {
    }

    /** @hide */
    @UnsupportedAppUsage
    public int getDiscoverableTimeout() {
        if (getState() != STATE_ON) {
            return -1;
@@ -1483,6 +1492,7 @@ public final class BluetoothAdapter {
    }

    /** @hide */
    @UnsupportedAppUsage
    public void setDiscoverableTimeout(int timeout) {
        if (getState() != STATE_ON) {
            return;
@@ -2007,6 +2017,7 @@ public final class BluetoothAdapter {
     * #STATE_CONNECTING} or {@link #STATE_DISCONNECTED}
     * @hide
     */
    @UnsupportedAppUsage
    public int getConnectionState() {
        if (getState() != STATE_ON) {
            return BluetoothAdapter.STATE_DISCONNECTED;
@@ -2094,6 +2105,7 @@ public final class BluetoothAdapter {
     * permissions, or channel in use.
     * @hide
     */
    @UnsupportedAppUsage
    public BluetoothServerSocket listenUsingRfcommOn(int channel, boolean mitm,
            boolean min16DigitPin) throws IOException {
        BluetoothServerSocket socket =
@@ -2206,6 +2218,7 @@ public final class BluetoothAdapter {
     * permissions, or channel in use.
     * @hide
     */
    @UnsupportedAppUsage
    public BluetoothServerSocket listenUsingEncryptedRfcommWithServiceRecord(String name, UUID uuid)
            throws IOException {
        return createNewRfcommSocketAndRecord(name, uuid, false, true);
@@ -2749,6 +2762,7 @@ public final class BluetoothAdapter {
        return true;
    }

    @UnsupportedAppUsage
    /*package*/ IBluetoothManager getBluetoothManager() {
        return mManagerService;
    }
@@ -2756,6 +2770,7 @@ public final class BluetoothAdapter {
    private final ArrayList<IBluetoothManagerCallback> mProxyServiceStateCallbacks =
            new ArrayList<IBluetoothManagerCallback>();

    @UnsupportedAppUsage
    /*package*/ IBluetooth getBluetoothService(IBluetoothManagerCallback cb) {
        synchronized (mProxyServiceStateCallbacks) {
            if (cb == null) {
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.bluetooth;

import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;

@@ -63,6 +64,7 @@ public final class BluetoothClass implements Parcelable {
    private final int mClass;

    /** @hide */
    @UnsupportedAppUsage
    public BluetoothClass(int classInt) {
        mClass = classInt;
    }
@@ -322,8 +324,10 @@ public final class BluetoothClass implements Parcelable {
    }

    /** @hide */
    @UnsupportedAppUsage
    public static final int PROFILE_HEADSET = 0;
    /** @hide */
    @UnsupportedAppUsage
    public static final int PROFILE_A2DP = 1;
    /** @hide */
    public static final int PROFILE_OPP = 2;
@@ -346,6 +350,7 @@ public final class BluetoothClass implements Parcelable {
     * @return True if this device might support specified profile.
     * @hide
     */
    @UnsupportedAppUsage
    public boolean doesClassMatch(int profile) {
        if (profile == PROFILE_A2DP) {
            if (hasService(Service.RENDER)) {
+36 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.bluetooth;

import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;

@@ -32,34 +33,58 @@ public final class BluetoothCodecConfig implements Parcelable {
    // Add an entry for each source codec here.
    // NOTE: The values should be same as those listed in the following file:
    //   hardware/libhardware/include/hardware/bt_av.h
    @UnsupportedAppUsage
    public static final int SOURCE_CODEC_TYPE_SBC = 0;
    @UnsupportedAppUsage
    public static final int SOURCE_CODEC_TYPE_AAC = 1;
    @UnsupportedAppUsage
    public static final int SOURCE_CODEC_TYPE_APTX = 2;
    @UnsupportedAppUsage
    public static final int SOURCE_CODEC_TYPE_APTX_HD = 3;
    @UnsupportedAppUsage
    public static final int SOURCE_CODEC_TYPE_LDAC = 4;
    @UnsupportedAppUsage
    public static final int SOURCE_CODEC_TYPE_MAX = 5;

    @UnsupportedAppUsage
    public static final int SOURCE_CODEC_TYPE_INVALID = 1000 * 1000;

    @UnsupportedAppUsage
    public static final int CODEC_PRIORITY_DISABLED = -1;
    @UnsupportedAppUsage
    public static final int CODEC_PRIORITY_DEFAULT = 0;
    @UnsupportedAppUsage
    public static final int CODEC_PRIORITY_HIGHEST = 1000 * 1000;

    @UnsupportedAppUsage
    public static final int SAMPLE_RATE_NONE = 0;
    @UnsupportedAppUsage
    public static final int SAMPLE_RATE_44100 = 0x1 << 0;
    @UnsupportedAppUsage
    public static final int SAMPLE_RATE_48000 = 0x1 << 1;
    @UnsupportedAppUsage
    public static final int SAMPLE_RATE_88200 = 0x1 << 2;
    @UnsupportedAppUsage
    public static final int SAMPLE_RATE_96000 = 0x1 << 3;
    @UnsupportedAppUsage
    public static final int SAMPLE_RATE_176400 = 0x1 << 4;
    @UnsupportedAppUsage
    public static final int SAMPLE_RATE_192000 = 0x1 << 5;

    @UnsupportedAppUsage
    public static final int BITS_PER_SAMPLE_NONE = 0;
    @UnsupportedAppUsage
    public static final int BITS_PER_SAMPLE_16 = 0x1 << 0;
    @UnsupportedAppUsage
    public static final int BITS_PER_SAMPLE_24 = 0x1 << 1;
    @UnsupportedAppUsage
    public static final int BITS_PER_SAMPLE_32 = 0x1 << 2;

    @UnsupportedAppUsage
    public static final int CHANNEL_MODE_NONE = 0;
    @UnsupportedAppUsage
    public static final int CHANNEL_MODE_MONO = 0x1 << 0;
    @UnsupportedAppUsage
    public static final int CHANNEL_MODE_STEREO = 0x1 << 1;

    private final int mCodecType;
@@ -72,6 +97,7 @@ public final class BluetoothCodecConfig implements Parcelable {
    private final long mCodecSpecific3;
    private final long mCodecSpecific4;

    @UnsupportedAppUsage
    public BluetoothCodecConfig(int codecType, int codecPriority,
            int sampleRate, int bitsPerSample,
            int channelMode, long codecSpecific1,
@@ -276,6 +302,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return the codec type
     */
    @UnsupportedAppUsage
    public int getCodecType() {
        return mCodecType;
    }
@@ -296,6 +323,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return the codec priority
     */
    @UnsupportedAppUsage
    public int getCodecPriority() {
        return mCodecPriority;
    }
@@ -307,6 +335,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @param codecPriority the codec priority
     */
    @UnsupportedAppUsage
    public void setCodecPriority(int codecPriority) {
        mCodecPriority = codecPriority;
    }
@@ -324,6 +353,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return the codec sample rate
     */
    @UnsupportedAppUsage
    public int getSampleRate() {
        return mSampleRate;
    }
@@ -338,6 +368,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return the codec bits per sample
     */
    @UnsupportedAppUsage
    public int getBitsPerSample() {
        return mBitsPerSample;
    }
@@ -351,6 +382,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return the codec channel mode
     */
    @UnsupportedAppUsage
    public int getChannelMode() {
        return mChannelMode;
    }
@@ -360,6 +392,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return a codec specific value1.
     */
    @UnsupportedAppUsage
    public long getCodecSpecific1() {
        return mCodecSpecific1;
    }
@@ -369,6 +402,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return a codec specific value2
     */
    @UnsupportedAppUsage
    public long getCodecSpecific2() {
        return mCodecSpecific2;
    }
@@ -378,6 +412,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return a codec specific value3
     */
    @UnsupportedAppUsage
    public long getCodecSpecific3() {
        return mCodecSpecific3;
    }
@@ -387,6 +422,7 @@ public final class BluetoothCodecConfig implements Parcelable {
     *
     * @return a codec specific value4
     */
    @UnsupportedAppUsage
    public long getCodecSpecific4() {
        return mCodecSpecific4;
    }
Loading