From 9292ebc23ba0501d57c81d9c22fd3672fdcc0a9f Mon Sep 17 00:00:00 2001 From: Amit Kumar Prasad Date: Mon, 23 Jan 2023 16:15:04 +0530 Subject: Frameworks: Set and Get AFH map support CRs-Fixed: 3396190 Change-Id: Ifd4db2975742f30312468c6c04fcd3fb97daafda --- core/java/android/bluetooth/BluetoothAdapter.java | 55 +++++++++++++++++++++++ core/java/android/bluetooth/BluetoothDevice.java | 39 ++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index ea6fddbfac73..23fa0e29e166 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -1591,6 +1591,61 @@ public final class BluetoothAdapter { return false; } + /** + * Sets the AFH map for BT Adapter + * + * Allows the Host to specify a channel classification based on its “local information”. + * + * @param afhMap + * @return true if Afh map is set, false on error + * @hide + */ + @RequiresBluetoothConnectPermission + @RequiresPermission(allOf = { + android.Manifest.permission.BLUETOOTH_CONNECT, + android.Manifest.permission.BLUETOOTH_PRIVILEGED, + }) + public boolean setAfhChannelMap(int transport, int len, @NonNull byte[] afhMap) { + if (getState() != STATE_ON) return false; + try { + mServiceLock.readLock().lock(); + if (mService != null) return mService.setAfhChannelMap(transport, len, afhMap, mAttributionSource); + } catch (RemoteException e) { + Log.e(TAG, e.getMessage(), e); + } finally { + mServiceLock.readLock().unlock(); + } + return false; + } + + /** + * Reads the AFH channel map + * + *

command returns the values for the AFH_Mode and AFH_Channel_Map + * for the specified Bluetooth device . + * + * @param BluetoothDevice + * @return true if command success, false on error + * @hide + */ + @RequiresBluetoothConnectPermission + @RequiresPermission(allOf = { + android.Manifest.permission.BLUETOOTH_CONNECT, + android.Manifest.permission.BLUETOOTH_PRIVILEGED, + }) + public boolean getAfhChannelMap(@NonNull BluetoothDevice device, int transport) { + if (getState() != STATE_ON) return false; + try { + mServiceLock.readLock().lock(); + if (mService != null) return mService.getAfhChannelMap(device, transport, mAttributionSource); + } catch (RemoteException e) { + Log.e(TAG, e.getMessage(), e); + } finally { + mServiceLock.readLock().unlock(); + } + return false; + } + /** * Get the current Bluetooth scan mode of the local Bluetooth adapter. *

The Bluetooth scan mode determines if the local adapter is diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index d0baece08935..e37d64d99886 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -156,6 +156,45 @@ public final class BluetoothDevice implements Parcelable, Attributable { public static final String ACTION_FOUND = "android.bluetooth.device.action.FOUND"; + /** + * Broadcast Action: Indicates the Bluetooth current AFH map + *

Always contains the extra fields {@link #EXTRA_AFH_MAP}, + * {@link #EXTRA_TRANSPORT}. + *

Requires {@link android.Manifest.permission#BLUETOOTH} to receive. + * @hide + **/ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_AFH_MAP = "android.bluetooth.action.AFH_MAP"; + + /** + * Broadcast Action: Indicates the Bluetooth current AFH map status + *

Always contains the extra fields {@link #EXTRA_STATUS}, + * {@link #EXTRA_TRANSPORT}. + *

Requires {@link android.Manifest.permission#BLUETOOTH} to receive. + * @hide + **/ + @RequiresLegacyBluetoothPermission + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_AFH_MAP_STATUS = "android.bluetooth.action.AFH_MAP_STATUS"; + + /** + * Used as an int extra field in {@link #ACTION_GET_AFH_MAP} + *@hide + **/ + public static final String EXTRA_TRANSPORT = "android.bluetooth.extra.TRANSPORT"; + + /** + * Used as an byte array extra field for Afh map in {@link #ACTION_GET_AFH_MAP} + *@hide + **/ + public static final String EXTRA_AFH_MAP = "android.bluetooth.extra.AFH_MAP"; + + /** + * Used as an int extra field for Afh mode in {@link #ACTION_GET_AFH_MAP} + *@hide + **/ + public static final String EXTRA_AFH_MODE = "android.bluetooth.extra.AFH_MODE"; + /** * Broadcast Action: Bluetooth class of a remote device has changed. *

Always contains the extra fields {@link #EXTRA_DEVICE} and {@link -- cgit v1.2.3 From bd50da68327d7199c49bb3c0a4ec3bc758977933 Mon Sep 17 00:00:00 2001 From: Gnaneshwar Gatla Date: Thu, 16 Mar 2023 00:13:45 +0000 Subject: Revert "enable secondary SIM do not disturb feature" Revert submission 1211882-am-860e4ec8-6588-4220-8975-23d1d20a2deb Reason for revert: to avoid CTS failure Reverted changes: /q/submissionid:1211882-am-860e4ec8-6588-4220-8975-23d1d20a2deb Change-Id: I9ece2fe4422d0ab723f1a7e05742dd555d5d1823 --- core/res/AndroidManifest.xml | 7 ------- core/res/res/values/strings.xml | 5 ----- 2 files changed, 12 deletions(-) diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 2e395900d96b..049aa4a0ec1b 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -6557,13 +6557,6 @@ - - - diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 6f3b428b826b..aff387cd358f 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -4093,11 +4093,6 @@ Allows an app to see all installed packages. - - enable do not disturb feature on secondary SIM - - Secondary SIM Do Not Disturb - Tap twice for zoom control -- cgit v1.2.3