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

Commit 40ecd434 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add Executors to Dependency"

parents 7ffd615b 36cbc4ac
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -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<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.
     */
@@ -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;
@@ -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);

+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;