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

Commit 3f38e428 authored by William Escande's avatar William Escande
Browse files

API Changes needed for apex to build

internal cherry-pick

Bug: 216476895
Test: Compile
Tag: #refactor
Change-Id: I09108622038b174104457ca18ac6ec7949978f66
Merged-In: I09108622038b174104457ca18ac6ec7949978f66
CTS-Coverage-Bug: 217352944
parent 61713020
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2159,6 +2159,8 @@ public class AdapterService extends Service {
                return false;
            }

            enforceBluetoothPrivilegedPermission(service);

            DeviceProperties deviceProp = service.mRemoteDevices.getDeviceProperties(device);
            if (deviceProp != null) {
                deviceProp.setBondingInitiatedLocally(false);
+133 −0

File changed.

Preview size limit exceeded, changes collapsed.

+17 −10
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.annotation.RequiresNoPermission;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.bluetooth.annotations.RequiresBluetoothConnectPermission;
import android.bluetooth.annotations.RequiresLegacyBluetoothAdminPermission;
@@ -124,11 +125,12 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @SystemApi
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @UnsupportedAppUsage(trackingBug = 171933273)
    @SuppressLint("ActionValue")
    public static final String ACTION_ACTIVE_DEVICE_CHANGED =
            "android.bluetooth.a2dp.profile.action.ACTIVE_DEVICE_CHANGED";

@@ -145,11 +147,12 @@ public final class BluetoothA2dp implements BluetoothProfile {
     *
     * @hide
     */
    @SystemApi
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @UnsupportedAppUsage(trackingBug = 181103983)
    @SuppressLint("ActionValue")
    public static final String ACTION_CODEC_CONFIG_CHANGED =
            "android.bluetooth.a2dp.profile.action.CODEC_CONFIG_CHANGED";

@@ -695,8 +698,12 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @param volume Absolute volume to be set on AVRCP side
     * @hide
     */
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public void setAvrcpAbsoluteVolume(int volume) {
        if (DBG) Log.d(TAG, "setAvrcpAbsoluteVolume");
        final IBluetoothA2dp service = getService();
@@ -769,7 +776,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @return the current codec status
     * @hide
     */
    @UnsupportedAppUsage(trackingBug = 181103983)
    @SystemApi
    @Nullable
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
@@ -802,7 +809,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @param codecConfig the codec configuration preference
     * @hide
     */
    @UnsupportedAppUsage(trackingBug = 181103983)
    @SystemApi
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@@ -833,7 +840,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @param device the remote Bluetooth device.
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @SystemApi
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@@ -849,7 +856,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @param device the remote Bluetooth device.
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @SystemApi
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@@ -892,7 +899,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_SUPPORTED.
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @SystemApi
    @RequiresLegacyBluetoothAdminPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@@ -925,7 +932,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_PREF_DISABLED.
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @SystemApi
    @RequiresLegacyBluetoothAdminPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@@ -959,7 +966,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * OPTIONAL_CODECS_PREF_DISABLED.
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @SystemApi
    @RequiresLegacyBluetoothAdminPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
+30 −10
Original line number Diff line number Diff line
@@ -222,6 +222,7 @@ public final class BluetoothAdapter {
     *
     * @hide
     */
    @SystemApi
    public static final int STATE_BLE_ON = 15;

    /**
@@ -271,6 +272,9 @@ public final class BluetoothAdapter {
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
    @NonNull
    public static String nameForState(@AdapterState int state) {
        switch (state) {
            case STATE_OFF:
@@ -367,10 +371,13 @@ public final class BluetoothAdapter {
     *
     * @hide
     */
    @SystemApi
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    @SuppressLint("ActionValue")
    public static final String
            ACTION_REQUEST_DISABLE = "android.bluetooth.adapter.action.REQUEST_DISABLE";

    /**
@@ -1395,7 +1402,7 @@ public final class BluetoothAdapter {
     * @return true to indicate that the config file was successfully cleared
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
@@ -1429,10 +1436,12 @@ public final class BluetoothAdapter {
     * @return the UUIDs supported by the local Bluetooth Adapter.
     * @hide
     */
    @UnsupportedAppUsage
    @SystemApi
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @NonNull
    @SuppressLint(value = {"ArrayReturn", "NullableCollection"})
    public @Nullable ParcelUuid[] getUuids() {
        if (getState() != STATE_ON) {
            return null;
@@ -2643,12 +2652,14 @@ public final class BluetoothAdapter {
     * @param result The callback to which to send the activity info.
     * @hide
     */
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public void requestControllerActivityEnergyInfo(ResultReceiver result) {
    public void requestControllerActivityEnergyInfo(@NonNull ResultReceiver result) {
        requireNonNull(result, "ResultReceiver cannot be null");
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
@@ -2675,9 +2686,13 @@ public final class BluetoothAdapter {
     *
     * @hide
     */
    @SystemApi
    @RequiresLegacyBluetoothAdminPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public @NonNull List<BluetoothDevice> getMostRecentlyConnectedDevices() {
        if (getState() != STATE_ON) {
            return new ArrayList<>();
@@ -2835,8 +2850,7 @@ public final class BluetoothAdapter {
     * #STATE_CONNECTING} or {@link #STATE_DISCONNECTED}
     * @hide
     */
    @UnsupportedAppUsage
    @RequiresLegacyBluetoothPermission
    @SystemApi
    @RequiresNoPermission
    public int getConnectionState() {
        if (getState() != STATE_ON) {
@@ -4129,7 +4143,8 @@ public final class BluetoothAdapter {
     *
     * @hide
     */
    public boolean registerServiceLifecycleCallback(ServiceLifecycleCallback callback) {
    @SystemApi
    public boolean registerServiceLifecycleCallback(@NonNull ServiceLifecycleCallback callback) {
        return getBluetoothService(callback.mRemote) != null;
    }

@@ -4147,6 +4162,7 @@ public final class BluetoothAdapter {
     *
     * @hide
     */
    @SystemApi
    public abstract static class ServiceLifecycleCallback {

        /** Called when the bluetooth stack is up */
@@ -4622,6 +4638,7 @@ public final class BluetoothAdapter {
     * @throws IllegalArgumentException if the callback is already registered
     * @hide
     */
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
@@ -4719,19 +4736,21 @@ public final class BluetoothAdapter {
     *
     * @hide
     */
    @SystemApi
    public abstract static class BluetoothConnectionCallback {
        /**
         * Callback triggered when a bluetooth device (classic or BLE) is connected
         * @param device is the connected bluetooth device
         */
        public void onDeviceConnected(BluetoothDevice device) {}
        public void onDeviceConnected(@NonNull BluetoothDevice device) {}

        /**
         * Callback triggered when a bluetooth device (classic or BLE) is disconnected
         * @param device is the disconnected bluetooth device
         * @param reason is the disconnect reason
         */
        public void onDeviceDisconnected(BluetoothDevice device, @DisconnectReason int reason) {}
        public void onDeviceDisconnected(@NonNull BluetoothDevice device,
                @DisconnectReason int reason) {}

        /**
         * @hide
@@ -4754,6 +4773,7 @@ public final class BluetoothAdapter {
        /**
         * Returns human-readable strings corresponding to {@link DisconnectReason}.
         */
        @NonNull
        public static String disconnectReasonText(@DisconnectReason int reason) {
            switch (reason) {
                case BluetoothStatusCodes.ERROR_UNKNOWN:
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.bluetooth;

import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
@@ -245,18 +246,22 @@ public final class BluetoothClass implements Parcelable {
        /**
         * @hide
         */
        @SystemApi
        public static final int PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500;
        /**
         * @hide
         */
        @SystemApi
        public static final int PERIPHERAL_KEYBOARD = 0x0540;
        /**
         * @hide
         */
        @SystemApi
        public static final int PERIPHERAL_POINTING = 0x0580;
        /**
         * @hide
         */
        @SystemApi
        public static final int PERIPHERAL_KEYBOARD_POINTING = 0x05C0;
    }

Loading