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

Commit f2d8e74c authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Suppress unlock noises while in-call.

Bug: 2458106
parent 43cfa0e2
Loading
Loading
Loading
Loading
+23 −14
Original line number Diff line number Diff line
@@ -225,6 +225,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,

    private boolean mScreenOn = false;

    // last known state of the cellular connection
    private String mPhoneState = TelephonyManager.EXTRA_STATE_IDLE;

    /**
     * we send this intent when the keyguard is dismissed.
     */
@@ -683,9 +686,10 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                if (mDelayedShowingSequence == sequence) {
                    doKeyguard();
                }
            } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)
                    && TelephonyManager.EXTRA_STATE_IDLE.equals(intent.getStringExtra(
                            TelephonyManager.EXTRA_STATE))  // call ending
            } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) {
                mPhoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);

                if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)  // call ending
                        && !mScreenOn                           // screen off
                        && mExternallyEnabled) {                // not disabled by any app

@@ -698,6 +702,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                    doKeyguard();
                }
            }
        }
    };


@@ -977,7 +982,11 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                return;
            }

            // only play "unlock" noises if not on a call (since the incall UI
            // disables the keyguard)
            if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) {
                playSounds(false);
            }

            mKeyguardViewManager.hide();
            mShowing = false;