summaryrefslogtreecommitdiffstats
path: root/android/src
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-07-18 21:26:03 +0000
committerThomas Martitz <kugel@rockbox.org>2011-07-18 21:26:03 +0000
commit02b2b285d6dfb798d09dab15614f38b8e7948a95 (patch)
tree8b80c43f8c7497744b2e32816c933bc1fdaefc9d /android/src
parent33de9cdaefd8684e3411486612e68c0c2bd6be3d (diff)
downloadrockbox-02b2b285d6dfb798d09dab15614f38b8e7948a95.tar.gz
rockbox-02b2b285d6dfb798d09dab15614f38b8e7948a95.tar.bz2
rockbox-02b2b285d6dfb798d09dab15614f38b8e7948a95.zip
Android: Slightly rework logging to logcat by offloading duplicated code to a new helper class.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30161 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android/src')
-rw-r--r--android/src/org/rockbox/Helper/MediaButtonReceiver.java3
-rw-r--r--android/src/org/rockbox/Helper/RunForegroundManager.java10
-rw-r--r--android/src/org/rockbox/RockboxActivity.java6
-rw-r--r--android/src/org/rockbox/RockboxFramebuffer.java6
-rw-r--r--android/src/org/rockbox/RockboxPCM.java16
5 files changed, 6 insertions, 35 deletions
diff --git a/android/src/org/rockbox/Helper/MediaButtonReceiver.java b/android/src/org/rockbox/Helper/MediaButtonReceiver.java
index eebdbb985b..2334259c8e 100644
--- a/android/src/org/rockbox/Helper/MediaButtonReceiver.java
+++ b/android/src/org/rockbox/Helper/MediaButtonReceiver.java
@@ -29,7 +29,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
-import android.util.Log;
import android.view.KeyEvent;
public class MediaButtonReceiver
@@ -144,7 +143,7 @@ public class MediaButtonReceiver
public void onAudioFocusChange(int focusChange)
{
- Log.d("Rockbox", "Audio focus" + ((focusChange>0)?"gained":"lost")+
+ Logger.d("Audio focus" + ((focusChange>0)?"gained":"lost")+
": "+ focusChange);
if (running)
{ /* Play nice and stop for the the other app */
diff --git a/android/src/org/rockbox/Helper/RunForegroundManager.java b/android/src/org/rockbox/Helper/RunForegroundManager.java
index 99287c3c6a..7677444374 100644
--- a/android/src/org/rockbox/Helper/RunForegroundManager.java
+++ b/android/src/org/rockbox/Helper/RunForegroundManager.java
@@ -40,16 +40,6 @@ public class RunForegroundManager
initForegroundCompat();
}
- private void LOG(CharSequence text)
- {
- Log.d("Rockbox", (String)text);
- }
-
- private void LOG(CharSequence text, Throwable tr)
- {
- Log.d("Rockbox", (String)text, tr);
- }
-
public void startForeground()
{
startForegroundCompat(R.string.notification, mNotification);
diff --git a/android/src/org/rockbox/RockboxActivity.java b/android/src/org/rockbox/RockboxActivity.java
index cae0510229..355c57daa8 100644
--- a/android/src/org/rockbox/RockboxActivity.java
+++ b/android/src/org/rockbox/RockboxActivity.java
@@ -28,7 +28,6 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.ResultReceiver;
-import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
@@ -129,9 +128,4 @@ public class RockboxActivity extends Activity
super.onDestroy();
setServiceActivity(false);
}
-
- private void LOG(CharSequence text)
- {
- Log.d("Rockbox", (String) text);
- }
}
diff --git a/android/src/org/rockbox/RockboxFramebuffer.java b/android/src/org/rockbox/RockboxFramebuffer.java
index 6acc5322df..66e5991a3e 100644
--- a/android/src/org/rockbox/RockboxFramebuffer.java
+++ b/android/src/org/rockbox/RockboxFramebuffer.java
@@ -28,7 +28,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
@@ -96,11 +95,6 @@ public class RockboxFramebuffer extends SurfaceView
holder.unlockCanvasAndPost(c);
}
- private void LOG(CharSequence text)
- {
- Log.d("Rockbox", (String) text);
- }
-
public boolean onTouchEvent(MotionEvent me)
{
int x = (int) me.getX();
diff --git a/android/src/org/rockbox/RockboxPCM.java b/android/src/org/rockbox/RockboxPCM.java
index eaccddb76a..5ed2a9050d 100644
--- a/android/src/org/rockbox/RockboxPCM.java
+++ b/android/src/org/rockbox/RockboxPCM.java
@@ -22,6 +22,7 @@
package org.rockbox;
import java.util.Arrays;
+import org.rockbox.Helper.Logger;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -32,7 +33,6 @@ import android.media.AudioTrack;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Process;
-import android.util.Log;
public class RockboxPCM extends AudioTrack
{
@@ -58,11 +58,6 @@ public class RockboxPCM extends AudioTrack
private float curpcmvolume = 0;
private float pcmrange;
- private void LOG(CharSequence text)
- {
- Log.d("Rockbox", (String) text);
- }
-
public RockboxPCM()
{
super(streamtype, samplerate, channels, encoding,
@@ -99,7 +94,7 @@ public class RockboxPCM extends AudioTrack
{
int rbvolume = ((maxstreamvolume - volume) * -99) /
maxstreamvolume;
- LOG("java:postVolumeChangedEvent, avol "+volume+" rbvol "+rbvolume);
+ Logger.d("java:postVolumeChangedEvent, avol "+volume+" rbvol "+rbvolume);
postVolumeChangedEvent(rbvolume);
}
@@ -138,7 +133,6 @@ public class RockboxPCM extends AudioTrack
new IntentFilter("android.media.VOLUME_CHANGED_ACTION"));
}
- @SuppressWarnings("unused")
private int bytes2frames(int bytes)
{
/* 1 sample is 2 bytes, 2 samples are 1 frame */
@@ -213,7 +207,7 @@ public class RockboxPCM extends AudioTrack
@SuppressWarnings("unused")
private void set_volume(int volume)
{
- LOG("java:set_volume("+volume+")");
+ Logger.d("java:set_volume("+volume+")");
/* Rockbox 'volume' is 0..-990 deci-dB attenuation.
Android streams have rather low resolution volume control,
typically 8 or 15 steps.
@@ -233,7 +227,7 @@ public class RockboxPCM extends AudioTrack
int oldstreamvolume = audiomanager.getStreamVolume(streamtype);
if (streamvolume != oldstreamvolume) {
- LOG("java:setStreamVolume("+streamvolume+")");
+ Logger.d("java:setStreamVolume("+streamvolume+")");
setstreamvolume = streamvolume;
audiomanager.setStreamVolume(streamtype, streamvolume, 0);
}
@@ -264,7 +258,7 @@ public class RockboxPCM extends AudioTrack
setNotificationMarkerPosition(pcm.refillmark);
break;
case PLAYSTATE_STOPPED:
- LOG("Stopped");
+ Logger.d("Stopped");
break;
}
}