summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPreeti Ahuja <preetia@codeaurora.org>2013-10-01 18:20:56 -0700
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:29:32 -0600
commit22d9ad8b53ad9e8aae1acd9a568693437de5b401 (patch)
tree91e99d645f668f0ab0876a45d8272041672f89f5
parent7315e94eff1019d678b723d621dc407e2d3e12ab (diff)
downloadandroid_packages_apps_Stk-22d9ad8b53ad9e8aae1acd9a568693437de5b401.tar.gz
android_packages_apps_Stk-22d9ad8b53ad9e8aae1acd9a568693437de5b401.tar.bz2
android_packages_apps_Stk-22d9ad8b53ad9e8aae1acd9a568693437de5b401.zip
Correct handling of Launch Browser command.
1) Stk: Create STK Default Url via System Property - Create a default url, specific to the STK module that can be set via a system property. - This url will be used when processing a launch browser proactive command that contains no url data associated with it. 2) Stk: Update Launch Browser If Not Already Launched Behavior - Since the default browser supports tabs, it will never be considered unavailable. Thus, there is no need to send a terminal response with a browser unavailable result code. - Suppress user confirmation when the browser mode is launch if not already launched and the alphaid is null or contains no text. Change-Id: I44cc1736da3f962cc5a6d7afd7b7f84d845fdb25
-rwxr-xr-xsrc/com/android/stk/StkAppService.java62
1 files changed, 42 insertions, 20 deletions
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 76f08b7..4435eb5 100755
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -27,6 +27,7 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RecentTaskInfo;
import android.app.ActivityManager.RunningAppProcessInfo;
+import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -40,6 +41,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
+import android.os.SystemProperties;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.view.Gravity;
@@ -77,6 +79,7 @@ import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.cat.CatService;
+import java.util.Iterator;
import java.util.LinkedList;
import java.lang.System;
import java.util.List;
@@ -249,6 +252,9 @@ public class StkAppService extends Service implements Runnable {
}
}
+ // system property to set the STK specific default url for launch browser proactive cmds
+ private static final String STK_BROWSER_DEFAULT_URL_SYSPROP = "persist.radio.stk.default_url";
+
@Override
public void onCreate() {
CatLog.d(LOG_TAG, "onCreate()+");
@@ -920,7 +926,22 @@ public class StkAppService extends Service implements Runnable {
}
break;
case LAUNCH_BROWSER:
- launchConfirmationDialog(mStkContext[slotId].mCurrentCmd.geTextMessage(), slotId);
+ TextMessage alphaId = mStkContext[slotId].mCurrentCmd.geTextMessage();
+ if ((mStkContext[slotId].mCurrentCmd.getBrowserSettings().mode
+ == LaunchBrowserMode.LAUNCH_IF_NOT_ALREADY_LAUNCHED) &&
+ ((alphaId == null) || (alphaId.text == null) || (alphaId.text.length() == 0))) {
+ // don't need user confirmation in this case
+ // just launch the browser or spawn a new tab
+ CatLog.d(this, "Browser mode is: launch if not already launched " +
+ "and user confirmation is not currently needed.\n" +
+ "supressing confirmation dialogue and confirming silently...");
+ mStkContext[slotId].launchBrowser = true;
+ mStkContext[slotId].mBrowserSettings =
+ mStkContext[slotId].mCurrentCmd.getBrowserSettings();
+ sendResponse(RES_ID_CONFIRM, slotId, true);
+ } else {
+ launchConfirmationDialog(alphaId, slotId);
+ }
break;
case SET_UP_CALL:
TextMessage mesg = mStkContext[slotId].mCurrentCmd.getCallSettings().confirmMsg;
@@ -1453,30 +1474,31 @@ public class StkAppService extends Service implements Runnable {
return;
}
- Intent intent = null;
Uri data = null;
-
- if (settings.url != null) {
- CatLog.d(LOG_TAG, "settings.url = " + settings.url);
- if ((settings.url.startsWith("http://") || (settings.url.startsWith("https://")))) {
- data = Uri.parse(settings.url);
- } else {
- String modifiedUrl = "http://" + settings.url;
- CatLog.d(LOG_TAG, "modifiedUrl = " + modifiedUrl);
- data = Uri.parse(modifiedUrl);
- }
- }
- if (data != null) {
- intent = new Intent(Intent.ACTION_VIEW);
- intent.setData(data);
- } else {
+ String url;
+ if (settings.url == null) {
// if the command did not contain a URL,
// launch the browser to the default homepage.
- CatLog.d(LOG_TAG, "launch browser with default URL ");
- intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
- Intent.CATEGORY_APP_BROWSER);
+ CatLog.d(this, "no url data provided by proactive command." +
+ " launching browser with stk default URL ... ");
+ url = SystemProperties.get(STK_BROWSER_DEFAULT_URL_SYSPROP,
+ "http://www.google.com");
+ } else {
+ CatLog.d(this, "launch browser command has attached url = " + settings.url);
+ url = settings.url;
+ }
+
+ if (url.startsWith("http://") || url.startsWith("https://")) {
+ data = Uri.parse(url);
+ CatLog.d(this, "launching browser with url = " + url);
+ } else {
+ String modifiedUrl = "http://" + url;
+ data = Uri.parse(modifiedUrl);
+ CatLog.d(this, "launching browser with modified url = " + modifiedUrl);
}
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setData(data);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
switch (settings.mode) {
case USE_EXISTING_BROWSER: