Program: 32212
Project: 32212
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_home);
  getActionBar().setDisplayShowTitleEnabled(false);
  mSession=Matrix.getInstance(getApplicationContext()).getDefaultSession();
  if (mSession == null) {
    finish();
    return;
  }
  mMyRoomList=(ExpandableListView)findViewById(R.id.listView_myRooms);
  mAdapter=new RoomSummaryAdapter(this,R.layout.adapter_item_my_rooms);
  if ((null != savedInstanceState) && savedInstanceState.containsKey(UNREAD_MESSAGE_MAP)) {
    Serializable map=savedInstanceState.getSerializable(UNREAD_MESSAGE_MAP);
    if (null != map) {
      mAdapter.setUnreadCountMap((HashMap<String,Integer>)map);
    }
  }
  mMyRoomList.setAdapter(mAdapter);
  mSession.getDataHandler().addListener(mListener);
  mMyRoomList.setOnChildClickListener(new ExpandableListView.OnChildClickListener(){
    @Override public boolean onChildClick(    ExpandableListView parent,    View v,    int groupPosition,    int childPosition,    long id){
      String roomId;
      if (groupPosition == recentsGroupIndex) {
        roomId=mAdapter.getRoomSummaryAt(childPosition).getRoomId();
        mAdapter.resetUnreadCount(roomId);
      }
 else {
        roomId=mAdapter.getPublicRoomAt(childPosition).roomId;
      }
      CommonActivityUtils.goToRoomPage(roomId,HomeActivity.this);
      mAdapter.notifyDataSetChanged();
      return true;
    }
  }
);
  mMyRoomList.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener(){
    @Override public void onGroupCollapse(    int groupPosition){
      if (groupPosition == publicRoomsGroupIndex) {
        if (!mMyRoomList.isGroupExpanded(recentsGroupIndex)) {
          mMyRoomList.expandGroup(recentsGroupIndex);
        }
      }
 else {
        if (!mMyRoomList.isGroupExpanded(publicRoomsGroupIndex)) {
          mMyRoomList.expandGroup(publicRoomsGroupIndex);
        }
      }
    }
  }
);
  mMyRoomList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener(){
    @Override public void onGroupExpand(    int groupPosition){
      if (groupPosition == publicRoomsGroupIndex) {
        refreshPublicRoomsList();
      }
    }
  }
);
  mSearchRoomEditText=(EditText)this.findViewById(R.id.editText_search_room);
  mSearchRoomEditText.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    android.text.Editable s){
      mAdapter.setSearchedPattern(s.toString());
      mMyRoomList.smoothScrollToPosition(0);
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_home);
  if (null != getActionBar()) {
    getActionBar().setDisplayShowTitleEnabled(false);
  }
  mSession=Matrix.getInstance(getApplicationContext()).getDefaultSession();
  if (mSession == null) {
    finish();
    return;
  }
  mMyRoomList=(ExpandableListView)findViewById(R.id.listView_myRooms);
  mAdapter=new RoomSummaryAdapter(this,R.layout.adapter_item_my_rooms);
  if ((null != savedInstanceState) && savedInstanceState.containsKey(UNREAD_MESSAGE_MAP)) {
    Serializable map=savedInstanceState.getSerializable(UNREAD_MESSAGE_MAP);
    if (null != map) {
      mAdapter.setUnreadCountMap((HashMap<String,Integer>)map);
    }
  }
  mMyRoomList.setAdapter(mAdapter);
  mSession.getDataHandler().addListener(mListener);
  mMyRoomList.setOnChildClickListener(new ExpandableListView.OnChildClickListener(){
    @Override public boolean onChildClick(    ExpandableListView parent,    View v,    int groupPosition,    int childPosition,    long id){
      String roomId;
      if (groupPosition == recentsGroupIndex) {
        roomId=mAdapter.getRoomSummaryAt(childPosition).getRoomId();
        mAdapter.resetUnreadCount(roomId);
      }
 else {
        roomId=mAdapter.getPublicRoomAt(childPosition).roomId;
      }
      CommonActivityUtils.goToRoomPage(roomId,HomeActivity.this);
      mAdapter.notifyDataSetChanged();
      return true;
    }
  }
);
  mMyRoomList.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener(){
    @Override public void onGroupCollapse(    int groupPosition){
      if (groupPosition == publicRoomsGroupIndex) {
        if (!mMyRoomList.isGroupExpanded(recentsGroupIndex)) {
          mMyRoomList.expandGroup(recentsGroupIndex);
        }
      }
 else {
        if (!mMyRoomList.isGroupExpanded(publicRoomsGroupIndex)) {
          mMyRoomList.expandGroup(publicRoomsGroupIndex);
        }
      }
    }
  }
);
  mMyRoomList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener(){
    @Override public void onGroupExpand(    int groupPosition){
      if (groupPosition == publicRoomsGroupIndex) {
        refreshPublicRoomsList();
      }
    }
  }
);
  mSearchRoomEditText=(EditText)this.findViewById(R.id.editText_search_room);
  mSearchRoomEditText.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    android.text.Editable s){
      mAdapter.setSearchedPattern(s.toString());
      mMyRoomList.smoothScrollToPosition(0);
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
}