Bug 590225 - webapps OS level integration for Android a=blocking-fennec, r=mwu,vladimir, blassey

This commit is contained in:
Fabrice Desré
2010-10-15 14:16:45 -04:00
parent 1d4a158037
commit 83cb5d5e9a
14 changed files with 338 additions and 4 deletions

View File

@@ -363,6 +363,26 @@ class GeckoAppShell
Log.i("GeckoAppJava", "scheduling restart");
gRestartScheduled = true;
}
// "Installs" an application by creating a shortcut
static void installWebApplication(String aURI, String aTitle, String aIconData) {
Log.w("GeckoAppJava", "installWebApplication for " + aURI + " [" + aTitle + "]");
// the intent to be launched by the shortcut
Intent shortcutIntent = new Intent("org.mozilla.fennec.WEBAPP");
shortcutIntent.setClassName(GeckoApp.mAppContext,
"org.mozilla." + GeckoApp.mAppContext.getAppName() + ".App");
shortcutIntent.putExtra("args", "--webapp=" + aURI);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aTitle);
byte[] raw = Base64.decode(aIconData.substring(22), Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(raw, 0, raw.length);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
GeckoApp.mAppContext.sendBroadcast(intent);
}
static String[] getHandlersForMimeType(String aMimeType, String aAction) {
Intent intent = getIntentForActionString(aAction);