Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78c41141 authored by dooyoung.hwang's avatar dooyoung.hwang Committed by Selim Cinek
Browse files

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
parent 73c46f06
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -1706,12 +1706,6 @@ public abstract class BaseStatusBar extends SystemUI implements
                        sbn.getPackageContext(mContext),
                        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) {
                contentViewLocal.setIsRootNamespace(true);
@@ -1729,6 +1723,12 @@ public abstract class BaseStatusBar extends SystemUI implements
                publicViewLocal.setIsRootNamespace(true);
                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.
        try {