Loading tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java +16 −0 Original line number Diff line number Diff line Loading @@ -15,8 +15,11 @@ */ package android.view; import com.android.ide.common.rendering.api.LayoutLog; import com.android.layoutlib.bridge.Bridge; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; import java.lang.reflect.Field; import java.util.concurrent.atomic.AtomicReference; /** Loading Loading @@ -64,4 +67,17 @@ public class Choreographer_Delegate { thisChoreographer.doCallbacks(Choreographer.CALLBACK_COMMIT, frameTimeNanos); } public static void dispose() { try { Field threadInstanceField = Choreographer.class.getDeclaredField("sThreadInstance"); @SuppressWarnings("unchecked") ThreadLocal<Choreographer> threadInstance = (ThreadLocal<Choreographer>) threadInstanceField.get(null); threadInstance.remove(); } catch (ReflectiveOperationException e) { assert false; Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to clear Choreographer memory.", e, null); } } } tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +1 −0 Original line number Diff line number Diff line Loading @@ -1453,6 +1453,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { if (createdLooper) { Bridge.cleanupThread(); Choreographer_Delegate.dispose(); } } } Loading
tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java +16 −0 Original line number Diff line number Diff line Loading @@ -15,8 +15,11 @@ */ package android.view; import com.android.ide.common.rendering.api.LayoutLog; import com.android.layoutlib.bridge.Bridge; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; import java.lang.reflect.Field; import java.util.concurrent.atomic.AtomicReference; /** Loading Loading @@ -64,4 +67,17 @@ public class Choreographer_Delegate { thisChoreographer.doCallbacks(Choreographer.CALLBACK_COMMIT, frameTimeNanos); } public static void dispose() { try { Field threadInstanceField = Choreographer.class.getDeclaredField("sThreadInstance"); @SuppressWarnings("unchecked") ThreadLocal<Choreographer> threadInstance = (ThreadLocal<Choreographer>) threadInstanceField.get(null); threadInstance.remove(); } catch (ReflectiveOperationException e) { assert false; Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to clear Choreographer memory.", e, null); } } }
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +1 −0 Original line number Diff line number Diff line Loading @@ -1453,6 +1453,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { if (createdLooper) { Bridge.cleanupThread(); Choreographer_Delegate.dispose(); } } }