Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

bug 620584 - add ANDROID_PACKAGE_NAME rather than hard code org.mozil…

…la.@MOZ_APP_NAME@ r=ted,blassy a=stuart

--HG--
branch : GECKO20b8_20101214_RELBRANCH
extra : transplant_source : %CD%DD%FC9%9D%F3X%EE%40%E6Z%FB0%7ED%83%AE%5C%AD%A6
  • Loading branch information...
commit 1de8b50df013d9482e368c464a943ff8562a8844 1 parent f305443
Michael Wu authored December 21, 2010
2  config/autoconf.mk.in
@@ -705,6 +705,8 @@ ANDROID_SDK       = @ANDROID_SDK@
705 705
 ANDROID_TOOLS     = @ANDROID_TOOLS@
706 706
 ANDROID_VERSION   = @ANDROID_VERSION@
707 707
 
  708
+ANDROID_PACKAGE_NAME = @ANDROID_PACKAGE_NAME@
  709
+
708 710
 JS_SHARED_LIBRARY = @JS_SHARED_LIBRARY@
709 711
 
710 712
 # We only want to do the pymake sanity on Windows, other os's can cope
4  configure.in
@@ -330,6 +330,9 @@ if test "$target" = "arm-android-eabi" ; then
330 330
     ANDROID_SDK="${android_sdk}"
331 331
     ANDROID_TOOLS="${android_tools}"
332 332
     ANDROID_VERSION="${android_version}"
  333
+    if test -z "$ANDROID_PACKAGE_NAME" ; then
  334
+        ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
  335
+    fi
333 336
 
334 337
     AC_DEFINE(ANDROID)
335 338
     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
@@ -344,6 +347,7 @@ AC_SUBST(ANDROID_TOOLCHAIN)
344 347
 AC_SUBST(ANDROID_PLATFORM)
345 348
 AC_SUBST(ANDROID_SDK)
346 349
 AC_SUBST(ANDROID_TOOLS)
  350
+AC_SUBST(ANDROID_PACKAGE_NAME)
347 351
 
348 352
 dnl ========================================================
349 353
 dnl Checks for compilers.
2  embedding/android/AlertNotification.java
@@ -82,7 +82,7 @@ public void updateProgress(String aAlertText, long aProgress, long aProgressMax)
82 82
             // Custom view
83 83
             int layout = aAlertText.length() > 0 ? R.layout.notification_progress_text : R.layout.notification_progress;
84 84
 
85  
-            RemoteViews view = new RemoteViews("org.mozilla." + GeckoApp.mAppContext.getAppName(), layout);
  85
+            RemoteViews view = new RemoteViews(GeckoApp.mAppContext.getPackageName(), layout);
86 86
             view.setImageViewResource(R.id.notificationImage, mIcon);
87 87
             view.setTextViewText(R.id.notificationTitle, mTitle);
88 88
             contentView = view;
4  embedding/android/AndroidManifest.xml.in
... ...
@@ -1,7 +1,7 @@
1 1
 #filter substitution
2 2
 <?xml version="1.0" encoding="utf-8"?>
3 3
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
4  
-      package="org.mozilla.@MOZ_APP_NAME@"
  4
+      package="@ANDROID_PACKAGE_NAME@"
5 5
       android:installLocation="auto"
6 6
       android:versionCode="1"
7 7
       android:versionName="@MOZ_APP_VERSION@"
@@ -76,7 +76,7 @@
76 76
         <activity android:name="Restarter"
77 77
                   android:theme="@android:style/Theme.Light.NoTitleBar">
78 78
           <intent-filter>
79  
-            <action android:name="org.mozilla.gecko.restart@MOZ_APP_NAME@" 
  79
+            <action android:name="org.mozilla.gecko.restart" 
80 80
 		    android:process="@MOZ_APP_NAME@Restarter"/>
81 81
           </intent-filter>
82 82
         </activity>
6  embedding/android/App.java.in
@@ -36,13 +36,13 @@
36 36
  * ***** END LICENSE BLOCK ***** */
37 37
 
38 38
 #filter substitution
39  
-package org.mozilla.@MOZ_APP_NAME@;
  39
+package @ANDROID_PACKAGE_NAME@;
40 40
 
41 41
 import org.mozilla.gecko.GeckoApp;
42 42
 
43 43
 public class App extends GeckoApp {
44  
-    public String getAppName() {
45  
-	return "@MOZ_APP_NAME@";
  44
+    public String getPackageName() {
  45
+	return "@ANDROID_PACKAGE_NAME@";
46 46
     }
47 47
     public String getContentProcessName() {
48 48
         return "@MOZ_CHILD_PROCESS_NAME@";
10  embedding/android/CrashReporter.java.in
@@ -36,7 +36,7 @@
36 36
  * ***** END LICENSE BLOCK ***** */
37 37
 
38 38
 #filter substitution
39  
-package org.mozilla.@MOZ_APP_NAME@;
  39
+package @ANDROID_PACKAGE_NAME@;
40 40
 
41 41
 
42 42
 import android.app.*;
@@ -108,7 +108,7 @@ public class CrashReporter extends Activity
108 108
     String passedMinidumpPath = getIntent().getStringExtra("minidumpPath");
109 109
     File passedMinidumpFile = new File(passedMinidumpPath);
110 110
     File pendingDir =
111  
-      new File("/data/data/org.mozilla.@MOZ_APP_NAME@/mozilla/Crash Reports/pending");
  111
+      new File("/data/data/@ANDROID_PACKAGE_NAME@/mozilla/Crash Reports/pending");
112 112
     pendingDir.mkdirs();
113 113
     mPendingMinidumpFile = new File(pendingDir, passedMinidumpFile.getName());
114 114
     moveFile(passedMinidumpFile, mPendingMinidumpFile);
@@ -275,7 +275,7 @@ public class CrashReporter extends Activity
275 275
 
276 276
       if (conn.getResponseCode() == conn.HTTP_OK) {
277 277
         File submittedDir = new File(
278  
-          "/data/data/org.mozilla.@MOZ_APP_NAME@/mozilla/Crash Reports/submitted");
  278
+          "/data/data/@ANDROID_PACKAGE_NAME@/mozilla/Crash Reports/submitted");
279 279
         submittedDir.mkdirs();
280 280
         minidumpFile.delete();
281 281
         extrasFile.delete();
@@ -298,8 +298,8 @@ public class CrashReporter extends Activity
298 298
     try {
299 299
       String action = "android.intent.action.MAIN";
300 300
       Intent intent = new Intent(action);
301  
-      intent.setClassName("org.mozilla.@MOZ_APP_NAME@",
302  
-                          "org.mozilla.@MOZ_APP_NAME@.App");
  301
+      intent.setClassName("@ANDROID_PACKAGE_NAME@",
  302
+                          "@ANDROID_PACKAGE_NAME@.App");
303 303
       Log.i("GeckoCrashReporter", intent.toString());
304 304
       startActivity(intent);
305 305
     } catch (Exception e) {
18  embedding/android/GeckoApp.java
@@ -409,7 +409,7 @@ public boolean onKeyLongPress(int keyCode, KeyEvent event) {
409 409
         return false;
410 410
     }
411 411
 
412  
-    abstract public String getAppName();
  412
+    abstract public String getPackageName();
413 413
     abstract public String getContentProcessName();
414 414
 
415 415
     protected void unpackComponents()
@@ -418,7 +418,7 @@ protected void unpackComponents()
418 418
         ZipFile zip;
419 419
         InputStream listStream;
420 420
 
421  
-        File componentsDir = new File("/data/data/org.mozilla." + getAppName() +
  421
+        File componentsDir = new File("/data/data/" + getPackageName() +
422 422
                                       "/components");
423 423
         componentsDir.mkdir();
424 424
         zip = new ZipFile(getApplication().getPackageResourcePath());
@@ -451,7 +451,7 @@ private void unpackFile(ZipFile zip, byte[] buf, ZipEntry fileEntry,
451 451
             throw new FileNotFoundException("Can't find " + name + " in " +
452 452
                                             zip.getName());
453 453
 
454  
-        File outFile = new File("/data/data/org.mozilla." + getAppName() +
  454
+        File outFile = new File("/data/data/" + getPackageName() +
455 455
                                 "/" + name);
456 456
         if (outFile.exists() &&
457 457
             outFile.lastModified() == fileEntry.getTime() &&
@@ -493,10 +493,10 @@ public void addEnvToIntent(Intent intent) {
493 493
 
494 494
     public void doRestart() {
495 495
         try {
496  
-            String action = "org.mozilla.gecko.restart" + getAppName();
  496
+            String action = "org.mozilla.gecko.restart";
497 497
             Intent intent = new Intent(action);
498  
-            intent.setClassName("org.mozilla." + getAppName(),
499  
-                                "org.mozilla." + getAppName() + ".Restarter");
  498
+            intent.setClassName(getPackageName(),
  499
+                                getPackageName() + ".Restarter");
500 500
             addEnvToIntent(intent);
501 501
             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
502 502
                             Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
@@ -530,7 +530,7 @@ private void checkAndLaunchUpdate() {
530 530
         Log.i("GeckoAppJava", "Update is available!");
531 531
 
532 532
         // Launch APK
533  
-        File updateFileToRun = new File(updateDir + getAppName() + "-update.apk");
  533
+        File updateFileToRun = new File(updateDir + getPackageName() + "-update.apk");
534 534
         try {
535 535
             if (updateFile.renameTo(updateFileToRun)) {
536 536
                 String amCmd = "/system/bin/am start -a android.intent.action.VIEW " +
@@ -612,8 +612,8 @@ protected void onActivityResult(int requestCode, int resultCode,
612 612
                     File.createTempFile("tmp_" + 
613 613
                                         (int)Math.floor(1000 * Math.random()), 
614 614
                                         fileExt, 
615  
-                                        new File("/data/data/org.mozilla." +
616  
-                                                 getAppName()));
  615
+                                        new File("/data/data/" +
  616
+                                                 getPackageName()));
617 617
                 
618 618
                 FileOutputStream fos = new FileOutputStream(file);
619 619
                 InputStream is = cr.openInputStream(uri);
10  embedding/android/GeckoAppShell.java
@@ -109,8 +109,8 @@ public static void loadGeckoLibs(String apkName) {
109 109
             Log.i("GeckoApp", "env"+ c +": "+ env);
110 110
         }
111 111
 
112  
-        File f = new File("/data/data/org.mozilla." + 
113  
-                          GeckoApp.mAppContext.getAppName() +"/tmp");
  112
+        File f = new File("/data/data/" + 
  113
+                          GeckoApp.mAppContext.getPackageName() + "/tmp");
114 114
         if (!f.exists())
115 115
             f.mkdirs();
116 116
 
@@ -366,7 +366,7 @@ static void installWebApplication(String aURI, String aTitle, String aIconData)
366 366
         // the intent to be launched by the shortcut
367 367
         Intent shortcutIntent = new Intent("org.mozilla.fennec.WEBAPP");
368 368
         shortcutIntent.setClassName(GeckoApp.mAppContext,
369  
-                                    "org.mozilla." + GeckoApp.mAppContext.getAppName() + ".App");
  369
+                                    GeckoApp.mAppContext.getPackageName() + ".App");
370 370
         shortcutIntent.putExtra("args", "--webapp=" + aURI);
371 371
         
372 372
         Intent intent = new Intent();
@@ -521,7 +521,7 @@ public static void showAlertNotification(String aImageUrl, String aAlertTitle, S
521 521
         // The intent to launch when the user clicks the expanded notification
522 522
         Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLICK);
523 523
         notificationIntent.setClassName(GeckoApp.mAppContext,
524  
-            "org.mozilla." + GeckoApp.mAppContext.getAppName() + ".NotificationHandler");
  524
+            GeckoApp.mAppContext.getPackageName() + ".NotificationHandler");
525 525
 
526 526
         // Put the strings into the intent as an URI "alert:<name>#<cookie>"
527 527
         Uri dataUri = Uri.fromParts("alert", aAlertName, aAlertCookie);
@@ -533,7 +533,7 @@ public static void showAlertNotification(String aImageUrl, String aAlertTitle, S
533 533
         // The intent to execute when the status entry is deleted by the user with the "Clear All Notifications" button
534 534
         Intent clearNotificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLEAR);
535 535
         clearNotificationIntent.setClassName(GeckoApp.mAppContext,
536  
-            "org.mozilla." + GeckoApp.mAppContext.getAppName() + ".NotificationHandler");
  536
+            GeckoApp.mAppContext.getPackageName() + ".NotificationHandler");
537 537
         clearNotificationIntent.setData(dataUri);
538 538
 
539 539
         PendingIntent pendingClearIntent = PendingIntent.getActivity(GeckoApp.mAppContext, 0, clearNotificationIntent, 0);
1  embedding/android/Makefile.in
@@ -66,6 +66,7 @@ MIN_CPU_VERSION=5
66 66
 endif
67 67
 
68 68
 DEFINES += \
  69
+  -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
69 70
   -DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
70 71
   -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
71 72
   -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
2  embedding/android/NotificationHandler.java.in
@@ -36,7 +36,7 @@
36 36
  * ***** END LICENSE BLOCK ***** */
37 37
 
38 38
 #filter substitution
39  
-package org.mozilla.@MOZ_APP_NAME@;
  39
+package @ANDROID_PACKAGE_NAME@;
40 40
 
41 41
 import android.app.Activity;
42 42
 import android.app.NotificationManager;
4  other-licenses/android/APKOpen.cpp
@@ -439,7 +439,7 @@ static void * mozload(const char * path, void *zip,
439 439
 
440 440
   if (extractLibs) {
441 441
     char fullpath[256];
442  
-    snprintf(fullpath, 256, "/data/data/org.mozilla.fennec/%s", path + 4);
  442
+    snprintf(fullpath, 256, "/data/data/" ANDROID_PACKAGE_NAME "/%s", path + 4);
443 443
     __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "resolved %s to %s", path, fullpath);
444 444
     extractFile(fullpath, entry, data);
445 445
     handle = __wrap_dlopen(fullpath, RTLD_LAZY);
@@ -560,7 +560,7 @@ extern "C" void simple_linker_init(void);
560 560
 static void
561 561
 loadLibs(const char *apkName)
562 562
 {
563  
-  chdir("/data/data/org.mozilla.fennec");
  563
+  chdir("/data/data/" ANDROID_PACKAGE_NAME);
564 564
 
565 565
   simple_linker_init();
566 566
 
1  other-licenses/android/Makefile.in
@@ -53,6 +53,7 @@ DEFINES += \
53 53
   -DMOZ_LINKER \
54 54
   -DLINKER_TEXT_BASE=0xB0001000 \
55 55
   -DLINKER_AREA_SIZE=0x01000000 \
  56
+  -DANDROID_PACKAGE_NAME='"$(ANDROID_PACKAGE_NAME)"' \
56 57
   $(NULL)
57 58
 
58 59
 CPPSRCS = \
1  toolkit/xre/Makefile.in
@@ -135,6 +135,7 @@ endif
135 135
 
136 136
 ifeq ($(OS_TARGET),Android)
137 137
 CPPSRCS += nsAndroidStartup.cpp
  138
+DEFINES += -DANDROID_PACKAGE_NAME='"$(ANDROID_PACKAGE_NAME)"'
138 139
 endif
139 140
 
140 141
 SHARED_LIBRARY_LIBS += ../profile/src/$(LIB_PREFIX)profile_s.$(LIB_SUFFIX)
6  toolkit/xre/nsAndroidStartup.cpp
@@ -94,7 +94,7 @@ GeckoStart(void *data)
94 94
 
95 95
     nsresult rv;
96 96
     nsCOMPtr<nsILocalFile> appini;
97  
-    rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/org.mozilla." MOZ_APP_NAME "/application.ini"),
  97
+    rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/" ANDROID_PACKAGE_NAME "/application.ini"),
98 98
                          PR_FALSE,
99 99
                          getter_AddRefs(appini));
100 100
     if (NS_FAILED(rv)) {
@@ -105,12 +105,12 @@ GeckoStart(void *data)
105 105
     nsXREAppData *appData;
106 106
     rv = XRE_CreateAppData(appini, &appData);
107 107
     if (NS_FAILED(rv)) {
108  
-        LOG("Failed to load application.ini from /data/data/org.mozilla." MOZ_APP_NAME "/application.ini\n");
  108
+        LOG("Failed to load application.ini from /data/data/" ANDROID_PACKAGE_NAME "/application.ini\n");
109 109
         return 0;
110 110
     }
111 111
 
112 112
     nsCOMPtr<nsILocalFile> xreDir;
113  
-    rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/org.mozilla." MOZ_APP_NAME),
  113
+    rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/data/" ANDROID_PACKAGE_NAME),
114 114
                          PR_FALSE,
115 115
                          getter_AddRefs(xreDir));
116 116
     if (NS_FAILED(rv)) {
2  toolkit/xre/nsXREDirProvider.cpp
@@ -1104,7 +1104,7 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsILocalFile** aFile, PRBool aLocal)
1104 1104
 #elif defined(ANDROID)
1105 1105
   // used for setting the patch to our profile
1106 1106
   // XXX: investigate putting the profile somewhere else
1107  
-  const char* homeDir = "/data/data/org.mozilla." MOZ_APP_NAME;
  1107
+  const char* homeDir = "/data/data/" ANDROID_PACKAGE_NAME;
1108 1108
 
1109 1109
   rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), PR_TRUE,
1110 1110
                              getter_AddRefs(localDir));

0 notes on commit 1de8b50

Please sign in to comment.
Something went wrong with that request. Please try again.