Loading android/app/res/values/config.xml +4 −3 Original line number Diff line number Diff line Loading @@ -63,12 +63,13 @@ <integer name="gatt_low_power_latency_secondary">15</integer> <!-- ============================================================ --> <!-- Specifies latency parameters for high priority, balanced and low power GATT configurations. These values represents the number of packets a peripheral device is allowed to skip. --> <!-- Specifies latency parameters for high priority, balanced, low power and Digital Car Key-preferred GATT configurations. These values represent the number of packets a peripheral device is allowed to skip. --> <integer name="gatt_high_priority_latency">0</integer> <integer name="gatt_balanced_priority_latency">0</integer> <integer name="gatt_low_power_latency">2</integer> <integer name="gatt_dck_priority_latency">0</integer> <!-- Specifies the min/max subrate factor parameters for high priority, balanced and low power subrate request configurations. --> Loading android/app/src/com/android/bluetooth/btservice/CompanionManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ public class CompanionManager { private final int[] mGattConnHighDefault; private final int[] mGattConnBalanceDefault; private final int[] mGattConnLowDefault; private final int[] mGattConnDckDefault; @VisibleForTesting static final int COMPANION_TYPE_NONE = 0; @VisibleForTesting static final int COMPANION_TYPE_PRIMARY = 1; Loading @@ -81,6 +82,9 @@ public class CompanionManager { static final String PROPERTY_LOW_MIN_INTERVAL = "bluetooth.gatt.low_priority_min.interval"; static final String PROPERTY_LOW_MAX_INTERVAL = "bluetooth.gatt.low_priority_max.interval"; static final String PROPERTY_LOW_LATENCY = "bluetooth.gatt.low_priority.latency"; static final String PROPERTY_DCK_MIN_INTERVAL = "bluetooth.gatt.dck_priority_min.interval"; static final String PROPERTY_DCK_MAX_INTERVAL = "bluetooth.gatt.dck_priority_max.interval"; static final String PROPERTY_DCK_LATENCY = "bluetooth.gatt.dck_priority.latency"; static final String PROPERTY_SUFFIX_PRIMARY = ".primary"; static final String PROPERTY_SUFFIX_SECONDARY = ".secondary"; Loading Loading @@ -109,6 +113,10 @@ public class CompanionManager { getGattConfig(PROPERTY_LOW_MIN_INTERVAL, R.integer.gatt_low_power_min_interval), getGattConfig(PROPERTY_LOW_MAX_INTERVAL, R.integer.gatt_low_power_max_interval), getGattConfig(PROPERTY_LOW_LATENCY, R.integer.gatt_low_power_latency)}; mGattConnDckDefault = new int[] { getGattConfig(PROPERTY_DCK_MIN_INTERVAL, R.integer.gatt_dck_priority_min_interval), getGattConfig(PROPERTY_DCK_MAX_INTERVAL, R.integer.gatt_dck_priority_max_interval), getGattConfig(PROPERTY_DCK_LATENCY, R.integer.gatt_dck_priority_latency)}; mGattConnHighPrimary = new int[] { getGattConfig(PROPERTY_HIGH_MIN_INTERVAL + PROPERTY_SUFFIX_PRIMARY, Loading Loading @@ -397,6 +405,8 @@ public class CompanionManager { return mGattConnHighDefault[type]; case BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER: return mGattConnLowDefault[type]; case BluetoothGatt.CONNECTION_PRIORITY_DCK: return mGattConnDckDefault[type]; } return mGattConnBalanceDefault[type]; } Loading android/app/tests/unit/src/com/android/bluetooth/btservice/CompanionManagerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ public class CompanionManagerTest { checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_HIGH); checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_BALANCED); checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER); checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_DCK); } private void loadCompanionInfoHelper(String address, int companionType) { Loading framework/java/android/bluetooth/BluetoothGatt.java +3 −2 Original line number Diff line number Diff line Loading @@ -1885,14 +1885,15 @@ public final class BluetoothGatt implements BluetoothProfile { * * @param connectionPriority Request a specific connection priority. Must be one of {@link * BluetoothGatt#CONNECTION_PRIORITY_BALANCED}, {@link BluetoothGatt#CONNECTION_PRIORITY_HIGH} * or {@link BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER}. * {@link BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER}, or * {@link BluetoothGatt#CONNECTION_PRIORITY_DCK}. * @throws IllegalArgumentException If the parameters are outside of their specified range. */ @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean requestConnectionPriority(int connectionPriority) { if (connectionPriority < CONNECTION_PRIORITY_BALANCED || connectionPriority > CONNECTION_PRIORITY_LOW_POWER) { || connectionPriority > CONNECTION_PRIORITY_DCK) { throw new IllegalArgumentException("connectionPriority not within valid range"); } Loading Loading
android/app/res/values/config.xml +4 −3 Original line number Diff line number Diff line Loading @@ -63,12 +63,13 @@ <integer name="gatt_low_power_latency_secondary">15</integer> <!-- ============================================================ --> <!-- Specifies latency parameters for high priority, balanced and low power GATT configurations. These values represents the number of packets a peripheral device is allowed to skip. --> <!-- Specifies latency parameters for high priority, balanced, low power and Digital Car Key-preferred GATT configurations. These values represent the number of packets a peripheral device is allowed to skip. --> <integer name="gatt_high_priority_latency">0</integer> <integer name="gatt_balanced_priority_latency">0</integer> <integer name="gatt_low_power_latency">2</integer> <integer name="gatt_dck_priority_latency">0</integer> <!-- Specifies the min/max subrate factor parameters for high priority, balanced and low power subrate request configurations. --> Loading
android/app/src/com/android/bluetooth/btservice/CompanionManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ public class CompanionManager { private final int[] mGattConnHighDefault; private final int[] mGattConnBalanceDefault; private final int[] mGattConnLowDefault; private final int[] mGattConnDckDefault; @VisibleForTesting static final int COMPANION_TYPE_NONE = 0; @VisibleForTesting static final int COMPANION_TYPE_PRIMARY = 1; Loading @@ -81,6 +82,9 @@ public class CompanionManager { static final String PROPERTY_LOW_MIN_INTERVAL = "bluetooth.gatt.low_priority_min.interval"; static final String PROPERTY_LOW_MAX_INTERVAL = "bluetooth.gatt.low_priority_max.interval"; static final String PROPERTY_LOW_LATENCY = "bluetooth.gatt.low_priority.latency"; static final String PROPERTY_DCK_MIN_INTERVAL = "bluetooth.gatt.dck_priority_min.interval"; static final String PROPERTY_DCK_MAX_INTERVAL = "bluetooth.gatt.dck_priority_max.interval"; static final String PROPERTY_DCK_LATENCY = "bluetooth.gatt.dck_priority.latency"; static final String PROPERTY_SUFFIX_PRIMARY = ".primary"; static final String PROPERTY_SUFFIX_SECONDARY = ".secondary"; Loading Loading @@ -109,6 +113,10 @@ public class CompanionManager { getGattConfig(PROPERTY_LOW_MIN_INTERVAL, R.integer.gatt_low_power_min_interval), getGattConfig(PROPERTY_LOW_MAX_INTERVAL, R.integer.gatt_low_power_max_interval), getGattConfig(PROPERTY_LOW_LATENCY, R.integer.gatt_low_power_latency)}; mGattConnDckDefault = new int[] { getGattConfig(PROPERTY_DCK_MIN_INTERVAL, R.integer.gatt_dck_priority_min_interval), getGattConfig(PROPERTY_DCK_MAX_INTERVAL, R.integer.gatt_dck_priority_max_interval), getGattConfig(PROPERTY_DCK_LATENCY, R.integer.gatt_dck_priority_latency)}; mGattConnHighPrimary = new int[] { getGattConfig(PROPERTY_HIGH_MIN_INTERVAL + PROPERTY_SUFFIX_PRIMARY, Loading Loading @@ -397,6 +405,8 @@ public class CompanionManager { return mGattConnHighDefault[type]; case BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER: return mGattConnLowDefault[type]; case BluetoothGatt.CONNECTION_PRIORITY_DCK: return mGattConnDckDefault[type]; } return mGattConnBalanceDefault[type]; } Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/CompanionManagerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ public class CompanionManagerTest { checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_HIGH); checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_BALANCED); checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER); checkReasonableConnParameterHelper(BluetoothGatt.CONNECTION_PRIORITY_DCK); } private void loadCompanionInfoHelper(String address, int companionType) { Loading
framework/java/android/bluetooth/BluetoothGatt.java +3 −2 Original line number Diff line number Diff line Loading @@ -1885,14 +1885,15 @@ public final class BluetoothGatt implements BluetoothProfile { * * @param connectionPriority Request a specific connection priority. Must be one of {@link * BluetoothGatt#CONNECTION_PRIORITY_BALANCED}, {@link BluetoothGatt#CONNECTION_PRIORITY_HIGH} * or {@link BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER}. * {@link BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER}, or * {@link BluetoothGatt#CONNECTION_PRIORITY_DCK}. * @throws IllegalArgumentException If the parameters are outside of their specified range. */ @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean requestConnectionPriority(int connectionPriority) { if (connectionPriority < CONNECTION_PRIORITY_BALANCED || connectionPriority > CONNECTION_PRIORITY_LOW_POWER) { || connectionPriority > CONNECTION_PRIORITY_DCK) { throw new IllegalArgumentException("connectionPriority not within valid range"); } Loading