源码基于API26
mParent干嘛来着,带着这个疑问上车了
通过源码发现在Activity中attach()方法中赋值了,事实上还有个方法也可以赋值,即setParent(Activity parent).
不多说直接看attach()
final void attach(Context
context, ActivityThread aThread,
Instrumentation instr, IBinder token, int ident,
Application application, Intent intent, ActivityInfo info,
CharSequence title, Activity parent, String id,
NonConfigurationInstances lastNonConfigurationInstances,
Configuration config, String referrer, IVoiceInteractor voiceInteractor,
Window window) {
…
mMainThread = aThread;
mInstrumentation = instr;
mToken = token;
mIdent = ident;
mApplication = application;
mIntent = intent;
mReferrer = referrer;
mComponent = intent.getComponent();
mActivityInfo = info;
mTitle = title;
//在这里被赋值了