diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-03-13 18:02:54 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2015-03-16 11:29:12 -0700 |
commit | 3d07c94c393831091958fe6a98811843db8973bd (patch) | |
tree | 0cd5c4ea3dc580772b28ef76e9b5b76fe23de081 /services/voiceinteraction | |
parent | 872d191e6134b429f833013b8706c7b54ebd0d2a (diff) | |
download | frameworks_base-3d07c94c393831091958fe6a98811843db8973bd.zip frameworks_base-3d07c94c393831091958fe6a98811843db8973bd.tar.gz frameworks_base-3d07c94c393831091958fe6a98811843db8973bd.tar.bz2 |
Add new voice request for picking from a list.
Also add API for voice interaction service to control
whether the system should hold a wake lock while it is
working with an activity (and actually *do* hold a wake
lock while doing so, duh!).
And while in there, clean up the launching wake lock to
correctly give blame to the app that is launching.
Change-Id: I7cc4d566b80f59fe0a9ac51ae9bbb7188a01f433
Diffstat (limited to 'services/voiceinteraction')
2 files changed, 30 insertions, 0 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java index 6b8c49c..f032ccf 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java @@ -479,6 +479,24 @@ public class VoiceInteractionManagerService extends SystemService { } @Override + public void setKeepAwake(IBinder token, boolean keepAwake) { + synchronized (this) { + if (mImpl == null) { + Slog.w(TAG, "setKeepAwake without running voice interaction service"); + return; + } + final int callingPid = Binder.getCallingPid(); + final int callingUid = Binder.getCallingUid(); + final long caller = Binder.clearCallingIdentity(); + try { + mImpl.setKeepAwakeLocked(callingPid, callingUid, token, keepAwake); + } finally { + Binder.restoreCallingIdentity(caller); + } + } + } + + @Override public void finish(IBinder token) { synchronized (this) { if (mImpl == null) { diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index 9e92867..5a91b88 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -174,6 +174,18 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne } } + public void setKeepAwakeLocked(int callingPid, int callingUid, IBinder token, + boolean keepAwake) { + try { + if (mActiveSession == null || token != mActiveSession.mToken) { + Slog.w(TAG, "setKeepAwake does not match active session"); + return; + } + mAm.setVoiceKeepAwake(mActiveSession.mSession, keepAwake); + } catch (RemoteException e) { + throw new IllegalStateException("Unexpected remote error", e); + } + } public void finishLocked(int callingPid, int callingUid, IBinder token) { if (mActiveSession == null || token != mActiveSession.mToken) { |