From 937a991be46c355f57dcb5cebf9ff645fe87633f Mon Sep 17 00:00:00 2001 From: Annie Chin Date: Tue, 31 May 2016 10:14:23 -0700 Subject: [PATCH] Add createAssistManager() method to SystemUIFactory Bug: 29045300 Change-Id: Ic912066944e3aed377fcc6af223b585c5ba3840c --- .../SystemUI/src/com/android/systemui/SystemUIFactory.java | 6 ++++++ .../src/com/android/systemui/assist/AssistManager.java | 7 ++++++- .../android/systemui/statusbar/phone/PhoneStatusBar.java | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index 35d6a20e00da9..5a0c94fd9a9d6 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -24,6 +24,8 @@ import android.view.ViewGroup; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.R; +import com.android.systemui.assist.AssistManager; +import com.android.systemui.statusbar.BaseStatusBar; import com.android.systemui.statusbar.ScrimView; import com.android.systemui.statusbar.phone.KeyguardBouncer; import com.android.systemui.statusbar.phone.NotificationIconAreaController; @@ -123,4 +125,8 @@ public class SystemUIFactory { public int getHomeLayoutId() { return R.layout.home; } + + public AssistManager createAssistManager(BaseStatusBar bar, Context context) { + return new AssistManager(bar, context); + } } diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index a0aeb2ff7b77a..a5e771fa53a49 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -30,6 +30,7 @@ import android.widget.ImageView; import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.systemui.R; +import com.android.systemui.SystemUIFactory; import com.android.systemui.statusbar.BaseStatusBar; import com.android.systemui.statusbar.CommandQueue; @@ -103,6 +104,10 @@ public class AssistManager { } } + protected boolean shouldShowOrb() { + return true; + } + public void startAssist(Bundle args) { final ComponentName assistComponent = getAssistInfo(); if (assistComponent == null) { @@ -110,7 +115,7 @@ public class AssistManager { } final boolean isService = assistComponent.equals(getVoiceInteractorComponentName()); - if (!isService || !isVoiceSessionRunning()) { + if (!isService || (!isVoiceSessionRunning() && shouldShowOrb())) { showOrb(assistComponent, isService); mView.postDelayed(mHideRunnable, isService ? TIMEOUT_SERVICE 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 6877f985d8a51..7ebeb8d995cef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -765,7 +765,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // no window manager? good luck with that } - mAssistManager = new AssistManager(this, context); + mAssistManager = SystemUIFactory.getInstance().createAssistManager(this, context); // figure out which pixel-format to use for the status bar. mPixelFormat = PixelFormat.OPAQUE;