Merge "Merge "Prevent deadlock in AttentionManagerService" into qt-dev am: bcfa3c158e am: e19629a039" into qt-r1-dev-plus-aosp
am: 25b6bb5d00
Change-Id: Ibf27ae2cd548f99dc9b17b9483c13fa488b226b0
diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java
index e148468..3b19d08 100644
--- a/services/core/java/com/android/server/attention/AttentionManagerService.java
+++ b/services/core/java/com/android/server/attention/AttentionManagerService.java
@@ -116,6 +116,14 @@
}
@Override
+ public void onBootPhase(int phase) {
+ if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
+ mContext.registerReceiver(new ScreenStateReceiver(),
+ new IntentFilter(Intent.ACTION_SCREEN_OFF));
+ }
+ }
+
+ @Override
public void onStart() {
publishBinderService(Context.ATTENTION_SERVICE, new BinderService());
publishLocalService(AttentionManagerInternal.class, new LocalService());
@@ -135,10 +143,6 @@
private boolean isServiceAvailable() {
if (mComponentName == null) {
mComponentName = resolveAttentionService(mContext);
- if (mComponentName != null) {
- mContext.registerReceiver(new ScreenStateReceiver(),
- new IntentFilter(Intent.ACTION_SCREEN_OFF));
- }
}
return mComponentName != null;
}