diff options
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); |