backout 1595af7124c3 and da61d0b35be3 (bug 709230) because it shouldn't have landed yet a=me
authorBrad Lassey <blassey@mozilla.com>
Mon, 06 Feb 2012 23:22:25 -0500
changeset 85342 1c0aba74d116362d84b18432c0cc584ee3eeafbf
parent 85341 ce224666955ca018408dc1ccb77cfa4911553a34
child 85343 ab1685df6e2f8ac03de24be1b71f7f6e3e5d9391
push id559
push userblassey@mozilla.com
push dateTue, 07 Feb 2012 04:23:02 +0000
treeherdermozilla-beta@1c0aba74d116 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs709230
milestone11.0
backs out1595af7124c35727e0322e3b7538926ed7efa5cd
backout 1595af7124c3 and da61d0b35be3 (bug 709230) because it shouldn't have landed yet a=me
config/android-common.mk
mobile/android/base/GeckoAppShell.java
mobile/android/base/Makefile.in
mobile/android/config/proguard.cfg
--- a/config/android-common.mk
+++ b/config/android-common.mk
@@ -43,17 +43,16 @@ endif
 
 ifndef JAVA_CLASSPATH
   $(error JAVA_CLASSPATH must be defined before including android-common.mk)
 endif
 
 DX=$(ANDROID_PLATFORM_TOOLS)/dx
 AAPT=$(ANDROID_PLATFORM_TOOLS)/aapt
 APKBUILDER=$(ANDROID_SDK)/../../tools/apkbuilder
-PROGUARD=java -jar $(ANDROID_SDK)/../../tools/proguard/lib/proguard.jar
 ZIPALIGN=$(ANDROID_SDK)/../../tools/zipalign
 
 ifdef JARSIGNER
   APKBUILDER_FLAGS += -u
 endif
 
 # For Android, this defaults to $(ANDROID_SDK)/android.jar
 ifndef JAVA_BOOTCLASSPATH
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -237,17 +237,17 @@ public class GeckoAppShell
                 }
             }
         } catch (Exception e) {
             Log.e(LOGTAG, "exception while stating cache dir: ", e);
         }
         return sFreeSpace;
     }
 
-    private static boolean moveFile(File inFile, File outFile)
+    static boolean moveFile(File inFile, File outFile)
     {
         Log.i(LOGTAG, "moving " + inFile + " to " + outFile);
         if (outFile.isDirectory())
             outFile = new File(outFile, inFile.getName());
         try {
             if (inFile.renameTo(outFile))
                 return true;
         } catch (SecurityException se) {
@@ -276,17 +276,17 @@ public class GeckoAppShell
             } catch (SecurityException se) {
                 Log.w(LOGTAG, "error trying to delete file", se);
             }
             return false;
         }
         return true;
     }
 
-    private static boolean moveDir(File from, File to) {
+    static boolean moveDir(File from, File to) {
         try {
             to.mkdirs();
             if (from.renameTo(to))
                 return true;
         } catch (SecurityException se) {
             Log.w(LOGTAG, "error trying to rename file", se);
         }
         File[] files = from.listFiles();
@@ -496,17 +496,17 @@ public class GeckoAppShell
                 GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
                 return true;
             }
         });
 
         layerController.notifyLayerClientOfGeometryChange();
     }
 
-    public static void sendPendingEventsToGecko() {
+    static void sendPendingEventsToGecko() {
         try {
             while (!gPendingEvents.isEmpty()) {
                 GeckoEvent e = gPendingEvents.removeFirst();
                 notifyGeckoOfEvent(e);
             }
         } catch (NoSuchElementException e) {}
     }
 
@@ -562,18 +562,18 @@ public class GeckoAppShell
 
     // Signal the Java thread that it's time to wake up
     public static void acknowledgeEventSync() {
         CountDownLatch tmp = sGeckoPendingAcks;
         if (tmp != null)
             tmp.countDown();
     }
 
-    private static Sensor gAccelerometerSensor = null;
-    private static Sensor gOrientationSensor = null;
+    static Sensor gAccelerometerSensor = null;
+    static Sensor gOrientationSensor = null;
 
     public static void enableDeviceMotion(boolean enable) {
         LayerView v = GeckoApp.mAppContext.getLayerController().getView();
         SensorManager sm = (SensorManager) v.getContext().getSystemService(Context.SENSOR_SERVICE);
 
         if (gAccelerometerSensor == null || gOrientationSensor == null) {
             gAccelerometerSensor = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
             gOrientationSensor   = sm.getDefaultSensor(Sensor.TYPE_ORIENTATION);
@@ -622,39 +622,37 @@ public class GeckoAppShell
     public static void moveTaskToBack() {
         GeckoApp.mAppContext.moveTaskToBack(true);
     }
 
     public static void returnIMEQueryResult(String result, int selectionStart, int selectionLength) {
         mInputConnection.returnIMEQueryResult(result, selectionStart, selectionLength);
     }
 
-    public static void onXreExit() {
+    static void onXreExit() {
         // mLaunchState can only be Launched or GeckoRunning at this point
         GeckoApp.setLaunchState(GeckoApp.LaunchState.GeckoExiting);
         Log.i(LOGTAG, "XRE exited");
         if (gRestartScheduled) {
             GeckoApp.mAppContext.doRestart();
         } else {
             Log.i(LOGTAG, "we're done, good bye");
             GeckoApp.mAppContext.finish();
         }
 
         Log.w(LOGTAG, "Killing via System.exit()");
         System.exit(0);
     }
-
-    public static void scheduleRestart() {
+    static void scheduleRestart() {
         Log.i(LOGTAG, "scheduling restart");
         gRestartScheduled = true;
     }
 
     // "Installs" an application by creating a shortcut
-    public static void createShortcut(String aTitle, String aURI,
-                                      String aIconData, String aType) {
+    static void createShortcut(String aTitle, String aURI, String aIconData, String aType) {
         byte[] raw = Base64.decode(aIconData.substring(22), Base64.DEFAULT);
         Bitmap bitmap = BitmapFactory.decodeByteArray(raw, 0, raw.length);
         createShortcut(aTitle, aURI, bitmap, aType);
     }
 
     public static void createShortcut(final String aTitle, final String aURI, final Bitmap aIcon, final String aType) {
         getHandler().post(new Runnable() {
             public void run() {
@@ -750,32 +748,32 @@ public class GeckoAppShell
                                        kIconSize/2 + aSource.getWidth()/2,
                                        kIconSize/2 + aSource.getHeight()/2),
                               null);
         }
 
         return bitmap;
     }
 
-    public static String[] getHandlersForMimeType(String aMimeType, String aAction) {
+    static String[] getHandlersForMimeType(String aMimeType, String aAction) {
         Intent intent = getIntentForActionString(aAction);
         if (aMimeType != null && aMimeType.length() > 0)
             intent.setType(aMimeType);
         return getHandlersForIntent(intent);
     }
 
-    public static String[] getHandlersForURL(String aURL, String aAction) {
+    static String[] getHandlersForURL(String aURL, String aAction) {
         // aURL may contain the whole URL or just the protocol
         Uri uri = aURL.indexOf(':') >= 0 ? Uri.parse(aURL) : new Uri.Builder().scheme(aURL).build();
         Intent intent = getIntentForActionString(aAction);
         intent.setData(uri);
         return getHandlersForIntent(intent);
     }
 
-    private static String[] getHandlersForIntent(Intent intent) {
+    static String[] getHandlersForIntent(Intent intent) {
         PackageManager pm = GeckoApp.mAppContext.getPackageManager();
         List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
         int numAttr = 4;
         String[] ret = new String[list.size() * numAttr];
         for (int i = 0; i < list.size(); i++) {
             ResolveInfo resolveInfo = list.get(i);
             ret[i * numAttr] = resolveInfo.loadLabel(pm).toString();
             if (resolveInfo.isDefault)
@@ -783,29 +781,29 @@ public class GeckoAppShell
             else
                 ret[i * numAttr + 1] = "";
             ret[i * numAttr + 2] = resolveInfo.activityInfo.applicationInfo.packageName;
             ret[i * numAttr + 3] = resolveInfo.activityInfo.name;
         }
         return ret;
     }
 
-    private static Intent getIntentForActionString(String aAction) {
+    static Intent getIntentForActionString(String aAction) {
         // Default to the view action if no other action as been specified.
         if (aAction != null && aAction.length() > 0)
             return new Intent(aAction);
         else
             return new Intent(Intent.ACTION_VIEW);
     }
 
-    public static String getExtensionFromMimeType(String aMimeType) {
+    static String getExtensionFromMimeType(String aMimeType) {
         return MimeTypeMap.getSingleton().getExtensionFromMimeType(aMimeType);
     }
 
-    public static String getMimeTypeFromExtensions(String aFileExt) {
+    static String getMimeTypeFromExtensions(String aFileExt) {
         MimeTypeMap mtm = MimeTypeMap.getSingleton();
         StringTokenizer st = new StringTokenizer(aFileExt, "., ");
         String type = null;
         String subType = null;
         while (st.hasMoreElements()) {
             String ext = st.nextToken();
             String mt = mtm.getMimeTypeFromExtension(ext);
             if (mt == null)
@@ -820,18 +818,18 @@ public class GeckoAppShell
         }
         if (type == null)
             type = "*";
         if (subType == null)
             subType = "*";
         return type + "/" + subType;
     }
 
-    public static boolean openUriExternal(String aUriSpec, String aMimeType, String aPackageName,
-                                          String aClassName, String aAction, String aTitle) {
+    static boolean openUriExternal(String aUriSpec, String aMimeType, String aPackageName,
+                                   String aClassName, String aAction, String aTitle) {
         Intent intent = getIntentForActionString(aAction);
         if (aAction.equalsIgnoreCase(Intent.ACTION_SEND)) {
             intent.putExtra(Intent.EXTRA_TEXT, aUriSpec);
             intent.putExtra(Intent.EXTRA_SUBJECT, aTitle);
             if (aMimeType != null && aMimeType.length() > 0)
                 intent.setType(aMimeType);
         } else if (aMimeType.length() > 0) {
             intent.setDataAndType(Uri.parse(aUriSpec), aMimeType);
@@ -872,26 +870,26 @@ public class GeckoAppShell
         try {
             GeckoApp.mAppContext.startActivity(intent);
             return true;
         } catch(ActivityNotFoundException e) {
             return false;
         }
     }
 
-    private static final SynchronousQueue<String> sClipboardQueue =
+    static SynchronousQueue<String> sClipboardQueue =
         new SynchronousQueue<String>();
-    private static final String EMPTY_STRING = new String();
+    private static String EMPTY_STRING = new String();
 
     // On some devices, access to the clipboard service needs to happen
     // on a thread with a looper, so dispatch this to our looper thread
     // Note: the main looper won't work because it may be blocked on the
     // gecko thread, which is most likely this thread
-    public static String getClipboardText() {
-        getHandler().post(new Runnable() {
+    static String getClipboardText() {
+        getHandler().post(new Runnable() { 
             @SuppressWarnings("deprecation")
             public void run() {
                 Context context = GeckoApp.mAppContext;
                 String text = null;
                 if (android.os.Build.VERSION.SDK_INT >= 11) {
                     android.content.ClipboardManager cm = (android.content.ClipboardManager)
                         context.getSystemService(Context.CLIPBOARD_SERVICE);
                     if (cm.hasPrimaryClip()) {
@@ -913,18 +911,18 @@ public class GeckoAppShell
             }});
         try {
             String ret = sClipboardQueue.take();
             return (EMPTY_STRING.equals(ret) ? null : ret);
         } catch (InterruptedException ie) {}
         return null;
     }
 
-    public static void setClipboardText(final String text) {
-        getHandler().post(new Runnable() {
+    static void setClipboardText(final String text) {
+        getHandler().post(new Runnable() { 
             @SuppressWarnings("deprecation")
             public void run() {
                 Context context = GeckoApp.mAppContext;
                 if (android.os.Build.VERSION.SDK_INT >= 11) {
                     android.content.ClipboardManager cm = (android.content.ClipboardManager)
                         context.getSystemService(Context.CLIPBOARD_SERVICE);
                     cm.setPrimaryClip(ClipData.newPlainText("Text", text));
                 } else {
@@ -1227,24 +1225,24 @@ public class GeckoAppShell
                 return true;
             }            
         }
         GeckoPidCallback visitor = new GeckoPidCallback();            
         EnumerateGeckoProcesses(visitor);
         return visitor.otherPidExist;
     }
 
-    private interface GeckoProcessesVisitor{
+    interface GeckoProcessesVisitor{
         boolean callback(int pid);
     }
 
-    private static int sPidColumn = -1;
-    private static int sUserColumn = -1;
+    static int sPidColumn = -1;
+    static int sUserColumn = -1;
+    private static void EnumerateGeckoProcesses(GeckoProcessesVisitor visiter) {
 
-    private static void EnumerateGeckoProcesses(GeckoProcessesVisitor visiter) {
         try {
 
             // run ps and parse its output
             java.lang.Process ps = Runtime.getRuntime().exec("ps");
             BufferedReader in = new BufferedReader(new InputStreamReader(ps.getInputStream()),
                                                    2048);
 
             String headerOutput = in.readLine();
@@ -1434,39 +1432,38 @@ public class GeckoAppShell
             Log.i(LOGTAG, "class not found", cnfe);
         } catch (android.content.pm.PackageManager.NameNotFoundException nnfe) {
             Log.i(LOGTAG, "package not found", nnfe);
         }
         Log.e(LOGTAG, "couldn't find class");
         return null;
     }
 
-    private static native void executeNextRunnable();
+    static native void executeNextRunnable();
 
-    private static class GeckoRunnableCallback implements Runnable {
+    static class GeckoRunnableCallback implements Runnable {
         public void run() {
             Log.i(LOGTAG, "run GeckoRunnableCallback");
             GeckoAppShell.executeNextRunnable();
         }
     }
 
     public static void postToJavaThread(boolean mainThread) {
         Log.i(LOGTAG, "post to " + (mainThread ? "main " : "") + "java thread");
         getMainHandler().post(new GeckoRunnableCallback());
     }
-
-    private static android.hardware.Camera sCamera = null;
-
-    private static native void cameraCallbackBridge(byte[] data);
+    
+    public static android.hardware.Camera sCamera = null;
+    
+    static native void cameraCallbackBridge(byte[] data);
 
-    private static final int kPreferedFps = 25;
-    private static byte[] sCameraBuffer = null;
+    static int kPreferedFps = 25;
+    static byte[] sCameraBuffer = null;
 
-    public static int[] initCamera(String aContentType, int aCamera,
-                                   int aWidth, int aHeight) {
+    static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
         Log.i(LOGTAG, "initCamera(" + aContentType + ", " + aWidth + "x" + aHeight + ") on thread " + Thread.currentThread().getId());
 
         getMainHandler().post(new Runnable() {
                 public void run() {
                     try {
                         GeckoApp.mAppContext.enableCameraView();
                     } catch (Exception e) {}
                 }
@@ -1552,34 +1549,34 @@ public class GeckoAppShell
             Log.i(LOGTAG, "Camera preview started");
         } catch(RuntimeException e) {
             Log.e(LOGTAG, "initCamera RuntimeException : ", e);
             result[0] = result[1] = result[2] = result[3] = 0;
         }
         return result;
     }
 
-    public static synchronized void closeCamera() {
+    static synchronized void closeCamera() {
         Log.i(LOGTAG, "closeCamera() on thread " + Thread.currentThread().getId());
         getMainHandler().post(new Runnable() {
                 public void run() {
                     try {
                         GeckoApp.mAppContext.disableCameraView();
                     } catch (Exception e) {}
                 }
             });
         if (sCamera != null) {
             sCamera.stopPreview();
             sCamera.release();
             sCamera = null;
             sCameraBuffer = null;
         }
     }
 
-    public static SynchronousQueue<String> sPromptQueue = null;
+    static SynchronousQueue<String> sPromptQueue = null;
 
     public static void registerGeckoEventListener(String event, GeckoEventListener listener) {
         if (mEventListeners == null)
             mEventListeners = new HashMap<String, ArrayList<GeckoEventListener>>();
 
         if (!mEventListeners.containsKey(event))
             mEventListeners.put(event, new ArrayList<GeckoEventListener>());
 
@@ -1683,29 +1680,29 @@ public class GeckoAppShell
         }
         return gPromptService;
     }
 
     public static double[] getCurrentBatteryInformation() {
         return GeckoBatteryManager.getCurrentInformation();
     }
 
-    public static void checkUriVisited(String uri) {   // invoked from native JNI code
+    static void checkUriVisited(String uri) {   // invoked from native JNI code
         GlobalHistory.getInstance().checkUriVisited(uri);
     }
 
-    public static void markUriVisited(final String uri) {    // invoked from native JNI code
+    static void markUriVisited(final String uri) {    // invoked from native JNI code
         getHandler().post(new Runnable() { 
             public void run() {
                 GlobalHistory.getInstance().add(uri);
             }
         });
     }
 
-    public static void hideProgressDialog() {
+    static void hideProgressDialog() {
         // unused stub
     }
 
     /*
      * WebSMS related methods.
      */
     public static int getNumberOfMessagesForText(String aText) {
         return GeckoSmsManager.getNumberOfMessagesForText(aText);
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -583,23 +583,17 @@ include $(topsrcdir)/config/android-comm
 # Instead of on the .class files, since more than one .class file might be produced per .java file
 # Sync dependencies are provided in a single jar. Sync classes themselves are delivered as source,
 # because Android resource classes must be compiled together in order to avoid overlapping resource
 # indices.
 classes.dex: $(FENNEC_JAVA_FILES) $(FENNEC_PP_JAVA_FILES) $(SYNC_JAVA_FILES) $(SYNC_PP_JAVA_FILES) $(SYNC_THIRDPARTY_JAVA_FILES) R.java
 	$(NSINSTALL) -D classes
 	$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(SYNC_THIRDPARTY_JAVA_FILES))
 	$(JAVAC) $(JAVAC_FLAGS) -Xlint:all,-deprecation,-fallthrough -d classes -classpath classes $(addprefix $(srcdir)/,$(FENNEC_JAVA_FILES)) $(FENNEC_PP_JAVA_FILES) $(addprefix $(srcdir)/,$(SYNC_JAVA_FILES)) $(SYNC_PP_JAVA_FILES) R.java
-	$(PROGUARD) @$(topsrcdir)/mobile/android/config/proguard.cfg \
-			-injars classes \
-			-outjars classes-proguarded \
-			-libraryjars $(ANDROID_SDK)/android.jar
-	# ProGuard may optimize away local variables, so dx --no-locals to ignore
-	# debug symbols for missing local variables.
-	$(DX) --dex --output=$@ --no-locals classes-proguarded
+	$(DX) --dex --output=$@ classes
 
 PP_RES_XML=$(SYNC_PP_RES_XML)
 
 # This is kinda awful; if any of the source files change, we remake them all.
 $(PP_RES_XML): $(patsubst res/%,$(srcdir)/resources/%.in,$(PP_RES_XML))
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
              $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $(subst res,$(srcdir)/resources,$@).in > $@
 
deleted file mode 100644
--- a/mobile/android/config/proguard.cfg
+++ /dev/null
@@ -1,98 +0,0 @@
-#
-# Rules from Google's example proguard.cfg in the Android SDK:
-# android-sdk-macosx/tools/lib/proguard.cfg
-#
-
-# TODO: We can remove -dontskipnonpubliclibraryclasses for ProGuard >= 4.5
-# because it is enabled by default.
--dontskipnonpubliclibraryclasses
--dontpreverify
--verbose
-
-# Preserve all fundamental application classes.
--keep public class * extends android.app.Activity
--keep public class * extends android.app.Application
--keep public class * extends android.app.Service
--keep public class * extends android.content.BroadcastReceiver
--keep public class * extends android.content.ContentProvider
--keep public class * extends android.app.backup.BackupAgentHelper
--keep public class * extends android.preference.Preference
-
-# Preserve all native method names and the names of their classes.
--keepclasseswithmembernames class * {
-    native <methods>;
-}
-
-# Preserve all classes that have special context constructors, and the
-# constructors themselves.
--keepclasseswithmembers class * {
-    public <init>(android.content.Context, android.util.AttributeSet);
-}
-
-# Preserve all classes that have special context constructors, and the
-# constructors themselves.
--keepclasseswithmembers class * {
-    public <init>(android.content.Context, android.util.AttributeSet, int);
-}
-
--keepclassmembers class * extends android.app.Activity {
-   public void *(android.view.View);
-}
-
-# Preserve the special static methods that are required in all enumeration
-# classes.
--keepclassmembers enum * {
-    public static **[] values();
-    public static ** valueOf(java.lang.String);
-}
-
-#
-# Rules from ProGuard's Android example:
-# http://proguard.sourceforge.net/manual/examples.html#androidapplication
-#
-
-# Switch off some optimizations that trip older versions of the Dalvik VM.
-# https://code.google.com/p/android/issues/detail?id=964
--optimizations !code/simplification/cast
-
-# Preserve all View implementations, their special context constructors, and
-# their setters.
--keep public class * extends android.view.View {
-    public <init>(android.content.Context);
-    public <init>(android.content.Context, android.util.AttributeSet);
-    public <init>(android.content.Context, android.util.AttributeSet, int);
-    public void set*(...);
-}
-
-# Preserve the special fields of all Parcelable implementations.
--keepclassmembers class * implements android.os.Parcelable {
-    static android.os.Parcelable$Creator CREATOR;
-}
-
-# Preserve static fields of inner classes of R classes that might be accessed
-# through introspection.
--keepclassmembers class **.R$* {
-    public static <fields>;
-}
-
-#
-# Mozilla-specific rules
-#
-
-# Preserve public classes and methods accessed from C++ JNI.
--keep public class org.mozilla.gecko.** { public *; }
-
-# Google defaults to 5 passes, but Fennec benefits from up to 9-10 passes.
--optimizationpasses 10
-
-# Disable obfuscation because it makes exception stack traces more
-# difficult to debug. Plus Firefox's code is already open-source.
--dontobfuscate
-
-# Silence warnings about "Note: duplicate definition of library class".
--dontnote **,!org.mozilla.**
-
-# Allow private members to be made public to improve method inlining.
-# TODO: Enable -allowaccessmodification optimizations for ProGuard >= 4.6.
-# These optimizations trigger a ProGuard 4.4 bug when inlining private methods.
-##-allowaccessmodification