Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +19 −0 Original line number Diff line number Diff line Loading @@ -2216,4 +2216,23 @@ public abstract class BaseStatusBar extends SystemUI implements mAssistManager.startAssist(args); } } public boolean isCameraAllowedByAdmin() { if (mDevicePolicyManager.getCameraDisabled(null, mCurrentUserId)) { return false; } else if (isKeyguardShowing() && isKeyguardSecure()) { // Check if the admin has disabled the camera specifically for the keyguard return (mDevicePolicyManager.getKeyguardDisabledFeatures(null, mCurrentUserId) & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) == 0; } return true; } public boolean isKeyguardShowing() { if (mStatusBarKeyguardViewManager == null) { Slog.i(TAG, "isKeyguardShowing() called before startKeyguard(), returning true"); return true; } return mStatusBarKeyguardViewManager.isShowing(); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +4 −19 Original line number Diff line number Diff line Loading @@ -284,7 +284,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return; } ResolveInfo resolved = resolveCameraIntent(); boolean visible = !isCameraDisabledByDpm() && resolved != null boolean isCameraDisabled = (mPhoneStatusBar != null) && !mPhoneStatusBar.isCameraAllowedByAdmin(); boolean visible = !isCameraDisabled && resolved != null && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance) && mUserSetupComplete; mCameraImageView.setVisibility(visible ? View.VISIBLE : View.GONE); Loading Loading @@ -318,24 +321,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL && pm.resolveActivity(PHONE_INTENT, 0) != null; } private boolean isCameraDisabledByDpm() { final DevicePolicyManager dpm = (DevicePolicyManager) getContext().getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm != null && mPhoneStatusBar != null) { try { final int userId = ActivityManagerNative.getDefault().getCurrentUser().id; final int disabledFlags = dpm.getKeyguardDisabledFeatures(null, userId); final boolean disabledBecauseKeyguardSecure = (disabledFlags & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0 && mPhoneStatusBar.isKeyguardSecure(); return dpm.getCameraDisabled(null) || disabledBecauseKeyguardSecure; } catch (RemoteException e) { Log.e(TAG, "Can't get userId", e); } } return false; } private void watchForCameraPolicyChanges() { final IntentFilter filter = new IntentFilter(); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.util.MathUtils; import android.util.EventLog; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; Loading Loading @@ -2433,6 +2434,10 @@ public class NotificationPanelView extends PanelView implements * @param keyguardIsShowing whether keyguard is being shown */ public boolean canCameraGestureBeLaunched(boolean keyguardIsShowing) { if (!mStatusBar.isCameraAllowedByAdmin()) { EventLog.writeEvent(0x534e4554, "63787722", -1, ""); return false; } ResolveInfo resolveInfo = mKeyguardBottomArea.resolveCameraIntent(); String packageToLaunch = (resolveInfo == null || resolveInfo.activityInfo == null) ? null : resolveInfo.activityInfo.packageName; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +19 −0 Original line number Diff line number Diff line Loading @@ -2216,4 +2216,23 @@ public abstract class BaseStatusBar extends SystemUI implements mAssistManager.startAssist(args); } } public boolean isCameraAllowedByAdmin() { if (mDevicePolicyManager.getCameraDisabled(null, mCurrentUserId)) { return false; } else if (isKeyguardShowing() && isKeyguardSecure()) { // Check if the admin has disabled the camera specifically for the keyguard return (mDevicePolicyManager.getKeyguardDisabledFeatures(null, mCurrentUserId) & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) == 0; } return true; } public boolean isKeyguardShowing() { if (mStatusBarKeyguardViewManager == null) { Slog.i(TAG, "isKeyguardShowing() called before startKeyguard(), returning true"); return true; } return mStatusBarKeyguardViewManager.isShowing(); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +4 −19 Original line number Diff line number Diff line Loading @@ -284,7 +284,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return; } ResolveInfo resolved = resolveCameraIntent(); boolean visible = !isCameraDisabledByDpm() && resolved != null boolean isCameraDisabled = (mPhoneStatusBar != null) && !mPhoneStatusBar.isCameraAllowedByAdmin(); boolean visible = !isCameraDisabled && resolved != null && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance) && mUserSetupComplete; mCameraImageView.setVisibility(visible ? View.VISIBLE : View.GONE); Loading Loading @@ -318,24 +321,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL && pm.resolveActivity(PHONE_INTENT, 0) != null; } private boolean isCameraDisabledByDpm() { final DevicePolicyManager dpm = (DevicePolicyManager) getContext().getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm != null && mPhoneStatusBar != null) { try { final int userId = ActivityManagerNative.getDefault().getCurrentUser().id; final int disabledFlags = dpm.getKeyguardDisabledFeatures(null, userId); final boolean disabledBecauseKeyguardSecure = (disabledFlags & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0 && mPhoneStatusBar.isKeyguardSecure(); return dpm.getCameraDisabled(null) || disabledBecauseKeyguardSecure; } catch (RemoteException e) { Log.e(TAG, "Can't get userId", e); } } return false; } private void watchForCameraPolicyChanges() { final IntentFilter filter = new IntentFilter(); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.util.MathUtils; import android.util.EventLog; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; Loading Loading @@ -2433,6 +2434,10 @@ public class NotificationPanelView extends PanelView implements * @param keyguardIsShowing whether keyguard is being shown */ public boolean canCameraGestureBeLaunched(boolean keyguardIsShowing) { if (!mStatusBar.isCameraAllowedByAdmin()) { EventLog.writeEvent(0x534e4554, "63787722", -1, ""); return false; } ResolveInfo resolveInfo = mKeyguardBottomArea.resolveCameraIntent(); String packageToLaunch = (resolveInfo == null || resolveInfo.activityInfo == null) ? null : resolveInfo.activityInfo.packageName; Loading