Merge cherrypicks of ['googleplex-android-review.googlesource.com/35620473'] into 24Q3-platform-release.

Change-Id: Ibf32621c0e6a7fb8bef99adc493888151ad8aeaf
diff --git a/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java b/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java
index cb96c67..8264f6e 100644
--- a/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java
+++ b/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java
@@ -22,6 +22,7 @@
 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;
@@ -95,6 +96,7 @@
             UUID.fromString("c2b85688-516e-11ee-be56-0242ac120002");
     public static final String NPE_WHEN_CALLED_SEND_CMD_PARAMS_ERROR_MSG =
             "mCaller[RilMessageDecoder] is Null when called SendCmdParams";
+    private Context mContext;
     /**
      * Returns a singleton instance of CommandParamsFactory
      * @param caller Class used for queuing raw ril messages, decoding them into
@@ -116,6 +118,7 @@
 
     private CommandParamsFactory(RilMessageDecoder caller, IccFileHandler fh, Context context) {
         mCaller = caller;
+        mContext = context;
         mIconLoader = IconLoader.getInstance(this, fh);
         try {
             mNoAlphaUsrCnf = context.getResources().getBoolean(
@@ -888,7 +891,12 @@
      */
     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();
diff --git a/src/java/com/android/internal/telephony/cat/ResultException.java b/src/java/com/android/internal/telephony/cat/ResultException.java
index 0de9ffe..a0f1406 100644
--- a/src/java/com/android/internal/telephony/cat/ResultException.java
+++ b/src/java/com/android/internal/telephony/cat/ResultException.java
@@ -34,13 +34,12 @@
     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