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

Commit 4b42291d authored by Ytai Ben-Tsvi's avatar Ytai Ben-Tsvi
Browse files

Handle exception on setCaptureState

The call to set the capture state is coming from a system server
thread and so failing to handle exception would result in crashing the
system_server process (soft reboot).

Instead, we just log these exceptions on the client side and assume
that the server knows how to recover.

Bug: 171182853
Test: Manual verification that key sound trigger features still
      work.
Change-Id: I97a0b8044f0b6200b4f87fbcf73fca939258b070
parent ab09038c
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -16,11 +16,6 @@

package com.android.server.soundtrigger_middleware;

import android.media.ICaptureStateListener;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;

import java.util.concurrent.Semaphore;
@@ -78,7 +73,11 @@ class ExternalCaptureStateTracker {
     * @param active true when external capture is active.
     */
    private void setCaptureState(boolean active) {
        try {
            mListener.accept(active);
        } catch (Exception e) {
            Log.e(TAG, "Exception caught while setting capture state", e);
        }
    }

    /**