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

Commit 64dc0380 authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

Fix layoutlib [DO NOT MERGE]

Fix a NPE.

The cherry-pick differs slightly from the original to remove changes not
relevant to the current branch.

Bug: 11140701
Change-Id: Id92fc5359acf6dde1bcdbc781aaf637fdb6eecbf
(cherry-picked from 87be67f9)
parent a59c27dd
Loading
Loading
Loading
Loading
+15 −6
Original line number Original line Diff line number Diff line
@@ -246,11 +246,16 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
     * The counterpart is {@link #setUp()}.
     * The counterpart is {@link #setUp()}.
     */
     */
    private void tearDown() {
    private void tearDown() {
        // The context may be null, if there was an error during init().
        if (mContext != null) {
            // Make sure to remove static references, otherwise we could not unload the lib
            // Make sure to remove static references, otherwise we could not unload the lib
            mContext.disposeResources();
            mContext.disposeResources();
        }


        if (sCurrentContext != null) {
            // quit HandlerThread created during this session.
            // quit HandlerThread created during this session.
            HandlerThread_Delegate.cleanUp(sCurrentContext);
            HandlerThread_Delegate.cleanUp(sCurrentContext);
        }


        // clear the stored ViewConfiguration since the map is per density and not per context.
        // clear the stored ViewConfiguration since the map is per density and not per context.
        ViewConfiguration_Accessor.clearConfigurations();
        ViewConfiguration_Accessor.clearConfigurations();
@@ -261,10 +266,14 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
        sCurrentContext = null;
        sCurrentContext = null;


        Bridge.setLog(null);
        Bridge.setLog(null);
        if (mContext != null) {
            mContext.getRenderResources().setFrameworkResourceIdProvider(null);
            mContext.getRenderResources().setFrameworkResourceIdProvider(null);
            mContext.getRenderResources().setLogger(null);
            mContext.getRenderResources().setLogger(null);
        }
        }


        mContext = null;
    }

    public static BridgeContext getCurrentContext() {
    public static BridgeContext getCurrentContext() {
        return sCurrentContext;
        return sCurrentContext;
    }
    }