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

Commit 0e444d3a authored by João Assad's avatar João Assad Committed by Gerrit Code Review
Browse files

Framework: Option to not lock automatically when a call ends (1/2)

When a call ends while the screen is off the phone is automatically locked. This commit adds an option to disable this behavior.

Navigate to Phone->Settings and uncheck the option Lock when call ends under the advanced settings section.

Commit includes option in english and translation to portuguese.

Change-Id: Ib37d1be2e2238d822c1db2cfc6d23353588a6127
parent d14db203
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2237,6 +2237,12 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_VIBRATE_ENABLED = "lockscreen.vibrate_enabled";

        /**
         * Whether the screen will be locked if a call ends and the screen is off.
         * @hide
         */
        public static final String LOCKSCREEN_IF_CALL_ENDS_WITH_SCREENOFF = "lockscreen_if_call_ends_with_screenoff";

        /**
         * Stores values for custom lockscreen targets
         * @hide
+4 −1
Original line number Diff line number Diff line
@@ -872,11 +872,14 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                }
            } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) {
                mPhoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
                final ContentResolver cr = mContext.getContentResolver();

                synchronized (KeyguardViewMediator.this) {
                    if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)  // call ending
                            && !mScreenOn                           // screen off
                            && mExternallyEnabled) {                // not disabled by any app
                            && mExternallyEnabled                   // not disabled by any app
                            && Settings.System.getInt(cr,
                                    Settings.System.LOCKSCREEN_IF_CALL_ENDS_WITH_SCREENOFF, 1) == 1) {

                        // note: this is a way to gracefully reenable the keyguard when the call
                        // ends and the screen is off without always reenabling the keyguard