Merge "Add Executors to Dependency" am: 40ecd434e4 am: 5565ad41ef
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1437251 Change-Id: I458cb2d5130f949e5eab520b59c41f74495350ce
This commit is contained in:
@@ -126,6 +126,7 @@ import com.android.systemui.wm.DisplayController;
|
|||||||
import com.android.systemui.wm.DisplayImeController;
|
import com.android.systemui.wm.DisplayImeController;
|
||||||
import com.android.systemui.wm.SystemWindows;
|
import com.android.systemui.wm.SystemWindows;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -167,6 +168,15 @@ public class Dependency {
|
|||||||
* Generic handler on the main thread.
|
* Generic handler on the main thread.
|
||||||
*/
|
*/
|
||||||
private static final String MAIN_HANDLER_NAME = "main_handler";
|
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.
|
* 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 =
|
public static final DependencyKey<Handler> MAIN_HANDLER =
|
||||||
new DependencyKey<>(MAIN_HANDLER_NAME);
|
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.
|
* 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;
|
@Inject @Named(TIME_TICK_HANDLER_NAME) Lazy<Handler> mTimeTickHandler;
|
||||||
@Nullable
|
@Nullable
|
||||||
@Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy<String> mLeakReportEmail;
|
@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<ClockManager> mClockManager;
|
||||||
@Inject Lazy<ActivityManagerWrapper> mActivityManagerWrapper;
|
@Inject Lazy<ActivityManagerWrapper> mActivityManagerWrapper;
|
||||||
@Inject Lazy<DevicePolicyManagerWrapper> mDevicePolicyManagerWrapper;
|
@Inject Lazy<DevicePolicyManagerWrapper> mDevicePolicyManagerWrapper;
|
||||||
@@ -337,6 +360,8 @@ public class Dependency {
|
|||||||
mProviders.put(BG_LOOPER, mBgLooper::get);
|
mProviders.put(BG_LOOPER, mBgLooper::get);
|
||||||
mProviders.put(MAIN_LOOPER, mMainLooper::get);
|
mProviders.put(MAIN_LOOPER, mMainLooper::get);
|
||||||
mProviders.put(MAIN_HANDLER, mMainHandler::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(ActivityStarter.class, mActivityStarter::get);
|
||||||
mProviders.put(BroadcastDispatcher.class, mBroadcastDispatcher::get);
|
mProviders.put(BroadcastDispatcher.class, mBroadcastDispatcher::get);
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,6 @@ import com.android.systemui.statusbar.policy.PreviewInflater;
|
|||||||
import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory;
|
import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory;
|
||||||
import com.android.systemui.tuner.TunerService;
|
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
|
* Implementation for the bottom area of the Keyguard, including camera/phone affordance and status
|
||||||
* text.
|
* text.
|
||||||
@@ -561,7 +559,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!mKeyguardStateController.canDismissLockScreen()) {
|
if (!mKeyguardStateController.canDismissLockScreen()) {
|
||||||
Dependency.get(Executor.class).execute(runnable);
|
Dependency.get(Dependency.BACKGROUND_EXECUTOR).execute(runnable);
|
||||||
} else {
|
} else {
|
||||||
boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr)
|
boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr)
|
||||||
&& Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0;
|
&& Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user