Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

replaced custom App.logi/App.loge with standard Log.i/Log.e

  • Loading branch information...
commit 598c5cdb81ca75c8b7d139cc681b9ffc531bab73 1 parent 0db63cd
@eighthave eighthave authored
View
14 src/info/guardianproject/lildebi/App.java
@@ -1,14 +0,0 @@
-package info.guardianproject.lildebi;
-
-import android.util.Log;
-
-public class App {
- public static void logi(String val) {
- Log.i(App.class.getName(), val);
- }
-
- public static void loge(String val, Exception e) {
- Log.e(App.class.getName(), val, e);
- }
-
-}
View
15 src/info/guardianproject/lildebi/DebiHelper.java
@@ -10,6 +10,7 @@
import android.content.Context;
import android.content.res.AssetManager;
+import android.util.Log;
public class DebiHelper {
public static int STARTING_INSTALL = 12345;
@@ -46,7 +47,7 @@ public static void unzipDebiFiles(Context context) {
if (file.exists()) {
file.delete();
- App.logi("DebiHelper.unzipDebiFiles() deleting "
+ Log.i(LilDebi.TAG, "DebiHelper.unzipDebiFiles() deleting "
+ file.getAbsolutePath());
}
@@ -67,7 +68,7 @@ public static void unzipDebiFiles(Context context) {
assetIS.close();
}
} catch (IOException e) {
- App.loge("Can't unzip", e);
+ Log.e(LilDebi.TAG, "Can't unzip", e);
}
chmod(0644, new File(app_bin, "usr-share-debootstrap.tar.bz2"));
chmod(0644, new File(app_bin, "lildebi-common"));
@@ -89,17 +90,17 @@ public static void chmod(int mode, File path) {
int a = (Integer) setPermissions.invoke(null, path.getAbsolutePath(), mode,
-1, -1);
if (a != 0) {
- App.logi("ERROR: android.os.FileUtils.setPermissions() returned " + a
+ Log.i(LilDebi.TAG, "ERROR: android.os.FileUtils.setPermissions() returned " + a
+ " for '" + path + "'");
}
} catch (ClassNotFoundException e) {
- App.logi("android.os.FileUtils.setPermissions() failed - ClassNotFoundException.");
+ Log.i(LilDebi.TAG, "android.os.FileUtils.setPermissions() failed - ClassNotFoundException.");
} catch (IllegalAccessException e) {
- App.logi("android.os.FileUtils.setPermissions() failed - IllegalAccessException.");
+ Log.i(LilDebi.TAG, "android.os.FileUtils.setPermissions() failed - IllegalAccessException.");
} catch (InvocationTargetException e) {
- App.logi("android.os.FileUtils.setPermissions() failed - InvocationTargetException.");
+ Log.i(LilDebi.TAG, "android.os.FileUtils.setPermissions() failed - InvocationTargetException.");
} catch (NoSuchMethodException e) {
- App.logi("android.os.FileUtils.setPermissions() failed - NoSuchMethodException.");
+ Log.i(LilDebi.TAG, "android.os.FileUtils.setPermissions() failed - NoSuchMethodException.");
}
}
View
7 src/info/guardianproject/lildebi/InstallActivity.java
@@ -19,6 +19,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -43,7 +44,7 @@
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
mBoundService = ((InstallService.LocalBinder) service).getService();
- App.logi("calling serviceBound");
+ Log.i(LilDebi.TAG, "calling serviceBound");
wireButtons();
}
@@ -62,7 +63,7 @@ public void onServiceDisconnected(ComponentName className) {
private BroadcastReceiver installFinishedRec;
void doBindService() {
- App.logi("bindService");
+ Log.i(LilDebi.TAG, "bindService");
bindService(new Intent(this, InstallService.class), mConnection,
Context.BIND_AUTO_CREATE);
mIsBound = true;
@@ -162,7 +163,7 @@ public void onClick(View view) {
intent.putExtra(MIRROR, selectedMirror.getText().toString());
intent.putExtra(IMAGESIZE, imagesize.getText().toString());
startService(intent);
- App.logi("Starting install service");
+ Log.i(LilDebi.TAG, "Starting install service");
handler.postDelayed(new Runnable() {
public void run() {
refreshButtons();
View
9 src/info/guardianproject/lildebi/InstallService.java
@@ -7,6 +7,7 @@
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
+import android.util.Log;
public class InstallService extends Service {
private InstallThread installThread;
@@ -83,16 +84,16 @@ public void run() {
it.start();
et.start();
- App.logi("cd " + DebiHelper.app_bin.getAbsolutePath());
+ Log.i(LilDebi.TAG, "cd " + DebiHelper.app_bin.getAbsolutePath());
writeCommand(os, "cd " + DebiHelper.app_bin.getAbsolutePath());
writeCommand(os, "./create-debian-setup.sh " + DebiHelper.args + release
+ " http://" + mirror + "/debian/ " + imagesize);
writeCommand(os, "exit");
sh.waitFor();
- App.logi("Done!");
+ Log.i(LilDebi.TAG, "Done!");
} catch (Exception e) {
- App.loge("Error!!!", e);
+ Log.e(LilDebi.TAG, "Error!!!", e);
} finally {
stopSelf();
synchronized (InstallService.this) {
@@ -108,7 +109,7 @@ public void run() {
logfile.append(log.toString());
logfile.close();
} catch (Exception e) {
- App.loge("Error writing install log file", e);
+ Log.e(LilDebi.TAG, "Error writing install log file", e);
}
}
}
View
10 src/info/guardianproject/lildebi/LilDebi.java
@@ -14,6 +14,7 @@
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
+import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
@@ -29,6 +30,7 @@
import android.widget.TextView.OnEditorActionListener;
public class LilDebi extends Activity implements OnCreateContextMenuListener {
+ public static final String TAG = "LilDebi";
private boolean debianInstalled;
private boolean debianMounted;
private TextView statusTitle;
@@ -156,16 +158,16 @@ public void run() {
it.start();
et.start();
- App.logi("cd " + DebiHelper.app_bin.getAbsolutePath());
+ Log.i(LilDebi.TAG, "cd " + DebiHelper.app_bin.getAbsolutePath());
writeCommand(os, "cd " + DebiHelper.app_bin.getAbsolutePath());
- App.logi(command);
+ Log.i(LilDebi.TAG, command);
writeCommand(os, command);
writeCommand(os, "exit");
sh.waitFor();
- App.logi("Done!");
+ Log.i(LilDebi.TAG, "Done!");
} catch (Exception e) {
- App.loge("Error!!!", e);
+ Log.e(LilDebi.TAG, "Error!!!", e);
} finally {
synchronized (LilDebi.this) {
commandThread = null;
View
3  src/info/guardianproject/lildebi/StreamDisplay.java
@@ -4,6 +4,7 @@
import java.io.InputStream;
import android.os.Handler;
+import android.util.Log;
import android.widget.ScrollView;
import android.widget.TextView;
@@ -52,7 +53,7 @@ public void run()
}
catch (IOException e)
{
- App.loge("", e);
+ Log.e(LilDebi.TAG, "", e);
}
}
}
View
4 src/info/guardianproject/lildebi/StreamThread.java
@@ -3,6 +3,8 @@
import java.io.IOException;
import java.io.InputStream;
+import android.util.Log;
+
public class StreamThread extends Thread {
InputStream i;
StreamUpdate update;
@@ -26,7 +28,7 @@ public void run() {
update.update(readString);
}
} catch (IOException e) {
- App.loge("", e);
+ Log.e(LilDebi.TAG, "", e);
}
}
View
14 src/org/torproject/android/service/TorServiceUtils.java
@@ -2,7 +2,7 @@
/* See LICENSE for licensing information */
package org.torproject.android.service;
-import info.guardianproject.lildebi.App;
+import info.guardianproject.lildebi.LilDebi;
import java.io.BufferedReader;
import java.io.File;
@@ -36,15 +36,15 @@ public static boolean checkRootAccess() {
} catch (IOException e) {
//this means that there is no root to be had (normally) so we won't log anything
- App.loge("Error checking for root access", e);
+ Log.e(LilDebi.TAG, "Error checking for root access", e);
}
catch (Exception e) {
- App.loge("Error checking for root access", e);
+ Log.e(LilDebi.TAG, "Error checking for root access", e);
//this means that there is no root to be had (normally)
}
- App.logi("Could not acquire root permissions");
+ Log.i(LilDebi.TAG, "Could not acquire root permissions");
return false;
}
@@ -105,7 +105,7 @@ public static int findProcessIdWithPidOf(String command) throws Exception
}
catch (NumberFormatException e)
{
- App.loge("unable to parse process pid: " + line, e);
+ Log.e(LilDebi.TAG, "unable to parse process pid: " + line, e);
}
}
@@ -152,7 +152,7 @@ public static int findProcessIdWithPS(String command) throws Exception
public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAsRoot, boolean waitFor) throws Exception
{
- App.logi("executing shell cmds: " + cmds[0] + "; runAsRoot=" + runAsRoot);
+ Log.i(LilDebi.TAG, "executing shell cmds: " + cmds[0] + "; runAsRoot=" + runAsRoot);
Process proc = null;
@@ -201,7 +201,7 @@ public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAs
log.append(exitCode);
log.append("\n");
- App.logi("command process exit value: " + exitCode);
+ Log.i(LilDebi.TAG, "command process exit value: " + exitCode);
}
Please sign in to comment.
Something went wrong with that request. Please try again.