Permalink
Browse files

Introduce the config to disable LAUNCH_BROWSER

am: a8a184d

Change-Id: I9ca355def685e111338abc82215ca1380d8bb262
  • Loading branch information...
Sooraj Sasindran android-build-merger
Sooraj Sasindran authored and android-build-merger committed Oct 15, 2016
2 parents bfb63c8 + a8a184d commit eac4e91fcfb7367346de957629d0a8b53f1d0b68
Showing with 33 additions and 0 deletions.
  1. +33 −0 src/com/android/stk/StkAppService.java
@@ -40,9 +40,11 @@
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 @@ private boolean isTopOfStack() {
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 @@ private void handleCmd(CatCmdMessage cmdMsg, int slotId) {
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) &&

0 comments on commit eac4e91

Please sign in to comment.