diff options
author | Jorim Jaggi <jjaggi@google.com> | 2015-05-18 17:35:26 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-05-18 21:39:05 -0700 |
commit | 9d91083034654b37461c891308a1d426054170a8 (patch) | |
tree | 4ff94f232c2820c929db20fff10718dda103b89f /services/voiceinteraction/java | |
parent | ae1eac53a77a8f1cd6f1df0f8628cc64439e6a22 (diff) | |
download | frameworks_base-9d91083034654b37461c891308a1d426054170a8.zip frameworks_base-9d91083034654b37461c891308a1d426054170a8.tar.gz frameworks_base-9d91083034654b37461c891308a1d426054170a8.tar.bz2 |
Add setting to disable assist data (1/2)
Bug: 20944446
Change-Id: I8050df3177b6d540829c3f0989a4e4b1381c87ec
Diffstat (limited to 'services/voiceinteraction/java')
-rw-r--r-- | services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java index 42eb6c3..58a8272 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java @@ -35,6 +35,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; +import android.provider.Settings; import android.service.voice.IVoiceInteractionSession; import android.service.voice.IVoiceInteractionSessionService; import android.service.voice.VoiceInteractionService; @@ -190,7 +191,8 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { mHaveAssistData = false; if ((flags&VoiceInteractionService.START_WITH_ASSIST) != 0) { if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid, - mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED) { + mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED + && isStructureEnabled()) { try { mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL, mAssistReceiver); @@ -455,6 +457,11 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { } } + private boolean isStructureEnabled() { + return Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, mUser) != 0; + } + public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("mToken="); pw.println(mToken); pw.print(prefix); pw.print("mShown="); pw.println(mShown); |