Bug 588607 - 2. Make the Java wrapper use the new library loader, r=blassey a=blocking-fennec
authorMichael Wu <mwu@mozilla.com>
Fri, 15 Oct 2010 11:28:03 -0700
changeset 55917 a6b6ebdd29a2
parent 55916 266535ecad79
child 55918 884b917c7628
push id16337
push usermwu@mozilla.com
push dateFri, 15 Oct 2010 23:41:19 +0000
treeherdermozilla-central@ab6d8c5a300a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, blocking-fennec
bugs588607
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 588607 - 2. Make the Java wrapper use the new library loader, r=blassey a=blocking-fennec
embedding/android/GeckoApp.java
embedding/android/GeckoAppShell.java
embedding/android/Makefile.in
toolkit/mozapps/installer/packager.mk
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -167,17 +167,17 @@ abstract public class GeckoApp
             if (!useLaunchButton)
                 mProgressDialog = 
                     ProgressDialog.show(GeckoApp.this, "",
                                         getString(R.string.splash_screen_label),
                                         true);
             // Load our JNI libs; we need to do this before launch() because
             // setInitialSize will be called even before Gecko is actually up
             // and running.
-            GeckoAppShell.loadGeckoLibs();
+            GeckoAppShell.loadGeckoLibs(getApplication().getPackageResourcePath());
 
             if (useLaunchButton) {
                 final Button b = new Button(this);
                 b.setText("Launch"); // don't need to localize
                 b.setOnClickListener(new Button.OnClickListener() {
                         public void onClick (View v) {
                             // hide the button so we can't be launched again
                             mainLayout.removeView(b);
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -92,69 +92,46 @@ class GeckoAppShell
     // helper methods
     public static native void setInitialSize(int width, int height);
     public static native void setSurfaceView(GeckoSurfaceView sv);
     public static native void putenv(String map);
     public static native void onResume();
     public static native void onLowMemory();
     public static native void callObserver(String observerKey, String topic, String data);
     public static native void removeObserver(String observerKey);
+    public static native void loadLibs(String apkName);
 
     // java-side stuff
-    public static void loadGeckoLibs() {
+    public static void loadGeckoLibs(String apkName) {
         // The package data lib directory isn't placed in ld.so's
         // search path, so we have to manually load libraries that
         // libxul will depend on.  Not ideal.
+        System.loadLibrary("mozutils");
 
-        // MozAlloc
-        System.loadLibrary("mozalloc");
-        System.loadLibrary("mozutils");
                 
         Intent i = GeckoApp.mAppContext.getIntent();
         String env = i.getStringExtra("env0");
         Log.i("GeckoApp", "env0: "+ env);
         for (int c = 1; env != null; c++) {
             GeckoAppShell.putenv(env);
             env = i.getStringExtra("env" + c);
             Log.i("GeckoApp", "env"+ c +": "+ env);
         }
 
         File f = new File("/data/data/org.mozilla." + 
                           GeckoApp.mAppContext.getAppName() +"/tmp");
         if (!f.exists())
             f.mkdirs();
+
         GeckoAppShell.putenv("TMPDIR=" + f.getPath());
 
         f = Environment.getDownloadCacheDirectory();
         GeckoAppShell.putenv("EXTERNAL_STORAGE" + f.getPath());
 
-        // NSPR
-        System.loadLibrary("nspr4");
-        System.loadLibrary("plc4");
-        System.loadLibrary("plds4");
-
-        // SQLite
-        System.loadLibrary("mozsqlite3");
-
-        // NSS
-        System.loadLibrary("nssutil3");
-        System.loadLibrary("nss3");
-        System.loadLibrary("ssl3");
-        System.loadLibrary("smime3");
-
-        // XUL
-        System.loadLibrary("xul");
-
-        // xpcom glue -- needed to load binary components
-        System.loadLibrary("xpcom");                                          
-
-        // Root certs. someday we may teach security/manager/ssl/src/nsNSSComponent.cpp to find ckbi itself
-        System.loadLibrary("nssckbi");
-        System.loadLibrary("freebl3");
-        System.loadLibrary("softokn3");
+        loadLibs(apkName);
     }
 
     public static void runGecko(String apkPath, String args, String url) {
         // run gecko -- it will spawn its own thread
         GeckoAppShell.nativeInit();
 
         // Tell Gecko where the target surface view is for rendering
         GeckoAppShell.setSurfaceView(GeckoApp.surfaceView);
--- a/embedding/android/Makefile.in
+++ b/embedding/android/Makefile.in
@@ -79,18 +79,16 @@ GARBAGE += \
   $(PROCESSEDJAVAFILES) \
   gecko.ap_  \
   res/values/strings.xml \
   R.java \
   $(NULL)
 
 GARBAGE_DIRS += classes
 
-DIRS = utils
-
 # Bug 567884 - Need a way to find appropriate icons during packaging
 ifeq ($(MOZ_APP_NAME),fennec)
 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
 else
 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
 endif
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -193,28 +193,30 @@ DIST_FILES += $(MOZ_CHILD_PROCESS_NAME)
 endif
 
 PKG_SUFFIX      = .apk
 INNER_MAKE_PACKAGE	= \
   rm -f $(_ABS_DIST)/gecko.ap_ && \
   ( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
     rm -rf lib && \
     mkdir -p lib/armeabi && \
-    cp lib*.so lib/armeabi && \
+    cp lib*.so lib && \
+    mv lib/libmozutils.so lib/armeabi && \
     $(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) ) && \
   rm -f $(_ABS_DIST)/gecko.apk && \
   $(APKBUILDER) $(_ABS_DIST)/gecko.apk -v $(APKBUILDER_FLAGS) -z $(_ABS_DIST)/gecko.ap_ -f $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/classes.dex && \
   cp $(_ABS_DIST)/gecko.apk $(_ABS_DIST)/gecko-unsigned-unaligned.apk && \
   $(JARSIGNER) $(_ABS_DIST)/gecko.apk && \
   $(ZIPALIGN) -f -v 4 $(_ABS_DIST)/gecko.apk $(PACKAGE)
 INNER_UNMAKE_PACKAGE	= \
   mkdir $(MOZ_PKG_DIR) && \
   cd $(MOZ_PKG_DIR) && \
   $(UNZIP) $(UNPACKAGE) && \
   mv lib/armeabi/*.so . && \
+  mv lib/*.so . && \
   rm -rf lib
 endif
 ifeq ($(MOZ_PKG_FORMAT),DMG)
 ifndef _APPNAME
 ifdef MOZ_DEBUG
 _APPNAME	= $(MOZ_APP_DISPLAYNAME)Debug.app
 else
 _APPNAME	= $(MOZ_APP_DISPLAYNAME).app