Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77e01859 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Make the lock screen camera widget configurable (1/2)" into cm-11.0

parents a7e0e71c c7133ae6
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ public class LockPatternUtils {
    public final static String LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS
            = "lockscreen.power_button_instantly_locks";
    public final static String LOCKSCREEN_WIDGETS_ENABLED = "lockscreen.widgets_enabled";
    public final static String LOCKSCREEN_CAMERA_ENABLED = "lockscreen.camera_enabled";

    public final static String PASSWORD_HISTORY_KEY = "lockscreen.passwordhistory";

@@ -1431,6 +1432,22 @@ public class LockPatternUtils {
        setBoolean(LOCKSCREEN_WIDGETS_ENABLED, enabled, userId);
    }

    public boolean getCameraEnabled() {
        return getCameraEnabled(getCurrentOrCallingUserId());
    }

    public boolean getCameraEnabled(int userId) {
        return getBoolean(LOCKSCREEN_CAMERA_ENABLED, true, userId);
    }

    public void setCameraEnabled(boolean enabled) {
        setCameraEnabled(enabled, getCurrentOrCallingUserId());
    }

    public void setCameraEnabled(boolean enabled, int userId) {
        setBoolean(LOCKSCREEN_CAMERA_ENABLED, enabled, userId);
    }

    /**
     * @hide
     * Set the lock-before-unlock option (show widgets before the secure
+2 −1
Original line number Diff line number Diff line
@@ -476,7 +476,8 @@ public class KeyguardHostView extends KeyguardViewBase {

    private boolean cameraDisabledByDpm() {
        return mCameraDisabled
                || (mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0;
                || (mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0
                || !mLockPatternUtils.getCameraEnabled();
    }

    private void updateSecurityViews() {
+6 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import android.view.accessibility.AccessibilityManager.TouchExplorationStateChan
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.R;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.DelegateViewHelper;
@@ -73,6 +74,7 @@ public class NavigationBarView extends LinearLayout {
    private boolean mInEditMode;
    private NavbarEditor mEditBar;
    private NavBarReceiver mNavBarReceiver;
    private LockPatternUtils mLockUtils;
    private OnClickListener mRecentsClickListener;
    private OnTouchListener mRecentsPreloadListener;
    private OnTouchListener mHomeSearchActionListener;
@@ -232,6 +234,8 @@ public class NavigationBarView extends LinearLayout {
        mNavBarReceiver = new NavBarReceiver();
        mContext.registerReceiverAsUser(mNavBarReceiver, UserHandle.ALL,
                new IntentFilter(NAVBAR_EDIT_ACTION), null, null);

        mLockUtils = new LockPatternUtils(context);
    }

    private void watchForDevicePolicyChanges() {
@@ -469,7 +473,8 @@ public class NavigationBarView extends LinearLayout {
        setButtonWithTagVisibility(NavbarEditor.NAVBAR_SEARCH, !disableRecent);

        final boolean showSearch = disableHome && !disableSearch;
        final boolean showCamera = showSearch && !mCameraDisabledByDpm;
        final boolean showCamera = showSearch && !mCameraDisabledByDpm
                && mLockUtils.getCameraEnabled();
        setVisibleOrGone(getSearchLight(), showSearch);
        setVisibleOrGone(getCameraButton(), showCamera);