diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-07-15 14:20:51 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2015-07-15 14:20:51 -0700 |
commit | 1de1186d28f0ca7c0b6298edfa8ae497e651ba87 (patch) | |
tree | a2fb5d493d38c1e5879a6e37e3e9d2773d8823aa /core/java/android/service | |
parent | 1d4247c4cc89c6d62e44ed3115f26579979b44b5 (diff) | |
download | frameworks_base-1de1186d28f0ca7c0b6298edfa8ae497e651ba87.zip frameworks_base-1de1186d28f0ca7c0b6298edfa8ae497e651ba87.tar.gz frameworks_base-1de1186d28f0ca7c0b6298edfa8ae497e651ba87.tar.bz2 |
Implement issue #22403908: Enable assistant to refuse context sharing
New APIs allow the voice interaction service to set/retrieve a filter
for which of the show flags are allowed.
Change-Id: I588cbe55afee0548ad3afa22d3a7d3bc43cb54a6
Diffstat (limited to 'core/java/android/service')
-rw-r--r-- | core/java/android/service/voice/VoiceInteractionService.java | 31 | ||||
-rw-r--r-- | core/java/android/service/voice/VoiceInteractionSession.java | 28 |
2 files changed, 56 insertions, 3 deletions
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java index 549c93e..479c9e2 100644 --- a/core/java/android/service/voice/VoiceInteractionService.java +++ b/core/java/android/service/voice/VoiceInteractionService.java @@ -37,7 +37,6 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.Locale; - /** * Top-level service of the current global voice interactor, which is providing * support for hotwording, the back-end of a {@link android.app.VoiceInteractor}, etc. @@ -154,11 +153,39 @@ public class VoiceInteractionService extends Service { } /** + * Set contextual options you would always like to have disabled when a session + * is shown. The flags may be any combination of + * {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} and + * {@link VoiceInteractionSession#SHOW_WITH_SCREENSHOT + * VoiceInteractionSession.SHOW_WITH_SCREENSHOT}. + */ + public void setDisabledShowContext(int flags) { + try { + mSystemService.setDisabledShowContext(flags); + } catch (RemoteException e) { + } + } + + /** + * Return the value set by {@link #setDisabledShowContext}. + */ + public int getDisabledShowContext() { + try { + return mSystemService.getDisabledShowContext(); + } catch (RemoteException e) { + return 0; + } + } + + /** * Request that the associated {@link android.service.voice.VoiceInteractionSession} be * shown to the user, starting it if necessary. * @param args Arbitrary arguments that will be propagated to the session. * @param flags Indicates additional optional behavior that should be performed. May - * be {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} + * be any combination of + * {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} and + * {@link VoiceInteractionSession#SHOW_WITH_SCREENSHOT + * VoiceInteractionSession.SHOW_WITH_SCREENSHOT} * to request that the system generate and deliver assist data on the current foreground * app as part of showing the session UI. */ diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java index e408b36..a2eb353 100644 --- a/core/java/android/service/voice/VoiceInteractionSession.java +++ b/core/java/android/service/voice/VoiceInteractionSession.java @@ -908,12 +908,38 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall } /** + * Equivalent to {@link VoiceInteractionService#setDisabledShowContext + * VoiceInteractionService.setDisabledShowContext(int)}. + */ + public void setDisabledShowContext(int flags) { + try { + mSystemService.setDisabledShowContext(flags); + } catch (RemoteException e) { + } + } + + /** + * Equivalent to {@link VoiceInteractionService#getDisabledShowContext + * VoiceInteractionService.getDisabledShowContext}. + */ + public int getDisabledShowContext() { + try { + return mSystemService.getDisabledShowContext(); + } catch (RemoteException e) { + return 0; + } + } + + /** * Show the UI for this session. This asks the system to go through the process of showing * your UI, which will eventually culminate in {@link #onShow}. This is similar to calling * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}. * @param args Arbitrary arguments that will be propagated {@link #onShow}. * @param flags Indicates additional optional behavior that should be performed. May - * be {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} + * be any combination of + * {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} and + * {@link VoiceInteractionSession#SHOW_WITH_SCREENSHOT + * VoiceInteractionSession.SHOW_WITH_SCREENSHOT} * to request that the system generate and deliver assist data on the current foreground * app as part of showing the session UI. */ |