Merge "Prevent deadlock in AttentionManagerService" into qt-dev am: bcfa3c158e

am: e19629a039

Change-Id: I38a0f74c7f9932995d896ae4bc6d663cd207d565
This commit is contained in:
Alex Salo
2019-05-22 04:29:39 -07:00
committed by android-build-merger

View File

@@ -115,6 +115,14 @@ public class AttentionManagerService extends SystemService {
mAttentionHandler = handler;
}
@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());
@@ -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;
}