diff options
| author | 2020-09-25 05:52:34 +0000 | |
|---|---|---|
| committer | 2020-09-25 05:52:34 +0000 | |
| commit | 5bbd3ef39dff99f9fa0289cf1c7d7eab32afb9ae (patch) | |
| tree | 1f4068480e2578dc5bc362d8cc376d673cd50694 | |
| parent | 177fb5371ab0b618ad7fce756b9a14e43d5c7763 (diff) | |
| parent | f3bcbd5bd2eeaaf5b166685d656e5da2066a3cff (diff) | |
Merge "Add Executors to Dependency" am: 40ecd434e4 am: 5565ad41ef am: b3af577b3d am: 47a73ac9ac am: f3bcbd5bd2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1437251
Change-Id: I0668fc6154541bdf36ab9005f606ec2a76858193
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/Dependency.java | 25 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/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 ed5fd009af79..f24644bfe312 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.wm.shell.common.DisplayController; import com.android.wm.shell.common.DisplayImeController; import com.android.wm.shell.common.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. @@ -199,6 +209,17 @@ public class Dependency { new DependencyKey<>(MAIN_HANDLER_NAME); /** + * Generic executor on the main thread. + */ + public static final DependencyKey<Executor> MAIN_EXECUTOR = + new DependencyKey<>(MAIN_EXECUTOR_NAME); + /** + * Generic executor on a background thread. + */ + public static final DependencyKey<Executor> BACKGROUND_EXECUTOR = + new DependencyKey<>(BACKGROUND_EXECUTOR_NAME); + + /** * An email address to send memory leak reports to by default. */ public static final DependencyKey<String> LEAK_REPORT_EMAIL = @@ -301,6 +322,8 @@ public class Dependency { @Inject @Named(TIME_TICK_HANDLER_NAME) Lazy<Handler> mTimeTickHandler; @Nullable @Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy<String> mLeakReportEmail; + @Inject @Main Lazy<Executor> mMainExecutor; + @Inject @Background Lazy<Executor> mBackgroundExecutor; @Inject Lazy<ClockManager> mClockManager; @Inject Lazy<ActivityManagerWrapper> mActivityManagerWrapper; @Inject Lazy<DevicePolicyManagerWrapper> mDevicePolicyManagerWrapper; @@ -336,6 +359,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; |