Loading core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2037,6 +2037,7 @@ package android.media.metrics { package android.media.soundtrigger { public final class SoundTriggerInstrumentation { method public void setInPhoneCallState(boolean); method public void setResourceContention(boolean); method public void triggerOnResourcesAvailable(); method public void triggerRestart(); Loading core/java/com/android/internal/app/ISoundTriggerService.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -79,4 +79,10 @@ interface ISoundTriggerService { * Attach an HAL injection interface. */ void attachInjection(ISoundTriggerInjection injection); /** * Test API to override the phone call state. */ void setInPhoneCallState(boolean isInPhoneCall); } media/java/android/media/soundtrigger/SoundTriggerInstrumentation.java +22 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public final class SoundTriggerInstrumentation { @GuardedBy("mLock") private IBinder mClientToken = null; private final ISoundTriggerService mService; private final GlobalCallback mClientCallback; private final Executor mGlobalCallbackExecutor; Loading Loading @@ -562,6 +564,7 @@ public final class SoundTriggerInstrumentation { @NonNull GlobalCallback callback) { mClientCallback = Objects.requireNonNull(callback); mGlobalCallbackExecutor = Objects.requireNonNull(executor); mService = service; try { service.attachInjection(new Injection()); } catch (RemoteException e) { Loading Loading @@ -651,5 +654,24 @@ public final class SoundTriggerInstrumentation { } } } /** * Simulate a phone call for {@link com.android.server.soundtrigger.SoundTriggerService}. * If the phone call state changes, the service will be notified to respond. * The service should pause recognition for the duration of the call. * * @param isInPhoneCall - {@code true} to cause the SoundTriggerService to * see the phone call state as off-hook. {@code false} to cause the service to * see the state as normal. * @hide */ @TestApi public void setInPhoneCallState(boolean isInPhoneCall) { try { mService.setInPhoneCallState(isInPhoneCall); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -412,6 +412,12 @@ public class SoundTriggerService extends SystemService { } } @Override public void setInPhoneCallState(boolean isInPhoneCall) { Slog.i(TAG, "Overriding phone call state: " + isInPhoneCall); mDeviceStateHandler.onPhoneCallStateChanged(isInPhoneCall); } @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { // Event loggers Loading Loading
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2037,6 +2037,7 @@ package android.media.metrics { package android.media.soundtrigger { public final class SoundTriggerInstrumentation { method public void setInPhoneCallState(boolean); method public void setResourceContention(boolean); method public void triggerOnResourcesAvailable(); method public void triggerRestart(); Loading
core/java/com/android/internal/app/ISoundTriggerService.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -79,4 +79,10 @@ interface ISoundTriggerService { * Attach an HAL injection interface. */ void attachInjection(ISoundTriggerInjection injection); /** * Test API to override the phone call state. */ void setInPhoneCallState(boolean isInPhoneCall); }
media/java/android/media/soundtrigger/SoundTriggerInstrumentation.java +22 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public final class SoundTriggerInstrumentation { @GuardedBy("mLock") private IBinder mClientToken = null; private final ISoundTriggerService mService; private final GlobalCallback mClientCallback; private final Executor mGlobalCallbackExecutor; Loading Loading @@ -562,6 +564,7 @@ public final class SoundTriggerInstrumentation { @NonNull GlobalCallback callback) { mClientCallback = Objects.requireNonNull(callback); mGlobalCallbackExecutor = Objects.requireNonNull(executor); mService = service; try { service.attachInjection(new Injection()); } catch (RemoteException e) { Loading Loading @@ -651,5 +654,24 @@ public final class SoundTriggerInstrumentation { } } } /** * Simulate a phone call for {@link com.android.server.soundtrigger.SoundTriggerService}. * If the phone call state changes, the service will be notified to respond. * The service should pause recognition for the duration of the call. * * @param isInPhoneCall - {@code true} to cause the SoundTriggerService to * see the phone call state as off-hook. {@code false} to cause the service to * see the state as normal. * @hide */ @TestApi public void setInPhoneCallState(boolean isInPhoneCall) { try { mService.setInPhoneCallState(isInPhoneCall); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -412,6 +412,12 @@ public class SoundTriggerService extends SystemService { } } @Override public void setInPhoneCallState(boolean isInPhoneCall) { Slog.i(TAG, "Overriding phone call state: " + isInPhoneCall); mDeviceStateHandler.onPhoneCallStateChanged(isInPhoneCall); } @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { // Event loggers Loading