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

Commit 386f22eb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I4a75924b,I62ad7797 into tm-qpr-dev

* changes:
  LeAudioTestApp: Add group id input support for lock/unlock button
  SetDeviceUnauthorized with non-LE audio device for PTS GMCS test
parents 052e684a a155f1e2
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -176,6 +176,11 @@ public class McpService extends ProfileService {
    }

    public void onDeviceUnauthorized(BluetoothDevice device) {
        if (Utils.isPtsTestMode()) {
            Log.d(TAG, "PTS test: setDeviceAuthorized");
            setDeviceAuthorized(device, true);
            return;
        }
        Log.w(TAG, "onDeviceUnauthorized - authorization notification not implemented yet ");
    }

@@ -194,9 +199,10 @@ public class McpService extends ProfileService {
    }

    public int getDeviceAuthorization(BluetoothDevice device) {
        // TODO: For now just reject authorization for other than LeAudio device already authorized.
        //       Consider intent based authorization mechanism for non-LeAudio devices.
        return mDeviceAuthorizations.getOrDefault(device, BluetoothDevice.ACCESS_UNKNOWN);
        // TODO: For now just reject authorization for other than LeAudio device already authorized
        // except for PTS. Consider intent based authorization mechanism for non-LeAudio devices.
        return mDeviceAuthorizations.getOrDefault(device, Utils.isPtsTestMode()
                ? BluetoothDevice.ACCESS_ALLOWED : BluetoothDevice.ACCESS_UNKNOWN);
    }

    @GuardedBy("mLock")
+32 −8
Original line number Diff line number Diff line
@@ -1262,19 +1262,43 @@ public class LeAudioRecycleViewAdapter
            });

            leAudioSetLockButton.setOnClickListener(view -> {
                final Integer group_id =
                        Integer.parseInt(ViewHolder.this.leAudioGroupIdText.getText().toString());
                AlertDialog.Builder alert = new AlertDialog.Builder(itemView.getContext());
                alert.setTitle("Pick a group ID");
                final EditText input = new EditText(itemView.getContext());
                input.setInputType(InputType.TYPE_CLASS_NUMBER);
                input.setRawInputType(Configuration.KEYBOARD_12KEY);
                alert.setView(input);
                alert.setPositiveButton("Ok", (dialog, whichButton) -> {
                    final Integer group_id = Integer.valueOf(input.getText().toString());
                    if (leAudioInteractionListener != null)
                        leAudioInteractionListener.onGroupSetLockClicked(
                            devices.get(ViewHolder.this.getAdapterPosition()), group_id, true);

                });
                alert.setNegativeButton("Cancel", (dialog, whichButton) -> {
                    // Do nothing
                });
                alert.show();
            });

            leAudioSetUnlockButton.setOnClickListener(view -> {
                final Integer group_id =
                        Integer.parseInt(ViewHolder.this.leAudioGroupIdText.getText().toString());
                AlertDialog.Builder alert = new AlertDialog.Builder(itemView.getContext());
                alert.setTitle("Pick a group ID");
                final EditText input = new EditText(itemView.getContext());
                input.setInputType(InputType.TYPE_CLASS_NUMBER);
                input.setRawInputType(Configuration.KEYBOARD_12KEY);
                alert.setView(input);
                alert.setPositiveButton("Ok", (dialog, whichButton) -> {
                    final Integer group_id = Integer.valueOf(input.getText().toString());
                    if (leAudioInteractionListener != null)
                        leAudioInteractionListener.onGroupSetLockClicked(
                            devices.get(ViewHolder.this.getAdapterPosition()), group_id, false);

                });
                alert.setNegativeButton("Cancel", (dialog, whichButton) -> {
                    // Do nothing
                });
                alert.show();
            });

            leAudioGroupMicrophoneSwitch.setOnCheckedChangeListener((compoundButton, b) -> {