History log of /frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fc970ab65ad8c860dd0654d59b70bbe271f95784 26-Feb-2016 Diego Perez <diegoperez@google.com> Implement VirtualRefBasePtr native methods

The VirtualRefBasePtr is used to track the usage of native objects from
the java side by reference counting. Implementing the class delegate to
make sure we dispose the objects correctly.

Change-Id: I3dd4717944b0dbe79f30e49b3083bf65c6e5276d
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
511e48728a4b8f8736fcb2ea28dd1ab7cc699972 06-Aug-2015 Diego Perez <diegoperez@google.com> Make DelegateManager thread safe

We have been seeing crashes on the Theme editor related to an assertion
on getDelegate when the object does not exist
(http://b.android.com/181951).
When debugging, the crash was happening without seeing a previous call
to removeJavaReference. This seems to completely remove that crash.
Since the DelegateManager can be called at least from two threads
(main thread and the finalizer), it should be thread safe.

Bug: http://b.android.com/181951
Change-Id: I1b28f863ff198f8592f170a98f9de391b2ac3ea2
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
476e582d2ffdf25102d4c55f8c242baa3d21d37f 22-May-2015 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Change nullity annotations.

Switch from using tools nullity annotations (com.android.annotations)
to android framework annotations (android.annotation).

A new sdk-common prebuilt is required for LayoutLib tests. The new
sdk-common requires an updated tools-common. The updated tools-common
doesn't have nullity annotations. So, instead of adding the annotation
dependency, just reuse the platform ones. This also paves the way to
include other platform annotations like IdRes etc.

Change-Id: I87b8f767d3681d914abe7d1329e26a87f49f50a7
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
d77b9ed7dcc42efca33b225c4594a30aab9e709c 12-May-2015 Deepanshu Gupta <deepanshu@google.com> Add missing delegates for M preview.

- Remove ICU dependency (use the version bundled with platform).
- Restructure intelliJ project to move dependencies to module.
- Minor fixes to layoutlib tests.

TODO:
- Load ICU data.
- Hyphenator doesn't work.
- High quality line breaker not present.

Change-Id: I965e096e17bfc97ee995a649c3f4f6f64bb4f70d
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
88a8364c386c694f7ad56662ef89713dbf7c9d63 27-Jan-2014 Narayan Kamath <narayan@google.com> Track 64bit changes to android/graphics.

All pointers are now 64bits wide, so should be
represented as java longs and not ints.

Also changed DelegateManager and SparseWeakArray to
reflect the new world order.

Change-Id: Ic32b6b53818dbae9b949f03004c4fb6dae26cdbe
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
282e181b58cf72b6ca770dc7ca5f91f135444502 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "Move frameworks/base/tools/ to frameworks/tools/"

This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
9f6a119c8aa276432ece4fe2118bd8a3c9b1067e 28-Aug-2013 Mike Lockwood <lockwood@google.com> Move frameworks/base/tools/ to frameworks/tools/

Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
f0a53435f14d23d9555fc46014352ee6a7baa647 24-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Add debug mode.

Change-Id: If4263c7dba63a063f84e0c6988c270eb6d291ac3
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
cc4977d0fdaf657907912fd6cc2f9426dc8d2e36 22-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Hold onto delegate references.

When an object is given a delegate to hold onto, keep
the reference to the delegate instead of its native integer.

Also change the way the finalizer works by not explicitely deleting
the delegate. Instead we want the delegate to be deleted when
nothing holds a reference to it. To do this, instead of using
a regular SparseArray, we use a SparseArray of WeakReferences.
Because the main Java object that "owns" the delegate does not
actually holds a reference to the delegate, we fake this by
having the delegate manager hold a reference to delegates for
the main object. This is added/removed as the object is created
and the native finalized is called.

This makes layoutlib behave more like the JNI code where the native
objects are reference counted, and where the Java object can be
deleted but the delegate it owns is kept around (usually because
another type of delegates hold a reference on it.)

To properly handle the WeakReferences, we need to be able to
regularly clear the SparseArray of WeakReference that were
referencing objects that have been GC'ed.
Since the SparseArray is regularly being compacted (actually only
when items are removed), we use a custom SparseWeakArray (started
as a straight copy of SparseArray) that handles the WeakReference
and takes care of compacting the array by removing deleted indices
and WeakReference that returns null. Since our specific use case
doesn't call actually delete() or remove(), the compacting
only happens when the array needs to be resized.

Change-Id: Iacc5c1ff5b21732b8816fda87eb090da12d034e0
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
d43909c7503e11eb335a452d296a10804bb01fd6 23-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: add support for unsupported drawing modifiers.

DrawFilter, Rasterizer, ColorFilter and MaskFilter
are not supported but we need to provide their
JNI counterparts anyway, to at least display warnings
when they are used.

Also improved the API to query Paint for Shaders
and PathEffects, and clean up some code by
moving asserts into the DelegateManager.

Change-Id: I8942514565d28576d5608c6373bda25d86d42ff2
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
5a09488a158b669577cd8eb557ce4feb62929e75 19-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: Properly dispose of bitmap delegate.

This is done by initializing the android.util.Finalizers that's
reponsible for calling out to the native bitmap destructor.
Also implemented the native bitmap destructor

Also fix Bridge by removing obsolete API methods, and removing
some unneeded synchronized blocks now that the whole rendering
(and scene creation) is protected by a synchronized on the bridge
object anyway.

Change-Id: Ie1792da6db354836542dfc11f457fe4a6d78ddfb
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
c2e9651bf386a1f7bf7fc706cf5424950570470c 10-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: New bridge implementation using the new API 5.

Since the new API prepare for stateful layoutlib, major
reorganization of the code.

New "android" sub-package for all extended android classes.
Also moved BridgeInflater in here so that all extended classes
are in this package. Only delegates and classes replacing
renamed classes are in their original android.* packages.
Also created full file for the empty implementations of
IWindow and IWindowSession.
New "impl" for the dirty work implementation.
Main package contains the basic implementation of the API.

Most of the code that was in Bridge is now in .impl.LayoutSceneImpl,
with the main init/inflate/render code split into the contrustrutor,
inflate() and render().

Change-Id: Ie15b15e5a1b2388cd6ef82e518345b1fc02ec981
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java