diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 360a9da50fde..9f3df5625a58 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -705,6 +705,8 @@ ANDROID_SDK = @ANDROID_SDK@ ANDROID_TOOLS = @ANDROID_TOOLS@ ANDROID_VERSION = @ANDROID_VERSION@ +ANDROID_PACKAGE_NAME = @ANDROID_PACKAGE_NAME@ + JS_SHARED_LIBRARY = @JS_SHARED_LIBRARY@ # We only want to do the pymake sanity on Windows, other os's can cope diff --git a/configure.in b/configure.in index 976157f570b1..0caf9c1ac943 100644 --- a/configure.in +++ b/configure.in @@ -330,6 +330,9 @@ if test "$target" = "arm-android-eabi" ; then ANDROID_SDK="${android_sdk}" ANDROID_TOOLS="${android_tools}" ANDROID_VERSION="${android_version}" + if test -z "$ANDROID_PACKAGE_NAME" ; then + ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)' + fi AC_DEFINE(ANDROID) AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version) @@ -344,6 +347,7 @@ AC_SUBST(ANDROID_TOOLCHAIN) AC_SUBST(ANDROID_PLATFORM) AC_SUBST(ANDROID_SDK) AC_SUBST(ANDROID_TOOLS) +AC_SUBST(ANDROID_PACKAGE_NAME) dnl ======================================================== dnl Checks for compilers. diff --git a/embedding/android/AlertNotification.java b/embedding/android/AlertNotification.java index 16ccbf5fd55b..cde9a1c510ef 100644 --- a/embedding/android/AlertNotification.java +++ b/embedding/android/AlertNotification.java @@ -82,7 +82,7 @@ public void updateProgress(String aAlertText, long aProgress, long aProgressMax) // Custom view int layout = aAlertText.length() > 0 ? R.layout.notification_progress_text : R.layout.notification_progress; - RemoteViews view = new RemoteViews("org.mozilla." + GeckoApp.mAppContext.getAppName(), layout); + RemoteViews view = new RemoteViews(GeckoApp.mAppContext.getPackageName(), layout); view.setImageViewResource(R.id.notificationImage, mIcon); view.setTextViewText(R.id.notificationTitle, mTitle); contentView = view; diff --git a/embedding/android/AndroidManifest.xml.in b/embedding/android/AndroidManifest.xml.in index 17d0f732330b..a6fb6a28d3c0 100644 --- a/embedding/android/AndroidManifest.xml.in +++ b/embedding/android/AndroidManifest.xml.in @@ -1,7 +1,7 @@ #filter substitution - diff --git a/embedding/android/App.java.in b/embedding/android/App.java.in index 88d207de8242..6512b4f966b8 100644 --- a/embedding/android/App.java.in +++ b/embedding/android/App.java.in @@ -36,13 +36,13 @@ * ***** END LICENSE BLOCK ***** */ #filter substitution -package org.mozilla.@MOZ_APP_NAME@; +package @ANDROID_PACKAGE_NAME@; import org.mozilla.gecko.GeckoApp; public class App extends GeckoApp { - public String getAppName() { - return "@MOZ_APP_NAME@"; + public String getPackageName() { + return "@ANDROID_PACKAGE_NAME@"; } public String getContentProcessName() { return "@MOZ_CHILD_PROCESS_NAME@"; diff --git a/embedding/android/CrashReporter.java.in b/embedding/android/CrashReporter.java.in index cd46e380749b..cdd6854e17bb 100644 --- a/embedding/android/CrashReporter.java.in +++ b/embedding/android/CrashReporter.java.in @@ -36,7 +36,7 @@ * ***** END LICENSE BLOCK ***** */ #filter substitution -package org.mozilla.@MOZ_APP_NAME@; +package @ANDROID_PACKAGE_NAME@; import android.app.*; @@ -108,7 +108,7 @@ public class CrashReporter extends Activity String passedMinidumpPath = getIntent().getStringExtra("minidumpPath"); File passedMinidumpFile = new File(passedMinidumpPath); File pendingDir = - new File("/data/data/org.mozilla.@MOZ_APP_NAME@/mozilla/Crash Reports/pending"); + new File("/data/data/@ANDROID_PACKAGE_NAME@/mozilla/Crash Reports/pending"); pendingDir.mkdirs(); mPendingMinidumpFile = new File(pendingDir, passedMinidumpFile.getName()); moveFile(passedMinidumpFile, mPendingMinidumpFile); @@ -275,7 +275,7 @@ public class CrashReporter extends Activity if (conn.getResponseCode() == conn.HTTP_OK) { File submittedDir = new File( - "/data/data/org.mozilla.@MOZ_APP_NAME@/mozilla/Crash Reports/submitted"); + "/data/data/@ANDROID_PACKAGE_NAME@/mozilla/Crash Reports/submitted"); submittedDir.mkdirs(); minidumpFile.delete(); extrasFile.delete(); @@ -298,8 +298,8 @@ public class CrashReporter extends Activity try { String action = "android.intent.action.MAIN"; Intent intent = new Intent(action); - intent.setClassName("org.mozilla.@MOZ_APP_NAME@", - "org.mozilla.@MOZ_APP_NAME@.App"); + intent.setClassName("@ANDROID_PACKAGE_NAME@", + "@ANDROID_PACKAGE_NAME@.App"); Log.i("GeckoCrashReporter", intent.toString()); startActivity(intent); } catch (Exception e) { diff --git a/embedding/android/GeckoApp.java b/embedding/android/GeckoApp.java index 460f8d3694e5..07caecdf7ba8 100644 --- a/embedding/android/GeckoApp.java +++ b/embedding/android/GeckoApp.java @@ -409,7 +409,7 @@ public boolean onKeyLongPress(int keyCode, KeyEvent event) { return false; } - abstract public String getAppName(); + abstract public String getPackageName(); abstract public String getContentProcessName(); protected void unpackComponents() @@ -418,7 +418,7 @@ protected void unpackComponents() ZipFile zip; InputStream listStream; - File componentsDir = new File("/data/data/org.mozilla." + getAppName() + + File componentsDir = new File("/data/data/" + getPackageName() + "/components"); componentsDir.mkdir(); zip = new ZipFile(getApplication().getPackageResourcePath()); @@ -451,7 +451,7 @@ private void unpackFile(ZipFile zip, byte[] buf, ZipEntry fileEntry, throw new FileNotFoundException("Can't find " + name + " in " + zip.getName()); - File outFile = new File("/data/data/org.mozilla." + getAppName() + + File outFile = new File("/data/data/" + getPackageName() + "/" + name); if (outFile.exists() && outFile.lastModified() == fileEntry.getTime() && @@ -493,10 +493,10 @@ public void addEnvToIntent(Intent intent) { public void doRestart() { try { - String action = "org.mozilla.gecko.restart" + getAppName(); + String action = "org.mozilla.gecko.restart"; Intent intent = new Intent(action); - intent.setClassName("org.mozilla." + getAppName(), - "org.mozilla." + getAppName() + ".Restarter"); + intent.setClassName(getPackageName(), + getPackageName() + ".Restarter"); addEnvToIntent(intent); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); @@ -530,7 +530,7 @@ private void checkAndLaunchUpdate() { Log.i("GeckoAppJava", "Update is available!"); // Launch APK - File updateFileToRun = new File(updateDir + getAppName() + "-update.apk"); + File updateFileToRun = new File(updateDir + getPackageName() + "-update.apk"); try { if (updateFile.renameTo(updateFileToRun)) { String amCmd = "/system/bin/am start -a android.intent.action.VIEW " + @@ -612,8 +612,8 @@ protected void onActivityResult(int requestCode, int resultCode, File.createTempFile("tmp_" + (int)Math.floor(1000 * Math.random()), fileExt, - new File("/data/data/org.mozilla." + - getAppName())); + new File("/data/data/" + + getPackageName())); FileOutputStream fos = new FileOutputStream(file); InputStream is = cr.openInputStream(uri); diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index a9483865bef3..fb5d86c94465 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -109,8 +109,8 @@ public static void loadGeckoLibs(String apkName) { Log.i("GeckoApp", "env"+ c +": "+ env); } - File f = new File("/data/data/org.mozilla." + - GeckoApp.mAppContext.getAppName() +"/tmp"); + File f = new File("/data/data/" + + GeckoApp.mAppContext.getPackageName() + "/tmp"); if (!f.exists()) f.mkdirs(); @@ -366,7 +366,7 @@ static void installWebApplication(String aURI, String aTitle, String aIconData) // 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"); + GeckoApp.mAppContext.getPackageName() + ".App"); shortcutIntent.putExtra("args", "--webapp=" + aURI); Intent intent = new Intent(); @@ -521,7 +521,7 @@ public static void showAlertNotification(String aImageUrl, String aAlertTitle, S // The intent to launch when the user clicks the expanded notification Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLICK); notificationIntent.setClassName(GeckoApp.mAppContext, - "org.mozilla." + GeckoApp.mAppContext.getAppName() + ".NotificationHandler"); + GeckoApp.mAppContext.getPackageName() + ".NotificationHandler"); // Put the strings into the intent as an URI "alert:#" Uri dataUri = Uri.fromParts("alert", aAlertName, aAlertCookie); @@ -533,7 +533,7 @@ public static void showAlertNotification(String aImageUrl, String aAlertTitle, S // The intent to execute when the status entry is deleted by the user with the "Clear All Notifications" button Intent clearNotificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLEAR); clearNotificationIntent.setClassName(GeckoApp.mAppContext, - "org.mozilla." + GeckoApp.mAppContext.getAppName() + ".NotificationHandler"); + GeckoApp.mAppContext.getPackageName() + ".NotificationHandler"); clearNotificationIntent.setData(dataUri); PendingIntent pendingClearIntent = PendingIntent.getActivity(GeckoApp.mAppContext, 0, clearNotificationIntent, 0); diff --git a/embedding/android/Makefile.in b/embedding/android/Makefile.in index 873d9193547d..76cfd7091743 100644 --- a/embedding/android/Makefile.in +++ b/embedding/android/Makefile.in @@ -66,6 +66,7 @@ MIN_CPU_VERSION=5 endif DEFINES += \ + -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \ -DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \ -DMOZ_APP_NAME=$(MOZ_APP_NAME) \ -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \ diff --git a/embedding/android/NotificationHandler.java.in b/embedding/android/NotificationHandler.java.in index 1e109e413476..d4b82ab26c1b 100644 --- a/embedding/android/NotificationHandler.java.in +++ b/embedding/android/NotificationHandler.java.in @@ -36,7 +36,7 @@ * ***** END LICENSE BLOCK ***** */ #filter substitution -package org.mozilla.@MOZ_APP_NAME@; +package @ANDROID_PACKAGE_NAME@; import android.app.Activity; import android.app.NotificationManager; diff --git a/other-licenses/android/APKOpen.cpp b/other-licenses/android/APKOpen.cpp index 7de334c6d630..d8ba93118137 100644 --- a/other-licenses/android/APKOpen.cpp +++ b/other-licenses/android/APKOpen.cpp @@ -439,7 +439,7 @@ static void * mozload(const char * path, void *zip, if (extractLibs) { char fullpath[256]; - snprintf(fullpath, 256, "/data/data/org.mozilla.fennec/%s", path + 4); + snprintf(fullpath, 256, "/data/data/" ANDROID_PACKAGE_NAME "/%s", path + 4); __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "resolved %s to %s", path, fullpath); extractFile(fullpath, entry, data); handle = __wrap_dlopen(fullpath, RTLD_LAZY); @@ -560,7 +560,7 @@ extern "C" void simple_linker_init(void); static void loadLibs(const char *apkName) { - chdir("/data/data/org.mozilla.fennec"); + chdir("/data/data/" ANDROID_PACKAGE_NAME); simple_linker_init(); diff --git a/other-licenses/android/Makefile.in b/other-licenses/android/Makefile.in index c5f75009d03c..392b1ddfa455 100644 --- a/other-licenses/android/Makefile.in +++ b/other-licenses/android/Makefile.in @@ -53,6 +53,7 @@ DEFINES += \ -DMOZ_LINKER \ -DLINKER_TEXT_BASE=0xB0001000 \ -DLINKER_AREA_SIZE=0x01000000 \ + -DANDROID_PACKAGE_NAME='"$(ANDROID_PACKAGE_NAME)"' \ $(NULL) CPPSRCS = \ diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in index 8813ec9b8870..a5e2bd4456d5 100644 --- a/toolkit/xre/Makefile.in +++ b/toolkit/xre/Makefile.in @@ -135,6 +135,7 @@ endif ifeq ($(OS_TARGET),Android) CPPSRCS += nsAndroidStartup.cpp +DEFINES += -DANDROID_PACKAGE_NAME='"$(ANDROID_PACKAGE_NAME)"' endif SHARED_LIBRARY_LIBS += ../profile/src/$(LIB_PREFIX)profile_s.$(LIB_SUFFIX) diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp index 5a8599bd241e..12c015d80ae6 100644 --- a/toolkit/xre/nsAndroidStartup.cpp +++ b/toolkit/xre/nsAndroidStartup.cpp @@ -94,7 +94,7 @@ GeckoStart(void *data) nsresult rv; nsCOMPtr appini; - rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/org.mozilla." MOZ_APP_NAME "/application.ini"), + rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/" ANDROID_PACKAGE_NAME "/application.ini"), PR_FALSE, getter_AddRefs(appini)); if (NS_FAILED(rv)) { @@ -105,12 +105,12 @@ GeckoStart(void *data) nsXREAppData *appData; rv = XRE_CreateAppData(appini, &appData); if (NS_FAILED(rv)) { - LOG("Failed to load application.ini from /data/data/org.mozilla." MOZ_APP_NAME "/application.ini\n"); + LOG("Failed to load application.ini from /data/data/" ANDROID_PACKAGE_NAME "/application.ini\n"); return 0; } nsCOMPtr xreDir; - rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/org.mozilla." MOZ_APP_NAME), + rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/" ANDROID_PACKAGE_NAME), PR_FALSE, getter_AddRefs(xreDir)); if (NS_FAILED(rv)) { diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index a701bbcc5a83..0b5f3b4b64d6 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -1104,7 +1104,7 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsILocalFile** aFile, PRBool aLocal) #elif defined(ANDROID) // used for setting the patch to our profile // XXX: investigate putting the profile somewhere else - const char* homeDir = "/data/data/org.mozilla." MOZ_APP_NAME; + const char* homeDir = "/data/data/" ANDROID_PACKAGE_NAME; rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), PR_TRUE, getter_AddRefs(localDir));