Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b11d05d authored by Adam Lesinski's avatar Adam Lesinski Committed by gitbuildkicker
Browse files

Make sure system UI context has the same LoadedApk as system context

When the system Application object is created, it should be shared by
both system and system UI context.

Bug: 37111478
Test: - Open settings
Test: - adb shell am crash com.android.settings
Test: - with crash dialog open, press volume keys
Test: - observe no crash
Change-Id: I2b4656680d25fe61fee69c01ee10522aac4e2942
(cherry picked from commit 6f1a9171)
parent f708f301
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2199,7 +2199,7 @@ public final class ActivityThread {
    public ContextImpl getSystemUiContext() {
        synchronized (this) {
            if (mSystemUiContext == null) {
                mSystemUiContext = ContextImpl.createSystemUiContext(this);
                mSystemUiContext = ContextImpl.createSystemUiContext(getSystemContext());
            }
            return mSystemUiContext;
        }
+5 −4
Original line number Diff line number Diff line
@@ -2219,11 +2219,12 @@ class ContextImpl extends Context {

    /**
     * System Context to be used for UI. This Context has resources that can be themed.
     * Make sure that the created system UI context shares the same LoadedApk as the system context.
     */
    static ContextImpl createSystemUiContext(ActivityThread mainThread) {
        LoadedApk packageInfo = new LoadedApk(mainThread);
        ContextImpl context = new ContextImpl(null, mainThread, packageInfo, null, null, null, 0,
                null);
    static ContextImpl createSystemUiContext(ContextImpl systemContext) {
        final LoadedApk packageInfo = systemContext.mPackageInfo;
        ContextImpl context = new ContextImpl(null, systemContext.mMainThread, packageInfo, null,
                null, null, 0, null);
        context.setResources(createResources(null, packageInfo, null, Display.DEFAULT_DISPLAY, null,
                packageInfo.getCompatibilityInfo()));
        return context;