summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPreeti Ahuja <preetia@codeaurora.org>2015-09-02 01:10:58 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-09-02 01:10:58 +0000
commit241e5db41a11a0ff462f1c3717a7d314b6a8c5cf (patch)
treee1e24221b87cb96d08151a3d7d3ec74f76e0e7d4
parentfdc2de4bdcc687c776b4da40d68964444c6a30eb (diff)
parente6bb02b871fc833f399e50f7c83112117bc73bfb (diff)
downloadandroid_packages_apps_Stk-241e5db41a11a0ff462f1c3717a7d314b6a8c5cf.tar.gz
android_packages_apps_Stk-241e5db41a11a0ff462f1c3717a7d314b6a8c5cf.tar.bz2
android_packages_apps_Stk-241e5db41a11a0ff462f1c3717a7d314b6a8c5cf.zip
am e6bb02b8: am a7cdca22: Correct handling of Launch Browser command.
* commit 'e6bb02b871fc833f399e50f7c83112117bc73bfb': Correct handling of Launch Browser command.
-rw-r--r--src/com/android/stk/StkAppService.java63
1 files changed, 43 insertions, 20 deletions
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 937acec..7c85616 100644
--- 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,8 +41,10 @@ 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.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -77,6 +80,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 +253,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()+");
@@ -909,7 +916,22 @@ public class StkAppService extends Service implements Runnable {
launchEventMessage(slotId);
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) || TextUtils.isEmpty(alphaId.text))) {
+ // 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;
@@ -1442,30 +1464,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: