summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-11-15 19:51:56 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-15 19:51:56 -0800
commit45f05c9580739ffe2d665cec50efb0bb57d757ba (patch)
tree27bd99a75b42a27622a00b679f767c46e5496a61 /packages
parent3e7497b4eccd3db1d6ff0ce1f1f2db11f9a8eeef (diff)
parent29ea525d18b3c36c56e0c5391bb849a9baf27668 (diff)
downloadframeworks_base-45f05c9580739ffe2d665cec50efb0bb57d757ba.zip
frameworks_base-45f05c9580739ffe2d665cec50efb0bb57d757ba.tar.gz
frameworks_base-45f05c9580739ffe2d665cec50efb0bb57d757ba.tar.bz2
Merge "Fix bug 5623642 - Status bar background incompatible with some legacy apps" into ics-mr1
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/drawable/notification_row_legacy_bg.xml22
-rw-r--r--packages/SystemUI/res/values/colors.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java25
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java30
4 files changed, 76 insertions, 2 deletions
diff --git a/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml b/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml
new file mode 100644
index 0000000..ce3372e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+
+ <item android:state_pressed="true" android:drawable="@drawable/notification_item_background_color_pressed" />
+ <item android:state_pressed="false" android:drawable="@drawable/notification_item_background_legacy_color" />
+</selector>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index ff67a7e..3a2ea65 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -30,4 +30,5 @@
<drawable name="notification_tracking_bg">#d8000000</drawable>
<color name="notification_list_shadow_top">#80000000</color>
<drawable name="recents_callout_line">#99ffffff</drawable>
+ <drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index b0554d0..f0093d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -28,11 +28,14 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.Handler;
@@ -775,6 +778,8 @@ public class PhoneStatusBar extends StatusBar {
row.setDrawingCacheEnabled(true);
}
+ applyLegacyRowBackground(notification, content);
+
return new View[] { row, content, expanded };
}
@@ -948,6 +953,8 @@ public class PhoneStatusBar extends StatusBar {
row.setDrawingCacheEnabled(true);
}
+ applyLegacyRowBackground(sbn, content);
+
entry.row = row;
entry.content = content;
entry.expanded = expanded;
@@ -956,6 +963,24 @@ public class PhoneStatusBar extends StatusBar {
return true;
}
+ void applyLegacyRowBackground(StatusBarNotification sbn, View content) {
+ if (sbn.notification.contentView.getLayoutId() !=
+ com.android.internal.R.layout.status_bar_latest_event_content) {
+ int version = 0;
+ try {
+ ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.pkg, 0);
+ version = info.targetSdkVersion;
+ } catch (NameNotFoundException ex) {
+ Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.pkg, ex);
+ }
+ if (version > 0 && version < Build.VERSION_CODES.HONEYCOMB) {
+ content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
+ } else {
+ content.setBackgroundResource(R.drawable.notification_row_bg);
+ }
+ }
+ }
+
StatusBarNotification removeNotificationViews(IBinder key) {
NotificationData.Entry entry = mNotificationData.remove(key);
if (entry == null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 5c691aa..01406bc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -32,13 +32,17 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.inputmethodservice.InputMethodService;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
+import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -1742,8 +1746,10 @@ public class TabletStatusBar extends StatusBar implements
}
void workAroundBadLayerDrawableOpacity(View v) {
- LayerDrawable d = (LayerDrawable)v.getBackground();
- if (d == null) return;
+ Drawable bgd = v.getBackground();
+ if (!(bgd instanceof LayerDrawable)) return;
+
+ LayerDrawable d = (LayerDrawable) bgd;
v.setBackgroundDrawable(null);
d.setOpacity(PixelFormat.TRANSLUCENT);
v.setBackgroundDrawable(d);
@@ -1809,6 +1815,8 @@ public class TabletStatusBar extends StatusBar implements
row.setDrawingCacheEnabled(true);
}
+ applyLegacyRowBackground(sbn, content);
+
entry.row = row;
entry.content = content;
entry.expanded = expanded;
@@ -1817,6 +1825,24 @@ public class TabletStatusBar extends StatusBar implements
return true;
}
+ void applyLegacyRowBackground(StatusBarNotification sbn, View content) {
+ if (sbn.notification.contentView.getLayoutId() !=
+ com.android.internal.R.layout.status_bar_latest_event_content) {
+ int version = 0;
+ try {
+ ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.pkg, 0);
+ version = info.targetSdkVersion;
+ } catch (NameNotFoundException ex) {
+ Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.pkg, ex);
+ }
+ if (version > 0 && version < Build.VERSION_CODES.HONEYCOMB) {
+ content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
+ } else {
+ content.setBackgroundResource(R.drawable.notification_row_bg);
+ }
+ }
+ }
+
public void clearAll() {
try {
mBarService.onClearAllNotifications();