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

Commit 6ad0bdfe authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I72de8348,I14f8eda5,I641e9933,Iec541126,Iebb66edf, ...

* changes:
  LeAudioTestApp: Add button to trigget set active group
  HapClientService: Don't use cache for PTS
  has_client: Add upper tester for the PTS
  has_client: Disconnect profile when control point is not accesable
  has_client: Improve subscribing for notification
  has_client: Fix Indication confirmation
  has_client: Always write CCC values
  has_client: Improve subscribtion to control point
  gatt: Fix incorrect GATT confirmation on indication
parents c2caeafe edc55d33
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -696,6 +696,12 @@ public class HapClientService extends ProfileService {
        BluetoothHapPresetInfo defaultValue = null;
        if (presetIndex == BluetoothHapClient.PRESET_INDEX_UNAVAILABLE) return defaultValue;

        if (Utils.isPtsTestMode()) {
            /* We want native to be called for PTS testing even we have all
             * the data in the cache here
             */
            mHapClientNativeInterface.getPresetInfo(device, presetIndex);
        }
        List<BluetoothHapPresetInfo> current_presets = mPresetsMap.get(device);
        if (current_presets != null) {
            for (BluetoothHapPresetInfo preset : current_presets) {
+9 −0
Original line number Diff line number Diff line
@@ -1219,6 +1219,15 @@ public class BluetoothProxy {
        return true;
    }

    public boolean hapSetActivePresetForGroup(BluetoothDevice device, int preset_index) {
        if (bluetoothHapClient == null)
            return false;

        int groupId = bluetoothLeAudio.getGroupId(device);
        bluetoothHapClient.selectPresetForGroup(groupId, preset_index);
        return true;
    }

    public boolean hapChangePresetName(BluetoothDevice device, int preset_index, String name) {
        if (bluetoothHapClient == null)
            return false;
+20 −0
Original line number Diff line number Diff line
@@ -890,6 +890,8 @@ public class LeAudioRecycleViewAdapter

        void onSetActivePresetClicked(BluetoothDevice device, int preset_index);

        void onSetActivePresetForGroupClicked(BluetoothDevice device, int preset_index);

        void onNextDevicePresetClicked(BluetoothDevice device);

        void onPreviousDevicePresetClicked(BluetoothDevice device);
@@ -947,6 +949,7 @@ public class LeAudioRecycleViewAdapter
        private Spinner leAudioHapPresetsSpinner;
        private Button leAudioHapChangePresetNameButton;
        private Button leAudioHapSetActivePresetButton;
        private Button leAudioHapSetActivePresetForGroupButton;
        private Button leAudioHapReadPresetInfoButton;
        private Button leAudioHapNextDevicePresetButton;
        private Button leAudioHapPreviousDevicePresetButton;
@@ -1041,6 +1044,8 @@ public class LeAudioRecycleViewAdapter
                    itemView.findViewById(R.id.hap_change_preset_name_button);
            leAudioHapSetActivePresetButton =
                    itemView.findViewById(R.id.hap_set_active_preset_button);
            leAudioHapSetActivePresetForGroupButton =
                    itemView.findViewById(R.id.hap_set_active_preset_for_group_button);
            leAudioHapReadPresetInfoButton =
                    itemView.findViewById(R.id.hap_read_preset_info_button);
            leAudioHapNextDevicePresetButton =
@@ -1110,6 +1115,21 @@ public class LeAudioRecycleViewAdapter
                }
            });

            leAudioHapSetActivePresetForGroupButton.setOnClickListener(view -> {
                if (hapInteractionListener != null) {
                    if (leAudioHapPresetsSpinner.getSelectedItem() == null) {
                        Toast.makeText(view.getContext(), "No known preset, please reconnect.",
                                Toast.LENGTH_SHORT).show();
                        return;
                    }

                    Integer index = Integer.valueOf(
                            leAudioHapPresetsSpinner.getSelectedItem().toString().split("\\s")[0]);
                    hapInteractionListener.onSetActivePresetForGroupClicked(
                            devices.get(ViewHolder.this.getAdapterPosition()).device, index);
                }
            });

            leAudioHapReadPresetInfoButton.setOnClickListener(view -> {
                if (hapInteractionListener != null) {
                    if (leAudioHapPresetsSpinner.getSelectedItem() == null) {
+4 −0
Original line number Diff line number Diff line
@@ -81,6 +81,10 @@ public class LeAudioViewModel extends AndroidViewModel {
        bluetoothProxy.hapSetActivePreset(device, preset_index);
    }

    public void hapSetActivePresetForGroup(BluetoothDevice device, int preset_index) {
        bluetoothProxy.hapSetActivePresetForGroup(device, preset_index);
    }

    public void hapChangePresetName(BluetoothDevice device, int preset_index, String name) {
        bluetoothProxy.hapChangePresetName(device, preset_index, name);
    }
+5 −0
Original line number Diff line number Diff line
@@ -521,6 +521,11 @@ public class MainActivity extends AppCompatActivity {
                        leAudioViewModel.hapSetActivePreset(device, preset_index);
                    }

                    @Override
                    public void onSetActivePresetForGroupClicked(BluetoothDevice device, int preset_index) {
                        leAudioViewModel.hapSetActivePresetForGroup(device, preset_index);
                    }

                    @Override
                    public void onChangePresetNameClicked(BluetoothDevice device, int preset_index,
                            String name) {
Loading