int assign(String webappId){
  int activityIndex=checkIfAssigned(webappId);
  if (activityIndex == INVALID_ACTIVITY_INDEX) {
    activityIndex=mActivityList.get(0).mActivityIndex;
    ActivityEntry newEntry=new ActivityEntry(activityIndex,webappId);
    mActivityList.set(0,newEntry);
  }
  markActivityUsed(activityIndex,webappId);
  return activityIndex;
}

int assign ( String webappId ) { int activityIndex = checkIfAssigned ( webappId ) ; if ( activityIndex == INVALID_ACTIVITY_INDEX ) { activityIndex = mActivityList . get ( 0 ) . mActivityIndex ; ActivityEntry newEntry = new ActivityEntry ( activityIndex , webappId ) ; mActivityList . set ( 0 , newEntry ) ; } markActivityUsed ( activityIndex , webappId ) ; return activityIndex ; }
assigns the webapp with the given id to one of the available webappactivities . if we know that the webapp was previously launched in one of the activities , re - use it . otherwise , take the least recently used webappactivity id and use that .
