Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3bcbd5b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add Executors to Dependency" am: 40ecd434 am: 5565ad41 am: b3af577b am: 47a73ac9

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1437251

Change-Id: Ieb63a9be346d1855e1f39c4a3f15ea969e6518dc
parents c9f2bbea 47a73ac9
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -127,6 +127,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;
@@ -168,6 +169,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 {
    public static final DependencyKey<Handler> MAIN_HANDLER =
            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.
     */
@@ -303,6 +324,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;
@@ -339,6 +362,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);

+1 −3
Original line number Diff line number Diff line
@@ -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;