Closed nihald2000 closed 6 months ago
Please open a separate request for those.
Did you try and confirm that this works?
Yes, I have successfully built the project. its working
The SmsSnippet is an example.
Inside BroadcastReceiver
, save data in SnippetEvent then post to EventCache.
Outside BroadcastReceiver
, use Utils.waitForSnippetEvent to get the data you need.
So you don't have to declare a boolean sIsHFPProfileReady
, then both BroadcastReceiver
and general methods read from this value.
SnippetEvent event = new SnippetEvent(mCallbackId, SMS_RECEIVED_EVENT_NAME) required: String,String but
sIsHFPProfileReady
is boolean value.Reviewed all commit messages. Reviewable status: 1 of 2 files reviewed, 21 unresolved discussions (waiting on @ko1in1u, @xpconanfan, and @zsyai)
The string here when declaring SnippetEvent is its event name, the data (sIsHFPProfileReady
) is put in to Bundle. Example:
// Inside BroadcastReceiver
SnippetEvent event = new SnippetEvent(callbackId, "thisIsTheEventName");
event.getData().putBoolean("isHfpProfileReady", true);
EventCache eventCache = EventCache.getInstance();
eventCache.postEvent(event);
# Out of BroadcastReceiver
SnippetEvent event = Utils.waitForSnippetEvent(callbackId, "thisIsTheEventName", timeout);
Boolean isHfpProfileReady = event.getData().getBoolean("isHfpProfileReady")
java.util.concurrent.TimeoutException: Timed out waiting(60000 millis) for SnippetEvent: BluetoothHeadsetCallback getting above TimeoutException
Reviewable status: all files reviewed, 21 unresolved discussions (waiting on @ko1in1u, @xpconanfan, and @zsyai)
The TimeoutException is bc of not receive such event until timeout, it should debug from the logic when posting event. (e.g. never receive the expected event?)
The class provides functionality for:
Setting connection policies Connecting and disconnecting from remote devices Retrieving connection states Managing voice recognition Includes methods like:
btHeadsetClientSet btHfp-connect btHfp-disconnect btHfp-getConnectionState btHfp-startVoiceRecognition btHfp-stopVoiceRecognition Also utilizes BroadcastReceiver for handling Bluetooth events.
This change is