code: public void setDefaultActivity(int index) {
          synchronized (mInstanceLock) {
              ensureConsistentState();
  
              ActivityResolveInfo newDefaultActivity = mActivities.get(index);
              ActivityResolveInfo oldDefaultActivity = mActivities.get(0);
  
              final float weight;
              if (oldDefaultActivity != null) {
                  // Add a record with weight enough to boost the chosen at the top.
                  weight = oldDefaultActivity.weight - newDefaultActivity.weight
                          + DEFAULT_ACTIVITY_INFLATION;
              } else {
                  weight = DEFAULT_HISTORICAL_RECORD_WEIGHT;
              }
  
              ComponentName defaultName = new ComponentName(
                      newDefaultActivity.resolveInfo.activityInfo.packageName,
                      newDefaultActivity.resolveInfo.activityInfo.name);
              HistoricalRecord historicalRecord = new HistoricalRecord(defaultName,
                      System.currentTimeMillis(), weight);
              addHisoricalRecord(historicalRecord);
          }
      }
docs: Sets the default activity. The default activity is set by adding a
  historical record with weight high enough that this activity will
  become the highest ranked. Such a strategy guarantees that the default
  will eventually change if not used. Also the weight of the record for
  setting a default is inflated with a constant amount to guarantee that
  it will stay as default for awhile.
  
  @param index The index of the activity to set as default.