diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-12-10 18:29:24 -0800 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-12-14 16:27:27 -0800 |
commit | 545252f4fde6fbb70b07e97a120c7d1405758017 (patch) | |
tree | e3238e5262e77cd91751c2302c30d828c539c55c /graphics | |
parent | 224333c03f1a9e14fce09207dc15d06365bf917b (diff) | |
download | frameworks_base-545252f4fde6fbb70b07e97a120c7d1405758017.zip frameworks_base-545252f4fde6fbb70b07e97a120c7d1405758017.tar.gz frameworks_base-545252f4fde6fbb70b07e97a120c7d1405758017.tar.bz2 |
Refactoring of the screen magnification feature.
1. This patch takes care of the case where a magnified window is covering an unmagnigied
one. One example is a dialog that covers the IME window.
bug:7634430
2. Ensuring that the UI automator tool can connect and correctly dump the screen.
bug:7694696
3. Removed the partial implementation for multi display magnification. It adds
unnecessary complexity since it cannot be implemented without support for
input from multiple screens. We will revisit when necessary.
4. Moved the magnified border window as a surface in the window manager.
5. Moved the mediator APIs on the window manager and the policy methods on the
WindowManagerPolicy.
6. Implemented batch event processing for the accessibility input filter.
Change-Id: I4ebf68b94fb07201e124794f69611ece388ec116
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Region.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java index 27ea0f0..9773039 100644 --- a/graphics/java/android/graphics/Region.java +++ b/graphics/java/android/graphics/Region.java @@ -18,8 +18,15 @@ package android.graphics; import android.os.Parcel; import android.os.Parcelable; +import android.util.Pools.SynchronizedPool; public class Region implements Parcelable { + + private static final int MAX_POOL_SIZE = 10; + + private static final SynchronizedPool<Region> sPool = + new SynchronizedPool<Region>(MAX_POOL_SIZE); + /** * @hide */ @@ -291,6 +298,39 @@ public class Region implements Parcelable { return nativeToString(mNativeRegion); } + /** + * @return An instance from a pool if such or a new one. + * + * @hide + */ + public static Region obtain() { + Region region = sPool.acquire(); + return (region != null) ? region : new Region(); + } + + /** + * @return An instance from a pool if such or a new one. + * + * @param other Region to copy values from for initialization. + * + * @hide + */ + public static Region obtain(Region other) { + Region region = obtain(); + region.set(other); + return region; + } + + /** + * Recycles an instance. + * + * @hide + */ + public void recycle() { + setEmpty(); + sPool.release(this); + } + ////////////////////////////////////////////////////////////////////////// public static final Parcelable.Creator<Region> CREATOR |