From 36cbc4ac67bde407905458361962f7292af7a272 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Thu, 24 Sep 2020 12:09:32 -0400 Subject: Add Executors to Dependency Test: manual, trigger KeyguardBottomAreaView#launchVoiceAssist Fixes: 167421921 Change-Id: I9b366f2fb69f47e0fb7bf19ced0c5382d0bb9c7c --- .../src/com/android/systemui/Dependency.java | 25 ++++++++++++++++++++++ .../statusbar/phone/KeyguardBottomAreaView.java | 4 +--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index 02d2b8e4ef0f..d1df27683a25 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -126,6 +126,7 @@ import com.android.systemui.wm.DisplayController; import com.android.systemui.wm.DisplayImeController; import com.android.systemui.wm.SystemWindows; +import java.util.concurrent.Executor; import java.util.function.Consumer; import javax.inject.Inject; @@ -167,6 +168,15 @@ public class Dependency { * Generic handler on the main thread. */ private static final String MAIN_HANDLER_NAME = "main_handler"; + /** + * Generic executor on the main thread. + */ + private static final String MAIN_EXECUTOR_NAME = "main_executor"; + + /** + * Generic executor on a background thread. + */ + private static final String BACKGROUND_EXECUTOR_NAME = "background_executor"; /** * An email address to send memory leak reports to by default. @@ -198,6 +208,17 @@ public class Dependency { public static final DependencyKey MAIN_HANDLER = new DependencyKey<>(MAIN_HANDLER_NAME); + /** + * Generic executor on the main thread. + */ + public static final DependencyKey MAIN_EXECUTOR = + new DependencyKey<>(MAIN_EXECUTOR_NAME); + /** + * Generic executor on a background thread. + */ + public static final DependencyKey BACKGROUND_EXECUTOR = + new DependencyKey<>(BACKGROUND_EXECUTOR_NAME); + /** * An email address to send memory leak reports to by default. */ @@ -301,6 +322,8 @@ public class Dependency { @Inject @Named(TIME_TICK_HANDLER_NAME) Lazy mTimeTickHandler; @Nullable @Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy mLeakReportEmail; + @Inject @Main Lazy mMainExecutor; + @Inject @Background Lazy mBackgroundExecutor; @Inject Lazy mClockManager; @Inject Lazy mActivityManagerWrapper; @Inject Lazy mDevicePolicyManagerWrapper; @@ -337,6 +360,8 @@ public class Dependency { mProviders.put(BG_LOOPER, mBgLooper::get); mProviders.put(MAIN_LOOPER, mMainLooper::get); mProviders.put(MAIN_HANDLER, mMainHandler::get); + mProviders.put(MAIN_EXECUTOR, mMainExecutor::get); + mProviders.put(BACKGROUND_EXECUTOR, mBackgroundExecutor::get); mProviders.put(ActivityStarter.class, mActivityStarter::get); mProviders.put(BroadcastDispatcher.class, mBroadcastDispatcher::get); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index b47c59acb82d..0a366c9bb380 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -85,8 +85,6 @@ import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; -import java.util.concurrent.Executor; - /** * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status * text. @@ -561,7 +559,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } }; if (!mKeyguardStateController.canDismissLockScreen()) { - Dependency.get(Executor.class).execute(runnable); + Dependency.get(Dependency.BACKGROUND_EXECUTOR).execute(runnable); } else { boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr) && Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0; -- cgit v1.2.3-59-g8ed1b