diff options
author | Preeti Ahuja <preetia@codeaurora.org> | 2013-10-01 18:20:56 -0700 |
---|---|---|
committer | Amit Mahajan <amitmahajan@google.com> | 2015-09-01 17:18:08 -0700 |
commit | a7cdca2272caa61ca36301320ec72fae0d16f6d2 (patch) | |
tree | 4ae8c683330e093fadb9b395b8f9553f20452a84 /src | |
parent | f67c36432c23546b6005348075f0056c884d1b50 (diff) | |
download | Stk-a7cdca2272caa61ca36301320ec72fae0d16f6d2.tar.gz |
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.
BUG=22637280
Change-Id: I44cc1736da3f962cc5a6d7afd7b7f84d845fdb25
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/stk/StkAppService.java | 63 |
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: |