summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-09-14 22:19:26 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-09-14 22:19:26 +0000
commitcac6285b48e88e118f69992d5c97d56163b6274c (patch)
tree1b0da552914d9e5a9e3cfd0c32cfb84313231aa0
parent8e07ad473e0a63af1a5bfd7b172b00f17318a24c (diff)
parent3d98aa4a186554322e024b4f329666db43666c9b (diff)
downloadbase-marshmallow-mr2-release.tar.gz
Merge cherrypicks of [2903504, 2902882, 2902883, 2903505, 2903506, 2902675, 2902677, 2902679, 2902681, 2902682, 2902683, 2902684, 2902685, 2902687, 2903524, 2902884, 2903525] into mnc-mr2-releaseandroid-6.0.1_r81marshmallow-mr2-release
Change-Id: Ie5c3f23f74525374a14388c155c9551b2499291f
-rw-r--r--core/java/android/service/gatekeeper/GateKeeperResponse.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java5
4 files changed, 30 insertions, 19 deletions
diff --git a/core/java/android/service/gatekeeper/GateKeeperResponse.java b/core/java/android/service/gatekeeper/GateKeeperResponse.java
index a512957d6040..6ca6d8ac7100 100644
--- a/core/java/android/service/gatekeeper/GateKeeperResponse.java
+++ b/core/java/android/service/gatekeeper/GateKeeperResponse.java
@@ -85,6 +85,8 @@ public final class GateKeeperResponse implements Parcelable {
if (mPayload != null) {
dest.writeInt(mPayload.length);
dest.writeByteArray(mPayload);
+ } else {
+ dest.writeInt(0);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 9ff86ebf88aa..6aa805757d04 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -2215,4 +2215,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();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 14176a6f5b3c..bf7e83ac07cb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -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);
@@ -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);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index bdd2c73bd674..c4aee64957a4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -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;
@@ -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;