diff options
author | Jorim Jaggi <jjaggi@google.com> | 2015-07-06 16:18:11 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-07-08 22:26:24 +0000 |
commit | 165ce066b701ba0153000f0692bfc7032655d17d (patch) | |
tree | f557490ccff7c7dd1787fedd40540d6ccd35d5a3 /packages/SystemUI/src/com/android/systemui/statusbar | |
parent | 588932a53e63c0a7ee281dea22559c129b40eb99 (diff) | |
download | frameworks_base-165ce066b701ba0153000f0692bfc7032655d17d.zip frameworks_base-165ce066b701ba0153000f0692bfc7032655d17d.tar.gz frameworks_base-165ce066b701ba0153000f0692bfc7032655d17d.tar.bz2 |
Fix assist for hardware long-press
Activating the assistant will now route through SysUI, so
we have the logic whether to start an activity or to start a voice
interaction session in one single place.
Bug: 22201770
Change-Id: I0f4699533aea2a1e595ee25a844434c82f548c01
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar')
3 files changed, 22 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 6ad0ef9..f62dc59 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -41,9 +41,9 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.graphics.drawable.Icon; import android.os.AsyncTask; import android.os.Build; +import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; @@ -65,7 +65,6 @@ import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.view.Display; -import android.view.Gravity; import android.view.IWindowManager; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -2125,4 +2124,11 @@ public abstract class BaseStatusBar extends SystemUI implements mAssistManager.showDisclosure(); } } + + @Override + public void startAssist(Bundle args) { + if (mAssistManager != null) { + mAssistManager.startAssist(args); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 0deff08..a1b07b5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar; +import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; @@ -62,6 +63,7 @@ public class CommandQueue extends IStatusBar.Stub { private static final int MSG_APP_TRANSITION_CANCELLED = 20 << MSG_SHIFT; private static final int MSG_APP_TRANSITION_STARTING = 21 << MSG_SHIFT; private static final int MSG_ASSIST_DISCLOSURE = 22 << MSG_SHIFT; + private static final int MSG_START_ASSIST = 23 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; @@ -106,6 +108,7 @@ public class CommandQueue extends IStatusBar.Stub { public void appTransitionCancelled(); public void appTransitionStarting(long startTime, long duration); public void showAssistDisclosure(); + public void startAssist(Bundle args); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { @@ -283,6 +286,13 @@ public class CommandQueue extends IStatusBar.Stub { } } + public void startAssist(Bundle args) { + synchronized (mList) { + mHandler.removeMessages(MSG_START_ASSIST); + mHandler.obtainMessage(MSG_START_ASSIST, args).sendToTarget(); + } + } + private final class H extends Handler { public void handleMessage(Message msg) { final int what = msg.what & MSG_MASK; @@ -378,6 +388,9 @@ public class CommandQueue extends IStatusBar.Stub { case MSG_ASSIST_DISCLOSURE: mCallbacks.showAssistDisclosure(); break; + case MSG_START_ASSIST: + mCallbacks.startAssist((Bundle) msg.obj); + break; } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 20f4dc7..c481be1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -81,7 +81,6 @@ import android.view.MotionEvent; import android.view.ThreadedRenderer; import android.view.VelocityTracker; import android.view.View; -import android.view.ViewConfiguration; import android.view.ViewGroup.LayoutParams; import android.view.ViewStub; import android.view.WindowManager; @@ -106,7 +105,6 @@ import com.android.systemui.EventLogConstants; import com.android.systemui.EventLogTags; import com.android.systemui.Prefs; import com.android.systemui.R; -import com.android.systemui.SwipeHelper; import com.android.systemui.assist.AssistManager; import com.android.systemui.doze.DozeHost; import com.android.systemui.doze.DozeLog; @@ -1045,8 +1043,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (shouldDisableNavbarGestures()) { return false; } - mAssistManager.prepareBeforeInvocation(); - mAssistManager.onGestureInvoked(); + mAssistManager.startAssist(new Bundle() /* args */); awakenDreams(); if (mNavigationBarView != null) { mNavigationBarView.abortCurrentGesture(); |