void saveState(Bundle outState){
  final int numTabs=getTabCount();
  if (numTabs == 0) {
    return;
  }
  long[] ids=new long[numTabs];
  int i=0;
  for (  Tab tab : mTabs) {
    Bundle tabState=tab.saveState();
    if (tabState != null && tab.isPrivateBrowsingEnabled() == false) {
      ids[i++]=tab.getId();
      String key=Long.toString(tab.getId());
      if (outState.containsKey(key)) {
        for (        Tab dt : mTabs) {
          Log.e(LOGTAG,dt.toString());
        }
        throw new IllegalStateException("Error saving state, duplicate tab ids!");
      }
      outState.putBundle(key,tabState);
    }
 else {
      ids[i++]=-1;
      tab.deleteThumbnail();
    }
  }
  if (!outState.isEmpty()) {
    outState.putLongArray(POSITIONS,ids);
    Tab current=getCurrentTab();
    long cid=-1;
    if (current != null) {
      cid=current.getId();
    }
    outState.putLong(CURRENT,cid);
  }
}

void saveState ( Bundle outState ) { final int numTabs = getTabCount ( ) ; if ( numTabs == 0 ) { return ; } long [ ] ids = new long [ numTabs ] ; int i = 0 ; for ( Tab tab : mTabs ) { Bundle tabState = tab . saveState ( ) ; if ( tabState != null && tab . isPrivateBrowsingEnabled ( ) == false ) { ids [ i ++ ] = tab . getId ( ) ; String key = Long . toString ( tab . getId ( ) ) ; if ( outState . containsKey ( key ) ) { for ( Tab dt : mTabs ) { Log . e ( LOGTAG , dt . toString ( ) ) ; } throw new IllegalStateException ( "Error saving state, duplicate tab ids!" ) ; } outState . putBundle ( key , tabState ) ; } else { ids [ i ++ ] = - 1 ; tab . deleteThumbnail ( ) ; } } if ( ! outState . isEmpty ( ) ) { outState . putLongArray ( POSITIONS , ids ) ; Tab current = getCurrentTab ( ) ; long cid = - 1 ; if ( current != null ) { cid = current . getId ( ) ; } outState . putLong ( CURRENT , cid ) ; } }
save the tab state : current position position sorted array of tab ids for each tab id , save the tab state
