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

Commit 38393bb9 authored by Hemant Gupta's avatar Hemant Gupta Committed by Myles Watson
Browse files

HID: Send Connection change broadcast to all users

Issue Description:
Steps:
1) Create a sub-user and switch to it.
2) Connected to a HID device via BT(Keyboard BKB50).
3) Check the BT icon on the status bar.

Actual Result:
At step 3, BT icon shows the device is not connected.

Expected Result:
At step 3, BT icon shows the device is connected.

Root Cause:
SystemUI can't receive the broadcast of HID connection state change
in sub-user.

Fix:
Use sendBroadcastAsUser() instead of sendBroadcast() for connection
change.

Test: Tested that BT icon shows connected after HID connection.

Bug: 62683719
Change-Id: I9eeac34dd31c7a4acb15d71b8bf8eb4cf97680a2
parent dff31f4f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;

@@ -763,7 +764,7 @@ public class HidHostService extends ProfileService {
        intent.putExtra(BluetoothProfile.EXTRA_STATE, newState);
        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        sendBroadcast(intent, BLUETOOTH_PERM);
        sendBroadcastAsUser(intent, UserHandle.ALL, BLUETOOTH_PERM);
    }

    private void broadcastHandshake(BluetoothDevice device, int status) {