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

Commit 801a2348 authored by Matt Garnes's avatar Matt Garnes Committed by Gerrit Code Review
Browse files

Add hotword AudioService null check

If an application tries to start recording with the HOTWORD input before
AudioService is ready, the interface is not available to call
handleHotwordInput on. Check for null and only log if AudioService is
not available.

Change-Id: I2e693c5aed7cdce6299d8ff16341c1af8dd5b54f
Issue-Id: FOR-257
parent 256268f3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -974,7 +974,14 @@ public class AudioRecord
        final IBinder b = ServiceManager.getService(android.content.Context.AUDIO_SERVICE);
        final IAudioService ias = IAudioService.Stub.asInterface(b);
        try {
            // If the caller tries to start recording with the HOTWORD input
            // before AUDIO_SERVICE has started, IAudioService may not be available.
            if (ias != null) {
                ias.handleHotwordInput(listening);
            } else {
                Log.e(TAG, "Error talking to AudioService when handling hotword input, "
                        + "AudioService unavailable");
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error talking to AudioService when handling hotword input.", e);
        }