diff options
| author | 2021-03-30 22:42:24 +0000 | |
|---|---|---|
| committer | 2021-03-30 22:42:24 +0000 | |
| commit | 4cad28d8fd1b52649c2a0400e2d005bf10071256 (patch) | |
| tree | 6704410fa96df754438e006a6214b7d5bd85f2ca | |
| parent | 7f6376818d01b53238653ecf27a54d562f8ce344 (diff) | |
| parent | c903ac37a5ffc5e0e848339ee427f97633d20a17 (diff) | |
Merge "Fail early in AttentionManagerService if camera lock is enabled" into sc-dev
| -rw-r--r-- | services/core/java/com/android/server/attention/AttentionManagerService.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java index 68cfc23699ce..f566080b3fca 100644 --- a/services/core/java/com/android/server/attention/AttentionManagerService.java +++ b/services/core/java/com/android/server/attention/AttentionManagerService.java @@ -38,6 +38,7 @@ import android.content.ServiceConnection; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; +import android.hardware.SensorPrivacyManager; import android.os.Binder; import android.os.Handler; import android.os.IBinder; @@ -115,6 +116,7 @@ public class AttentionManagerService extends SystemService { private static String sTestAttentionServicePackage; private final Context mContext; private final PowerManager mPowerManager; + private final SensorPrivacyManager mPrivacyManager; private final Object mLock; @GuardedBy("mLock") @VisibleForTesting @@ -146,6 +148,7 @@ public class AttentionManagerService extends SystemService { mPowerManager = powerManager; mLock = lock; mAttentionHandler = handler; + mPrivacyManager = SensorPrivacyManager.getInstance(context); } @Override @@ -249,6 +252,11 @@ public class AttentionManagerService extends SystemService { return false; } + if (mPrivacyManager.isSensorPrivacyEnabled(SensorPrivacyManager.Sensors.CAMERA)) { + Slog.w(LOG_TAG, "Camera is locked by a toggle."); + return false; + } + // don't allow attention check in screen off state if (!mPowerManager.isInteractive()) { return false; |