am b835dd76: Close assist when launching intents from notification shade
* commit 'b835dd7641c60cd5d2b372331ffc19f7165244bd': Close assist when launching intents from notification shade
This commit is contained in:
@@ -96,6 +96,11 @@ interface IVoiceInteractionManagerService {
|
||||
*/
|
||||
void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback);
|
||||
|
||||
/**
|
||||
* Hides the session from the active service, if it is showing.
|
||||
*/
|
||||
void hideCurrentSession();
|
||||
|
||||
/**
|
||||
* Notifies the active service that a launch was requested from the Keyguard. This will only
|
||||
* be called if {@link #activeServiceSupportsLaunchFromKeyguard()} returns true.
|
||||
|
||||
@@ -124,6 +124,14 @@ public class AssistManager {
|
||||
startAssist();
|
||||
}
|
||||
|
||||
public void hideAssist() {
|
||||
try {
|
||||
mVoiceInteractionManagerService.hideCurrentSession();
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed to call hideCurrentSession", e);
|
||||
}
|
||||
}
|
||||
|
||||
private WindowManager.LayoutParams getLayoutParams() {
|
||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
|
||||
@@ -92,6 +92,7 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.RecentsComponent;
|
||||
import com.android.systemui.SwipeHelper;
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.assist.AssistManager;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.statusbar.NotificationData.Entry;
|
||||
import com.android.systemui.statusbar.phone.NavigationBarView;
|
||||
@@ -240,6 +241,8 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
|
||||
private NotificationClicker mNotificationClicker = new NotificationClicker();
|
||||
|
||||
protected AssistManager mAssistManager;
|
||||
|
||||
@Override // NotificationData.Environment
|
||||
public boolean isDeviceProvisioned() {
|
||||
return mDeviceProvisioned;
|
||||
@@ -1626,6 +1629,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
// TODO: Dismiss Keyguard.
|
||||
}
|
||||
if (intent.isActivity()) {
|
||||
mAssistManager.hideAssist();
|
||||
overrideActivityPendingAppTransition(keyguardShowing
|
||||
&& !afterKeyguardGone);
|
||||
}
|
||||
|
||||
@@ -344,8 +344,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
private int mNavigationIconHints = 0;
|
||||
private HandlerThread mHandlerThread;
|
||||
|
||||
private AssistManager mAssistManager;
|
||||
|
||||
// ensure quick settings is disabled until the current user makes it through the setup wizard
|
||||
private boolean mUserSetup = false;
|
||||
private ContentObserver mUserSetupObserver = new ContentObserver(new Handler()) {
|
||||
@@ -2753,6 +2751,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
mAssistManager.hideAssist();
|
||||
intent.setFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
int result = ActivityManager.START_CANCELED;
|
||||
@@ -2781,7 +2780,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
}
|
||||
};
|
||||
executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShade, afterKeyguardGone);
|
||||
executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShade,
|
||||
afterKeyguardGone);
|
||||
}
|
||||
|
||||
public void executeRunnableDismissingKeyguard(final Runnable runnable,
|
||||
|
||||
@@ -49,6 +49,7 @@ import android.service.voice.VoiceInteractionServiceInfo;
|
||||
import android.service.voice.VoiceInteractionSession;
|
||||
import android.speech.RecognitionService;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.app.IVoiceInteractionManagerService;
|
||||
@@ -475,11 +476,9 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
Slog.w(TAG, "hideSessionFromSession without running voice interaction service");
|
||||
return false;
|
||||
}
|
||||
final int callingPid = Binder.getCallingPid();
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
final long caller = Binder.clearCallingIdentity();
|
||||
try {
|
||||
return mImpl.hideSessionLocked(callingPid, callingUid);
|
||||
return mImpl.hideSessionLocked();
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(caller);
|
||||
}
|
||||
@@ -743,6 +742,28 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideCurrentSession() throws RemoteException {
|
||||
enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
|
||||
synchronized (this) {
|
||||
if (mImpl == null) {
|
||||
return;
|
||||
}
|
||||
final long caller = Binder.clearCallingIdentity();
|
||||
try {
|
||||
if (mImpl.mActiveSession != null && mImpl.mActiveSession.mSession != null) {
|
||||
try {
|
||||
mImpl.mActiveSession.mSession.closeSystemDialogs();
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed to call closeSystemDialogs", e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchVoiceAssistFromKeyguard() {
|
||||
enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
|
||||
|
||||
@@ -144,7 +144,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
|
||||
return mActiveSession.showLocked(args, flags, showCallback);
|
||||
}
|
||||
|
||||
public boolean hideSessionLocked(int callingPid, int callingUid) {
|
||||
public boolean hideSessionLocked() {
|
||||
if (mActiveSession != null) {
|
||||
return mActiveSession.hideLocked();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user