diff options
| author | 2019-05-20 15:59:48 -0700 | |
|---|---|---|
| committer | 2019-05-20 17:00:09 -0700 | |
| commit | 207e92db2df844e537101de761416635747ccf8e (patch) | |
| tree | a6226e947993a62df8600da4c2b59d483bea752c | |
| parent | 1cc5f3175f5de01140b12e5ed0c2ae54b3e2c2a5 (diff) | |
Prevent deadlock in AttentionManagerService
Bug: 133077390
Test: manually verified
Change-Id: I5548760fe8003c15612bebe275fd902fdafa21af
| -rw-r--r-- | services/core/java/com/android/server/attention/AttentionManagerService.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java index e14846863946..3b19d0875f5f 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 @@ public class AttentionManagerService extends SystemService { } @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 @@ public class AttentionManagerService extends SystemService { 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; } |