summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorSooraj Sasindran <sasindran@google.com>2016-10-12 16:28:25 -0700
committerSooraj Sasindran <sasindran@google.com>2016-10-14 15:58:30 -0700
commita8a184dbb8416d070720e18d42d8d5cf9f206a01 (patch)
treee9667c91750541c7b4b3f27e456ca885fad0a6bb /src/com/android
parent98f11ec49425614b7678b9d184c0e2a74ff28c7d (diff)
downloadStk-a8a184dbb8416d070720e18d42d8d5cf9f206a01.tar.gz
Introduce the config to disable LAUNCH_BROWSERnougat-mr1-dev
LAUNCH BROWSER STK command may need to be disabled if carrier would not want the default behavior. So introduce a carrierconfig key for the same. Test: Swapped the sprint sim cards and verified that browser launch do not happen Merged-in: Icf6d206af60b0c84dcacbd6bd3326140f5a0f21a BUG=31257758 Change-Id: Icf6d206af60b0c84dcacbd6bd3326140f5a0f21a
Diffstat (limited to 'src/com/android')
-rwxr-xr-xsrc/com/android/stk/StkAppService.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 8019a0c..6a3166c 100755
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -40,9 +40,11 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
+import android.os.PersistableBundle;
import android.os.PowerManager;
import android.os.SystemProperties;
import android.provider.Settings;
+import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.Gravity;
@@ -808,6 +810,28 @@ public class StkAppService extends Service implements Runnable {
return false;
}
+ /**
+ * Get the boolean config from carrier config manager.
+ *
+ * @param context the context to get carrier service
+ * @param key config key defined in CarrierConfigManager
+ * @return boolean value of corresponding key.
+ */
+ private static boolean getBooleanCarrierConfig(Context context, String key) {
+ CarrierConfigManager configManager = (CarrierConfigManager) context.getSystemService(
+ Context.CARRIER_CONFIG_SERVICE);
+ PersistableBundle b = null;
+ if (configManager != null) {
+ b = configManager.getConfig();
+ }
+ if (b != null) {
+ return b.getBoolean(key);
+ } else {
+ // Return static default defined in CarrierConfigManager.
+ return CarrierConfigManager.getDefaultConfig().getBoolean(key);
+ }
+ }
+
private void handleCmd(CatCmdMessage cmdMsg, int slotId) {
if (cmdMsg == null) {
@@ -918,6 +942,15 @@ public class StkAppService extends Service implements Runnable {
launchEventMessage(slotId);
break;
case LAUNCH_BROWSER:
+
+ /* Check if Carrier would not want to launch browser */
+ if (getBooleanCarrierConfig(mContext,
+ CarrierConfigManager.KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL)) {
+ CatLog.d(this, "Browser is not launched as per carrier.");
+ sendResponse(RES_ID_DONE, slotId, true);
+ break;
+ }
+
TextMessage alphaId = mStkContext[slotId].mCurrentCmd.geTextMessage();
if ((mStkContext[slotId].mCurrentCmd.getBrowserSettings().mode
== LaunchBrowserMode.LAUNCH_IF_NOT_ALREADY_LAUNCHED) &&