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

Commit 049f0f5f authored by Mathew Inwood's avatar Mathew Inwood
Browse files

Add maxTargetSdk restriction to unused APIs.

These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
parent abe93957
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final String ACTION_ACTIVE_DEVICE_CHANGED =
            "android.bluetooth.a2dp.profile.action.ACTIVE_DEVICE_CHANGED";

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

@@ -409,7 +409,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public boolean setActiveDevice(@Nullable BluetoothDevice device) {
        if (DBG) log("setActiveDevice(" + device + ")");
        try {
@@ -433,7 +433,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * is active
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @Nullable
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public BluetoothDevice getActiveDevice() {
@@ -651,7 +651,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @return the current codec status
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @Nullable
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public BluetoothCodecStatus getCodecStatus(@NonNull BluetoothDevice device) {
@@ -680,7 +680,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @param codecConfig the codec configuration preference
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public void setCodecConfigPreference(@NonNull BluetoothDevice device,
                                         @NonNull BluetoothCodecConfig codecConfig) {
@@ -710,7 +710,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * active A2DP Bluetooth device.
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public void enableOptionalCodecs(@NonNull BluetoothDevice device) {
        if (DBG) Log.d(TAG, "enableOptionalCodecs(" + device + ")");
@@ -725,7 +725,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * active A2DP Bluetooth device.
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public void disableOptionalCodecs(@NonNull BluetoothDevice device) {
        if (DBG) Log.d(TAG, "disableOptionalCodecs(" + device + ")");
@@ -766,7 +766,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_SUPPORTED.
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    @OptionalCodecsSupportStatus
    public int isOptionalCodecsSupported(@NonNull BluetoothDevice device) {
@@ -792,7 +792,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_PREF_DISABLED.
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    @OptionalCodecsPreferenceStatus
    public int isOptionalCodecsEnabled(@NonNull BluetoothDevice device) {
@@ -819,7 +819,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_PREF_DISABLED.
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public void setOptionalCodecsEnabled(@NonNull BluetoothDevice device,
            @OptionalCodecsPreferenceStatus int value) {
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
@@ -158,7 +159,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * @return false on immediate error, true otherwise
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean disconnect(BluetoothDevice device) {
        if (DBG) log("disconnect(" + device + ")");
+4 −3
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.BatteryStats;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.os.ParcelUuid;
import android.os.RemoteException;
@@ -1173,7 +1174,7 @@ public final class BluetoothAdapter {
     * @return true to indicate adapter shutdown has begun, or false on immediate error
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public boolean disable(boolean persist) {

        try {
@@ -1222,7 +1223,7 @@ public final class BluetoothAdapter {
     * @return true to indicate that the config file was successfully cleared
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    public boolean factoryReset() {
        try {
@@ -2594,7 +2595,7 @@ public final class BluetoothAdapter {
     * permissions, or channel in use.
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public BluetoothServerSocket listenUsingEncryptedRfcommWithServiceRecord(String name, UUID uuid)
            throws IOException {
        return createNewRfcommSocketAndRecord(name, uuid, false, true);
+13 −12
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.annotation.SystemApi;
import android.app.PropertyInvalidatedCache;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Parcel;
import android.os.ParcelUuid;
@@ -349,7 +350,7 @@ public final class BluetoothDevice implements Parcelable {

    /** @hide */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final String ACTION_SDP_RECORD =
            "android.bluetooth.device.action.SDP_RECORD";

@@ -645,7 +646,7 @@ public final class BluetoothDevice implements Parcelable {
     *
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int UNBOND_REASON_AUTH_FAILED = 1;

    /**
@@ -654,7 +655,7 @@ public final class BluetoothDevice implements Parcelable {
     *
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int UNBOND_REASON_AUTH_REJECTED = 2;

    /**
@@ -669,7 +670,7 @@ public final class BluetoothDevice implements Parcelable {
     *
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int UNBOND_REASON_REMOTE_DEVICE_DOWN = 4;

    /**
@@ -677,7 +678,7 @@ public final class BluetoothDevice implements Parcelable {
     *
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int UNBOND_REASON_DISCOVERY_IN_PROGRESS = 5;

    /**
@@ -685,7 +686,7 @@ public final class BluetoothDevice implements Parcelable {
     *
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int UNBOND_REASON_AUTH_TIMEOUT = 6;

    /**
@@ -693,7 +694,7 @@ public final class BluetoothDevice implements Parcelable {
     *
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int UNBOND_REASON_REPEATED_ATTEMPTS = 7;

    /**
@@ -702,7 +703,7 @@ public final class BluetoothDevice implements Parcelable {
     *
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int UNBOND_REASON_REMOTE_AUTH_CANCELED = 8;

    /**
@@ -781,7 +782,7 @@ public final class BluetoothDevice implements Parcelable {
            "android.bluetooth.device.extra.SDP_RECORD";

    /** @hide */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final String EXTRA_SDP_SEARCH_STATUS =
            "android.bluetooth.device.extra.SDP_SEARCH_STATUS";

@@ -1102,7 +1103,7 @@ public final class BluetoothDevice implements Parcelable {
     * @return true on success, false on error
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public boolean setAlias(@NonNull String alias) {
        final IBluetooth service = sService;
@@ -1541,7 +1542,7 @@ public final class BluetoothDevice implements Parcelable {
     * @return true pin has been set false for error
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean setPin(@NonNull String pin) {
        byte[] pinBytes = convertPinToBytes(pin);
@@ -2155,7 +2156,7 @@ public final class BluetoothDevice implements Parcelable {
     * operations.
     * @hide
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public BluetoothGatt connectGatt(Context context, boolean autoConnect,
            BluetoothGattCallback callback, int transport,
            boolean opportunistic, int phy, Handler handler) {
+3 −3
Original line number Diff line number Diff line
@@ -58,9 +58,9 @@ public final class BluetoothGatt implements BluetoothProfile {
    private int mConnState;
    private final Object mStateLock = new Object();
    private final Object mDeviceBusyLock = new Object();
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private Boolean mDeviceBusy = false;
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private int mTransport;
    private int mPhy;
    private boolean mOpportunistic;
@@ -881,7 +881,7 @@ public final class BluetoothGatt implements BluetoothProfile {
     * automatically connect as soon as the remote device becomes available (true).
     * @return true, if the connection attempt was initiated successfully
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    /*package*/ boolean connect(Boolean autoConnect, BluetoothGattCallback callback,
            Handler handler) {
        if (DBG) {
Loading