Merge "Fix CharSequence nonsense in NotificationStation." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c9a8abb538
@@ -87,7 +87,7 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private NotificationListenerService mListener = new NotificationListenerService() {
|
private final NotificationListenerService mListener = new NotificationListenerService() {
|
||||||
@Override
|
@Override
|
||||||
public void onNotificationPosted(StatusBarNotification sbn, RankingMap ranking) {
|
public void onNotificationPosted(StatusBarNotification sbn, RankingMap ranking) {
|
||||||
logd("onNotificationPosted: %s", sbn.getNotification());
|
logd("onNotificationPosted: %s", sbn.getNotification());
|
||||||
@@ -135,22 +135,16 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
mPm = mContext.getPackageManager();
|
mPm = mContext.getPackageManager();
|
||||||
mNoMan = INotificationManager.Stub.asInterface(
|
mNoMan = INotificationManager.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
||||||
try {
|
|
||||||
mListener.registerAsSystemService(mContext, new ComponentName(mContext.getPackageName(),
|
|
||||||
this.getClass().getCanonicalName()), ActivityManager.getCurrentUser());
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(TAG, "Cannot register listener", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetach() {
|
public void onPause() {
|
||||||
try {
|
try {
|
||||||
mListener.unregisterAsSystemService();
|
mListener.unregisterAsSystemService();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Cannot unregister listener", e);
|
Log.e(TAG, "Cannot unregister listener", e);
|
||||||
}
|
}
|
||||||
super.onDetach();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -171,6 +165,12 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
logd("onResume()");
|
logd("onResume()");
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
try {
|
||||||
|
mListener.registerAsSystemService(mContext, new ComponentName(mContext.getPackageName(),
|
||||||
|
this.getClass().getCanonicalName()), ActivityManager.getCurrentUser());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Cannot register listener", e);
|
||||||
|
}
|
||||||
refreshList();
|
refreshList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,17 +205,17 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getTitleString(Notification n) {
|
private static String getTitleString(Notification n) {
|
||||||
String title = null;
|
CharSequence title = null;
|
||||||
if (n.extras != null) {
|
if (n.extras != null) {
|
||||||
title = n.extras.getString(Notification.EXTRA_TITLE);
|
title = n.extras.getCharSequence(Notification.EXTRA_TITLE);
|
||||||
if (TextUtils.isEmpty(title)) {
|
if (TextUtils.isEmpty(title)) {
|
||||||
title = n.extras.getString(Notification.EXTRA_TEXT);
|
title = n.extras.getCharSequence(Notification.EXTRA_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(title) && !TextUtils.isEmpty(n.tickerText)) {
|
if (TextUtils.isEmpty(title) && !TextUtils.isEmpty(n.tickerText)) {
|
||||||
title = n.tickerText.toString();
|
title = n.tickerText;
|
||||||
}
|
}
|
||||||
return title;
|
return String.valueOf(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatPendingIntent(PendingIntent pi) {
|
private static String formatPendingIntent(PendingIntent pi) {
|
||||||
|
Reference in New Issue
Block a user