Merge changes from topic "detach_cut" into udc-dev am: 8bcb06a146
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22536415 Change-Id: I7036709ede8a3aadac1192ec5bcd9cf7044cf20d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1334,13 +1334,7 @@ public class AlwaysOnHotwordDetector extends AbstractDetector {
|
|||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mAvailability == STATE_KEYPHRASE_ENROLLED) {
|
detachSessionLocked();
|
||||||
try {
|
|
||||||
stopRecognition();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.i(TAG, "failed to stopRecognition in destroy", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mAvailability = STATE_INVALID;
|
mAvailability = STATE_INVALID;
|
||||||
mIsAvailabilityOverriddenByTestApi = false;
|
mIsAvailabilityOverriddenByTestApi = false;
|
||||||
@@ -1349,6 +1343,17 @@ public class AlwaysOnHotwordDetector extends AbstractDetector {
|
|||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void detachSessionLocked() {
|
||||||
|
try {
|
||||||
|
if (DBG) Slog.d(TAG, "detachSessionLocked() " + mSoundTriggerSession);
|
||||||
|
if (mSoundTriggerSession != null) {
|
||||||
|
mSoundTriggerSession.detach();
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -94,4 +94,9 @@ interface IVoiceInteractionSoundTriggerSession {
|
|||||||
*/
|
*/
|
||||||
@nullable SoundTrigger.ModelParamRange queryParameter(int keyphraseId,
|
@nullable SoundTrigger.ModelParamRange queryParameter(int keyphraseId,
|
||||||
in ModelParams modelParam);
|
in ModelParams modelParam);
|
||||||
|
/**
|
||||||
|
* Invalidates the sound trigger session and clears any associated resources. Subsequent calls
|
||||||
|
* to this object will throw IllegalStateException.
|
||||||
|
*/
|
||||||
|
void detach();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,12 @@ public interface SoundTriggerInternal {
|
|||||||
ModelParamRange queryParameter(int keyphraseId,
|
ModelParamRange queryParameter(int keyphraseId,
|
||||||
@ModelParams int modelParam);
|
@ModelParams int modelParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidates the sound trigger session and clears any associated resources. Subsequent
|
||||||
|
* calls to this object will throw IllegalStateException.
|
||||||
|
*/
|
||||||
|
void detach();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads (and stops if running) the given keyphraseId
|
* Unloads (and stops if running) the given keyphraseId
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1662,6 +1662,11 @@ public class SoundTriggerService extends SystemService {
|
|||||||
return mSoundTriggerHelper.queryKeyphraseParameter(keyphraseId, modelParam);
|
return mSoundTriggerHelper.queryKeyphraseParameter(keyphraseId, modelParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detach() {
|
||||||
|
mSoundTriggerHelper.detach();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int unloadKeyphraseModel(int keyphraseId) {
|
public int unloadKeyphraseModel(int keyphraseId) {
|
||||||
return mSoundTriggerHelper.unloadKeyphraseSoundModel(keyphraseId);
|
return mSoundTriggerHelper.unloadKeyphraseSoundModel(keyphraseId);
|
||||||
|
|||||||
@@ -69,4 +69,9 @@ final class SoundTriggerSessionBinderProxy extends IVoiceInteractionSoundTrigger
|
|||||||
public SoundTrigger.ModelParamRange queryParameter(int i, int i1) throws RemoteException {
|
public SoundTrigger.ModelParamRange queryParameter(int i, int i1) throws RemoteException {
|
||||||
return mDelegate.queryParameter(i, i1);
|
return mDelegate.queryParameter(i, i1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detach() throws RemoteException {
|
||||||
|
mDelegate.detach();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,15 @@ final class SoundTriggerSessionPermissionsDecorator implements
|
|||||||
"This object isn't intended to be used as a Binder.");
|
"This object isn't intended to be used as a Binder.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detach() {
|
||||||
|
try {
|
||||||
|
mDelegate.detach();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Share this code with SoundTriggerMiddlewarePermission.
|
// TODO: Share this code with SoundTriggerMiddlewarePermission.
|
||||||
private boolean isHoldingPermissions() {
|
private boolean isHoldingPermissions() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1856,6 +1856,11 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
"This object isn't intended to be used as a Binder.");
|
"This object isn't intended to be used as a Binder.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detach() {
|
||||||
|
mSession.detach();
|
||||||
|
}
|
||||||
|
|
||||||
private int unloadKeyphraseModel(int keyphraseId) {
|
private int unloadKeyphraseModel(int keyphraseId) {
|
||||||
final long caller = Binder.clearCallingIdentity();
|
final long caller = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user