Program: 93898
Project: 93898
Buggy source:
@Override public View getGroupView(final int groupPosition,boolean isExpanded,View convertView,final ViewGroup parent){
  final BluetoothGattCharacteristic characteristic=m_characteristicList.get(groupPosition);
  final String name=UuidUtil.getCharacteristicName(characteristic);
  final ExpandableListView elv=(ExpandableListView)parent;
  final Context context=parent.getContext();
  boolean writable=(characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_WRITE) != 0;
  boolean readable=(characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_READ) != 0;
  Uuids.GATTCharacteristic gc=Uuids.GATTCharacteristic.getCharacteristicForUUID(characteristic.getUuid());
  Uuids.GATTDisplayType dt=gc != null ? gc.getDisplayType() : Uuids.GATTDisplayType.Hex;
  final CharViewHolder h;
  if (convertView == null) {
    convertView=View.inflate(context,R.layout.characteristic_layout,null);
    h=new CharViewHolder();
    h.parentLayout=(RelativeLayout)convertView.findViewById(R.id.parentLayout);
    h.name=(TextView)convertView.findViewById(R.id.characteristicName);
    h.uuid=(TextView)convertView.findViewById(R.id.uuid);
    h.properties=(TextView)convertView.findViewById(R.id.properties);
    h.valueDisplayTypeLabel=(TextView)convertView.findViewById(R.id.valueDisplayTypeLabel);
    h.value=(TextView)convertView.findViewById(R.id.value);
    h.displayType=dt;
    h.expandArrow=(ImageView)convertView.findViewById(R.id.expandArrow);
    h.parentLayout.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        if (elv.isGroupExpanded(groupPosition))         elv.collapseGroup(groupPosition);
 else         elv.expandGroup(groupPosition);
      }
    }
);
{
      View v=convertView.findViewById(R.id.fakeOverflowMenu);
      final View anchor=convertView.findViewById(R.id.fakeOverflowMenuAnchor);
      v.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          PopupMenu popup=new PopupMenu(context,anchor);
          popup.getMenuInflater().inflate(R.menu.char_value_type_popup,popup.getMenu());
          popup.getMenu().getItem(h.displayType.ordinal()).setChecked(true);
          popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
            public boolean onMenuItemClick(            MenuItem item){
switch (item.getItemId()) {
case R.id.displayTypeBoolean:
                h.displayType=Uuids.GATTDisplayType.Boolean;
              break;
case R.id.displayTypeBitfield:
            h.displayType=Uuids.GATTDisplayType.Bitfield;
          break;
case R.id.displayTypeUnsignedInteger:
        h.displayType=Uuids.GATTDisplayType.UnsignedInteger;
      break;
case R.id.displayTypeSignedInteger:
    h.displayType=Uuids.GATTDisplayType.SignedInteger;
  break;
case R.id.displayTypeDecimal:
h.displayType=Uuids.GATTDisplayType.Decimal;
break;
case R.id.displayTypeString:
h.displayType=Uuids.GATTDisplayType.String;
break;
case R.id.displayTypeHex:
h.displayType=Uuids.GATTDisplayType.Hex;
break;
}
refreshValue(h,characteristic);
return true;
}
}
);
popup.show();
}
}
);
}
convertView.setTag(h);
}
 else {
h=(CharViewHolder)convertView.getTag();
}
if (writable) {
h.valueDisplayTypeLabel.setVisibility(View.VISIBLE);
h.value.setVisibility(View.VISIBLE);
h.value.setTextColor(context.getResources().getColor(R.color.item_title_blue));
h.value.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
Intent intent=new Intent(context,WriteValueActivity.class);
intent.putExtra("String_Node_Str",m_device.getMacAddress());
intent.putExtra("String_Node_Str",m_service.getUuid().toString());
intent.putExtra("String_Node_Str",characteristic.getUuid().toString());
context.startActivity(intent);
}
}
);
}
 else if (readable) {
h.valueDisplayTypeLabel.setVisibility(View.VISIBLE);
h.value.setVisibility(View.VISIBLE);
h.value.setTextColor(context.getResources().getColor(R.color.primary_gray));
}
 else {
h.valueDisplayTypeLabel.setVisibility(View.GONE);
h.value.setVisibility(View.GONE);
}
h.name.setText(name);
final String uuid;
if (name.equals(UuidUtil.CUSTOM_CHARACTERISTIC)) {
uuid=characteristic.getUuid().toString();
}
 else {
uuid=UuidUtil.getShortUuid(characteristic.getUuid());
}
h.uuid.setText(uuid);
final String properties=getPropertyString(characteristic);
h.properties.setText(properties);
{
if (getChildrenCount(groupPosition) < 1) h.expandArrow.setVisibility(View.GONE);
 else h.expandArrow.setVisibility(View.VISIBLE);
boolean expanded=elv.isGroupExpanded(groupPosition);
h.expandArrow.setImageResource(expanded ? R.drawable.ic_expand_less_black_24dp : R.drawable.ic_expand_more_black_24dp);
}
{
if (getChildrenCount(groupPosition) < 1) h.parentLayout.setBackground(null);
}
refreshValue(h,characteristic);
postFixRunnable(h.uuid,h);
return convertView;
}

Fixed version (ground truth):
@Override public View getGroupView(final int groupPosition,boolean isExpanded,View convertView,final ViewGroup parent){
  final BluetoothGattCharacteristic characteristic=m_characteristicList.get(groupPosition);
  final Context context=parent.getContext();
  final ExpandableListView elv=(ExpandableListView)parent;
  Uuids.GATTCharacteristic gc=Uuids.GATTCharacteristic.getCharacteristicForUUID(characteristic.getUuid());
  Uuids.GATTDisplayType dt=gc != null ? gc.getDisplayType() : Uuids.GATTDisplayType.Hex;
  final CharViewHolder h;
  if (convertView == null) {
    convertView=View.inflate(context,R.layout.characteristic_layout,null);
    h=new CharViewHolder();
    h.parentLayout=(RelativeLayout)convertView.findViewById(R.id.parentLayout);
    h.name=(TextView)convertView.findViewById(R.id.characteristicName);
    h.uuid=(TextView)convertView.findViewById(R.id.uuid);
    h.uuidOriginalTextSize=h.uuid.getTextSize();
    h.properties=(TextView)convertView.findViewById(R.id.properties);
    h.valueDisplayTypeLabel=(TextView)convertView.findViewById(R.id.valueDisplayTypeLabel);
    h.value=(TextView)convertView.findViewById(R.id.value);
    h.displayType=dt;
    h.expandArrow=(ImageView)convertView.findViewById(R.id.expandArrow);
    h.parentLayout.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        if (elv.isGroupExpanded(groupPosition))         elv.collapseGroup(groupPosition);
 else         elv.expandGroup(groupPosition);
      }
    }
);
{
      View v=convertView.findViewById(R.id.fakeOverflowMenu);
      final View anchor=convertView.findViewById(R.id.fakeOverflowMenuAnchor);
      v.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          PopupMenu popup=new PopupMenu(context,anchor);
          popup.getMenuInflater().inflate(R.menu.char_value_type_popup,popup.getMenu());
          popup.getMenu().getItem(h.displayType.ordinal()).setChecked(true);
          popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
            public boolean onMenuItemClick(            MenuItem item){
switch (item.getItemId()) {
case R.id.displayTypeBoolean:
                h.displayType=Uuids.GATTDisplayType.Boolean;
              break;
case R.id.displayTypeBitfield:
            h.displayType=Uuids.GATTDisplayType.Bitfield;
          break;
case R.id.displayTypeUnsignedInteger:
        h.displayType=Uuids.GATTDisplayType.UnsignedInteger;
      break;
case R.id.displayTypeSignedInteger:
    h.displayType=Uuids.GATTDisplayType.SignedInteger;
  break;
case R.id.displayTypeDecimal:
h.displayType=Uuids.GATTDisplayType.Decimal;
break;
case R.id.displayTypeString:
h.displayType=Uuids.GATTDisplayType.String;
break;
case R.id.displayTypeHex:
h.displayType=Uuids.GATTDisplayType.Hex;
break;
}
refreshValue(h,characteristic);
return true;
}
}
);
popup.show();
}
}
);
}
convertView.setTag(h);
}
 else {
h=(CharViewHolder)convertView.getTag();
}
refreshCharacteristicView(elv,groupPosition,h,characteristic);
return convertView;
}