Loading core/java/android/service/voice/HotwordDetectionService.java +10 −28 Original line number Original line Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.service.voice; package android.service.voice; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import android.annotation.CallSuper; import android.annotation.DurationMillisLong; import android.annotation.DurationMillisLong; import android.annotation.IntDef; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; Loading @@ -33,10 +30,8 @@ import android.content.Intent; import android.hardware.soundtrigger.SoundTrigger; import android.hardware.soundtrigger.SoundTrigger; import android.media.AudioFormat; import android.media.AudioFormat; import android.os.Bundle; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; import android.os.IRemoteCallback; import android.os.IRemoteCallback; import android.os.Looper; import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; import android.os.PersistableBundle; import android.os.RemoteException; import android.os.RemoteException; Loading Loading @@ -67,6 +62,8 @@ import java.util.function.IntConsumer; * to inform the system that a keyphrase was not detected. The system then relays this result to * to inform the system that a keyphrase was not detected. The system then relays this result to * the {@link VoiceInteractionService} through {@link HotwordDetector.Callback}. * the {@link VoiceInteractionService} through {@link HotwordDetector.Callback}. * * * Note: Methods in this class may be called concurrently * * @hide * @hide */ */ @SystemApi @SystemApi Loading Loading @@ -138,8 +135,6 @@ public abstract class HotwordDetectionService extends Service { public static final String SERVICE_INTERFACE = public static final String SERVICE_INTERFACE = "android.service.voice.HotwordDetectionService"; "android.service.voice.HotwordDetectionService"; private Handler mHandler; @Nullable @Nullable private ContentCaptureManager mContentCaptureManager; private ContentCaptureManager mContentCaptureManager; Loading @@ -154,13 +149,12 @@ public abstract class HotwordDetectionService extends Service { if (DBG) { if (DBG) { Log.d(TAG, "#detectFromDspSource"); Log.d(TAG, "#detectFromDspSource"); } } mHandler.sendMessage(obtainMessage(HotwordDetectionService::onDetect, HotwordDetectionService.this.onDetect( HotwordDetectionService.this, new AlwaysOnHotwordDetector.EventPayload( new AlwaysOnHotwordDetector.EventPayload( event.triggerInData, event.captureAvailable, event.triggerInData, event.captureAvailable, event.captureFormat, event.captureSession, event.data), event.captureFormat, event.captureSession, event.data), timeoutMillis, timeoutMillis, new Callback(callback))); new Callback(callback)); } } @Override @Override Loading @@ -169,11 +163,10 @@ public abstract class HotwordDetectionService extends Service { if (DBG) { if (DBG) { Log.d(TAG, "#updateState"); Log.d(TAG, "#updateState"); } } mHandler.sendMessage(obtainMessage(HotwordDetectionService::onUpdateStateInternal, HotwordDetectionService.this.onUpdateStateInternal( HotwordDetectionService.this, options, options, sharedMemory, sharedMemory, callback)); callback); } } @Override @Override Loading @@ -189,19 +182,15 @@ public abstract class HotwordDetectionService extends Service { } } switch (audioSource) { switch (audioSource) { case AUDIO_SOURCE_MICROPHONE: case AUDIO_SOURCE_MICROPHONE: mHandler.sendMessage(obtainMessage( HotwordDetectionService.this.onDetect( HotwordDetectionService::onDetect, new Callback(callback)); HotwordDetectionService.this, new Callback(callback))); break; break; case AUDIO_SOURCE_EXTERNAL: case AUDIO_SOURCE_EXTERNAL: mHandler.sendMessage(obtainMessage( HotwordDetectionService.this.onDetect( HotwordDetectionService::onDetect, HotwordDetectionService.this, audioStream, audioStream, audioFormat, audioFormat, options, options, new Callback(callback))); new Callback(callback)); break; break; default: default: Log.i(TAG, "Unsupported audio source " + audioSource); Log.i(TAG, "Unsupported audio source " + audioSource); Loading @@ -216,13 +205,6 @@ public abstract class HotwordDetectionService extends Service { } } }; }; @CallSuper @Override public void onCreate() { super.onCreate(); mHandler = Handler.createAsync(Looper.getMainLooper()); } @Override @Override @Nullable @Nullable public final IBinder onBind(@NonNull Intent intent) { public final IBinder onBind(@NonNull Intent intent) { Loading Loading
core/java/android/service/voice/HotwordDetectionService.java +10 −28 Original line number Original line Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.service.voice; package android.service.voice; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import android.annotation.CallSuper; import android.annotation.DurationMillisLong; import android.annotation.DurationMillisLong; import android.annotation.IntDef; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; Loading @@ -33,10 +30,8 @@ import android.content.Intent; import android.hardware.soundtrigger.SoundTrigger; import android.hardware.soundtrigger.SoundTrigger; import android.media.AudioFormat; import android.media.AudioFormat; import android.os.Bundle; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; import android.os.IRemoteCallback; import android.os.IRemoteCallback; import android.os.Looper; import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; import android.os.PersistableBundle; import android.os.RemoteException; import android.os.RemoteException; Loading Loading @@ -67,6 +62,8 @@ import java.util.function.IntConsumer; * to inform the system that a keyphrase was not detected. The system then relays this result to * to inform the system that a keyphrase was not detected. The system then relays this result to * the {@link VoiceInteractionService} through {@link HotwordDetector.Callback}. * the {@link VoiceInteractionService} through {@link HotwordDetector.Callback}. * * * Note: Methods in this class may be called concurrently * * @hide * @hide */ */ @SystemApi @SystemApi Loading Loading @@ -138,8 +135,6 @@ public abstract class HotwordDetectionService extends Service { public static final String SERVICE_INTERFACE = public static final String SERVICE_INTERFACE = "android.service.voice.HotwordDetectionService"; "android.service.voice.HotwordDetectionService"; private Handler mHandler; @Nullable @Nullable private ContentCaptureManager mContentCaptureManager; private ContentCaptureManager mContentCaptureManager; Loading @@ -154,13 +149,12 @@ public abstract class HotwordDetectionService extends Service { if (DBG) { if (DBG) { Log.d(TAG, "#detectFromDspSource"); Log.d(TAG, "#detectFromDspSource"); } } mHandler.sendMessage(obtainMessage(HotwordDetectionService::onDetect, HotwordDetectionService.this.onDetect( HotwordDetectionService.this, new AlwaysOnHotwordDetector.EventPayload( new AlwaysOnHotwordDetector.EventPayload( event.triggerInData, event.captureAvailable, event.triggerInData, event.captureAvailable, event.captureFormat, event.captureSession, event.data), event.captureFormat, event.captureSession, event.data), timeoutMillis, timeoutMillis, new Callback(callback))); new Callback(callback)); } } @Override @Override Loading @@ -169,11 +163,10 @@ public abstract class HotwordDetectionService extends Service { if (DBG) { if (DBG) { Log.d(TAG, "#updateState"); Log.d(TAG, "#updateState"); } } mHandler.sendMessage(obtainMessage(HotwordDetectionService::onUpdateStateInternal, HotwordDetectionService.this.onUpdateStateInternal( HotwordDetectionService.this, options, options, sharedMemory, sharedMemory, callback)); callback); } } @Override @Override Loading @@ -189,19 +182,15 @@ public abstract class HotwordDetectionService extends Service { } } switch (audioSource) { switch (audioSource) { case AUDIO_SOURCE_MICROPHONE: case AUDIO_SOURCE_MICROPHONE: mHandler.sendMessage(obtainMessage( HotwordDetectionService.this.onDetect( HotwordDetectionService::onDetect, new Callback(callback)); HotwordDetectionService.this, new Callback(callback))); break; break; case AUDIO_SOURCE_EXTERNAL: case AUDIO_SOURCE_EXTERNAL: mHandler.sendMessage(obtainMessage( HotwordDetectionService.this.onDetect( HotwordDetectionService::onDetect, HotwordDetectionService.this, audioStream, audioStream, audioFormat, audioFormat, options, options, new Callback(callback))); new Callback(callback)); break; break; default: default: Log.i(TAG, "Unsupported audio source " + audioSource); Log.i(TAG, "Unsupported audio source " + audioSource); Loading @@ -216,13 +205,6 @@ public abstract class HotwordDetectionService extends Service { } } }; }; @CallSuper @Override public void onCreate() { super.onCreate(); mHandler = Handler.createAsync(Looper.getMainLooper()); } @Override @Override @Nullable @Nullable public final IBinder onBind(@NonNull Intent intent) { public final IBinder onBind(@NonNull Intent intent) { Loading