Bug 709230 part 1 - Add missing access modifiers to GeckoAppShell.java. r=dougt
☠☠ backed out by 365277d89057 ☠ ☠
authorChris Peterson <cpeterson@mozilla.com>
Tue, 24 Jan 2012 17:52:34 -0800
changeset 86968 1d4d44ecd75c705e3d7049d3248c183eb8161664
parent 86967 60ce23560e511443ce598e4ae521ea7d6980dbbe
child 86969 823cd28154837eb1735c6f2c2673909e5bc74b76
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt
bugs709230
milestone12.0a1
Bug 709230 part 1 - Add missing access modifiers to GeckoAppShell.java. r=dougt
mobile/android/base/GeckoAppShell.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -249,17 +249,17 @@ public class GeckoAppShell
                 }
             }
         } catch (Exception e) {
             Log.e(LOGTAG, "exception while stating cache dir: ", e);
         }
         return sFreeSpace;
     }
 
-    static boolean moveFile(File inFile, File outFile)
+    private 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) {
@@ -288,17 +288,17 @@ public class GeckoAppShell
             } catch (SecurityException se) {
                 Log.w(LOGTAG, "error trying to delete file", se);
             }
             return false;
         }
         return true;
     }
 
-    static boolean moveDir(File from, File to) {
+    private 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();
@@ -508,17 +508,17 @@ public class GeckoAppShell
                 GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
                 return true;
             }
         });
 
         layerController.notifyLayerClientOfGeometryChange();
     }
 
-    static void sendPendingEventsToGecko() {
+    public static void sendPendingEventsToGecko() {
         try {
             while (!gPendingEvents.isEmpty()) {
                 GeckoEvent e = gPendingEvents.removeFirst();
                 notifyGeckoOfEvent(e);
             }
         } catch (NoSuchElementException e) {}
     }
 
@@ -574,18 +574,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();
     }
 
-    static Sensor gAccelerometerSensor = null;
-    static Sensor gOrientationSensor = null;
+    private static Sensor gAccelerometerSensor = null;
+    private 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);
@@ -634,37 +634,39 @@ 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);
     }
 
-    static void onXreExit() {
+    public 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);
     }
-    static void scheduleRestart() {
+
+    public static void scheduleRestart() {
         Log.i(LOGTAG, "scheduling restart");
         gRestartScheduled = true;
     }
 
     // "Installs" an application by creating a shortcut
-    static void createShortcut(String aTitle, String aURI, String aIconData, String aType) {
+    public 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() {
@@ -760,32 +762,32 @@ public class GeckoAppShell
                                        kIconSize/2 + aSource.getWidth()/2,
                                        kIconSize/2 + aSource.getHeight()/2),
                               null);
         }
 
         return bitmap;
     }
 
-    static String[] getHandlersForMimeType(String aMimeType, String aAction) {
+    public static String[] getHandlersForMimeType(String aMimeType, String aAction) {
         Intent intent = getIntentForActionString(aAction);
         if (aMimeType != null && aMimeType.length() > 0)
             intent.setType(aMimeType);
         return getHandlersForIntent(intent);
     }
 
-    static String[] getHandlersForURL(String aURL, String aAction) {
+    public 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);
     }
 
-    static String[] getHandlersForIntent(Intent intent) {
+    private 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)
@@ -793,29 +795,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;
     }
 
-    static Intent getIntentForActionString(String aAction) {
+    private 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);
     }
 
-    static String getExtensionFromMimeType(String aMimeType) {
+    public static String getExtensionFromMimeType(String aMimeType) {
         return MimeTypeMap.getSingleton().getExtensionFromMimeType(aMimeType);
     }
 
-    static String getMimeTypeFromExtensions(String aFileExt) {
+    public 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)
@@ -830,18 +832,18 @@ public class GeckoAppShell
         }
         if (type == null)
             type = "*";
         if (subType == null)
             subType = "*";
         return type + "/" + subType;
     }
 
-    static boolean openUriExternal(String aUriSpec, String aMimeType, String aPackageName,
-                                   String aClassName, String aAction, String aTitle) {
+    public 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);
@@ -882,26 +884,26 @@ public class GeckoAppShell
         try {
             GeckoApp.mAppContext.startActivity(intent);
             return true;
         } catch(ActivityNotFoundException e) {
             return false;
         }
     }
 
-    static SynchronousQueue<String> sClipboardQueue =
+    private static final SynchronousQueue<String> sClipboardQueue =
         new SynchronousQueue<String>();
-    private static String EMPTY_STRING = new String();
+    private static final 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
-    static String getClipboardText() {
-        getHandler().post(new Runnable() { 
+    public 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()) {
@@ -923,18 +925,18 @@ public class GeckoAppShell
             }});
         try {
             String ret = sClipboardQueue.take();
             return (EMPTY_STRING.equals(ret) ? null : ret);
         } catch (InterruptedException ie) {}
         return null;
     }
 
-    static void setClipboardText(final String text) {
-        getHandler().post(new Runnable() { 
+    public 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 {
@@ -1231,24 +1233,24 @@ public class GeckoAppShell
                 return true;
             }            
         }
         GeckoPidCallback visitor = new GeckoPidCallback();            
         EnumerateGeckoProcesses(visitor);
         return visitor.otherPidExist;
     }
 
-    interface GeckoProcessesVisitor{
+    private interface GeckoProcessesVisitor{
         boolean callback(int pid);
     }
 
-    static int sPidColumn = -1;
-    static int sUserColumn = -1;
+    private static int sPidColumn = -1;
+    private static int sUserColumn = -1;
+
     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();
@@ -1408,38 +1410,39 @@ 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;
     }
 
-    static native void executeNextRunnable();
+    private static native void executeNextRunnable();
 
-    static class GeckoRunnableCallback implements Runnable {
+    private 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());
     }
-    
-    public static android.hardware.Camera sCamera = null;
-    
-    static native void cameraCallbackBridge(byte[] data);
+
+    private static android.hardware.Camera sCamera = null;
+
+    private static native void cameraCallbackBridge(byte[] data);
 
-    static int kPreferedFps = 25;
-    static byte[] sCameraBuffer = null;
+    private static final int kPreferedFps = 25;
+    private static byte[] sCameraBuffer = null;
 
-    static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
+    public 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) {}
                 }
@@ -1525,34 +1528,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;
     }
 
-    static synchronized void closeCamera() {
+    public 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;
         }
     }
 
-    static SynchronousQueue<String> sPromptQueue = null;
+    public 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>());
 
@@ -1656,29 +1659,29 @@ public class GeckoAppShell
         }
         return gPromptService;
     }
 
     public static double[] getCurrentBatteryInformation() {
         return GeckoBatteryManager.getCurrentInformation();
     }
 
-    static void checkUriVisited(String uri) {   // invoked from native JNI code
+    public static void checkUriVisited(String uri) {   // invoked from native JNI code
         GlobalHistory.getInstance().checkUriVisited(uri);
     }
 
-    static void markUriVisited(final String uri) {    // invoked from native JNI code
+    public static void markUriVisited(final String uri) {    // invoked from native JNI code
         getHandler().post(new Runnable() { 
             public void run() {
                 GlobalHistory.getInstance().add(uri);
             }
         });
     }
 
-    static void hideProgressDialog() {
+    public static void hideProgressDialog() {
         // unused stub
     }
 
     /*
      * WebSMS related methods.
      */
     public static int getNumberOfMessagesForText(String aText) {
         if (SmsManager.getInstance() == null) {