question: 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 ; }
target:  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.