When the system connects to the VoiceInteractionSessionService, it
requests the service to create a new session. The service then delivers
this session to the system. Currently, a failure to deliver it is just
ignored, and the service continues to initialize the session. This
silently leaves the session in an invalid state where operations with it
always fail (since the system doesn't recognize the session).
There's currently a concurrency bug in the system server that causes the
session delivery to fail occasionally. Even with that fixed though, it's
good to handle unexpected errors here.
Fix: 178776751
Test: atest CtsVoiceInteractionTestCases --iterations
Change-Id: I3489db108158fa7c71179bee3d098ecd4ab6b2bd
Create the HotwordDetectionService to help to verify the audio data.
The VoiceInteractor app will implement the HotwordDetectionService
and create the validation algorithm to increase the hotword accuracy.
The HotwordDetectionService will be triggered by VoiceInteractor app
from the VoiceInteractionService after the VoiceInteractionService
is ready.
The VoiceInteractionManagerService will check if we need to bind the
HotwordDetectionService.
After receiving the audio data from the DSP, the
VoiceInteractionManagerService will pass the audio data to the
HotwordDetectionService, then the HotwordDetectionService will verify
the audio data and send the result back.
If the hotword is valid, then the VoiceInteractionManagerService will
inform the VoiceInteractionService. The VoiceInteractor app will show
the UI.
Local test:
1.Make sure the original hotword function to work well manually.
2.Add the additional test code and check the log to make sure the
basic flow of hotword detection service runs well manually.
Bug: 175738546
Test: Manually
Test: atest CtsVoiceInteractionTestCases
Change-Id: Idb662bab37bb9691da24c9c2910a2c3dafedcadd
MATCH_DEBUG_TRIAGED_MISSING is the deprecated equivalent to MATCH_DIRECT_BOOT_AUTO.
Not needed since we use MATCH_DIRECT_BOOT_AWARE and MATCH_DIRECT_BOOT_UNAWARE (see
comments on ag/1101955).
Bug: 178410946
Test: atest CtsVoiceInteractionTestCases
Change-Id: I2093b163bb18e43c4f868715d60bc4b637fced6c
Rotation Resolver Service provides the suggested screen rotation
to the system server.
Bug: 162359770
Bug: 172370409
Test: atest RotationResolverManagerPerUserServiceTest
Change-Id: Ia43dfdba8502e04768933ef46a4ac8a687d4936c
New system API interface for both SoundTriggerManager and
AlwaysOnHotwordDetector to indicate if a recognition should run in
battery saver mode or not.
Clients supply this information through the existing startRecognition
calls, and the client must hold a new privledged permission,
SOUND_TRIGGER_RUN_IN_BATTERY_SAVER, to indicate this intention.
As a prerequisite, the device PowerManagerService must have the
SoundTrigger service enabled in the battery saver mode battery policy.
If not enabled, recognition will be paused as if the client did not
provide the indication to run in battery saver mode.
Bug: 172294448
Test: build with Google search apk using this feature and verify
recognition keeps running in battery saver mode
Change-Id: Ia43be99290e6fd7c50ff8e4908d6c60ea513b19a
* Rename disposeConnection to disconnect
* Save the instance of Context used to bind the service
Fixes: 176822560
Test: atest CarrierMessagingServiceWrapperTest
Change-Id: I9d9f76033076f7a1261dddbe81429f81b0603bf4
The change in ag/13072747 could bring some unexpected behavior, as it
would drop important messages (onTileAdded, onTileDestroyed).
Given that there is no way to prevent messsages delivered after
onDestroy without implementing some kind of callback mechanism, instead
add explicit documentation about this behavior.
Test: build
Fixes: 172511340
Change-Id: I3fa6e41389477cbafa31809cd5041d67a76ccb91
This is the base class for service that provides wrapping/unwrapping of the opaque blob needed for
ResumeOnReboot operation. The package needs to provide a wrap and unwrap
implementation for handling the opaque blob, that's secure even when on
device keystore and clock is compromised. This can be achieved by using
tamper-resistant hardware such as a secure element with a secure clock,
or using a remote server to store and retrieve data and manage timing.
Bug: 172780686
Test: atest FrameworksServicesTests:ResumeOnRebootServiceProviderTests
Change-Id: I98378be6963194c2e6faef8ebc441066b75a0bbf
Updated ImpressionAttesationService to take in a byte array for the salt
instead of a String.
Test: Builds
Bug: 155825630
Change-Id: Iacd60e34e5103383207a4a497b0ee5e759d83b2b
This is the base class for service that provides wrapping/unwrapping of the opaque blob needed for
ResumeOnReboot operation. The package needs to provide a wrap and unwrap
implementation for handling the opaque blob, that's secure even when on
device keystore and clock is compromised. This can be achieved by using
tamper-resistant hardware such as a secure element with a secure clock,
or using a remote server to store and retrieve data and manage timing.
Bug: 172780686
Test: atest FrameworksServicesTests:ResumeOnRebootServiceProviderTests
Change-Id: I98378be6963194c2e6faef8ebc441066b75a0bbf
Merged-In: I98378be6963194c2e6faef8ebc441066b75a0bbf
(cherry picked from commit e1f51ddab63a54b7d66d3971b5301b66787e47cf)
The initial translation related APIs. The APIs and the implementation
will be revised in the follow up changes. The service register will
on the next changes.
Bug: 173243538
Bug: 176208267
Test: manual verification (build)
Change-Id: Ib7b39e1b548bc6663a81482fa335632e8da18d6a
Currently when switching the user, it will be possible to meet this
kind of issue due to timing factor that the API of SoundTriggerSession
was called by previous user and caused the exception "Caller is not
the current voice interaction service.". It seems that the flow between
switching user and voice interaction needs to be improved to avoid this
race condition issue, but the impact will be high.
It would be better to catch the exception and return the fail status
to caller instead of crashing as a short term solution.
Four approaches are considered below:
(1) Change state to STATE_INVALID
When AlwaysOnHotwordDetector is shutdown, the state will be set to
STATE_INVALID. Then all called methods from it will fail with an
IllegalStateException. This is a normal behavior that has been defined
in the javadoc. But the STATE_INVALID does not clearly indicate what
happended in the AlwaysOnHotwordDetector for this issue and what to do
next. So it is not the best approach to change the state to
STATE_INVALID directly.
(2) Use a new state to inform the caller (apply this)
Define a new state STATE_ERROR to indicate the unknown active
keyphrase availability due to an error.
public static final int STATE_ERROR = 3;
When the exception occurs, it will pass STATE_ERROR to the caller by
the callback API "onAvailabilityChanged(int status)".
Then all called methods from it should fail with an IllegalStateException
due to AlwaysOnHotwordDetector can not be used currently.
The caller should create a new instance after receiving this state.
In order to avoid unintended behavior in the application, it would be
better to use this approach when the target SDK version is greater
than R.
(3) Use onError() callback to inform the caller
Currently when some errors occurred during Recognition, the onError()
callback will be called. But it doesn't mean the caller should stop
to using the AlwaysOnHotwordDetector. It is different from what we
want that the caller should not use the AlwaysOnHotwordDetector and
should create a new instance. So it is not suitable to use the onError()
callback to inform the caller due to no error reason in the onError()
callback. The caller will not know what happened and what to do next.
(4) Create a new onError(int reason) callback to inform the caller
In this approach, it will need to create a new onError(int reason)
callback to inform the caller. It also needs to change the state of
AlwaysOnHotwordDetector, then all called methods from it should fail
with an IllegalStateException due to AlwaysOnHotwordDetector can not
be used currently. This approach is also fine, but it is very similar
to approach 2. Finaly we use the approach 2.
Bug: 148136382
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsSoundTriggerTestCases
Change-Id: I4697a2e6e26d412cf5c985467c652d30586adbe7