这个我做过,可以通过判断RawContacts.ACCOUNT_TYPE,不过就是有一些机子我获取不到RawContacts.ACCOUNT_TYPEZ这个数据库字段  Cursor cursor2 = activity.getContentResolver().query(
                         RawContacts.CONTENT_URI,null,Where,WhereParams,null);
                         int type = cursor2.getColumnIndex(RawContacts.ACCOUNT_TYPE);
                        if(cursor2.moveToFirst())
                        {
                         String typeString=cursor2.getString(type);
                         //如果数据类型为NULL,设置为本地联系人
                         if(typeString==null)typeString="vnd.sec.contact.phone";
                         //如果不是本机联系人
                        if(!typeString.equals("vnd.sec.contact.phone")){
                         //关闭
                         if (!cursor2.isClosed())
                           {
                                   cursor2.close();
                           }
                         continue;
                        }
                        }