From e981df2f3d3417b83f745a610af7241c2fa882b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Rymanowski?= <rlukasz@google.com>
Date: Fri, 14 Oct 2022 19:02:10 +0000
Subject: [PATCH] gmcs: Fix GATT no responing on GMCS GATT requests

If device authorization is unknown (new device and profiles are not yet
known), it could happen that GMCS would not respond on the GATT request
on the GMSC which leads to GATT timeout.

Bug: 248430016
Test: atest BluetoothInstrumentationTests
Tag: #feature

Change-Id: Id62b26b1d0a9299aa9d31cf21920efb49d40bc24
---
 android/app/src/com/android/bluetooth/mcp/McpService.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/android/app/src/com/android/bluetooth/mcp/McpService.java b/android/app/src/com/android/bluetooth/mcp/McpService.java
index 22d5ee2d43e..e46c23a5f4b 100644
--- a/android/app/src/com/android/bluetooth/mcp/McpService.java
+++ b/android/app/src/com/android/bluetooth/mcp/McpService.java
@@ -184,6 +184,7 @@ public class McpService extends ProfileService {
             return;
         }
         Log.w(TAG, "onDeviceUnauthorized - authorization notification not implemented yet ");
+        setDeviceAuthorized(device, false);
     }
 
     public void setDeviceAuthorized(BluetoothDevice device, boolean isAuthorized) {
-- 
GitLab