Merge "Prevent deadlock in AttentionManagerService" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bcfa3c158e
@@ -115,6 +115,14 @@ public class AttentionManagerService extends SystemService {
|
|||||||
mAttentionHandler = handler;
|
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
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
publishBinderService(Context.ATTENTION_SERVICE, new BinderService());
|
publishBinderService(Context.ATTENTION_SERVICE, new BinderService());
|
||||||
@@ -135,10 +143,6 @@ public class AttentionManagerService extends SystemService {
|
|||||||
private boolean isServiceAvailable() {
|
private boolean isServiceAvailable() {
|
||||||
if (mComponentName == null) {
|
if (mComponentName == null) {
|
||||||
mComponentName = resolveAttentionService(mContext);
|
mComponentName = resolveAttentionService(mContext);
|
||||||
if (mComponentName != null) {
|
|
||||||
mContext.registerReceiver(new ScreenStateReceiver(),
|
|
||||||
new IntentFilter(Intent.ACTION_SCREEN_OFF));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return mComponentName != null;
|
return mComponentName != null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user