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

Commit 0e69fea9 authored by Alain Vongsouvanh's avatar Alain Vongsouvanh
Browse files

DO NOT MERGE ANYWHERE GATT: Move connection parameters to config.xml

This makes it easier for OEMs to customize the high prioriy, balanced
and low power mode connection parameters through overlays.

Bug: 18013697
Change-Id: I8b486b772fdb871f2800238cb5e45c4ff0663952
(cherry-picked from e86c58bd)
parent 1d99d23c
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -34,13 +34,24 @@
         of the location permissions. -->
    <bool name="strict_location_check">true</bool>

    <!-- Specifies the min/max connection interval parameters for high priority
         and low power GATT configurations. These values are in multiples of
         1.25ms. -->
    <!-- Specifies the min/max connection interval parameters for high priority,
         balanced and low power GATT configurations. These values are in
         multiples of 1.25ms. -->
    <integer name="gatt_high_priority_min_interval">9</integer>
    <integer name="gatt_high_priority_max_interval">12</integer>
    <!-- Default specs recommended interval is 30 (24 * 1.25) -> 50 (40 * 1.25)
         ms. -->
    <integer name="gatt_balanced_priority_min_interval">24</integer>
    <integer name="gatt_balanced_priority_max_interval">40</integer>
    <integer name="gatt_low_power_min_interval">80</integer>
    <integer name="gatt_low_power_max_interval">100</integer>

    <!-- Specifies latency parameters for high priority, balanced and low power
         GATT configurations. These values represents the number of packets a
         slave 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>

    <bool name="headset_client_initial_audio_route_allowed">true</bool>
</resources>
+14 −5
Original line number Diff line number Diff line
@@ -1661,12 +1661,11 @@ public class GattService extends ProfileService {
    void connectionParameterUpdate(int clientIf, String address, int connectionPriority) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");

        // Default spec recommended interval is 30->50 ms
        int minInterval = 24; // 24 * 1.25ms = 30ms
        int maxInterval = 40; // 40 * 1.25ms = 50ms
        int minInterval;
        int maxInterval;

        // Slave latency
        int latency = 0;
        int latency;

        // Link supervision timeout is measured in N * 10ms
        int timeout = 2000; // 20s
@@ -1676,12 +1675,22 @@ public class GattService extends ProfileService {
            case BluetoothGatt.CONNECTION_PRIORITY_HIGH:
                minInterval = getResources().getInteger(R.integer.gatt_high_priority_min_interval);
                maxInterval = getResources().getInteger(R.integer.gatt_high_priority_max_interval);
                latency = getResources().getInteger(R.integer.gatt_high_priority_latency);
                break;

            case BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER:
                minInterval = getResources().getInteger(R.integer.gatt_low_power_min_interval);
                maxInterval = getResources().getInteger(R.integer.gatt_low_power_max_interval);
                latency = 2;
                latency = getResources().getInteger(R.integer.gatt_low_power_latency);
                break;

            default:
                // Using the values for CONNECTION_PRIORITY_BALANCED.
                minInterval =
                        getResources().getInteger(R.integer.gatt_balanced_priority_min_interval);
                maxInterval =
                        getResources().getInteger(R.integer.gatt_balanced_priority_max_interval);
                latency = getResources().getInteger(R.integer.gatt_balanced_priority_latency);
                break;
        }