Bug XXXX - Correctly renames the Log() functions to use the right filename. rs=blassey

This commit is contained in:
Doug Turner 2011-08-18 19:27:41 -07:00
parent 9cad6c7290
commit a16173b2e0
3 changed files with 66 additions and 60 deletions

View File

@ -66,6 +66,8 @@ import android.telephony.*;
abstract public class GeckoApp
extends Activity
{
private static final String LOG_FILE_NAME = "GeckoApp";
public static final String ACTION_ALERT_CLICK = "org.mozilla.gecko.ACTION_ALERT_CLICK";
public static final String ACTION_ALERT_CLEAR = "org.mozilla.gecko.ACTION_ALERT_CLEAR";
public static final String ACTION_WEBAPP = "org.mozilla.gecko.WEBAPP";
@ -151,13 +153,13 @@ abstract public class GeckoApp
try {
unpackComponents();
} catch (FileNotFoundException fnfe) {
Log.e("GeckoApp", "error unpacking components", fnfe);
Log.e(LOG_FILE_NAME, "error unpacking components", fnfe);
Looper.prepare();
showErrorDialog(getString(R.string.error_loading_file));
Looper.loop();
return;
} catch (IOException ie) {
Log.e("GeckoApp", "error unpacking components", ie);
Log.e(LOG_FILE_NAME, "error unpacking components", ie);
String msg = ie.getMessage();
Looper.prepare();
if (msg != null && msg.equalsIgnoreCase("No space left on device"))
@ -175,7 +177,7 @@ abstract public class GeckoApp
i.getStringExtra("args"),
i.getDataString());
} catch (Exception e) {
Log.e("GeckoApp", "top level exception", e);
Log.e(LOG_FILE_NAME, "top level exception", e);
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
GeckoAppShell.reportJavaCrash(sw.toString());
@ -199,7 +201,7 @@ abstract public class GeckoApp
try {
Looper.loop();
} catch (Exception e) {
Log.e("GeckoApp", "top level exception", e);
Log.e(LOG_FILE_NAME, "top level exception", e);
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
GeckoAppShell.reportJavaCrash(sw.toString());
@ -215,7 +217,7 @@ abstract public class GeckoApp
if (localeCode != null && localeCode.length() > 0)
GeckoAppShell.setSelectedLocale(localeCode);
Log.i("GeckoApp", "create");
Log.i(LOG_FILE_NAME, "create");
super.onCreate(savedInstanceState);
if (sGREDir == null)
@ -319,30 +321,30 @@ abstract public class GeckoApp
return;
if (Intent.ACTION_MAIN.equals(action)) {
Log.i("GeckoApp", "Intent : ACTION_MAIN");
Log.i(LOG_FILE_NAME, "Intent : ACTION_MAIN");
GeckoAppShell.sendEventToGecko(new GeckoEvent(""));
}
else if (Intent.ACTION_VIEW.equals(action)) {
String uri = intent.getDataString();
GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
Log.i("GeckoApp","onNewIntent: "+uri);
Log.i(LOG_FILE_NAME,"onNewIntent: "+uri);
}
else if (ACTION_WEBAPP.equals(action)) {
String uri = intent.getStringExtra("args");
GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
Log.i("GeckoApp","Intent : WEBAPP - " + uri);
Log.i(LOG_FILE_NAME,"Intent : WEBAPP - " + uri);
}
else if (ACTION_BOOKMARK.equals(action)) {
String args = intent.getStringExtra("args");
GeckoAppShell.sendEventToGecko(new GeckoEvent(args));
Log.i("GeckoApp","Intent : BOOKMARK - " + args);
Log.i(LOG_FILE_NAME,"Intent : BOOKMARK - " + args);
}
}
@Override
public void onPause()
{
Log.i("GeckoApp", "pause");
Log.i(LOG_FILE_NAME, "pause");
GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_PAUSING));
// The user is navigating away from this activity, but nothing
// has come to the foreground yet; for Gecko, we may want to
@ -364,7 +366,7 @@ abstract public class GeckoApp
@Override
public void onResume()
{
Log.i("GeckoApp", "resume");
Log.i(LOG_FILE_NAME, "resume");
if (checkLaunchState(LaunchState.GeckoRunning))
GeckoAppShell.onResume();
// After an onPause, the activity is back in the foreground.
@ -389,7 +391,7 @@ abstract public class GeckoApp
@Override
public void onStop()
{
Log.i("GeckoApp", "stop");
Log.i(LOG_FILE_NAME, "stop");
// We're about to be stopped, potentially in preparation for
// being destroyed. We're killable after this point -- as I
// understand it, in extreme cases the process can be terminated
@ -410,7 +412,7 @@ abstract public class GeckoApp
@Override
public void onRestart()
{
Log.i("GeckoApp", "restart");
Log.i(LOG_FILE_NAME, "restart");
GeckoAppShell.putChildInForeground();
super.onRestart();
}
@ -418,14 +420,14 @@ abstract public class GeckoApp
@Override
public void onStart()
{
Log.i("GeckoApp", "start");
Log.i(LOG_FILE_NAME, "start");
super.onStart();
}
@Override
public void onDestroy()
{
Log.i("GeckoApp", "destroy");
Log.i(LOG_FILE_NAME, "destroy");
// Tell Gecko to shutting down; we'll end up calling System.exit()
// in onXreExit.
if (isFinishing())
@ -437,7 +439,7 @@ abstract public class GeckoApp
@Override
public void onConfigurationChanged(android.content.res.Configuration newConfig)
{
Log.i("GeckoApp", "configuration changed");
Log.i(LOG_FILE_NAME, "configuration changed");
// nothing, just ignore
super.onConfigurationChanged(newConfig);
}
@ -445,7 +447,7 @@ abstract public class GeckoApp
@Override
public void onLowMemory()
{
Log.e("GeckoApp", "low memory");
Log.e(LOG_FILE_NAME, "low memory");
if (checkLaunchState(LaunchState.GeckoRunning))
GeckoAppShell.onLowMemory();
super.onLowMemory();
@ -470,7 +472,7 @@ abstract public class GeckoApp
removeFiles();
} catch (Exception ex) {
// This file may not be there, so just log any errors and move on
Log.w("GeckoApp", "error removing files", ex);
Log.w(LOG_FILE_NAME, "error removing files", ex);
}
unpackFile(zip, buf, null, "application.ini");
unpackFile(zip, buf, null, getContentProcessName());
@ -585,11 +587,11 @@ abstract public class GeckoApp
addEnvToIntent(intent);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
Log.i("GeckoAppJava", intent.toString());
Log.i(LOG_FILE_NAME, intent.toString());
GeckoAppShell.killAnyZombies();
startActivity(intent);
} catch (Exception e) {
Log.i("GeckoAppJava", "error doing restart", e);
Log.i(LOG_FILE_NAME, "error doing restart", e);
}
finish();
// Give the restart process time to start before we die
@ -601,7 +603,7 @@ abstract public class GeckoApp
}
private void checkAndLaunchUpdate() {
Log.i("GeckoAppJava", "Checking for an update");
Log.i(LOG_FILE_NAME, "Checking for an update");
int statusCode = 8; // UNEXPECTED_ERROR
File baseUpdateDir = null;
@ -621,7 +623,7 @@ abstract public class GeckoApp
if (!updateFile.exists())
return;
Log.i("GeckoAppJava", "Update is available!");
Log.i(LOG_FILE_NAME, "Update is available!");
// Launch APK
File updateFileToRun = new File(updateDir, getPackageName() + "-update.apk");
@ -630,15 +632,15 @@ abstract public class GeckoApp
String amCmd = "/system/bin/am start -a android.intent.action.VIEW " +
"-n com.android.packageinstaller/.PackageInstallerActivity -d file://" +
updateFileToRun.getPath();
Log.i("GeckoAppJava", amCmd);
Log.i(LOG_FILE_NAME, amCmd);
Runtime.getRuntime().exec(amCmd);
statusCode = 0; // OK
} else {
Log.i("GeckoAppJava", "Cannot rename the update file!");
Log.i(LOG_FILE_NAME, "Cannot rename the update file!");
statusCode = 7; // WRITE_ERROR
}
} catch (Exception e) {
Log.i("GeckoAppJava", "error launching installer to update", e);
Log.i(LOG_FILE_NAME, "error launching installer to update", e);
}
// Update the status file
@ -651,7 +653,7 @@ abstract public class GeckoApp
outStream.write(buf, 0, buf.length);
outStream.close();
} catch (Exception e) {
Log.i("GeckoAppJava", "error writing status file", e);
Log.i(LOG_FILE_NAME, "error writing status file", e);
}
if (statusCode == 0)
@ -665,7 +667,7 @@ abstract public class GeckoApp
status = reader.readLine();
reader.close();
} catch (Exception e) {
Log.i("GeckoAppJava", "error reading update status", e);
Log.i(LOG_FILE_NAME, "error reading update status", e);
}
return status;
}
@ -685,7 +687,7 @@ abstract public class GeckoApp
try {
filePickerResult = mFilePickerResult.take();
} catch (InterruptedException e) {
Log.i("GeckoApp", "showing file picker ", e);
Log.i(LOG_FILE_NAME, "showing file picker ", e);
}
return filePickerResult;
@ -738,13 +740,13 @@ abstract public class GeckoApp
fos.close();
filePickerResult = file.getAbsolutePath();
}catch (Exception e) {
Log.e("GeckoApp", "showing file picker", e);
Log.e(LOG_FILE_NAME, "showing file picker", e);
}
}
try {
mFilePickerResult.put(filePickerResult);
} catch (InterruptedException e) {
Log.i("GeckoApp", "error returning file picker result", e);
Log.i(LOG_FILE_NAME, "error returning file picker result", e);
}
}
}

View File

@ -74,6 +74,8 @@ import android.graphics.Bitmap;
public class GeckoAppShell
{
private static final String LOG_FILE_NAME = "GeckoAppShell";
// static members only
private GeckoAppShell() { }
@ -190,25 +192,25 @@ public class GeckoAppShell
sFreeSpace = cacheStats.getFreeBlocks() *
cacheStats.getBlockSize();
} else {
Log.i("GeckoAppShell", "Unable to get cache dir");
Log.i(LOG_FILE_NAME, "Unable to get cache dir");
}
}
} catch (Exception e) {
Log.e("GeckoAppShell", "exception while stating cache dir: ", e);
Log.e(LOG_FILE_NAME, "exception while stating cache dir: ", e);
}
return sFreeSpace;
}
static boolean moveFile(File inFile, File outFile)
{
Log.i("GeckoAppShell", "moving " + inFile + " to " + outFile);
Log.i(LOG_FILE_NAME, "moving " + inFile + " to " + outFile);
if (outFile.isDirectory())
outFile = new File(outFile, inFile.getName());
try {
if (inFile.renameTo(outFile))
return true;
} catch (SecurityException se) {
Log.w("GeckoAppShell", "error trying to rename file", se);
Log.w(LOG_FILE_NAME, "error trying to rename file", se);
}
try {
long lastModified = inFile.lastModified();
@ -227,11 +229,11 @@ public class GeckoAppShell
else
return false;
} catch (Exception e) {
Log.e("GeckoAppShell", "exception while moving file: ", e);
Log.e(LOG_FILE_NAME, "exception while moving file: ", e);
try {
outFile.delete();
} catch (SecurityException se) {
Log.w("GeckoAppShell", "error trying to delete file", se);
Log.w(LOG_FILE_NAME, "error trying to delete file", se);
}
return false;
}
@ -244,7 +246,7 @@ public class GeckoAppShell
if (from.renameTo(to))
return true;
} catch (SecurityException se) {
Log.w("GeckoAppShell", "error trying to rename file", se);
Log.w(LOG_FILE_NAME, "error trying to rename file", se);
}
File[] files = from.listFiles();
boolean retVal = true;
@ -262,7 +264,7 @@ public class GeckoAppShell
}
from.delete();
} catch(Exception e) {
Log.e("GeckoAppShell", "error trying to move file", e);
Log.e(LOG_FILE_NAME, "error trying to move file", e);
}
return retVal;
}
@ -310,11 +312,11 @@ public class GeckoAppShell
GeckoAppShell.putenv("GRE_HOME=" + GeckoApp.sGREDir.getPath());
Intent i = geckoApp.getIntent();
String env = i.getStringExtra("env0");
Log.i("GeckoApp", "env0: "+ env);
Log.i(LOG_FILE_NAME, "env0: "+ env);
for (int c = 1; env != null; c++) {
GeckoAppShell.putenv(env);
env = i.getStringExtra("env" + c);
Log.i("GeckoApp", "env"+ c +": "+ env);
Log.i(LOG_FILE_NAME, "env"+ c +": "+ env);
}
File f = geckoApp.getDir("tmp", Context.MODE_WORLD_READABLE |
@ -346,7 +348,7 @@ public class GeckoAppShell
GeckoAppShell.putenv("UPDATES_DIRECTORY=" + updatesDir.getPath());
}
catch (Exception e) {
Log.i("GeckoApp", "No download directory has been found: " + e);
Log.i(LOG_FILE_NAME, "No download directory has been found: " + e);
}
putLocaleEnv();
@ -1107,7 +1109,7 @@ public class GeckoAppShell
// If the network state has changed, notify Gecko
if (notifyChanged && (state != sNetworkState || typeCode != sNetworkTypeCode)) {
Log.i("GeckoAppShell", "Network state changed: (" + state + ", " + type + ") ");
Log.i(LOG_FILE_NAME, "Network state changed: (" + state + ", " + type + ") ");
sNetworkState = state;
sNetworkType = type;
sNetworkTypeCode = typeCode;
@ -1191,7 +1193,7 @@ public class GeckoAppShell
fos.write(new Integer(pid).toString().getBytes());
fos.close();
} catch(Exception e) {
Log.e("GeckoAppShell", "error putting child in the background", e);
Log.e(LOG_FILE_NAME, "error putting child in the background", e);
}
}
return true;
@ -1212,7 +1214,7 @@ public class GeckoAppShell
fos.write(new Integer(pid).toString().getBytes());
fos.close();
} catch(Exception e) {
Log.e("GeckoAppShell", "error putting child in the foreground", e);
Log.e(LOG_FILE_NAME, "error putting child in the foreground", e);
}
}
return true;
@ -1300,7 +1302,7 @@ public class GeckoAppShell
in.close();
}
catch (Exception e) {
Log.i("GeckoAppShell", "finding procs throws ", e);
Log.i(LOG_FILE_NAME, "finding procs throws ", e);
}
}
@ -1343,7 +1345,7 @@ public class GeckoAppShell
return buf.array();
}
catch (Exception e) {
Log.i("GeckoAppShell", "getIconForExtension error: ", e);
Log.i(LOG_FILE_NAME, "getIconForExtension error: ", e);
return null;
}
}

View File

@ -71,6 +71,8 @@ class GeckoSurfaceView
extends SurfaceView
implements SurfaceHolder.Callback, SensorEventListener, LocationListener
{
private static final String LOG_FILE_NAME = "GeckoSurfaceView";
public GeckoSurfaceView(Context context) {
super(context);
@ -107,7 +109,7 @@ class GeckoSurfaceView
void drawSplashScreen(SurfaceHolder holder, int width, int height) {
Canvas c = holder.lockCanvas();
if (c == null) {
Log.i("GeckoSurfaceView", "canvas is null");
Log.i(LOG_FILE_NAME, "canvas is null");
return;
}
Resources res = getResources();
@ -173,7 +175,7 @@ class GeckoSurfaceView
try {
if (mInDrawing) {
Log.w("GeckoAppJava", "surfaceChanged while mInDrawing is true!");
Log.w(LOG_FILE_NAME, "surfaceChanged while mInDrawing is true!");
}
boolean invalidSize;
@ -198,7 +200,7 @@ class GeckoSurfaceView
mHeight = height;
mSurfaceValid = true;
Log.i("GeckoAppJava", "surfaceChanged: fmt: " + format + " dim: " + width + " " + height);
Log.i(LOG_FILE_NAME, "surfaceChanged: fmt: " + format + " dim: " + width + " " + height);
DisplayMetrics metrics = new DisplayMetrics();
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
@ -225,7 +227,7 @@ class GeckoSurfaceView
try {
syncDrawObject = mSyncDraws.take();
} catch (InterruptedException ie) {
Log.e("GeckoAppJava", "Threw exception while getting sync draw bitmap/buffer: ", ie);
Log.e(LOG_FILE_NAME, "Threw exception while getting sync draw bitmap/buffer: ", ie);
}
if (syncDrawObject != null) {
if (syncDrawObject instanceof Bitmap)
@ -238,7 +240,7 @@ class GeckoSurfaceView
}
public void surfaceCreated(SurfaceHolder holder) {
Log.i("GeckoAppJava", "surface created");
Log.i(LOG_FILE_NAME, "surface created");
GeckoEvent e = new GeckoEvent(GeckoEvent.SURFACE_CREATED);
GeckoAppShell.sendEventToGecko(e);
if (mShowingSplashScreen)
@ -246,7 +248,7 @@ class GeckoSurfaceView
}
public void surfaceDestroyed(SurfaceHolder holder) {
Log.i("GeckoAppJava", "surface destroyed");
Log.i(LOG_FILE_NAME, "surface destroyed");
mSurfaceValid = false;
mSoftwareBuffer = null;
mSoftwareBufferCopy = null;
@ -294,7 +296,7 @@ class GeckoSurfaceView
public int beginDrawing() {
if (mInDrawing) {
Log.e("GeckoAppJava", "Recursive beginDrawing call!");
Log.e(LOG_FILE_NAME, "Recursive beginDrawing call!");
return DRAW_ERROR;
}
@ -312,7 +314,7 @@ class GeckoSurfaceView
mSurfaceLock.lock();
if (!mSurfaceValid) {
Log.e("GeckoAppJava", "Surface not valid");
Log.e(LOG_FILE_NAME, "Surface not valid");
mSurfaceLock.unlock();
return DRAW_ERROR;
}
@ -324,20 +326,20 @@ class GeckoSurfaceView
public void endDrawing() {
if (!mInDrawing) {
Log.e("GeckoAppJava", "endDrawing without beginDrawing!");
Log.e(LOG_FILE_NAME, "endDrawing without beginDrawing!");
return;
}
try {
if (!mSurfaceValid) {
Log.e("GeckoAppJava", "endDrawing with false mSurfaceValid");
Log.e(LOG_FILE_NAME, "endDrawing with false mSurfaceValid");
return;
}
} finally {
mInDrawing = false;
if (!mSurfaceLock.isHeldByCurrentThread())
Log.e("GeckoAppJava", "endDrawing while mSurfaceLock not held by current thread!");
Log.e(LOG_FILE_NAME, "endDrawing while mSurfaceLock not held by current thread!");
mSurfaceLock.unlock();
}
@ -368,7 +370,7 @@ class GeckoSurfaceView
try {
mSyncDraws.put(bitmap);
} catch (InterruptedException ie) {
Log.e("GeckoAppJava", "Threw exception while getting sync draws queue: ", ie);
Log.e(LOG_FILE_NAME, "Threw exception while getting sync draws queue: ", ie);
}
return;
}
@ -389,7 +391,7 @@ class GeckoSurfaceView
try {
mSyncDraws.put(buffer);
} catch (InterruptedException ie) {
Log.e("GeckoAppJava", "Threw exception while getting sync bitmaps queue: ", ie);
Log.e(LOG_FILE_NAME, "Threw exception while getting sync bitmaps queue: ", ie);
}
return;
}
@ -492,7 +494,7 @@ class GeckoSurfaceView
mLastGeoAddress = addresses.get(0);
GeckoAppShell.sendEventToGecko(new GeckoEvent(location[0], mLastGeoAddress));
} catch (Exception e) {
Log.w("GeckoSurfaceView", "GeocoderTask "+e);
Log.w(LOG_FILE_NAME, "GeocoderTask "+e);
}
return null;
}