Program: 197763
Project: 197763
Buggy source:
private boolean inflateViews(NotificationData.Entry entry,ViewGroup parent,boolean isHeadsUp){
  PackageManager pmUser=getPackageManagerForUser(entry.notification.getUser().getIdentifier());
  int maxHeight=mRowMaxHeight;
  StatusBarNotification sbn=entry.notification;
  RemoteViews contentView=sbn.getNotification().contentView;
  RemoteViews bigContentView=sbn.getNotification().bigContentView;
  if (isHeadsUp) {
    maxHeight=mContext.getResources().getDimensionPixelSize(R.dimen.notification_mid_height);
    bigContentView=sbn.getNotification().headsUpContentView;
  }
  if (contentView == null) {
    return false;
  }
  if (DEBUG) {
    Log.v(TAG,"String_Node_Str" + sbn.getNotification().publicVersion);
  }
  Notification publicNotification=sbn.getNotification().publicVersion;
  ExpandableNotificationRow row;
  boolean hasUserChangedExpansion=false;
  boolean userExpanded=false;
  boolean userLocked=false;
  if (entry.row != null) {
    row=entry.row;
    hasUserChangedExpansion=row.hasUserChangedExpansion();
    userExpanded=row.isUserExpanded();
    userLocked=row.isUserLocked();
    entry.reset();
    if (hasUserChangedExpansion) {
      row.setUserExpanded(userExpanded);
    }
  }
 else {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    row=(ExpandableNotificationRow)inflater.inflate(R.layout.status_bar_notification_row,parent,false);
    row.setExpansionLogger(this,entry.notification.getKey());
  }
  row.setTag(sbn.getPackageName());
  final View guts=row.findViewById(R.id.notification_guts);
  final String pkg=entry.notification.getPackageName();
  String appname=pkg;
  Drawable pkgicon=null;
  int appUid=-1;
  try {
    final ApplicationInfo info=pmUser.getApplicationInfo(pkg,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
    if (info != null) {
      appname=String.valueOf(pmUser.getApplicationLabel(info));
      pkgicon=pmUser.getApplicationIcon(info);
      appUid=info.uid;
    }
  }
 catch (  NameNotFoundException e) {
    pkgicon=pmUser.getDefaultActivityIcon();
  }
  ((ImageView)row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon);
  ((DateTimeView)row.findViewById(R.id.timestamp)).setTime(entry.notification.getPostTime());
  ((TextView)row.findViewById(R.id.pkgname)).setText(appname);
  final View settingsButton=guts.findViewById(R.id.notification_inspect_item);
  if (appUid >= 0) {
    final int appUidF=appUid;
    settingsButton.setOnClickListener(new View.OnClickListener(){
      public void onClick(      View v){
        startAppNotificationSettingsActivity(pkg,appUidF);
      }
    }
);
  }
 else {
    settingsButton.setVisibility(View.GONE);
  }
  workAroundBadLayerDrawableOpacity(row);
  View vetoButton=updateNotificationVetoButton(row,sbn);
  vetoButton.setContentDescription(mContext.getString(R.string.accessibility_remove_notification));
  NotificationContentView expanded=(NotificationContentView)row.findViewById(R.id.expanded);
  NotificationContentView expandedPublic=(NotificationContentView)row.findViewById(R.id.expandedPublic);
  row.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
  PendingIntent contentIntent=sbn.getNotification().contentIntent;
  if (contentIntent != null) {
    final View.OnClickListener listener=makeClicker(contentIntent,sbn.getKey(),isHeadsUp);
    row.setOnClickListener(listener);
  }
 else {
    row.setOnClickListener(null);
  }
  View contentViewLocal=null;
  View bigContentViewLocal=null;
  try {
    contentViewLocal=contentView.apply(mContext,expanded,mOnClickHandler);
    if (bigContentView != null) {
      bigContentViewLocal=bigContentView.apply(mContext,expanded,mOnClickHandler);
    }
  }
 catch (  RuntimeException e) {
    final String ident=sbn.getPackageName() + "String_Node_Str" + Integer.toHexString(sbn.getId());
    Log.e(TAG,"String_Node_Str" + ident,e);
    return false;
  }
  if (contentViewLocal != null) {
    contentViewLocal.setIsRootNamespace(true);
    expanded.setContractedChild(contentViewLocal);
  }
  if (bigContentViewLocal != null) {
    bigContentViewLocal.setIsRootNamespace(true);
    expanded.setExpandedChild(bigContentViewLocal);
  }
  View publicViewLocal=null;
  if (publicNotification != null) {
    try {
      publicViewLocal=publicNotification.contentView.apply(mContext,expandedPublic,mOnClickHandler);
      if (publicViewLocal != null) {
        publicViewLocal.setIsRootNamespace(true);
        expandedPublic.setContractedChild(publicViewLocal);
      }
    }
 catch (    RuntimeException e) {
      final String ident=sbn.getPackageName() + "String_Node_Str" + Integer.toHexString(sbn.getId());
      Log.e(TAG,"String_Node_Str" + ident,e);
      publicViewLocal=null;
    }
  }
  if (publicViewLocal == null) {
    publicViewLocal=LayoutInflater.from(mContext).inflate(com.android.internal.R.layout.notification_template_material_base,expandedPublic,true);
    final TextView title=(TextView)publicViewLocal.findViewById(com.android.internal.R.id.title);
    try {
      title.setText(pmUser.getApplicationLabel(pmUser.getApplicationInfo(entry.notification.getPackageName(),0)));
    }
 catch (    NameNotFoundException e) {
      title.setText(entry.notification.getPackageName());
    }
    final ImageView icon=(ImageView)publicViewLocal.findViewById(com.android.internal.R.id.icon);
    final ImageView profileBadge=(ImageView)publicViewLocal.findViewById(com.android.internal.R.id.profile_badge_line3);
    final StatusBarIcon ic=new StatusBarIcon(entry.notification.getPackageName(),entry.notification.getUser(),entry.notification.getNotification().icon,entry.notification.getNotification().iconLevel,entry.notification.getNotification().number,entry.notification.getNotification().tickerText);
    Drawable iconDrawable=StatusBarIconView.getIcon(mContext,ic);
    icon.setImageDrawable(iconDrawable);
    if (mNotificationColorUtil.isGrayscale(iconDrawable)) {
      icon.setBackgroundResource(com.android.internal.R.drawable.notification_icon_legacy_bg);
      int padding=mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_large_icon_circle_padding);
      icon.setPadding(padding,padding,padding,padding);
    }
    if (profileBadge != null) {
      Drawable profileDrawable=mUserManager.getBadgeForUser(entry.notification.getUser(),0);
      if (profileDrawable != null) {
        profileBadge.setImageDrawable(profileDrawable);
        profileBadge.setVisibility(View.VISIBLE);
      }
 else {
        profileBadge.setVisibility(View.GONE);
      }
    }
    final View privateTime=contentViewLocal.findViewById(com.android.internal.R.id.time);
    if (privateTime != null && privateTime.getVisibility() == View.VISIBLE) {
      final View timeStub=publicViewLocal.findViewById(com.android.internal.R.id.time);
      timeStub.setVisibility(View.VISIBLE);
      final DateTimeView dateTimeView=(DateTimeView)publicViewLocal.findViewById(com.android.internal.R.id.time);
      dateTimeView.setTime(entry.notification.getNotification().when);
    }
    final TextView text=(TextView)publicViewLocal.findViewById(com.android.internal.R.id.text);
    if (text != null) {
      text.setText(R.string.notification_hidden_text);
      text.setTextAppearance(mContext,R.style.TextAppearance_Material_Notification_Parenthetical);
    }
    int topPadding=Notification.Builder.calculateTopPadding(mContext,false,mContext.getResources().getConfiguration().fontScale);
    title.setPadding(0,topPadding,0,0);
    entry.autoRedacted=true;
  }
  row.setClearable(sbn.isClearable());
  if (MULTIUSER_DEBUG) {
    TextView debug=(TextView)row.findViewById(R.id.debug_info);
    if (debug != null) {
      debug.setVisibility(View.VISIBLE);
      debug.setText("String_Node_Str" + mCurrentUserId + "String_Node_Str"+ entry.notification.getUserId());
    }
  }
  entry.row=row;
  entry.row.setHeightRange(mRowMinHeight,maxHeight);
  entry.row.setOnActivatedListener(this);
  entry.expanded=contentViewLocal;
  entry.expandedPublic=publicViewLocal;
  entry.setBigContentView(bigContentViewLocal);
  applyColorsAndBackgrounds(sbn,entry);
  if (hasUserChangedExpansion) {
    row.setUserExpanded(userExpanded);
  }
  row.setUserLocked(userLocked);
  return true;
}

Fixed version (ground truth):
private boolean inflateViews(NotificationData.Entry entry,ViewGroup parent,boolean isHeadsUp){
  PackageManager pmUser=getPackageManagerForUser(entry.notification.getUser().getIdentifier());
  int maxHeight=mRowMaxHeight;
  StatusBarNotification sbn=entry.notification;
  RemoteViews contentView=sbn.getNotification().contentView;
  RemoteViews bigContentView=sbn.getNotification().bigContentView;
  if (isHeadsUp) {
    maxHeight=mContext.getResources().getDimensionPixelSize(R.dimen.notification_mid_height);
    bigContentView=sbn.getNotification().headsUpContentView;
  }
  if (contentView == null) {
    return false;
  }
  if (DEBUG) {
    Log.v(TAG,"String_Node_Str" + sbn.getNotification().publicVersion);
  }
  Notification publicNotification=sbn.getNotification().publicVersion;
  ExpandableNotificationRow row;
  boolean hasUserChangedExpansion=false;
  boolean userExpanded=false;
  boolean userLocked=false;
  if (entry.row != null) {
    row=entry.row;
    hasUserChangedExpansion=row.hasUserChangedExpansion();
    userExpanded=row.isUserExpanded();
    userLocked=row.isUserLocked();
    entry.reset();
    if (hasUserChangedExpansion) {
      row.setUserExpanded(userExpanded);
    }
  }
 else {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    row=(ExpandableNotificationRow)inflater.inflate(R.layout.status_bar_notification_row,parent,false);
    row.setExpansionLogger(this,entry.notification.getKey());
  }
  row.setTag(sbn.getPackageName());
  final View guts=row.findViewById(R.id.notification_guts);
  final String pkg=entry.notification.getPackageName();
  String appname=pkg;
  Drawable pkgicon=null;
  int appUid=-1;
  try {
    final ApplicationInfo info=pmUser.getApplicationInfo(pkg,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
    if (info != null) {
      appname=String.valueOf(pmUser.getApplicationLabel(info));
      pkgicon=pmUser.getApplicationIcon(info);
      appUid=info.uid;
    }
  }
 catch (  NameNotFoundException e) {
    pkgicon=pmUser.getDefaultActivityIcon();
  }
  ((ImageView)row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon);
  ((DateTimeView)row.findViewById(R.id.timestamp)).setTime(entry.notification.getPostTime());
  ((TextView)row.findViewById(R.id.pkgname)).setText(appname);
  final View settingsButton=guts.findViewById(R.id.notification_inspect_item);
  if (appUid >= 0) {
    final int appUidF=appUid;
    settingsButton.setOnClickListener(new View.OnClickListener(){
      public void onClick(      View v){
        startAppNotificationSettingsActivity(pkg,appUidF);
      }
    }
);
  }
 else {
    settingsButton.setVisibility(View.GONE);
  }
  workAroundBadLayerDrawableOpacity(row);
  View vetoButton=updateNotificationVetoButton(row,sbn);
  vetoButton.setContentDescription(mContext.getString(R.string.accessibility_remove_notification));
  NotificationContentView expanded=(NotificationContentView)row.findViewById(R.id.expanded);
  NotificationContentView expandedPublic=(NotificationContentView)row.findViewById(R.id.expandedPublic);
  row.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
  PendingIntent contentIntent=sbn.getNotification().contentIntent;
  if (contentIntent != null) {
    final View.OnClickListener listener=makeClicker(contentIntent,sbn.getKey(),isHeadsUp);
    row.setOnClickListener(listener);
  }
 else {
    row.setOnClickListener(null);
  }
  View contentViewLocal=null;
  View bigContentViewLocal=null;
  try {
    contentViewLocal=contentView.apply(mContext,expanded,mOnClickHandler);
    if (bigContentView != null) {
      bigContentViewLocal=bigContentView.apply(mContext,expanded,mOnClickHandler);
    }
  }
 catch (  RuntimeException e) {
    final String ident=sbn.getPackageName() + "String_Node_Str" + Integer.toHexString(sbn.getId());
    Log.e(TAG,"String_Node_Str" + ident,e);
    return false;
  }
  if (contentViewLocal != null) {
    contentViewLocal.setIsRootNamespace(true);
    expanded.setContractedChild(contentViewLocal);
  }
  if (bigContentViewLocal != null) {
    bigContentViewLocal.setIsRootNamespace(true);
    expanded.setExpandedChild(bigContentViewLocal);
  }
  View publicViewLocal=null;
  if (publicNotification != null) {
    try {
      publicViewLocal=publicNotification.contentView.apply(mContext,expandedPublic,mOnClickHandler);
      if (publicViewLocal != null) {
        publicViewLocal.setIsRootNamespace(true);
        expandedPublic.setContractedChild(publicViewLocal);
      }
    }
 catch (    RuntimeException e) {
      final String ident=sbn.getPackageName() + "String_Node_Str" + Integer.toHexString(sbn.getId());
      Log.e(TAG,"String_Node_Str" + ident,e);
      publicViewLocal=null;
    }
  }
  if (publicViewLocal == null) {
    publicViewLocal=LayoutInflater.from(mContext).inflate(com.android.internal.R.layout.notification_template_material_base,expandedPublic,false);
    publicViewLocal.setIsRootNamespace(true);
    expandedPublic.setContractedChild(publicViewLocal);
    final TextView title=(TextView)publicViewLocal.findViewById(com.android.internal.R.id.title);
    try {
      title.setText(pmUser.getApplicationLabel(pmUser.getApplicationInfo(entry.notification.getPackageName(),0)));
    }
 catch (    NameNotFoundException e) {
      title.setText(entry.notification.getPackageName());
    }
    final ImageView icon=(ImageView)publicViewLocal.findViewById(com.android.internal.R.id.icon);
    final ImageView profileBadge=(ImageView)publicViewLocal.findViewById(com.android.internal.R.id.profile_badge_line3);
    final StatusBarIcon ic=new StatusBarIcon(entry.notification.getPackageName(),entry.notification.getUser(),entry.notification.getNotification().icon,entry.notification.getNotification().iconLevel,entry.notification.getNotification().number,entry.notification.getNotification().tickerText);
    Drawable iconDrawable=StatusBarIconView.getIcon(mContext,ic);
    icon.setImageDrawable(iconDrawable);
    if (mNotificationColorUtil.isGrayscale(iconDrawable)) {
      icon.setBackgroundResource(com.android.internal.R.drawable.notification_icon_legacy_bg);
      int padding=mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_large_icon_circle_padding);
      icon.setPadding(padding,padding,padding,padding);
    }
    if (profileBadge != null) {
      Drawable profileDrawable=mUserManager.getBadgeForUser(entry.notification.getUser(),0);
      if (profileDrawable != null) {
        profileBadge.setImageDrawable(profileDrawable);
        profileBadge.setVisibility(View.VISIBLE);
      }
 else {
        profileBadge.setVisibility(View.GONE);
      }
    }
    final View privateTime=contentViewLocal.findViewById(com.android.internal.R.id.time);
    if (privateTime != null && privateTime.getVisibility() == View.VISIBLE) {
      final View timeStub=publicViewLocal.findViewById(com.android.internal.R.id.time);
      timeStub.setVisibility(View.VISIBLE);
      final DateTimeView dateTimeView=(DateTimeView)publicViewLocal.findViewById(com.android.internal.R.id.time);
      dateTimeView.setTime(entry.notification.getNotification().when);
    }
    final TextView text=(TextView)publicViewLocal.findViewById(com.android.internal.R.id.text);
    if (text != null) {
      text.setText(R.string.notification_hidden_text);
      text.setTextAppearance(mContext,R.style.TextAppearance_Material_Notification_Parenthetical);
    }
    int topPadding=Notification.Builder.calculateTopPadding(mContext,false,mContext.getResources().getConfiguration().fontScale);
    title.setPadding(0,topPadding,0,0);
    entry.autoRedacted=true;
  }
  row.setClearable(sbn.isClearable());
  if (MULTIUSER_DEBUG) {
    TextView debug=(TextView)row.findViewById(R.id.debug_info);
    if (debug != null) {
      debug.setVisibility(View.VISIBLE);
      debug.setText("String_Node_Str" + mCurrentUserId + "String_Node_Str"+ entry.notification.getUserId());
    }
  }
  entry.row=row;
  entry.row.setHeightRange(mRowMinHeight,maxHeight);
  entry.row.setOnActivatedListener(this);
  entry.expanded=contentViewLocal;
  entry.expandedPublic=publicViewLocal;
  entry.setBigContentView(bigContentViewLocal);
  applyColorsAndBackgrounds(sbn,entry);
  if (hasUserChangedExpansion) {
    row.setUserExpanded(userExpanded);
  }
  row.setUserLocked(userLocked);
  return true;
}