summaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-12 20:10:05 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-12 20:10:05 +0000
commit51c91c599be824dee5315739600253aec7fabbc6 (patch)
tree7d263f5406f7a81675956cecf63129f0aa2f7921 /android
parentc98f5845f64b0327be9579d711b3bcc1743fef44 (diff)
downloadrockbox-51c91c599be824dee5315739600253aec7fabbc6.tar.gz
rockbox-51c91c599be824dee5315739600253aec7fabbc6.tar.bz2
rockbox-51c91c599be824dee5315739600253aec7fabbc6.zip
Adhere to the 80-char line width limit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28067 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android')
-rw-r--r--android/src/org/rockbox/RockboxPCM.java36
-rw-r--r--android/src/org/rockbox/RockboxService.java38
-rw-r--r--android/src/org/rockbox/RockboxTimer.java11
3 files changed, 54 insertions, 31 deletions
diff --git a/android/src/org/rockbox/RockboxPCM.java b/android/src/org/rockbox/RockboxPCM.java
index 52a47cfda0..a3d09a43eb 100644
--- a/android/src/org/rockbox/RockboxPCM.java
+++ b/android/src/org/rockbox/RockboxPCM.java
@@ -39,11 +39,13 @@ public class RockboxPCM extends AudioTrack
private Handler h = null;
private static final int samplerate = 44100;
/* should be CHANNEL_OUT_STEREO in 2.0 and above */
- private static final int channels = AudioFormat.CHANNEL_CONFIGURATION_STEREO;
- private static final int encoding = AudioFormat.ENCODING_PCM_16BIT;
+ private static final int channels =
+ AudioFormat.CHANNEL_CONFIGURATION_STEREO;
+ private static final int encoding =
+ AudioFormat.ENCODING_PCM_16BIT;
/* 24k is plenty, but some devices may have a higher minimum */
private static final int buf_len =
- Math.max(24<<10, getMinBufferSize(samplerate, channels, encoding));
+ Math.max(24<<10, getMinBufferSize(samplerate, channels, encoding));
private void LOG(CharSequence text)
{
@@ -54,7 +56,8 @@ public class RockboxPCM extends AudioTrack
{
super(AudioManager.STREAM_MUSIC, samplerate, channels, encoding,
buf_len, AudioTrack.MODE_STREAM);
- ht = new HandlerThread("audio thread", Process.THREAD_PRIORITY_URGENT_AUDIO);
+ ht = new HandlerThread("audio thread",
+ Process.THREAD_PRIORITY_URGENT_AUDIO);
ht.start();
raw_data = new byte[buf_len]; /* in shorts */
Arrays.fill(raw_data, (byte) 0);
@@ -88,13 +91,15 @@ public class RockboxPCM extends AudioTrack
{
if (h == null)
h = new Handler(ht.getLooper());
- if (setNotificationMarkerPosition(bytes2frames(buf_len)/4) != AudioTrack.SUCCESS)
+ if (setNotificationMarkerPosition(bytes2frames(buf_len)/4)
+ != AudioTrack.SUCCESS)
LOG("setNotificationMarkerPosition Error");
else
setPlaybackPositionUpdateListener(l, h);
}
/* need to fill with silence before starting playback */
- write(raw_data, frames2bytes(getPlaybackHeadPosition()), raw_data.length);
+ write(raw_data, frames2bytes(getPlaybackHeadPosition()),
+ raw_data.length);
}
play();
}
@@ -115,9 +120,11 @@ public class RockboxPCM extends AudioTrack
private void set_volume(int volume)
{
/* volume comes from 0..-990 from Rockbox */
- /* TODO volume is in dB, but this code acts as if it were in %, convert? */
+ /* TODO:
+ * volume is in dB, but this code acts as if it were in %, convert? */
float fvolume;
- /* special case min and max volume to not suffer from floating point accuracy */
+ /* special case min and max volume to not suffer from
+ * floating point accuracy */
if (volume == 0)
fvolume = 1.0f;
else if (volume == -990)
@@ -155,10 +162,15 @@ public class RockboxPCM extends AudioTrack
{
case AudioTrack.PLAYSTATE_PLAYING:
case AudioTrack.PLAYSTATE_PAUSED:
- /* refill at 25% no matter of how many bytes we've written */
- if (setNotificationMarkerPosition(bytes2frames(refill_mark))
- != AudioTrack.SUCCESS)
- LOG("Error in onMarkerReached: Could not set notification marker");
+ /* refill at 25% no matter of how many
+ * bytes we've written */
+ if (setNotificationMarkerPosition(
+ bytes2frames(refill_mark))
+ != AudioTrack.SUCCESS)
+ {
+ LOG("Error in onMarkerReached: " +
+ "Could not set notification marker");
+ }
else /* recharge */
setPlaybackPositionUpdateListener(this, h);
break;
diff --git a/android/src/org/rockbox/RockboxService.java b/android/src/org/rockbox/RockboxService.java
index d77b3b4e09..1416886ce8 100644
--- a/android/src/org/rockbox/RockboxService.java
+++ b/android/src/org/rockbox/RockboxService.java
@@ -52,10 +52,10 @@ public class RockboxService extends Service
public static RockboxFramebuffer fb = null;
private static RockboxService instance;
private Notification notification;
- private static final Class<?>[] mStartForegroundSignature = new Class[] {
- int.class, Notification.class};
- private static final Class<?>[] mStopForegroundSignature = new Class[] {
- boolean.class};
+ private static final Class<?>[] mStartForegroundSignature =
+ new Class[] { int.class, Notification.class };
+ private static final Class<?>[] mStopForegroundSignature =
+ new Class[] { boolean.class };
private NotificationManager mNM;
private Method mStartForeground;
@@ -89,7 +89,8 @@ public class RockboxService extends Service
private void do_start(Intent intent)
{
LOG("Start Service");
- /* Display a notification about us starting. We put an icon in the status bar. */
+ /* Display a notification about us starting.
+ * We put an icon in the status bar. */
create_notification();
}
@@ -127,9 +128,11 @@ public class RockboxService extends Service
BufferedOutputStream dest = null;
BufferedInputStream is = null;
ZipEntry entry;
- File file = new File("/data/data/org.rockbox/lib/libmisc.so");
+ File file = new File("/data/data/org.rockbox/" +
+ "lib/libmisc.so");
/* use arbitary file to determine whether extracting is needed */
- File file2 = new File("/data/data/org.rockbox/app_rockbox/rockbox/codecs/mpa.codec");
+ File file2 = new File("/data/data/org.rockbox/" +
+ "app_rockbox/rockbox/codecs/mpa.codec");
if (!file2.exists() || (file.lastModified() > file2.lastModified()))
{
ZipFile zipfile = new ZipFile(file);
@@ -150,7 +153,8 @@ public class RockboxService extends Service
}
continue;
}
- is = new BufferedInputStream(zipfile.getInputStream(entry), BUFFER);
+ is = new BufferedInputStream(zipfile.getInputStream(entry),
+ BUFFER);
int count;
byte data[] = new byte[BUFFER];
folder = new File(new File(entry.getName()).getParent());
@@ -240,18 +244,22 @@ public class RockboxService extends Service
private void create_notification()
{
- /* For now we'll use the same text for the ticker and the expanded notification */
+ /* For now we'll use the same text for the ticker and the
+ * expanded notification */
CharSequence text = getText(R.string.notification);
/* Set the icon, scrolling text and timestamp */
notification = new Notification(R.drawable.icon, text,
System.currentTimeMillis());
- /* The PendingIntent to launch our activity if the user selects this notification */
+ /* The PendingIntent to launch our activity if the user selects
+ * this notification */
Intent intent = new Intent(this, RockboxActivity.class);
- PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
+ PendingIntent contentIntent =
+ PendingIntent.getActivity(this, 0, intent, 0);
/* Set the info for the views that show in the notification panel. */
- notification.setLatestEventInfo(this, getText(R.string.notification), text, contentIntent);
+ notification.setLatestEventInfo(this,
+ getText(R.string.notification), text, contentIntent);
}
public static void startForeground()
@@ -260,7 +268,8 @@ public class RockboxService extends Service
{
/*
* Send the notification.
- * We use a layout id because it is a unique number. We use it later to cancel.
+ * We use a layout id because it is a unique number.
+ * We use it later to cancel.
*/
instance.mNM.notify(R.string.notification, instance.notification);
/*
@@ -268,7 +277,8 @@ public class RockboxService extends Service
* provides enough cpu time to do music decoding in the
* background
*/
- instance.startForegroundCompat(R.string.notification, instance.notification);
+ instance.startForegroundCompat(R.string.notification,
+ instance.notification);
}
}
diff --git a/android/src/org/rockbox/RockboxTimer.java b/android/src/org/rockbox/RockboxTimer.java
index ec5b9cd8bf..776902e45e 100644
--- a/android/src/org/rockbox/RockboxTimer.java
+++ b/android/src/org/rockbox/RockboxTimer.java
@@ -34,12 +34,13 @@ public class RockboxTimer extends Timer
long interval;
private class RockboxTimerTask extends TimerTask {
- private RockboxTimer t;
+ private RockboxTimer timer;
private TelephonyManager tm;
private int last_state;
- public RockboxTimerTask(RockboxService s, RockboxTimer parent) {
+ public RockboxTimerTask(RockboxService s, RockboxTimer parent)
+ {
super();
- t = parent;
+ timer = parent;
tm = (TelephonyManager)s.getSystemService(Context.TELEPHONY_SERVICE);
last_state = tm.getCallState();
}
@@ -63,8 +64,8 @@ public class RockboxTimer extends Timer
}
last_state = state;
}
- synchronized(t) {
- t.notify();
+ synchronized(timer) {
+ timer.notify();
}
}
}