diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-06-02 10:52:59 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2015-06-02 16:56:41 -0700 |
commit | 69c6adc96eecfde74ceb83cf9177428dc08b6067 (patch) | |
tree | 1c9fb3e63573cf0133ad3680d3cc8a048b0874c0 /services/voiceinteraction/java | |
parent | 133b107d28649ef5a984be0acc06f53e49853b22 (diff) | |
download | frameworks_base-69c6adc96eecfde74ceb83cf9177428dc08b6067.zip frameworks_base-69c6adc96eecfde74ceb83cf9177428dc08b6067.tar.gz frameworks_base-69c6adc96eecfde74ceb83cf9177428dc08b6067.tar.bz2 |
More API changes.
Start moving Assist* stuff to android.app.assist.
Clean up some more of the VoiceInteractionSession APIs.
Clearly document that finish() is not the same as hide(),
always call hide() instead, and fix the finish() path to
also always do a hide to make sure everything is cleaned
up correctly.
Change-Id: I962d4069fcb34fe89547a95d395ae1b9fa3b4148
Diffstat (limited to 'services/voiceinteraction/java')
2 files changed, 38 insertions, 37 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index 6de887b..d8569bc 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -201,7 +201,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne Slog.w(TAG, "finish does not match active session"); return; } - mActiveSession.cancel(); + mActiveSession.cancelLocked(); mActiveSession = null; } @@ -251,7 +251,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne // If there is an active session, cancel it to allow it to clean up its window and other // state. if (mActiveSession != null) { - mActiveSession.cancel(); + mActiveSession.cancelLocked(); mActiveSession = null; } try { diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java index b4629f2..0b430ca 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java @@ -19,9 +19,9 @@ package com.android.server.voiceinteraction; import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.AppOpsManager; -import android.app.AssistContent; -import android.app.AssistStructure; import android.app.IActivityManager; +import android.app.assist.AssistContent; +import android.app.assist.AssistStructure; import android.content.ClipData; import android.content.ComponentName; import android.content.ContentProvider; @@ -376,6 +376,40 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { return false; } + public void cancelLocked() { + hideLocked(); + mCanceled = true; + if (mBound) { + if (mSession != null) { + try { + mSession.destroy(); + } catch (RemoteException e) { + Slog.w(TAG, "Voice interation session already dead"); + } + } + if (mSession != null) { + try { + mAm.finishVoiceTask(mSession); + } catch (RemoteException e) { + } + } + mContext.unbindService(this); + try { + mIWindowManager.removeWindowToken(mToken); + } catch (RemoteException e) { + Slog.w(TAG, "Failed removing window token", e); + } + mBound = false; + mService = null; + mSession = null; + mInteractor = null; + } + if (mFullyBound) { + mContext.unbindService(mFullConnection); + mFullyBound = false; + } + } + public boolean deliverNewSessionLocked(IVoiceInteractionSession session, IVoiceInteractor interactor) { mSession = session; @@ -432,39 +466,6 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { mService = null; } - public void cancel() { - mCanceled = true; - if (mBound) { - if (mSession != null) { - try { - mSession.destroy(); - } catch (RemoteException e) { - Slog.w(TAG, "Voice interation session already dead"); - } - } - if (mSession != null) { - try { - mAm.finishVoiceTask(mSession); - } catch (RemoteException e) { - } - } - mContext.unbindService(this); - try { - mIWindowManager.removeWindowToken(mToken); - } catch (RemoteException e) { - Slog.w(TAG, "Failed removing window token", e); - } - mBound = false; - mService = null; - mSession = null; - mInteractor = null; - } - if (mFullyBound) { - mContext.unbindService(mFullConnection); - mFullyBound = false; - } - } - private boolean isStructureEnabled() { return Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, mUser) != 0; |