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

Unverified Commit 2dda1013 authored by Matt Garnes's avatar Matt Garnes Committed by Michael Bestas
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 3521407d
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1065,7 +1065,14 @@ public class AudioRecord implements AudioRouting
        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);
        }