diff options
author | Adrian Roos <roosa@google.com> | 2015-06-17 16:43:38 -0700 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2015-06-19 11:33:05 -0700 |
commit | 4f43dc042bf76ec6c3b340b2297dec7c4cdd9098 (patch) | |
tree | 871b6946c846090a5fc18f74867b554aff69868c /services/voiceinteraction/java | |
parent | cdca13c613d3a8c9c8d7f4c9c29f4cb47d1bdb8d (diff) | |
download | frameworks_base-4f43dc042bf76ec6c3b340b2297dec7c4cdd9098.zip frameworks_base-4f43dc042bf76ec6c3b340b2297dec7c4cdd9098.tar.gz frameworks_base-4f43dc042bf76ec6c3b340b2297dec7c4cdd9098.tar.bz2 |
Assist disclosure
Add an animation that discloses delivery
of contextual data to the assist component.
Also fixes a bug where contextual data was
delivered to legacy assist activities even
though the user explicitly disabled context.
Bug: 21568059
Change-Id: I27dfaa36e2f677b0d73acfa4730f0f4ea3486919
Diffstat (limited to 'services/voiceinteraction/java')
2 files changed, 24 insertions, 2 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index acd484d..af0ddbe 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -139,7 +139,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne IVoiceInteractionSessionShowCallback showCallback) { if (mActiveSession == null) { mActiveSession = new VoiceInteractionSessionConnection(mLock, mSessionComponentName, - mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid); + mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid, mHandler); } return mActiveSession.showLocked(args, flags, showCallback); } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java index 47a230a..cc6a9c5 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java @@ -32,6 +32,7 @@ import android.graphics.Bitmap; import android.net.Uri; import android.os.Binder; import android.os.Bundle; +import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; @@ -48,6 +49,8 @@ import com.android.internal.app.IAssistScreenshotReceiver; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.app.IVoiceInteractor; import com.android.internal.os.IResultReceiver; +import com.android.server.LocalServices; +import com.android.server.statusbar.StatusBarManagerInternal; import java.io.PrintWriter; import java.util.ArrayList; @@ -63,6 +66,7 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { final Context mContext; final Callback mCallback; final int mCallingUid; + final Handler mHandler; final IActivityManager mAm; final IWindowManager mIWindowManager; final AppOpsManager mAppOps; @@ -141,13 +145,14 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { }; public VoiceInteractionSessionConnection(Object lock, ComponentName component, int user, - Context context, Callback callback, int callingUid) { + Context context, Callback callback, int callingUid, Handler handler) { mLock = lock; mSessionComponentName = component; mUser = user; mContext = context; mCallback = callback; mCallingUid = callingUid; + mHandler = handler; mAm = ActivityManagerNative.getDefault(); mIWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); @@ -193,11 +198,13 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { mShowArgs = args; mShowFlags = flags; mHaveAssistData = false; + boolean needDisclosure = false; if ((flags& VoiceInteractionSession.SHOW_WITH_ASSIST) != 0) { if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid, mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED && allDataEnabled) { try { + needDisclosure = true; mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL, mAssistReceiver); } catch (RemoteException e) { @@ -215,6 +222,7 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED && allDataEnabled) { try { + needDisclosure = true; mIWindowManager.requestAssistScreenshot(mScreenshotReceiver); } catch (RemoteException e) { } @@ -225,6 +233,9 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { } else { mScreenshot = null; } + if (needDisclosure) { + mHandler.post(mShowAssistDisclosureRunnable); + } if (mSession != null) { try { mSession.show(mShowArgs, mShowFlags, showCallback); @@ -483,4 +494,15 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { pw.print(prefix); pw.print("mAssistData="); pw.println(mAssistData); } } + + private Runnable mShowAssistDisclosureRunnable = new Runnable() { + @Override + public void run() { + StatusBarManagerInternal statusBarInternal = LocalServices.getService( + StatusBarManagerInternal.class); + if (statusBarInternal != null) { + statusBarInternal.showAssistDisclosure(); + } + } + }; }; |