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

Commit d90ddcdf authored by Atneya Nair's avatar Atneya Nair Committed by Automerger Merge Worker
Browse files

Merge "Change SoundTriggerMiddleware to log to Slog" into udc-qpr-dev am: d6b8126a

parents ae8f3124 d6b8126a
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import android.os.HwBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
import android.util.Slog;

import java.util.ArrayList;
import java.util.Arrays;
@@ -62,7 +62,7 @@ class DefaultHalFactory implements HalFactory {
                        android.hardware.soundtrigger3.ISoundTriggerHw.class.getCanonicalName()
                                + "/default";
                if (ServiceManager.isDeclared(aidlServiceName)) {
                    Log.i(TAG, "Connecting to default soundtrigger3.ISoundTriggerHw");
                    Slog.i(TAG, "Connecting to default soundtrigger3.ISoundTriggerHw");
                    return new SoundTriggerHw3Compat(ServiceManager.waitForService(aidlServiceName),
                            () -> {
                                // This property needs to be defined in an init.rc script and
@@ -72,7 +72,7 @@ class DefaultHalFactory implements HalFactory {
                }

                // Fallback to soundtrigger-V2.x (HIDL).
                Log.i(TAG, "Connecting to default soundtrigger-V2.x.ISoundTriggerHw");
                Slog.i(TAG, "Connecting to default soundtrigger-V2.x.ISoundTriggerHw");
                ISoundTriggerHw driver = ISoundTriggerHw.getService(true);
                return SoundTriggerHw2Compat.create(driver, () -> {
                    // This property needs to be defined in an init.rc script and
@@ -81,7 +81,7 @@ class DefaultHalFactory implements HalFactory {
                }, mCaptureStateNotifier);
            } else if (mockHal == USE_MOCK_HAL_V2) {
                // Use V2 mock.
                Log.i(TAG, "Connecting to mock soundtrigger-V2.x.ISoundTriggerHw");
                Slog.i(TAG, "Connecting to mock soundtrigger-V2.x.ISoundTriggerHw");
                HwBinder.setTrebleTestingOverride(true);
                try {
                    ISoundTriggerHw driver = ISoundTriggerHw.getService("mock", true);
@@ -89,7 +89,7 @@ class DefaultHalFactory implements HalFactory {
                        try {
                            driver.debug(null, new ArrayList<>(Arrays.asList("reboot")));
                        } catch (Exception e) {
                            Log.e(TAG, "Failed to reboot mock HAL", e);
                            Slog.e(TAG, "Failed to reboot mock HAL", e);
                        }
                    }, mCaptureStateNotifier);
                } finally {
@@ -100,14 +100,14 @@ class DefaultHalFactory implements HalFactory {
                final String aidlServiceName =
                        android.hardware.soundtrigger3.ISoundTriggerHw.class.getCanonicalName()
                                + "/mock";
                Log.i(TAG, "Connecting to mock soundtrigger3.ISoundTriggerHw");
                Slog.i(TAG, "Connecting to mock soundtrigger3.ISoundTriggerHw");
                return new SoundTriggerHw3Compat(ServiceManager.waitForService(aidlServiceName),
                        () -> {
                            try {
                                ServiceManager.waitForService(aidlServiceName).shellCommand(null,
                                        null, null, new String[]{"reboot"}, null, null);
                            } catch (Exception e) {
                                Log.e(TAG, "Failed to reboot mock HAL", e);
                                Slog.e(TAG, "Failed to reboot mock HAL", e);
                            }
                        });
            } else {
+3 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.server.soundtrigger_middleware;

import android.annotation.NonNull;
import android.util.Log;
import android.util.Slog;

import java.util.LinkedList;
import java.util.List;
@@ -94,7 +94,7 @@ class ExternalCaptureStateTracker implements ICaptureStateNotifier {
                }
            }
        } catch (Exception e) {
            Log.e(TAG, "Exception caught while setting capture state", e);
            Slog.e(TAG, "Exception caught while setting capture state", e);
        }
    }

@@ -102,7 +102,7 @@ class ExternalCaptureStateTracker implements ICaptureStateNotifier {
     * Called by native code when the remote service died.
     */
    private void binderDied() {
        Log.w(TAG, "Audio policy service died");
        Slog.w(TAG, "Audio policy service died");
        mNeedToConnect.release();
    }
}
+9 −9
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import android.media.soundtrigger_middleware.PhraseRecognitionEventSys;
import android.media.soundtrigger_middleware.RecognitionEventSys;
import android.os.DeadObjectException;
import android.os.IBinder;
import android.util.Log;
import android.util.Slog;

import java.util.HashMap;
import java.util.Map;
@@ -227,10 +227,10 @@ public class SoundTriggerHalEnforcer implements ISoundTriggerHal {
        }
        if (e.getCause() instanceof DeadObjectException) {
            // Server is dead, no need to reboot.
            Log.e(TAG, "HAL died");
            Slog.e(TAG, "HAL died");
            throw new RecoverableException(Status.DEAD_OBJECT);
        }
        Log.e(TAG, "Exception caught from HAL, rebooting HAL");
        Slog.e(TAG, "Exception caught from HAL, rebooting HAL");
        reboot();
        throw e;
    }
@@ -257,14 +257,14 @@ public class SoundTriggerHalEnforcer implements ISoundTriggerHal {
            synchronized (mModelStates) {
                ModelState state = mModelStates.get(model);
                if (state == null) {
                    Log.wtfStack(TAG, "Unexpected recognition event for model: " + model);
                    Slog.wtfStack(TAG, "Unexpected recognition event for model: " + model);
                    reboot();
                    return;
                }
                if (event.recognitionEvent.recognitionStillActive
                        && event.recognitionEvent.status != RecognitionStatus.SUCCESS
                        && event.recognitionEvent.status != RecognitionStatus.FORCED) {
                    Log.wtfStack(TAG,
                    Slog.wtfStack(TAG,
                            "recognitionStillActive is only allowed when the recognition status "
                                    + "is SUCCESS");
                    reboot();
@@ -283,14 +283,14 @@ public class SoundTriggerHalEnforcer implements ISoundTriggerHal {
            synchronized (mModelStates) {
                ModelState state = mModelStates.get(model);
                if (state == null) {
                    Log.wtfStack(TAG, "Unexpected recognition event for model: " + model);
                    Slog.wtfStack(TAG, "Unexpected recognition event for model: " + model);
                    reboot();
                    return;
                }
                if (event.phraseRecognitionEvent.common.recognitionStillActive
                        && event.phraseRecognitionEvent.common.status != RecognitionStatus.SUCCESS
                        && event.phraseRecognitionEvent.common.status != RecognitionStatus.FORCED) {
                    Log.wtfStack(TAG,
                    Slog.wtfStack(TAG,
                            "recognitionStillActive is only allowed when the recognition status "
                                    + "is SUCCESS");
                    reboot();
@@ -309,13 +309,13 @@ public class SoundTriggerHalEnforcer implements ISoundTriggerHal {
            synchronized (mModelStates) {
                ModelState state = mModelStates.get(modelHandle);
                if (state == null) {
                    Log.wtfStack(TAG, "Unexpected unload event for model: " + modelHandle);
                    Slog.wtfStack(TAG, "Unexpected unload event for model: " + modelHandle);
                    reboot();
                    return;
                }

                if (state == ModelState.ACTIVE) {
                    Log.wtfStack(TAG, "Trying to unload an active model: " + modelHandle);
                    Slog.wtfStack(TAG, "Trying to unload an active model: " + modelHandle);
                    reboot();
                    return;
                }
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.media.soundtrigger.Properties;
import android.media.soundtrigger.RecognitionConfig;
import android.media.soundtrigger.SoundModel;
import android.os.IBinder;
import android.util.Log;
import android.util.Slog;

import java.util.Objects;

@@ -172,7 +172,7 @@ public class SoundTriggerHalWatchdog implements ISoundTriggerHal {

        Watchdog() {
            mTask = mTimer.createTask(() -> {
                Log.e(TAG, "HAL deadline expired. Rebooting.", mException);
                Slog.e(TAG, "HAL deadline expired. Rebooting.", mException);
                reboot();
            }, TIMEOUT_MS);
        }
+3 −3
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import android.os.IHwBinder;
import android.os.RemoteException;
import android.os.SystemClock;
import android.system.OsConstants;
import android.util.Log;
import android.util.Slog;

import java.io.IOException;
import java.util.HashMap;
@@ -240,7 +240,7 @@ final class SoundTriggerHw2Compat implements ISoundTriggerHal {
                try {
                    hidlModel.data.close();
                } catch (IOException e) {
                    Log.e(TAG, "Failed to close file", e);
                    Slog.e(TAG, "Failed to close file", e);
                }
            }
        }
@@ -276,7 +276,7 @@ final class SoundTriggerHw2Compat implements ISoundTriggerHal {
                try {
                    hidlModel.common.data.close();
                } catch (IOException e) {
                    Log.e(TAG, "Failed to close file", e);
                    Slog.e(TAG, "Failed to close file", e);
                }
            }
        }
Loading