Android在frameworks中获取systemUiContext流程
@frameworks/base/core/java/android/app/ActivityThread.java
ActivityThread.currentActivityThread().getSystemUiContext()
return getSystemUiContext(DEFAULT_DISPLAY);
@frameworks/base/core/java/android/app/ContextImpl.java
systemUiContext = ContextImpl.createSystemUiContext(getSystemContext(), displayId);
getSystemContext()
@frameworks/base/core/java/android/app/ContextImpl.java
if (mSystemContext == null) { mSystemContext = ContextImpl.createSystemContext(this); } //mSystemContext的context, context=android.app.ContextImpl@688b00a
LoadedApk packageInfo = new LoadedApk(mainThread);
ContextImpl context = new ContextImpl(null, mainThread, packageInfo, ContextParams.EMPTY, null, null, null, null, null, 0, null, null);
final WindowTokenClient token = new WindowTokenClient();
final ContextImpl context = systemContext.createWindowContextBase(token, displayId); //baseContext=android.app.ContextImpl@13bf2f7
ContextImpl baseContext = new ContextImpl(this, mMainThread, mPackageInfo, mParams, mAttributionSource.getAttributionTag(), mAttributionSource.getNext(), mSplitName, token, mUser, mFlags, mClassLoader, null);
baseContext.mDisplay = ResourcesManager.getInstance().getAdjustedDisplay(displayId, windowContextResources); //调整displayId
token.attachContext(context); //baseContext=android.app.ContextImpl@13bf2f7
token.attachToDisplayContent(displayId);
mDisplaySystemUiContexts.put(displayId, systemUiContext); //systemUiContext=android.app.ContextImpl@13bf2f7
return systemUiContext;