(Android8.1)拨号盘收藏联系人分析(常用联系人&&收藏联系人)

拨号盘收藏联系人分析(常用联系人&&收藏联系人):

1.[dialer]OldSpeedDialFragment调用onCreateLoader

return ContactTileLoaderFactory.createStrequentPhoneOnlyLoader(getActivity());

2.[dialer]ContactTileLoaderFactory调用(CursorLoader)createStrequentPhoneOnlyLoader

public static CursorLoader createFrequentLoader(Context context) {

return new CursorLoader(context, Contacts.CONTENT_FREQUENT_URI, COLUMNS,

            Contacts.STARRED +"=?", new String[]{"0"}, null);//收藏联系人字段STARRED 

}

3.[framework/base]CursorLoader调用-> ForceLoadContentObserver();

4.[OldSpeedDialFragment] 

 @Override public void onLoadFinished(Loader loader, Cursor data) {

      mContactTileAdapter.setContactCursor(data);//调用PhoneFavoritesTileAdapter->setContactCursor

      setEmptyViewVisibility(mContactTileAdapter.getCount() == 0);

    }

5.[dialer]PhoneFavoritesTileAdapter

  void setContactCursor(Cursor cursor) {

    if (!mDelayCursorUpdates && cursor != null && !cursor.isClosed()) {

      mNumStarred = getNumStarredContacts(cursor);

      if (mAwaitingRemove) {

        mDataSetChangedListener.cacheOffsetsForDatasetChange();

      }

      saveNumFrequentsFromCursor(cursor);

      saveCursorToCache(cursor);

      // cause a refresh of any views that rely on this data

      notifyDataSetChanged();

      // about to start redraw

      mDataSetChangedListener.onDataSetChangedForAnimation();

    }

  }

如有错误请帮忙指出,谢谢!

你可能感兴趣的:((Android8.1)拨号盘收藏联系人分析(常用联系人&&收藏联系人))