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

Commit 73654b86 authored by arunvoddu's avatar arunvoddu Committed by mse1969
Browse files

[Telephony][Security Fix] Launch Browser only if device is unlocked.

Ignore the launch browser proactive cmd from modem to STK if the device screen is locked.

Bug: 404254549
Flag: EXEMPT Bugfix.
Test: Verified manually with TestApk
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dcf5c112a93dc8fcc67d65434707e205fd79cee2)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:caba6e5e5adf45c1ff85fb2fe4765a4118df3563
Merged-In: I9f651c7f1c5674df5774f5a7609f6d3749b5c50c
Change-Id: I9f651c7f1c5674df5774f5a7609f6d3749b5c50c
parent 19199e6d
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListCon
import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.LANGUAGE_SELECTION_EVENT;
import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.USER_ACTIVITY_EVENT;

import android.app.KeyguardManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.Resources.NotFoundException;
@@ -85,6 +86,7 @@ class CommandParamsFactory extends Handler {
    private static final int MAX_GSM7_DEFAULT_CHARS = 239;
    private static final int MAX_UCS2_CHARS = 118;

    private Context mContext;
    static synchronized CommandParamsFactory getInstance(RilMessageDecoder caller,
            IccFileHandler fh, Context context) {
        if (sInstance != null) {
@@ -98,6 +100,7 @@ class CommandParamsFactory extends Handler {

    private CommandParamsFactory(RilMessageDecoder caller, IccFileHandler fh, Context context) {
        mCaller = caller;
        mContext = context;
        mIconLoader = IconLoader.getInstance(this, fh);
        try {
            mNoAlphaUsrCnf = context.getResources().getBoolean(
@@ -796,7 +799,12 @@ class CommandParamsFactory extends Handler {
     */
    private boolean processLaunchBrowser(CommandDetails cmdDet,
            List<ComprehensionTlv> ctlvs) throws ResultException {

        KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class);
        if (keyguardManager != null && keyguardManager.isDeviceLocked()) {
            CatLog.d(this, "The device is locked, cannot launch the Browser");
            throw new ResultException(ResultCode.LAUNCH_BROWSER_ERROR,
                    "The device is locked, unable to process the command.");
        }
        CatLog.d(this, "process LaunchBrowser");

        TextMessage confirmMsg = new TextMessage();
+1 −2
Original line number Diff line number Diff line
@@ -33,13 +33,12 @@ public class ResultException extends CatException {
    public ResultException(ResultCode result) {
        super();

        // ETSI TS 102 223, 8.12 -- For the general results '20', '21', '26',
        // ETSI TS 102 223, 8.12 -- For the general results '20', '21',
        // '38', '39', '3A', '3C', and '3D', it is mandatory for the terminal
        // to provide a specific cause value as additional information.
        switch (result) {
            case TERMINAL_CRNTLY_UNABLE_TO_PROCESS:    // 0x20
            case NETWORK_CRNTLY_UNABLE_TO_PROCESS:     // 0x21
            case LAUNCH_BROWSER_ERROR:                 // 0x26
            case MULTI_CARDS_CMD_ERROR:                // 0x38
            case USIM_CALL_CONTROL_PERMANENT:          // 0x39
            case BIP_ERROR:                            // 0x3a