am b9353372: am 8896783d: Updated StatusBar test app for new notifications API.

Merge commit 'b9353372f67dcb18bccb26165758a47cfe3197de'

* commit 'b9353372f67dcb18bccb26165758a47cfe3197de':
  Updated StatusBar test app for new notifications API.
diff --git a/tests/StatusBar/Android.mk b/tests/StatusBar/Android.mk
index 18fcad0..502657f 100644
--- a/tests/StatusBar/Android.mk
+++ b/tests/StatusBar/Android.mk
@@ -8,4 +8,6 @@
 LOCAL_PACKAGE_NAME := StatusBarTest
 LOCAL_CERTIFICATE := platform
 
+LOCAL_PROGUARD_ENABLED := disabled
+
 include $(BUILD_PACKAGE)
diff --git a/tests/StatusBar/AndroidManifest.xml b/tests/StatusBar/AndroidManifest.xml
index 21fb951..c1ca618 100644
--- a/tests/StatusBar/AndroidManifest.xml
+++ b/tests/StatusBar/AndroidManifest.xml
@@ -35,5 +35,7 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
+        <activity android:name="TestAlertActivity" android:theme="@android:style/Theme.Dialog">
+        </activity>
     </application>
 </manifest>
diff --git a/tests/StatusBar/res/layout/test_alert.xml b/tests/StatusBar/res/layout/test_alert.xml
new file mode 100644
index 0000000..325146c
--- /dev/null
+++ b/tests/StatusBar/res/layout/test_alert.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center">
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:gravity="center_horizontal"
+        android:orientation="vertical"
+        >
+
+        <TextView android:id="@+id/alertTitle"
+            style="?android:attr/textAppearanceLarge"
+            android:padding="5dip"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:gravity="center"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            style="@android:style/ButtonBar">
+
+            <Button
+                android:id="@+id/snooze"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="3"
+                android:onClick="dismiss"
+                android:text="Snooze" />
+
+            <!-- blank stretchable view -->
+            <View
+                android:layout_width="2dip"
+                android:layout_height="2dip"
+                android:layout_gravity="fill_horizontal"
+                android:layout_weight="1"/>
+
+            <Button
+                android:id="@+id/dismiss"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="3"
+                android:onClick="dismiss"
+                android:text="Dismiss" />
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java
index cb94e52..8c343b5 100644
--- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java
+++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java
@@ -23,6 +23,7 @@
 import android.view.View;
 import android.widget.ListView;
 import android.content.Intent;
+import android.app.PendingIntent;
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.StatusBarManager;
@@ -35,6 +36,8 @@
 import android.widget.RemoteViews;
 import android.widget.Toast;
 import android.os.PowerManager;
+import android.view.Window;
+import android.view.WindowManager;
 
 public class StatusBarTest extends TestActivity
 {
@@ -57,6 +60,53 @@
     }
 
     private Test[] mTests = new Test[] {
+        new Test("Hide") {
+            public void run() {
+                Window win = getWindow();
+                WindowManager.LayoutParams winParams = win.getAttributes();
+                winParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+                win.setAttributes(winParams);
+            }
+        },
+        new Test("Show") {
+            public void run() {
+                Window win = getWindow();
+                WindowManager.LayoutParams winParams = win.getAttributes();
+                winParams.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
+                win.setAttributes(winParams);
+            }
+        },
+        new Test("Immersive: Enter") {
+            public void run() {
+                setImmersive(true);
+            }
+        },
+        new Test("Immersive: Exit") {
+            public void run() {
+                setImmersive(false);
+            }
+        },
+        new Test("Priority notification") {
+            public void run() {
+                Notification not = new Notification(StatusBarTest.this,
+                                R.drawable.ic_statusbar_missedcall,
+                                "tick tick tick",
+                                System.currentTimeMillis()-(1000*60*60*24),
+                                "(453) 123-2328",
+                                "", null
+                                );
+                not.flags |= Notification.FLAG_HIGH_PRIORITY;
+                Intent fullScreenIntent = new Intent(StatusBarTest.this, TestAlertActivity.class);
+                int id = (int)System.currentTimeMillis(); // XXX HAX
+                fullScreenIntent.putExtra("id", id);
+                not.fullScreenIntent = PendingIntent.getActivity(
+                    StatusBarTest.this,
+                    0,
+                    fullScreenIntent,
+                    PendingIntent.FLAG_CANCEL_CURRENT);
+                mNotificationManager.notify(id, not);
+            }
+        },
         new Test("Disable Alerts") {
             public void run() {
                 mStatusBarManager.disable(StatusBarManager.DISABLE_NOTIFICATION_ALERTS);
diff --git a/tests/StatusBar/src/com/android/statusbartest/TestAlertActivity.java b/tests/StatusBar/src/com/android/statusbartest/TestAlertActivity.java
new file mode 100644
index 0000000..f5876d0
--- /dev/null
+++ b/tests/StatusBar/src/com/android/statusbartest/TestAlertActivity.java
@@ -0,0 +1,37 @@
+package com.android.statusbartest;
+
+import android.app.Activity;
+import android.app.NotificationManager;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+
+public class TestAlertActivity extends Activity {
+    int mId;
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        Log.d("StatusBarTest", "TestAlertActivity.onResume");
+        Intent intent = getIntent();
+        mId = intent.getIntExtra("id", -1);
+        Log.d("StatusBarTest", "Remembering notification id=" + mId);
+        setContentView(R.layout.test_alert);
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        Log.d("StatusBarTest", "onPause: Canceling notification id=" + mId);
+        NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+        nm.cancel(mId);
+        finish();
+    }
+
+    @SuppressWarnings({"UnusedDeclaration"})
+    public void dismiss(View v) {
+        Log.d("StatusBarTest", "TestAlertActivity.dismiss");
+        finish();
+    }
+}