Fix crashes after notifying bad notification
If applications whose targetSDK is below N build notification without contentView, contentView is created at inside of build() function in Notification.Builder. If application apply removeAllViews to this contentView, Notification View can have id 'status_bar_latest_event_content' without standard layout of notification. When inflating this notification, SystemUI try to wrap it with NotificationTemplateViewWrapper(its id is 'status_bar_latest_event_content'), and crash, because it does not have expected views. Test: Install & launch attached apk in below BUG url to N devices, and try to make notification by clicking 'do it' button. https://code.google.com/p/android/issues/detail?id=223479 Bug:31948446 Change-Id: Ifcdc79a117613e8afd2e8ed098afd211cceabf88
This commit is contained in:
committed by
Selim Cinek
parent
73c46f0609
commit
78c4114101
@@ -1706,12 +1706,6 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
sbn.getPackageContext(mContext),
|
sbn.getPackageContext(mContext),
|
||||||
contentContainerPublic, mOnClickHandler);
|
contentContainerPublic, mOnClickHandler);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (RuntimeException e) {
|
|
||||||
final String ident = sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId());
|
|
||||||
Log.e(TAG, "couldn't inflate view for notification " + ident, e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contentViewLocal != null) {
|
if (contentViewLocal != null) {
|
||||||
contentViewLocal.setIsRootNamespace(true);
|
contentViewLocal.setIsRootNamespace(true);
|
||||||
@@ -1729,6 +1723,12 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
publicViewLocal.setIsRootNamespace(true);
|
publicViewLocal.setIsRootNamespace(true);
|
||||||
contentContainerPublic.setContractedChild(publicViewLocal);
|
contentContainerPublic.setContractedChild(publicViewLocal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (RuntimeException e) {
|
||||||
|
final String ident = sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId());
|
||||||
|
Log.e(TAG, "couldn't inflate view for notification " + ident, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Extract target SDK version.
|
// Extract target SDK version.
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user