Merge "Removing a notification that isn't there isn't a big deal." into jb-dev
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 0c47069..6d3aa98 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -907,6 +907,8 @@
      * </pre>
      */
     public static class Builder {
+        private static final int MAX_ACTION_BUTTONS = 2;
+
         private Context mContext;
 
         private long mWhen;
@@ -938,7 +940,7 @@
         private ArrayList<String> mKindList = new ArrayList<String>(1);
         private Bundle mExtras;
         private int mPriority;
-        private ArrayList<Action> mActions = new ArrayList<Action>(3);
+        private ArrayList<Action> mActions = new ArrayList<Action>(MAX_ACTION_BUTTONS);
         private boolean mUseChronometer;
         private Style mStyle;
 
@@ -1460,7 +1462,7 @@
             if (N > 0) {
                 // Log.d("Notification", "has actions: " + mContentText);
                 big.setViewVisibility(R.id.actions, View.VISIBLE);
-                if (N>3) N=3;
+                if (N>MAX_ACTION_BUTTONS) N=MAX_ACTION_BUTTONS;
                 big.removeAllViews(R.id.actions);
                 for (int i=0; i<N; i++) {
                     final RemoteViews button = generateActionButton(mActions.get(i));
@@ -1500,18 +1502,14 @@
         }
 
         private RemoteViews generateActionButton(Action action) {
-            RemoteViews button = new RemoteViews(mContext.getPackageName(), R.layout.notification_action);
+            final boolean tombstone = (action.actionIntent == null);
+            RemoteViews button = new RemoteViews(mContext.getPackageName(), 
+                    tombstone ? R.layout.notification_action_tombstone
+                              : R.layout.notification_action);
             button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
             button.setTextViewText(R.id.action0, action.title);
-            if (action.actionIntent != null) {
+            if (!tombstone) {
                 button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
-                //button.setBoolean(R.id.action0, "setEnabled", true);
-                button.setFloat(R.id.button0, "setAlpha", 1.0f);
-                button.setBoolean(R.id.button0, "setClickable", true);
-            } else {
-                //button.setBoolean(R.id.action0, "setEnabled", false);
-                button.setFloat(R.id.button0, "setAlpha", 0.5f);
-                button.setBoolean(R.id.button0, "setClickable", false);
             }
             button.setContentDescription(R.id.action0, action.title);
             return button;
diff --git a/core/res/res/layout/notification_action.xml b/core/res/res/layout/notification_action.xml
index 28812a9..21f2474 100644
--- a/core/res/res/layout/notification_action.xml
+++ b/core/res/res/layout/notification_action.xml
@@ -17,8 +17,9 @@
 <Button xmlns:android="http://schemas.android.com/apk/res/android"
     style="?android:attr/borderlessButtonStyle" 
     android:id="@+id/action0"
-    android:layout_width="match_parent"
+    android:layout_width="0dp"
     android:layout_height="48dp"
+    android:layout_weight="1"
     android:gravity="left|center_vertical"
     android:drawablePadding="8dp"
     android:paddingLeft="8dp"
diff --git a/core/res/res/layout/notification_action_list.xml b/core/res/res/layout/notification_action_list.xml
new file mode 100644
index 0000000..fa0a8c8
--- /dev/null
+++ b/core/res/res/layout/notification_action_list.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/actions"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:visibility="gone"
+    android:showDividers="middle"
+    android:divider="?android:attr/listDivider"
+    >
+    <!-- actions will be added here -->
+</LinearLayout>
diff --git a/core/res/res/layout/notification_action_tombstone.xml b/core/res/res/layout/notification_action_tombstone.xml
index e61e15f..6c59ded 100644
--- a/core/res/res/layout/notification_action_tombstone.xml
+++ b/core/res/res/layout/notification_action_tombstone.xml
@@ -15,12 +15,16 @@
 -->
 
 <Button xmlns:android="http://schemas.android.com/apk/res/android"
+    style="?android:attr/borderlessButtonStyle" 
     android:id="@+id/action0"
-    android:layout_width="match_parent"
+    android:layout_width="0dp"
     android:layout_height="48dp"
+    android:layout_weight="1"
     android:gravity="left|center_vertical"
     android:drawablePadding="8dp"
     android:paddingLeft="8dp"
-    android:textColor="#666"
+    android:textColor="#ccc"
     android:textSize="14dp"
+    android:alpha="0.5"
+    android:enabled="false"
     />
diff --git a/core/res/res/layout/notification_template_big_base.xml b/core/res/res/layout/notification_template_big_base.xml
index 378161c..d50b792 100644
--- a/core/res/res/layout/notification_template_big_base.xml
+++ b/core/res/res/layout/notification_template_big_base.xml
@@ -143,14 +143,11 @@
                 style="?android:attr/progressBarStyleHorizontal"
                 />
         </LinearLayout>
-        <LinearLayout
+        <include
+            layout="@layout/notification_action_list"
             android:id="@+id/actions"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:visibility="gone"
-                >
-                <!-- actions will be added here -->
-        </LinearLayout>
+            />
     </LinearLayout>
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_big_picture.xml b/core/res/res/layout/notification_template_big_picture.xml
index 51e46b2..f98970a 100644
--- a/core/res/res/layout/notification_template_big_picture.xml
+++ b/core/res/res/layout/notification_template_big_picture.xml
@@ -27,11 +27,12 @@
         android:id="@+id/big_picture"
         android:layout_width="match_parent"
         android:layout_height="192dp"
+        android:layout_marginTop="64dp"
+        android:layout_gravity="bottom"
         android:scaleType="centerCrop"
         />
     <include layout="@layout/notification_template_base" 
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="192dp"
         />
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_big_text.xml b/core/res/res/layout/notification_template_big_text.xml
index 77a5f11..210bc13 100644
--- a/core/res/res/layout/notification_template_big_text.xml
+++ b/core/res/res/layout/notification_template_big_text.xml
@@ -105,16 +105,13 @@
                 android:layout_weight="1"
                 />
         </LinearLayout>
-        <LinearLayout
-            android:id="@+id/actions"
+        <include
+            layout="@layout/notification_action_list"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:orientation="vertical"
             android:visibility="gone"
             android:layout_weight="1"
-                >
-                <!-- actions will be added here -->
-        </LinearLayout>
+            />
         <TextView android:id="@+id/overflow_title"
             android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
             android:layout_width="match_parent"
diff --git a/core/res/res/layout/notification_template_inbox.xml b/core/res/res/layout/notification_template_inbox.xml
index 05ec1d8..eb5e759 100644
--- a/core/res/res/layout/notification_template_inbox.xml
+++ b/core/res/res/layout/notification_template_inbox.xml
@@ -93,8 +93,6 @@
             android:layout_height="0dp"
             android:singleLine="true"
             android:ellipsize="end"
-            android:paddingTop="4dp"
-            android:paddingBottom="4dp"
             android:visibility="gone"
             android:layout_weight="1"
             />
@@ -104,8 +102,6 @@
             android:layout_height="0dp"
             android:singleLine="true"
             android:ellipsize="end"
-            android:paddingTop="4dp"
-            android:paddingBottom="4dp"
             android:visibility="gone"
             android:layout_weight="1"
             />
@@ -115,8 +111,6 @@
             android:layout_height="0dp"
             android:singleLine="true"
             android:ellipsize="end"
-            android:paddingTop="4dp"
-            android:paddingBottom="4dp"
             android:visibility="gone"
             android:layout_weight="1"
             />
@@ -126,8 +120,6 @@
             android:layout_height="0dp"
             android:singleLine="true"
             android:ellipsize="end"
-            android:paddingTop="4dp"
-            android:paddingBottom="4dp"
             android:visibility="gone"
             android:layout_weight="1"
             />
@@ -137,21 +129,16 @@
             android:layout_height="0dp"
             android:singleLine="true"
             android:ellipsize="end"
-            android:paddingTop="4dp"
-            android:paddingBottom="4dp"
             android:visibility="gone"
             android:layout_weight="1"
             />
-        <LinearLayout
+        <include
+            layout="@layout/notification_action_list"
             android:id="@+id/actions"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:orientation="vertical"
             android:layout_weight="0"
-            android:visibility="gone"
-           >
-          <!-- actions will be added here -->
-        </LinearLayout>
+            />
         <TextView android:id="@+id/overflow_title"
             android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
             android:layout_width="match_parent"
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 2b34dab..8bf6b5c 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -239,22 +239,25 @@
     </style>
     <!-- Notification content styles -->
     <style name="TextAppearance.StatusBar.EventContent">
-        <item name="android:textColor">?android:attr/textColorSecondary</item>
-        <item name="android:textSize">12sp</item>
+        <item name="android:textColor">#808080</item>
+        <item name="android:textSize">14dp</item>
     </style>
     <style name="TextAppearance.StatusBar.EventContent.Title">
-        <item name="android:textColor">?android:attr/textColorPrimary</item>
-        <item name="android:textSize">16sp</item>
+        <item name="android:textColor">#ffffff</item>
+        <item name="android:fontFamily">sans-serif-light</item>
+        <item name="android:textSize">18dp</item>
         <item name="android:textStyle">bold</item>
     </style>
     <style name="TextAppearance.StatusBar.EventContent.Line2">
-        <item name="android:textSize">13sp</item>
+        <!-- inherit all -->
     </style>
     <style name="TextAppearance.StatusBar.EventContent.Info">
-        <!-- inherit all -->
+        <item name="android:textSize">12sp</item>
+        <item name="android:textColor">#666666</item>
     </style>
     <style name="TextAppearance.StatusBar.EventContent.Time">
-        <!-- inherit all -->
+        <item name="android:textSize">12sp</item>
+        <item name="android:textColor">#666666</item>
     </style>
 
     <style name="TextAppearance.Small.CalendarViewWeekDayView">
diff --git a/docs/html/guide/practices/design/performance.jd b/docs/html/guide/practices/design/performance.jd
index c41f971..dd9b554 100644
--- a/docs/html/guide/practices/design/performance.jd
+++ b/docs/html/guide/practices/design/performance.jd
@@ -180,6 +180,9 @@
 trivial getter. This is true in Froyo, but will improve in the future when
 the JIT inlines getter methods.</p>
 
+<p>Note that if you're using ProGuard, you can have the best
+of both worlds because ProGuard can inline accessors for you.</p>
+
 <a name="use_final" id="use_final"></a>
 <h2>Use Static Final For Constants</h2>
 
diff --git a/media/jni/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index d1cf8b5..040d2ab 100755
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -47,20 +47,23 @@
     $(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_SHARED_LIBRARIES := \
+    libandroid_runtime \
+    libaudioflinger \
     libaudioutils \
+    libbinder \
     libcutils \
     libdl \
-    libutils \
-    libandroid_runtime \
-    libnativehelper \
+    libgui \
     libmedia \
-    libaudioflinger \
-    libbinder \
+    libnativehelper \
     libstagefright \
     libstagefright_foundation \
     libstagefright_omx \
-    libgui \
-    libvideoeditorplayer
+    libutils \
+    libvideoeditor_core \
+    libvideoeditor_osal \
+    libvideoeditor_videofilters \
+    libvideoeditorplayer \
 
 
 LOCAL_CFLAGS += \
@@ -72,15 +75,6 @@
     -DUSE_STAGEFRIGHT_READERS \
     -DUSE_STAGEFRIGHT_3GPP_READER
 
-LOCAL_STATIC_LIBRARIES := \
-    libvideoeditor_core \
-    libstagefright_color_conversion \
-    libvideoeditor_3gpwriter \
-    libvideoeditor_mcs \
-    libvideoeditor_videofilters \
-    libvideoeditor_stagefrightshells \
-    libvideoeditor_osal
-
 LOCAL_MODULE:= libvideoeditor_jni
 
 LOCAL_MODULE_TAGS := optional
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 144760e..af77a30 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -16,12 +16,6 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <style name="TextAppearance.StatusBar.Title" parent="@*android:style/TextAppearance.StatusBar">
-        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
-        <item name="android:textStyle">bold</item>
-        <item name="android:textColor">?android:attr/textColorPrimary</item>
-    </style>
-
     <style name="TextAppearance.StatusBar.IntruderAlert"
         parent="@*android:style/TextAppearance.StatusBar">
     </style>
@@ -48,7 +42,7 @@
     </style>
 
     <style name="TextAppearance.StatusBar.Date" parent="@*android:style/TextAppearance.StatusBar.Icon">
-        <item name="android:textSize">16sp</item>
+        <item name="android:textSize">16dp</item>
         <item name="android:textStyle">normal</item>
         <item name="android:textColor">@android:color/holo_blue_light</item>
     </style>
@@ -57,6 +51,7 @@
 
     <style name="TextAppearance.StatusBar.Expanded.Clock">
         <item name="android:textSize">32dp</item>
+        <item name="android:fontFamily">sans-serif-light</item>
         <item name="android:textStyle">normal</item>
         <item name="android:textColor">#ffffff</item>
     </style>
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 6584c7d..2d65dd6 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -186,6 +186,7 @@
     public void removeLongPressCallback() {
         if (mWatchLongPress != null) {
             mHandler.removeCallbacks(mWatchLongPress);
+            mWatchLongPress = null;
         }
     }
 
@@ -245,6 +246,7 @@
                 mCurrView = null;
                 mCurrAnimView = null;
                 mLongPressSent = false;
+                removeLongPressCallback();
                 break;
         }
         return mDragging;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 4b223dd..a352748 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -531,30 +531,27 @@
             }
         }
         catch (RuntimeException e) {
-            exception = e;
-        }
-        if (expandedOneU == null && expandedLarge == null) {
             final String ident = sbn.pkg + "/0x" + Integer.toHexString(sbn.id);
-            Slog.e(TAG, "couldn't inflate view for notification " + ident, exception);
+            Slog.e(TAG, "couldn't inflate view for notification " + ident, e);
             return false;
-        } else {
-            if (expandedOneU != null) {
-                SizeAdaptiveLayout.LayoutParams params =
-                        new SizeAdaptiveLayout.LayoutParams(expandedOneU.getLayoutParams());
-                params.minHeight = minHeight;
-                params.maxHeight = minHeight;
-                adaptive.addView(expandedOneU, params);
-            }
-            if (expandedLarge != null) {
-                SizeAdaptiveLayout.LayoutParams params =
-                        new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
-                params.minHeight = minHeight+1;
-                params.maxHeight = maxHeight;
-                adaptive.addView(expandedLarge, params);
-            }
-            row.setDrawingCacheEnabled(true);
         }
 
+        if (expandedOneU != null) {
+            SizeAdaptiveLayout.LayoutParams params =
+                    new SizeAdaptiveLayout.LayoutParams(expandedOneU.getLayoutParams());
+            params.minHeight = rowHeight;
+            params.maxHeight = rowHeight;
+            adaptive.addView(expandedOneU, params);
+        }
+        if (expandedLarge != null) {
+            SizeAdaptiveLayout.LayoutParams params =
+                    new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
+            params.minHeight = rowHeight+1;
+            params.maxHeight = maxHeight;
+            adaptive.addView(expandedLarge, params);
+        }
+        row.setDrawingCacheEnabled(true);
+
         applyLegacyRowBackground(sbn, content);
 
         row.setTag(R.id.expandable_tag, Boolean.valueOf(large != null));