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

Commit 00ef5545 authored by Smriti Gupta's avatar Smriti Gupta Committed by Steve Kondik
Browse files

Bluetooth: Acquire wakelock to turn on lcd during Connection

This patch acquires wakelock to turn on LCD display of DUT if screen
is off during connection access request for PBAP/MAP. Without this
patch it was observed that if screen was off, lcd remained off for
incoming connection access request from remote device and user only
was hearing notification sound without lcd being lit up.

Change-Id: I87c296fce4cd8e0c133f74169d991eee263fed08
CRs-Fixed: 650261
parent 2067957a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -96,6 +96,13 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
                LocalBluetoothPreferences.shouldShowDialogInForeground(context, deviceAddress) ) {
                context.startActivity(connectionAccessIntent);
            } else {
                // Acquire wakelock so that LCD comes up since screen is off
                PowerManager.WakeLock wakeLock = null;
                wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK |
                    PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
                        "ConnectionAccessActivity");
                wakeLock.setReferenceCounted(false);
                wakeLock.acquire();
                // Put up a notification that leads to the dialog

                // Create an intent triggered by clicking on the
@@ -140,6 +147,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
                    (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

                notificationManager.notify(getNotificationTag(mRequestType),NOTIFICATION_ID, notification);
                wakeLock.release();
            }
        } else if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL)) {
            // Remove the notification