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

Commit 2d28217d authored by lpeter's avatar lpeter
Browse files

Set the Debug flag to false

Set the Debug flag to false, but we also reserve some logs
for clarifying the issue.

Bug: 177502877
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: Idf5dd82d8db27bb682b473eb4584e8b230073d08
parent aa80f8e7
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -72,8 +72,7 @@ import java.util.function.IntConsumer;
@SystemApi
public abstract class HotwordDetectionService extends Service {
    private static final String TAG = "HotwordDetectionService";
    // TODO (b/177502877): Set the Debug flag to false before shipping.
    private static final boolean DBG = true;
    private static final boolean DBG = false;

    private static final long UPDATE_TIMEOUT_MILLIS = 5000;

@@ -151,9 +150,7 @@ public abstract class HotwordDetectionService extends Service {
        @Override
        public void updateState(PersistableBundle options, SharedMemory sharedMemory,
                IRemoteCallback callback) throws RemoteException {
            if (DBG) {
                Log.d(TAG, "#updateState");
            }
            Log.v(TAG, "#updateState" + (callback != null ? " with callback" : ""));
            HotwordDetectionService.this.onUpdateStateInternal(
                    options,
                    sharedMemory,
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ import java.io.PrintWriter;
 **/
class SoftwareHotwordDetector extends AbstractHotwordDetector {
    private static final String TAG = SoftwareHotwordDetector.class.getSimpleName();
    private static final boolean DEBUG = true;
    private static final boolean DEBUG = false;

    private final IVoiceInteractionManagerService mManagerService;
    private final HotwordDetector.Callback mCallback;
+12 −34
Original line number Diff line number Diff line
@@ -87,8 +87,7 @@ import java.util.function.Function;
 */
final class HotwordDetectionConnection {
    private static final String TAG = "HotwordDetectionConnection";
    // TODO (b/177502877): Set the Debug flag to false before shipping.
    static final boolean DEBUG = true;
    static final boolean DEBUG = false;

    // TODO: These constants need to be refined.
    private static final long VALIDATION_TIMEOUT_MILLIS = 3000;
@@ -159,10 +158,7 @@ final class HotwordDetectionConnection {
        // TODO(volnov): we need to be smarter here, e.g. schedule it a bit more often, but wait
        // until the current session is closed.
        mCancellationTaskFuture = mScheduledExecutorService.scheduleAtFixedRate(() -> {
            if (DEBUG) {
                Slog.i(TAG, "Time to restart the process, TTL has passed");
            }

            Slog.v(TAG, "Time to restart the process, TTL has passed");
            synchronized (mLock) {
                restartProcessLocked();
            }
@@ -268,9 +264,7 @@ final class HotwordDetectionConnection {
    }

    void cancelLocked() {
        if (DEBUG) {
            Slog.d(TAG, "cancelLocked");
        }
        Slog.v(TAG, "cancelLocked");
        if (mRemoteHotwordDetectionService.isBound()) {
            mRemoteHotwordDetectionService.unbind();
            LocalServices.getService(PermissionManagerServiceInternal.class)
@@ -288,6 +282,7 @@ final class HotwordDetectionConnection {
        // TODO(b/191742511): this logic needs a test
        if (!mUpdateStateAfterStartFinished.get()
                && Instant.now().minus(MAX_UPDATE_TIMEOUT_DURATION).isBefore(mLastRestartInstant)) {
            Slog.v(TAG, "call updateStateAfterProcessStart");
            updateStateAfterProcessStart(options, sharedMemory);
        } else {
            mRemoteHotwordDetectionService.run(
@@ -407,15 +402,11 @@ final class HotwordDetectionConnection {

    private void detectFromDspSourceForTest(SoundTrigger.KeyphraseRecognitionEvent recognitionEvent,
            IHotwordRecognitionStatusCallback externalCallback) {
        if (DEBUG) {
            Slog.d(TAG, "detectFromDspSourceForTest");
        }
        Slog.v(TAG, "detectFromDspSourceForTest");
        IDspHotwordDetectionCallback internalCallback = new IDspHotwordDetectionCallback.Stub() {
            @Override
            public void onDetected(HotwordDetectedResult result) throws RemoteException {
                if (DEBUG) {
                    Slog.d(TAG, "onDetected");
                }
                Slog.v(TAG, "onDetected");
                synchronized (mLock) {
                    if (mValidatingDspTrigger) {
                        mValidatingDspTrigger = false;
@@ -433,9 +424,7 @@ final class HotwordDetectionConnection {

            @Override
            public void onRejected(HotwordRejectedResult result) throws RemoteException {
                if (DEBUG) {
                    Slog.d(TAG, "onRejected");
                }
                Slog.v(TAG, "onRejected");
                synchronized (mLock) {
                    if (mValidatingDspTrigger) {
                        mValidatingDspTrigger = false;
@@ -514,19 +503,14 @@ final class HotwordDetectionConnection {
    }

    void forceRestart() {
        if (DEBUG) {
            Slog.i(TAG, "Requested to restart the service internally. Performing the restart");
        }
        Slog.v(TAG, "Requested to restart the service internally. Performing the restart");
        synchronized (mLock) {
            restartProcessLocked();
        }
    }

    private void restartProcessLocked() {
        if (DEBUG) {
            Slog.i(TAG, "Restarting hotword detection process");
        }

        Slog.v(TAG, "Restarting hotword detection process");
        ServiceConnection oldConnection = mRemoteHotwordDetectionService;

        // TODO(volnov): this can be done after connect() has been successful.
@@ -547,9 +531,7 @@ final class HotwordDetectionConnection {
        // Recreate connection to reset the cache.
        mRemoteHotwordDetectionService = mServiceConnectionFactory.createLocked();

        if (DEBUG) {
            Slog.i(TAG, "Started the new process, issuing #onProcessRestarted");
        }
        Slog.v(TAG, "Started the new process, issuing #onProcessRestarted");
        try {
            mCallback.onProcessRestarted();
        } catch (RemoteException e) {
@@ -773,9 +755,7 @@ final class HotwordDetectionConnection {
            }
            synchronized (mLock) {
                if (!mRespectServiceConnectionStatusChanged) {
                    if (DEBUG) {
                        Slog.d(TAG, "Ignored onServiceConnectionStatusChanged event");
                    }
                    Slog.v(TAG, "Ignored onServiceConnectionStatusChanged event");
                    return;
                }
                mIsBound = connected;
@@ -792,9 +772,7 @@ final class HotwordDetectionConnection {
            super.binderDied();
            synchronized (mLock) {
                if (!mRespectServiceConnectionStatusChanged) {
                    if (DEBUG) {
                        Slog.d(TAG, "Ignored #binderDied event");
                    }
                    Slog.v(TAG, "Ignored #binderDied event");
                    return;
                }

+2 −5
Original line number Diff line number Diff line
@@ -79,8 +79,7 @@ import java.util.List;

class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConnection.Callback {
    final static String TAG = "VoiceInteractionServiceManager";
    // TODO (b/177502877): Set the Debug flag to false before shipping.
    static final boolean DEBUG = true;
    static final boolean DEBUG = false;

    final static String CLOSE_REASON_VOICE_INTERACTION = "voiceinteraction";

@@ -420,9 +419,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
            @Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory,
            IHotwordRecognitionStatusCallback callback) {
        if (DEBUG) {
            Slog.d(TAG, "updateStateLocked");
        }
        Slog.v(TAG, "updateStateLocked");
        if (mHotwordDetectionComponentName == null) {
            Slog.w(TAG, "Hotword detection service name not found");
            throw new IllegalStateException("Hotword detection service name not found");