summaryrefslogtreecommitdiffstats
path: root/tests/StatusBar
diff options
context:
space:
mode:
authorJoe Onorato <>2009-03-27 16:54:49 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-27 16:54:49 -0700
commit32f114b3c73c0c9146d507ac1473be1700eba14b (patch)
tree28fdabfed5e44dc9e665099679cb750b19111b0b /tests/StatusBar
parenta2debb356d857b2ee1ca26f95ed0136398393acd (diff)
downloadframeworks_base-32f114b3c73c0c9146d507ac1473be1700eba14b.zip
frameworks_base-32f114b3c73c0c9146d507ac1473be1700eba14b.tar.gz
frameworks_base-32f114b3c73c0c9146d507ac1473be1700eba14b.tar.bz2
AI 143279: am: CL 142828 am: CL 142827 Fix a typo that made the blink rate of the LED incorrect.
(and add a test that helped me debug it) Original author: joeo Merged from: //branches/cupcake/... Original author: android-build Merged from: //branches/donutburger/... Automated import of CL 143279
Diffstat (limited to 'tests/StatusBar')
-rw-r--r--tests/StatusBar/src/com/android/statusbartest/ToastTest.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/StatusBar/src/com/android/statusbartest/ToastTest.java b/tests/StatusBar/src/com/android/statusbartest/ToastTest.java
index 018c9f2..8d24781 100644
--- a/tests/StatusBar/src/com/android/statusbartest/ToastTest.java
+++ b/tests/StatusBar/src/com/android/statusbartest/ToastTest.java
@@ -33,6 +33,9 @@ import android.widget.Toast;
import android.widget.TextView;
import android.os.PowerManager;
+import java.io.FileReader;
+import java.io.IOException;
+
public class ToastTest extends TestActivity
{
private final static String TAG = "ToastTest";
@@ -51,7 +54,43 @@ public class ToastTest extends TestActivity
return mTests;
}
+ private static String readFile(String fn) {
+ FileReader f;
+ int len;
+
+ f = null;
+ try {
+ f = new FileReader(fn);
+ String s = "";
+ char[] cbuf = new char[200];
+ while ((len = f.read(cbuf, 0, cbuf.length)) >= 0) {
+ s += String.valueOf(cbuf, 0, len);
+ }
+ return s;
+ } catch (IOException ex) {
+ return "ERROR";
+ } finally {
+ if (f != null) {
+ try {
+ f.close();
+ } catch (IOException ex) {
+ return "ERROR!";
+ }
+ }
+ }
+ }
+
private Test[] mTests = new Test[] {
+ new Test("Read lights") {
+ public void run()
+ {
+ String text = "freq=" + readFile("/sys/class/leds/red/device/grpfreq")
+ + "\npwm=" + readFile("/sys/class/leds/red/device/grppwm");
+ mToast1 = Toast.makeText(ToastTest.this, text, Toast.LENGTH_SHORT);
+ mToast1.show();
+ }
+ },
+
new Test("Make Toast #1") {
public void run()
{