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

Commit c62d61cb authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Try to open default SMS app only if device is unlocked.

Test: manual
Bug: 115563714
Change-Id: I1513260cb71dd56b2589bb2e5bf1ce6da58beb91
parent c6645cd8
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1685,11 +1685,16 @@ public abstract class InboundSmsHandler extends StateMachine {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (ACTION_OPEN_SMS_APP.equals(intent.getAction())) {
                // do nothing if the user had not unlocked the device yet
                UserManager userManager =
                        (UserManager) context.getSystemService(Context.USER_SERVICE);
                if (!userManager.isUserUnlocked()) {
                    context.startActivity(context.getPackageManager().getLaunchIntentForPackage(
                            Telephony.Sms.getDefaultSmsPackage(context)));
                }
            }
        }
    }

    /**
     * Registers the broadcast receiver to launch the default SMS app when the user clicks the