public ComponentName resolveActivity(@NonNull PackageManager pm) { if (mComponent != null) {//如果当前组件不为空,则返回组件,为显式Intent return mComponent; } //如果mComponent为空则是隐式Intent,就解析Intent来获得具体是哪个Intent ResolveInfo info = pm.resolveActivity( this, PackageManager.MATCH_DEFAULT_ONLY); if (info != null) { return new ComponentName(//组装Intent的组件,提供显式调用 info.activityInfo.applicationInfo.packageName, info.activityInfo.name); } return null; }