diff options
author | Cory Fields <foss@atlastechnologiesinc.com> | 2013-03-05 01:13:31 -0800 |
---|---|---|
committer | Cory Fields <foss@atlastechnologiesinc.com> | 2013-03-05 01:13:31 -0800 |
commit | af0c7815895418caa62d44c9b07aa06f4e48cf01 (patch) | |
tree | f0a8e2876d3f88694e0213b711605dc608ae198c | |
parent | 95e441c36b4915406cd6066c22be76a3cfeca1f8 (diff) | |
parent | 46d19ad6ded8559af9d398061666184d6947b177 (diff) |
Merge pull request #2322 from theuni/android-app-builtin
droid: add builtin for executing android apps via applicationmanager
-rw-r--r-- | xbmc/ApplicationMessenger.cpp | 23 | ||||
-rw-r--r-- | xbmc/ApplicationMessenger.h | 2 | ||||
-rw-r--r-- | xbmc/interfaces/Builtins.cpp | 7 |
3 files changed, 32 insertions, 0 deletions
diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp index 0350b0379b..08841e4508 100644 --- a/xbmc/ApplicationMessenger.cpp +++ b/xbmc/ApplicationMessenger.cpp @@ -65,6 +65,9 @@ #include "windows/GUIWindowLoginScreen.h" #include "utils/GlobalsHandling.h" +#if defined(TARGET_ANDROID) + #include "xbmc/android/activity/XBMCApp.h" +#endif using namespace PVR; using namespace std; @@ -805,6 +808,19 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg) CGUIWindowLoginScreen::LoadProfile(pMsg->dwParam1); break; } + case TMSG_START_ANDROID_ACTIVITY: + { +#if defined(TARGET_ANDROID) + if (pMsg->params.size()) + { + CXBMCApp::StartActivity(pMsg->params[0], + pMsg->params.size() > 1 ? pMsg->params[1] : "", + pMsg->params.size() > 2 ? pMsg->params[2] : "", + pMsg->params.size() > 3 ? pMsg->params[3] : ""); + } +#endif + break; + } } } @@ -1290,3 +1306,10 @@ void CApplicationMessenger::LoadProfile(unsigned int idx) tMsg.dwParam1 = idx; SendMessage(tMsg, false); } + +void CApplicationMessenger::StartAndroidActivity(const vector<CStdString> ¶ms) +{ + ThreadMessage tMsg = {TMSG_START_ANDROID_ACTIVITY}; + tMsg.params = params; + SendMessage(tMsg, false); +} diff --git a/xbmc/ApplicationMessenger.h b/xbmc/ApplicationMessenger.h index 66952f8b2e..bf167c2a18 100644 --- a/xbmc/ApplicationMessenger.h +++ b/xbmc/ApplicationMessenger.h @@ -101,6 +101,7 @@ namespace MUSIC_INFO #define TMSG_GUI_INFOBOOL 609 #define TMSG_GUI_ADDON_DIALOG 610 #define TMSG_GUI_MESSAGE 611 +#define TMSG_START_ANDROID_ACTIVITY 612 #define TMSG_CALLBACK 800 @@ -241,6 +242,7 @@ public: bool SetupDisplay(); bool DestroyDisplay(); + void StartAndroidActivity(const std::vector<CStdString> ¶ms); virtual ~CApplicationMessenger(); private: diff --git a/xbmc/interfaces/Builtins.cpp b/xbmc/interfaces/Builtins.cpp index 3903c90c09..8e9b04f279 100644 --- a/xbmc/interfaces/Builtins.cpp +++ b/xbmc/interfaces/Builtins.cpp @@ -211,6 +211,9 @@ const BUILT_IN commands[] = { { "ToggleDebug", false, "Enables/disables debug mode" }, { "StartPVRManager", false, "(Re)Starts the PVR manager" }, { "StopPVRManager", false, "Stops the PVR manager" }, +#if defined(TARGET_ANDROID) + { "StartAndroidActivity", true, "Launch an Android native app with the given package name. Optional parms (in order): intent, dataType, dataURI." }, +#endif }; bool CBuiltins::HasCommand(const CStdString& execString) @@ -1624,6 +1627,10 @@ int CBuiltins::Execute(const CStdString& execString) { g_application.StopPVRManager(); } + else if (execute.Equals("StartAndroidActivity") && params.size() > 0) + { + CApplicationMessenger::Get().StartAndroidActivity(params); + } else return -1; return 0; |