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

Commit eeb3aaee authored by Les Prock's avatar Les Prock
Browse files

revert camera icon disable when Settings.System.LOCKSCREEN_MODLOCK_ENABLED was set to 1

Change-Id: I0f6e318c5da7b526e24f8c0c73102e3d7d826a46
parent b3426b64
Loading
Loading
Loading
Loading
+1 −57
Original line number Diff line number Diff line
@@ -117,9 +117,6 @@ public class NavigationBarView extends LinearLayout {
    // performs manual animation in sync with layout transitions
    private final NavTransitionListener mTransitionListener = new NavTransitionListener();

    private boolean mModLockDisabled = true;
    private SettingsObserver mObserver;

    private class NavTransitionListener implements TransitionListener {
        private boolean mBackTransitioning;
        private boolean mHomeAppearing;
@@ -248,8 +245,6 @@ public class NavigationBarView extends LinearLayout {
                new IntentFilter(NAVBAR_EDIT_ACTION), null, null);

        mLockUtils = new LockPatternUtils(context);

        mObserver = new SettingsObserver(new Handler());
    }

    private void watchForDevicePolicyChanges() {
@@ -514,7 +509,7 @@ public class NavigationBarView extends LinearLayout {
                && mLockUtils.getCameraEnabled();

        setVisibleOrGone(getSearchLight(), showSearch);
        setVisibleOrGone(getCameraButton(), showCamera && mModLockDisabled);
        setVisibleOrGone(getCameraButton(), showCamera);

        mBarTransitions.applyBackButtonQuiescentAlpha(mBarTransitions.getMode(), true /*animate*/);
    }
@@ -580,24 +575,6 @@ public class NavigationBarView extends LinearLayout {
        watchForAccessibilityChanges();
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();

        final Bundle keyguard_metadata = NavigationBarView
                    .getApplicationMetadata(mContext, "com.android.keyguard");
                if (null != keyguard_metadata &&
                    keyguard_metadata.getBoolean("com.cyanogenmod.keyguard", false)) {
                        mObserver.observe();
                }
    }

    @Override
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        mObserver.unobserve();
    }

    private void watchForAccessibilityChanges() {
        final AccessibilityManager am =
                (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
@@ -835,37 +812,4 @@ public class NavigationBarView extends LinearLayout {

        return null;
    }

    private class SettingsObserver extends ContentObserver {
        private boolean mObserving = false;

        SettingsObserver(Handler handler) {
            super(handler);
        }

        void observe() {
            mObserving = true;
            ContentResolver resolver = mContext.getContentResolver();
            resolver.registerContentObserver(
                Settings.System.getUriFor(Settings.System.LOCKSCREEN_MODLOCK_ENABLED),
                false, this);

            // intialize mModlockDisabled
            onChange(false);
        }

        void unobserve() {
            if (mObserving) {
                mContext.getContentResolver().unregisterContentObserver(this);
                mObserving = false;
            }
        }

        @Override
        public void onChange(boolean selfChange) {
            mModLockDisabled = Settings.System.getInt(mContext.getContentResolver(),
                    Settings.System.LOCKSCREEN_MODLOCK_ENABLED, 1) == 0;
            setDisabledFlags(mDisabledFlags, true /* force */);
        }
    }
}