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

Commit 62e835d6 authored by Amit Mahajan's avatar Amit Mahajan Committed by android-build-merger
Browse files

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

am: 2cd19833

Change-Id: I541fc4348cc34c5e1010561ff0387ae13eadc119
parents ea050038 2cd19833
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -1685,11 +1685,16 @@ public abstract class InboundSmsHandler extends StateMachine {
        @Override
        @Override
        public void onReceive(Context context, Intent intent) {
        public void onReceive(Context context, Intent intent) {
            if (ACTION_OPEN_SMS_APP.equals(intent.getAction())) {
            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(
                    context.startActivity(context.getPackageManager().getLaunchIntentForPackage(
                            Telephony.Sms.getDefaultSmsPackage(context)));
                            Telephony.Sms.getDefaultSmsPackage(context)));
                }
                }
            }
            }
        }
        }
    }


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