Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
add system property for disabling keyguard camera
Browse files Browse the repository at this point in the history
Change-Id: I0b65cac3c3d2fc495b339c34add742bd698b107c
  • Loading branch information
thestinger committed Feb 3, 2020
1 parent dea4697 commit 4e7178f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.MediaStore;
import android.service.media.CameraPrewarmService;
Expand Down Expand Up @@ -808,7 +809,7 @@ public IconState getIcon() {
boolean isCameraDisabled = (mStatusBar != null) && !mStatusBar.isCameraAllowedByAdmin();
mIconState.isVisible = !isCameraDisabled && resolved != null
&& getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance)
&& mUserSetupComplete;
&& mUserSetupComplete && SystemProperties.getBoolean("persist.keyguard.camera", true);
mIconState.drawable = mContext.getDrawable(R.drawable.ic_camera_alt_24dp);
mIconState.contentDescription =
mContext.getString(R.string.accessibility_camera_button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.android.server;

import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.Context;
Expand Down Expand Up @@ -407,6 +408,13 @@ public boolean interceptPowerKeyDown(KeyEvent event, boolean interactive,
boolean handleCameraGesture(boolean useWakelock, int source) {
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "GestureLauncher:handleCameraGesture");
try {
if (!SystemProperties.getBoolean("persist.keyguard.camera", true)) {
final KeyguardManager manager = (KeyguardManager) getContext().getSystemService(
Context.KEYGUARD_SERVICE);
if (manager.inKeyguardRestrictedInputMode()) {
return false;
}
}
boolean userSetupComplete = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
if (!userSetupComplete) {
Expand All @@ -422,7 +430,6 @@ boolean handleCameraGesture(boolean useWakelock, int source) {
"userSetupComplete = %s, performing camera gesture.",
userSetupComplete));
}

if (useWakelock) {
// Make sure we don't sleep too early
mWakeLock.acquire(500L);
Expand Down

0 comments on commit 4e7178f

Please sign in to comment.