Fix adaptive_sleep resetting after reboot

When device is locked after reboot - packageManager cannot resolve
the service. Instead, rely on the configuration that is provided
at the sign time. SystemServer relies on this as well, so it is
consistent.

Bug: 151176054
Test: manually
Change-Id: Ifc1c078e3d774d63b8aeec2fe6b332305e47847b
This commit is contained in:
Alex Salo
2020-04-10 18:13:03 -07:00
parent 007b5f7e71
commit e0d25ed36f

View File

@@ -165,7 +165,7 @@ public class AttentionManagerService extends SystemService {
* Returns {@code true} if attention service is supported on this device.
*/
private boolean isAttentionServiceSupported() {
return isServiceEnabled() && isServiceAvailable();
return isServiceEnabled() && isServiceConfigured(mContext);
}
@VisibleForTesting
@@ -210,6 +210,11 @@ public class AttentionManagerService extends SystemService {
return false;
}
if (!isServiceAvailable()) {
Slog.w(LOG_TAG, "Service is not available at this moment.");
return false;
}
// don't allow attention check in screen off state
if (!mPowerManager.isInteractive()) {
return false;