diff --git a/config/android-common.mk b/config/android-common.mk index bc863117d1b..4591239f63b 100644 --- a/config/android-common.mk +++ b/config/android-common.mk @@ -48,7 +48,6 @@ 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 diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 823b220fa09..b3875bfbb21 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -254,7 +254,7 @@ public class GeckoAppShell 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()) @@ -293,7 +293,7 @@ public class GeckoAppShell return true; } - private static boolean moveDir(File from, File to) { + static boolean moveDir(File from, File to) { try { to.mkdirs(); if (from.renameTo(to)) @@ -513,7 +513,7 @@ public class GeckoAppShell layerController.notifyLayerClientOfGeometryChange(); } - public static void sendPendingEventsToGecko() { + static void sendPendingEventsToGecko() { try { while (!gPendingEvents.isEmpty()) { GeckoEvent e = gPendingEvents.removeFirst(); @@ -579,8 +579,8 @@ public class GeckoAppShell 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(); @@ -639,7 +639,7 @@ public class GeckoAppShell 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"); @@ -653,15 +653,13 @@ public class GeckoAppShell 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); @@ -767,14 +765,14 @@ public class GeckoAppShell 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); @@ -782,7 +780,7 @@ public class GeckoAppShell return getHandlersForIntent(intent); } - private static String[] getHandlersForIntent(Intent intent) { + static String[] getHandlersForIntent(Intent intent) { PackageManager pm = GeckoApp.mAppContext.getPackageManager(); List list = pm.queryIntentActivities(intent, 0); int numAttr = 4; @@ -800,7 +798,7 @@ public class GeckoAppShell 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); @@ -808,11 +806,11 @@ public class GeckoAppShell 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; @@ -837,8 +835,8 @@ public class GeckoAppShell 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); @@ -889,16 +887,16 @@ public class GeckoAppShell } } - private static final SynchronousQueue sClipboardQueue = + static SynchronousQueue sClipboardQueue = new SynchronousQueue(); - 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; @@ -930,8 +928,8 @@ public class GeckoAppShell 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; @@ -1238,14 +1236,14 @@ public class GeckoAppShell 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) { + try { // run ps and parse its output @@ -1415,9 +1413,9 @@ public class GeckoAppShell 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(); @@ -1428,16 +1426,15 @@ public class GeckoAppShell Log.i(LOGTAG, "post to " + (mainThread ? "main " : "") + "java thread"); getMainHandler().post(new GeckoRunnableCallback()); } + + public static android.hardware.Camera sCamera = null; + + static native void cameraCallbackBridge(byte[] data); - private static android.hardware.Camera sCamera = null; + static int kPreferedFps = 25; + static byte[] sCameraBuffer = null; - private static native void cameraCallbackBridge(byte[] data); - - private static final int kPreferedFps = 25; - private 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() { @@ -1533,7 +1530,7 @@ public class GeckoAppShell 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() { @@ -1550,7 +1547,7 @@ public class GeckoAppShell } } - public static SynchronousQueue sPromptQueue = null; + static SynchronousQueue sPromptQueue = null; public static void registerGeckoEventListener(String event, GeckoEventListener listener) { if (mEventListeners == null) @@ -1664,11 +1661,11 @@ public class GeckoAppShell 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); @@ -1676,7 +1673,7 @@ public class GeckoAppShell }); } - public static void hideProgressDialog() { + static void hideProgressDialog() { // unused stub } diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index e337dc1ca78..81999c34911 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -586,13 +586,7 @@ classes.dex: $(FENNEC_JAVA_FILES) $(FENNEC_PP_JAVA_FILES) $(SYNC_JAVA_FILES) $(S $(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) diff --git a/mobile/android/config/proguard.cfg b/mobile/android/config/proguard.cfg deleted file mode 100644 index 675910f2855..00000000000 --- 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 ; -} - -# Preserve all classes that have special context constructors, and the -# constructors themselves. --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - -# Preserve all classes that have special context constructors, and the -# constructors themselves. --keepclasseswithmembers class * { - public (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 (android.content.Context); - public (android.content.Context, android.util.AttributeSet); - public (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 ; -} - -# -# 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