diff options
Diffstat (limited to 'core/java/android')
30 files changed, 1231 insertions, 1274 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index a2183e6..0787ef1 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -509,6 +509,12 @@ public class ActivityManager { */ public int stackId; + /** + * The id the of the user the task was running as. + * @hide + */ + public int userId; + public RecentTaskInfo() { } @@ -531,6 +537,7 @@ public class ActivityManager { TextUtils.writeToParcel(description, dest, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); dest.writeInt(stackId); + dest.writeInt(userId); } public void readFromParcel(Parcel source) { @@ -544,6 +551,7 @@ public class ActivityManager { origActivity = ComponentName.readFromParcel(source); description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); stackId = source.readInt(); + userId = source.readInt(); } public static final Creator<RecentTaskInfo> CREATOR @@ -567,7 +575,7 @@ public class ActivityManager { * {@link android.content.Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} flag. */ public static final int RECENT_WITH_EXCLUDED = 0x0001; - + /** * Provides a list that does not contain any * recent tasks that currently are not available to the user. @@ -575,6 +583,13 @@ public class ActivityManager { public static final int RECENT_IGNORE_UNAVAILABLE = 0x0002; /** + * Provides a list that also contains recent tasks for user + * and related users. + * @hide + */ + public static final int RECENT_INCLUDE_RELATED = 0x0004; + + /** * Return a list of the tasks that the user has recently launched, with * the most recent being first and older ones after in order. * diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 0351292..344c3b2 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1479,13 +1479,13 @@ class ContextImpl extends Context { private void validateServiceIntent(Intent service) { if (service.getComponent() == null && service.getPackage() == null) { - if (true || getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KITKAT) { + if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.L) { + IllegalArgumentException ex = new IllegalArgumentException( + "Service Intent must be explicit: " + service); + throw ex; + } else { Log.w(TAG, "Implicit intents with startService are not safe: " + service + " " + Debug.getCallers(2, 3)); - //IllegalArgumentException ex = new IllegalArgumentException( - // "Service Intent must be explicit: " + service); - //Log.e(TAG, "This will become an error", ex); - //throw ex; } } } diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index e06cf38..30c84f6 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -95,7 +95,7 @@ public class DevicePolicyManager { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_PROVISION_MANAGED_PROFILE - = "android.managedprovisioning.ACTION_PROVISION_MANAGED_PROFILE"; + = "android.app.action.ACTION_PROVISION_MANAGED_PROFILE"; /** * A String extra holding the name of the package of the mobile device management application diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 81a886a..134ffa9 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -242,6 +242,16 @@ public abstract class Context { public static final int BIND_ADJUST_WITH_ACTIVITY = 0x0080; /** + * @hide Flag for {@link #bindService}: Treat the binding as hosting + * an activity, an unbinding as the activity going in the background. + * That is, when unbinding, the process when empty will go on the activity + * LRU list instead of the regular one, keeping it around more aggressively + * than it otherwise would be. This is intended for use with IMEs to try + * to keep IME processes around for faster keyboard switching. + */ + public static final int BIND_TREAT_LIKE_ACTIVITY = 0x08000000; + + /** * @hide An idea that is not yet implemented. * Flag for {@link #bindService}: If binding from an activity, consider * this service to be visible like the binding activity is. That is, diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 4c04caa..45d6e88 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -271,6 +271,16 @@ public final class CameraCharacteristics extends CameraMetadata { new Key<int[]>("android.control.maxRegions", int[].class); /** + * <p>The set of edge enhancement modes supported by this camera device.</p> + * <p>This tag lists the valid modes for {@link CaptureRequest#EDGE_MODE android.edge.mode}.</p> + * <p>Full-capability camera devices must always support OFF and FAST.</p> + * + * @see CaptureRequest#EDGE_MODE + */ + public static final Key<byte[]> EDGE_AVAILABLE_EDGE_MODES = + new Key<byte[]>("android.edge.availableEdgeModes", byte[].class); + + /** * <p>Whether this camera device has a * flash.</p> * <p>If no flash, none of the flash controls do @@ -417,6 +427,16 @@ public final class CameraCharacteristics extends CameraMetadata { new Key<Integer>("android.lens.facing", int.class); /** + * <p>The set of noise reduction modes supported by this camera device.</p> + * <p>This tag lists the valid modes for {@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}.</p> + * <p>Full-capability camera devices must laways support OFF and FAST.</p> + * + * @see CaptureRequest#NOISE_REDUCTION_MODE + */ + public static final Key<byte[]> NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES = + new Key<byte[]>("android.noiseReduction.availableNoiseReductionModes", byte[].class); + + /** * <p>If set to 1, the HAL will always split result * metadata for a single capture into multiple buffers, * returned using multiple process_capture_result calls.</p> @@ -1130,6 +1150,17 @@ public final class CameraCharacteristics extends CameraMetadata { new Key<Integer>("android.tonemap.maxCurvePoints", int.class); /** + * <p>The set of tonemapping modes supported by this camera device.</p> + * <p>This tag lists the valid modes for {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}.</p> + * <p>Full-capability camera devices must always support CONTRAST_CURVE and + * FAST.</p> + * + * @see CaptureRequest#TONEMAP_MODE + */ + public static final Key<byte[]> TONEMAP_AVAILABLE_TONE_MAP_MODES = + new Key<byte[]>("android.tonemap.availableToneMapModes", byte[].class); + + /** * <p>A list of camera LEDs that are available on this system.</p> * @see #LED_AVAILABLE_LEDS_TRANSMIT * @hide diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java index 78e7037..0fcd598 100644 --- a/core/java/android/hardware/camera2/CameraManager.java +++ b/core/java/android/hardware/camera2/CameraManager.java @@ -81,13 +81,8 @@ public final class CameraManager { mCameraService = CameraBinderDecorator.newInstance(cameraServiceRaw); try { - int err = CameraMetadataNative.nativeSetupGlobalVendorTagDescriptor(); - if (err == CameraBinderDecorator.EOPNOTSUPP) { - Log.w(TAG, "HAL version doesn't vendor tags."); - } else { - CameraBinderDecorator.throwOnError(CameraMetadataNative. - nativeSetupGlobalVendorTagDescriptor()); - } + CameraBinderDecorator.throwOnError( + CameraMetadataNative.nativeSetupGlobalVendorTagDescriptor()); } catch(CameraRuntimeException e) { throw new IllegalStateException("Failed to setup camera vendor tags", e.asChecked()); diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 30f033f..7656505 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -835,11 +835,14 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * enhancement.</p> * <p>Edge/sharpness/detail enhancement. OFF means no * enhancement will be applied by the camera device.</p> + * <p>This must be set to one of the modes listed in {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}.</p> * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement * will be applied. HIGH_QUALITY mode indicates that the * camera device will use the highest-quality enhancement algorithms, * even if it slows down capture rate. FAST means the camera device will * not slow down capture rate when applying edge enhancement.</p> + * + * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES * @see #EDGE_MODE_OFF * @see #EDGE_MODE_FAST * @see #EDGE_MODE_HIGH_QUALITY @@ -1051,11 +1054,15 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * algorithm</p> * <p>Noise filtering control. OFF means no noise reduction * will be applied by the camera device.</p> + * <p>This must be set to a valid mode in + * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}.</p> * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering * will be applied. HIGH_QUALITY mode indicates that the camera device * will use the highest-quality noise filtering algorithms, * even if it slows down capture rate. FAST means the camera device should not * slow down capture rate when applying noise filtering.</p> + * + * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES * @see #NOISE_REDUCTION_MODE_OFF * @see #NOISE_REDUCTION_MODE_FAST * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY @@ -1403,6 +1410,8 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * tables, selective chroma enhancement, or other non-linear color * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is * CONTRAST_CURVE.</p> + * <p>This must be set to a valid mode in + * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}.</p> * <p>When using either FAST or HIGH_QUALITY, the camera device will * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE_RED android.tonemap.curveRed}, * {@link CaptureRequest#TONEMAP_CURVE_GREEN android.tonemap.curveGreen}, and {@link CaptureRequest#TONEMAP_CURVE_BLUE android.tonemap.curveBlue}. @@ -1412,6 +1421,7 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be * roughly the same.</p> * + * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES * @see CaptureRequest#TONEMAP_CURVE_BLUE * @see CaptureRequest#TONEMAP_CURVE_GREEN * @see CaptureRequest#TONEMAP_CURVE_RED diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 244e359..03661f0 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -1110,11 +1110,14 @@ public final class CaptureResult extends CameraMetadata { * enhancement.</p> * <p>Edge/sharpness/detail enhancement. OFF means no * enhancement will be applied by the camera device.</p> + * <p>This must be set to one of the modes listed in {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}.</p> * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement * will be applied. HIGH_QUALITY mode indicates that the * camera device will use the highest-quality enhancement algorithms, * even if it slows down capture rate. FAST means the camera device will * not slow down capture rate when applying edge enhancement.</p> + * + * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES * @see #EDGE_MODE_OFF * @see #EDGE_MODE_FAST * @see #EDGE_MODE_HIGH_QUALITY @@ -1378,11 +1381,15 @@ public final class CaptureResult extends CameraMetadata { * algorithm</p> * <p>Noise filtering control. OFF means no noise reduction * will be applied by the camera device.</p> + * <p>This must be set to a valid mode in + * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}.</p> * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering * will be applied. HIGH_QUALITY mode indicates that the camera device * will use the highest-quality noise filtering algorithms, * even if it slows down capture rate. FAST means the camera device should not * slow down capture rate when applying noise filtering.</p> + * + * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES * @see #NOISE_REDUCTION_MODE_OFF * @see #NOISE_REDUCTION_MODE_FAST * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY @@ -2075,6 +2082,8 @@ public final class CaptureResult extends CameraMetadata { * tables, selective chroma enhancement, or other non-linear color * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is * CONTRAST_CURVE.</p> + * <p>This must be set to a valid mode in + * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}.</p> * <p>When using either FAST or HIGH_QUALITY, the camera device will * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE_RED android.tonemap.curveRed}, * {@link CaptureRequest#TONEMAP_CURVE_GREEN android.tonemap.curveGreen}, and {@link CaptureRequest#TONEMAP_CURVE_BLUE android.tonemap.curveBlue}. @@ -2084,6 +2093,7 @@ public final class CaptureResult extends CameraMetadata { * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be * roughly the same.</p> * + * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES * @see CaptureRequest#TONEMAP_CURVE_BLUE * @see CaptureRequest#TONEMAP_CURVE_GREEN * @see CaptureRequest#TONEMAP_CURVE_RED diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 5b2a29e..3da00b1 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -175,6 +175,11 @@ public class ConnectivityManager { * {@hide} */ public static final String EXTRA_IS_ACTIVE = "isActive"; + /** + * The lookup key for a long that contains the timestamp (nanos) of the radio state change. + * {@hide} + */ + public static final String EXTRA_REALTIME_NS = "tsNanos"; /** * Broadcast Action: The setting for background data usage has changed diff --git a/core/java/android/net/INetworkManagementEventObserver.aidl b/core/java/android/net/INetworkManagementEventObserver.aidl index 5b16f8b..dd9c39f 100644 --- a/core/java/android/net/INetworkManagementEventObserver.aidl +++ b/core/java/android/net/INetworkManagementEventObserver.aidl @@ -86,8 +86,9 @@ interface INetworkManagementEventObserver { * * @param iface The interface. * @param active True if the interface is actively transmitting data, false if it is idle. + * @param tsNanos Elapsed realtime in nanos when the state of the network interface changed. */ - void interfaceClassDataActivityChanged(String label, boolean active); + void interfaceClassDataActivityChanged(String label, boolean active, long tsNanos); /** * Information about available DNS servers has been received. diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 22e1476..c8051aa 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -467,6 +467,19 @@ public class Build { * </ul> */ public static final int KITKAT = 19; + + /** + * L! + * + * <p>Applications targeting this or a later release will get these + * new changes in behavior:</p> + * <ul> + * <li> {@link android.content.Context#bindService Context.bindService} now + * requires an explicit Intent, and will throw an exception if given an explicit + * Intent.</li> + * </ul> + */ + public static final int L = CUR_DEVELOPMENT; } /** The type of build, like "user" or "eng". */ diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index b692ffd..f671ed9 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -338,11 +338,11 @@ public class RecoverySystem { } /** - * Reboots the device and wipes the user data partition. This is - * sometimes called a "factory reset", which is something of a - * misnomer because the system partition is not restored to its - * factory state. - * Requires the {@link android.Manifest.permission#REBOOT} permission. + * Reboots the device and wipes the user data and cache + * partitions. This is sometimes called a "factory reset", which + * is something of a misnomer because the system partition is not + * restored to its factory state. Requires the + * {@link android.Manifest.permission#REBOOT} permission. * * @param context the Context to use * @@ -350,6 +350,28 @@ public class RecoverySystem { * fails, or if the reboot itself fails. */ public static void rebootWipeUserData(Context context) throws IOException { + rebootWipeUserData(context, false); + } + + /** + * Reboots the device and wipes the user data and cache + * partitions. This is sometimes called a "factory reset", which + * is something of a misnomer because the system partition is not + * restored to its factory state. Requires the + * {@link android.Manifest.permission#REBOOT} permission. + * + * @param context the Context to use + * @param shutdown if true, the device will be powered down after + * the wipe completes, rather than being rebooted + * back to the regular system. + * + * @throws IOException if writing the recovery command file + * fails, or if the reboot itself fails. + * + * @hide + */ + public static void rebootWipeUserData(Context context, boolean shutdown) + throws IOException { final ConditionVariable condition = new ConditionVariable(); Intent intent = new Intent("android.intent.action.MASTER_CLEAR_NOTIFICATION"); @@ -365,7 +387,13 @@ public class RecoverySystem { // Block until the ordered broadcast has completed. condition.block(); - bootCommand(context, "--wipe_data\n--locale=" + Locale.getDefault().toString()); + String shutdownArg = ""; + if (shutdown) { + shutdownArg = "--shutdown_after\n"; + } + + bootCommand(context, shutdownArg + "--wipe_data\n--locale=" + + Locale.getDefault().toString()); } /** diff --git a/core/java/android/print/PrintManager.java b/core/java/android/print/PrintManager.java index d1bb8fd..e4f73cb 100644 --- a/core/java/android/print/PrintManager.java +++ b/core/java/android/print/PrintManager.java @@ -359,6 +359,17 @@ public final class PrintManager { * selected the hinted options in the print dialog, given the current printer * supports them. * </p> + * <p> + * <strong>Note:</strong> Calling this method will bring the print dialog and + * the system will connect to the provided {@link PrintDocumentAdapter}. If a + * configuration change occurs that you application does not handle, for example + * a rotation change, the system will drop the connection to the adapter as the + * activity has to be recreated and the old adapter may be invalid in this context, + * hence a new adapter instance is required. As a consequence, if your activity + * does not handle configuration changes (default behavior), you have to save the + * state that you were printing and call this method again when your activity + * is recreated. + * </p> * * @param printJobName A name for the new print job which is shown to the user. * @param documentAdapter An adapter that emits the document to print. diff --git a/core/java/android/speech/SpeechRecognizer.java b/core/java/android/speech/SpeechRecognizer.java index 94aedbd..91c3799 100644 --- a/core/java/android/speech/SpeechRecognizer.java +++ b/core/java/android/speech/SpeechRecognizer.java @@ -409,7 +409,7 @@ public class SpeechRecognizer { * Internal wrapper of IRecognitionListener which will propagate the results to * RecognitionListener */ - private class InternalListener extends IRecognitionListener.Stub { + private static class InternalListener extends IRecognitionListener.Stub { private RecognitionListener mInternalListener; private final static int MSG_BEGINNING_OF_SPEECH = 1; diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java index be6f401..ed52803 100644 --- a/core/java/android/view/DisplayList.java +++ b/core/java/android/view/DisplayList.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 The Android Open Source Project + * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,916 +16,10 @@ package android.view; -import android.graphics.Matrix; -import android.graphics.Path; - -/** - * <p>A display list records a series of graphics related operations and can replay - * them later. Display lists are usually built by recording operations on a - * {@link HardwareCanvas}. Replaying the operations from a display list avoids - * executing application code on every frame, and is thus much more efficient.</p> - * - * <p>Display lists are used internally for all views by default, and are not - * typically used directly. One reason to consider using a display is a custom - * {@link View} implementation that needs to issue a large number of drawing commands. - * When the view invalidates, all the drawing commands must be reissued, even if - * large portions of the drawing command stream stay the same frame to frame, which - * can become a performance bottleneck. To solve this issue, a custom View might split - * its content into several display lists. A display list is updated only when its - * content, and only its content, needs to be updated.</p> - * - * <p>A text editor might for instance store each paragraph into its own display list. - * Thus when the user inserts or removes characters, only the display list of the - * affected paragraph needs to be recorded again.</p> - * - * <h3>Hardware acceleration</h3> - * <p>Display lists can only be replayed using a {@link HardwareCanvas}. They are not - * supported in software. Always make sure that the {@link android.graphics.Canvas} - * you are using to render a display list is hardware accelerated using - * {@link android.graphics.Canvas#isHardwareAccelerated()}.</p> - * - * <h3>Creating a display list</h3> - * <pre class="prettyprint"> - * HardwareRenderer renderer = myView.getHardwareRenderer(); - * if (renderer != null) { - * DisplayList displayList = renderer.createDisplayList(); - * HardwareCanvas canvas = displayList.start(width, height); - * try { - * // Draw onto the canvas - * // For instance: canvas.drawBitmap(...); - * } finally { - * displayList.end(); - * } - * } - * </pre> - * - * <h3>Rendering a display list on a View</h3> - * <pre class="prettyprint"> - * protected void onDraw(Canvas canvas) { - * if (canvas.isHardwareAccelerated()) { - * HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas; - * hardwareCanvas.drawDisplayList(mDisplayList); - * } - * } - * </pre> - * - * <h3>Releasing resources</h3> - * <p>This step is not mandatory but recommended if you want to release resources - * held by a display list as soon as possible.</p> - * <pre class="prettyprint"> - * // Mark this display list invalid, it cannot be used for drawing anymore, - * // and release resources held by this display list - * displayList.clear(); - * </pre> - * - * <h3>Properties</h3> - * <p>In addition, a display list offers several properties, such as - * {@link #setScaleX(float)} or {@link #setLeft(int)}, that can be used to affect all - * the drawing commands recorded within. For instance, these properties can be used - * to move around a large number of images without re-issuing all the individual - * <code>drawBitmap()</code> calls.</p> - * - * <pre class="prettyprint"> - * private void createDisplayList() { - * mDisplayList = DisplayList.create("MyDisplayList"); - * HardwareCanvas canvas = mDisplayList.start(width, height); - * try { - * for (Bitmap b : mBitmaps) { - * canvas.drawBitmap(b, 0.0f, 0.0f, null); - * canvas.translate(0.0f, b.getHeight()); - * } - * } finally { - * displayList.end(); - * } - * } - * - * protected void onDraw(Canvas canvas) { - * if (canvas.isHardwareAccelerated()) { - * HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas; - * hardwareCanvas.drawDisplayList(mDisplayList); - * } - * } - * - * private void moveContentBy(int x) { - * // This will move all the bitmaps recorded inside the display list - * // by x pixels to the right and redraw this view. All the commands - * // recorded in createDisplayList() won't be re-issued, only onDraw() - * // will be invoked and will execute very quickly - * mDisplayList.offsetLeftAndRight(x); - * invalidate(); - * } - * </pre> - * - * <h3>Threading</h3> - * <p>Display lists must be created on and manipulated from the UI thread only.</p> - * - * @hide +/** TODO: Remove once frameworks/webview is updated + * @hide */ public class DisplayList { - /** - * Flag used when calling - * {@link HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int)} - * When this flag is set, draw operations lying outside of the bounds of the - * display list will be culled early. It is recommeneded to always set this - * flag. - * - * @hide - */ - public static final int FLAG_CLIP_CHILDREN = 0x1; - - // NOTE: The STATUS_* values *must* match the enum in DrawGlInfo.h - - /** - * Indicates that the display list is done drawing. - * - * @see HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int) - * - * @hide - */ + /** @hide */ public static final int STATUS_DONE = 0x0; - - /** - * Indicates that the display list needs another drawing pass. - * - * @see HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int) - * - * @hide - */ - public static final int STATUS_DRAW = 0x1; - - /** - * Indicates that the display list needs to re-execute its GL functors. - * - * @see HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int) - * @see HardwareCanvas#callDrawGLFunction(long) - * - * @hide - */ - public static final int STATUS_INVOKE = 0x2; - - /** - * Indicates that the display list performed GL drawing operations. - * - * @see HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int) - * - * @hide - */ - public static final int STATUS_DREW = 0x4; - - private boolean mValid; - private final long mNativeDisplayList; - private HardwareRenderer mRenderer; - - private DisplayList(String name) { - mNativeDisplayList = nCreate(); - nSetDisplayListName(mNativeDisplayList, name); - } - - /** - * Creates a new display list that can be used to record batches of - * drawing operations. - * - * @param name The name of the display list, used for debugging purpose. May be null. - * - * @return A new display list. - * - * @hide - */ - public static DisplayList create(String name) { - return new DisplayList(name); - } - - /** - * Starts recording the display list. All operations performed on the - * returned canvas are recorded and stored in this display list. - * - * Calling this method will mark the display list invalid until - * {@link #end()} is called. Only valid display lists can be replayed. - * - * @param width The width of the display list's viewport - * @param height The height of the display list's viewport - * - * @return A canvas to record drawing operations. - * - * @see #end() - * @see #isValid() - */ - public HardwareCanvas start(int width, int height) { - HardwareCanvas canvas = GLES20RecordingCanvas.obtain(); - canvas.setViewport(width, height); - // The dirty rect should always be null for a display list - canvas.onPreDraw(null); - return canvas; - } - - /** - * Ends the recording for this display list. A display list cannot be - * replayed if recording is not finished. Calling this method marks - * the display list valid and {@link #isValid()} will return true. - * - * @see #start(int, int) - * @see #isValid() - */ - public void end(HardwareRenderer renderer, HardwareCanvas endCanvas) { - if (!(endCanvas instanceof GLES20RecordingCanvas)) { - throw new IllegalArgumentException("Passed an invalid canvas to end!"); - } - - GLES20RecordingCanvas canvas = (GLES20RecordingCanvas) endCanvas; - canvas.onPostDraw(); - long displayListData = canvas.finishRecording(); - if (renderer != mRenderer) { - // If we are changing renderers first destroy with the old - // renderer, then set with the new one - destroyDisplayListData(); - } - mRenderer = renderer; - setDisplayListData(displayListData); - canvas.recycle(); - mValid = true; - } - - /** - * Reset native resources. This is called when cleaning up the state of display lists - * during destruction of hardware resources, to ensure that we do not hold onto - * obsolete resources after related resources are gone. - * - * @hide - */ - public void destroyDisplayListData() { - if (!mValid) return; - - setDisplayListData(0); - mRenderer = null; - mValid = false; - } - - private void setDisplayListData(long newData) { - if (mRenderer != null) { - mRenderer.setDisplayListData(mNativeDisplayList, newData); - } else { - throw new IllegalStateException("Trying to set data without a renderer! data=" + newData); - } - } - - /** - * Returns whether the display list is currently usable. If this returns false, - * the display list should be re-recorded prior to replaying it. - * - * @return boolean true if the display list is able to be replayed, false otherwise. - */ - public boolean isValid() { return mValid; } - - long getNativeDisplayList() { - if (!mValid) { - throw new IllegalStateException("The display list is not valid."); - } - return mNativeDisplayList; - } - - /////////////////////////////////////////////////////////////////////////// - // DisplayList Property Setters - /////////////////////////////////////////////////////////////////////////// - - /** - * Set the caching property on the display list, which indicates whether the display list - * holds a layer. Layer display lists should avoid creating an alpha layer, since alpha is - * handled in the drawLayer operation directly (and more efficiently). - * - * @param caching true if the display list represents a hardware layer, false otherwise. - * - * @hide - */ - public void setCaching(boolean caching) { - nSetCaching(mNativeDisplayList, caching); - } - - /** - * Set whether the display list should clip itself to its bounds. This property is controlled by - * the view's parent. - * - * @param clipToBounds true if the display list should clip to its bounds - */ - public void setClipToBounds(boolean clipToBounds) { - nSetClipToBounds(mNativeDisplayList, clipToBounds); - } - - /** - * Set whether the display list should collect and Z order all 3d composited descendents, and - * draw them in order with the default Z=0 content. - * - * @param isolatedZVolume true if the display list should collect and Z order descendents. - */ - public void setIsolatedZVolume(boolean isolatedZVolume) { - nSetIsolatedZVolume(mNativeDisplayList, isolatedZVolume); - } - - /** - * Sets whether the display list should be drawn immediately after the - * closest ancestor display list where isolateZVolume is true. If the - * display list itself satisfies this constraint, changing this attribute - * has no effect on drawing order. - * - * @param shouldProject true if the display list should be projected onto a - * containing volume. - */ - public void setProjectBackwards(boolean shouldProject) { - nSetProjectBackwards(mNativeDisplayList, shouldProject); - } - - /** - * Sets whether the display list is a projection receiver - that its parent - * DisplayList should draw any descendent DisplayLists with - * ProjectBackwards=true directly on top of it. Default value is false. - */ - public void setProjectionReceiver(boolean shouldRecieve) { - nSetProjectionReceiver(mNativeDisplayList, shouldRecieve); - } - - /** - * Sets the outline, defining the shape that casts a shadow, and the path to - * be clipped if setClipToOutline is set. - * - * Deep copies the native path to simplify reference ownership. - * - * @param outline Convex, CW Path to store in the DisplayList. May be null. - */ - public void setOutline(Path outline) { - long nativePath = (outline == null) ? 0 : outline.mNativePath; - nSetOutline(mNativeDisplayList, nativePath); - } - - /** - * Enables or disables clipping to the outline. - * - * @param clipToOutline true if clipping to the outline. - */ - public void setClipToOutline(boolean clipToOutline) { - nSetClipToOutline(mNativeDisplayList, clipToOutline); - } - - /** - * Set whether the DisplayList should cast a shadow. - * - * The shape of the shadow casting area is defined by the outline of the display list, if set - * and non-empty, otherwise it will be the bounds rect. - */ - public void setCastsShadow(boolean castsShadow) { - nSetCastsShadow(mNativeDisplayList, castsShadow); - } - - /** - * Sets whether the DisplayList should be drawn with perspective applied from the global camera. - * - * If set to true, camera distance will be ignored. Defaults to false. - */ - public void setUsesGlobalCamera(boolean usesGlobalCamera) { - nSetUsesGlobalCamera(mNativeDisplayList, usesGlobalCamera); - } - - /** - * Set the static matrix on the display list. The specified matrix is combined with other - * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.) - * - * @param matrix A transform matrix to apply to this display list - * - * @see #getMatrix(android.graphics.Matrix) - * @see #getMatrix() - */ - public void setStaticMatrix(Matrix matrix) { - nSetStaticMatrix(mNativeDisplayList, matrix.native_instance); - } - - /** - * Set the Animation matrix on the display list. This matrix exists if an Animation is - * currently playing on a View, and is set on the display list during at draw() time. When - * the Animation finishes, the matrix should be cleared by sending <code>null</code> - * for the matrix parameter. - * - * @param matrix The matrix, null indicates that the matrix should be cleared. - * - * @hide - */ - public void setAnimationMatrix(Matrix matrix) { - nSetAnimationMatrix(mNativeDisplayList, - (matrix != null) ? matrix.native_instance : 0); - } - - /** - * Sets the translucency level for the display list. - * - * @param alpha The translucency of the display list, must be a value between 0.0f and 1.0f - * - * @see View#setAlpha(float) - * @see #getAlpha() - */ - public void setAlpha(float alpha) { - nSetAlpha(mNativeDisplayList, alpha); - } - - /** - * Returns the translucency level of this display list. - * - * @return A value between 0.0f and 1.0f - * - * @see #setAlpha(float) - */ - public float getAlpha() { - return nGetAlpha(mNativeDisplayList); - } - - /** - * Sets whether the display list renders content which overlaps. Non-overlapping rendering - * can use a fast path for alpha that avoids rendering to an offscreen buffer. By default - * display lists consider they do not have overlapping content. - * - * @param hasOverlappingRendering False if the content is guaranteed to be non-overlapping, - * true otherwise. - * - * @see android.view.View#hasOverlappingRendering() - * @see #hasOverlappingRendering() - */ - public void setHasOverlappingRendering(boolean hasOverlappingRendering) { - nSetHasOverlappingRendering(mNativeDisplayList, hasOverlappingRendering); - } - - /** - * Indicates whether the content of this display list overlaps. - * - * @return True if this display list renders content which overlaps, false otherwise. - * - * @see #setHasOverlappingRendering(boolean) - */ - public boolean hasOverlappingRendering() { - //noinspection SimplifiableIfStatement - return nHasOverlappingRendering(mNativeDisplayList); - } - - /** - * Sets the translation value for the display list on the X axis. - * - * @param translationX The X axis translation value of the display list, in pixels - * - * @see View#setTranslationX(float) - * @see #getTranslationX() - */ - public void setTranslationX(float translationX) { - nSetTranslationX(mNativeDisplayList, translationX); - } - - /** - * Returns the translation value for this display list on the X axis, in pixels. - * - * @see #setTranslationX(float) - */ - public float getTranslationX() { - return nGetTranslationX(mNativeDisplayList); - } - - /** - * Sets the translation value for the display list on the Y axis. - * - * @param translationY The Y axis translation value of the display list, in pixels - * - * @see View#setTranslationY(float) - * @see #getTranslationY() - */ - public void setTranslationY(float translationY) { - nSetTranslationY(mNativeDisplayList, translationY); - } - - /** - * Returns the translation value for this display list on the Y axis, in pixels. - * - * @see #setTranslationY(float) - */ - public float getTranslationY() { - return nGetTranslationY(mNativeDisplayList); - } - - /** - * Sets the translation value for the display list on the Z axis. - * - * @see View#setTranslationZ(float) - * @see #getTranslationZ() - */ - public void setTranslationZ(float translationZ) { - nSetTranslationZ(mNativeDisplayList, translationZ); - } - - /** - * Returns the translation value for this display list on the Z axis. - * - * @see #setTranslationZ(float) - */ - public float getTranslationZ() { - return nGetTranslationZ(mNativeDisplayList); - } - - /** - * Sets the rotation value for the display list around the Z axis. - * - * @param rotation The rotation value of the display list, in degrees - * - * @see View#setRotation(float) - * @see #getRotation() - */ - public void setRotation(float rotation) { - nSetRotation(mNativeDisplayList, rotation); - } - - /** - * Returns the rotation value for this display list around the Z axis, in degrees. - * - * @see #setRotation(float) - */ - public float getRotation() { - return nGetRotation(mNativeDisplayList); - } - - /** - * Sets the rotation value for the display list around the X axis. - * - * @param rotationX The rotation value of the display list, in degrees - * - * @see View#setRotationX(float) - * @see #getRotationX() - */ - public void setRotationX(float rotationX) { - nSetRotationX(mNativeDisplayList, rotationX); - } - - /** - * Returns the rotation value for this display list around the X axis, in degrees. - * - * @see #setRotationX(float) - */ - public float getRotationX() { - return nGetRotationX(mNativeDisplayList); - } - - /** - * Sets the rotation value for the display list around the Y axis. - * - * @param rotationY The rotation value of the display list, in degrees - * - * @see View#setRotationY(float) - * @see #getRotationY() - */ - public void setRotationY(float rotationY) { - nSetRotationY(mNativeDisplayList, rotationY); - } - - /** - * Returns the rotation value for this display list around the Y axis, in degrees. - * - * @see #setRotationY(float) - */ - public float getRotationY() { - return nGetRotationY(mNativeDisplayList); - } - - /** - * Sets the scale value for the display list on the X axis. - * - * @param scaleX The scale value of the display list - * - * @see View#setScaleX(float) - * @see #getScaleX() - */ - public void setScaleX(float scaleX) { - nSetScaleX(mNativeDisplayList, scaleX); - } - - /** - * Returns the scale value for this display list on the X axis. - * - * @see #setScaleX(float) - */ - public float getScaleX() { - return nGetScaleX(mNativeDisplayList); - } - - /** - * Sets the scale value for the display list on the Y axis. - * - * @param scaleY The scale value of the display list - * - * @see View#setScaleY(float) - * @see #getScaleY() - */ - public void setScaleY(float scaleY) { - nSetScaleY(mNativeDisplayList, scaleY); - } - - /** - * Returns the scale value for this display list on the Y axis. - * - * @see #setScaleY(float) - */ - public float getScaleY() { - return nGetScaleY(mNativeDisplayList); - } - - /** - * Sets all of the transform-related values of the display list - * - * @param alpha The alpha value of the display list - * @param translationX The translationX value of the display list - * @param translationY The translationY value of the display list - * @param rotation The rotation value of the display list - * @param rotationX The rotationX value of the display list - * @param rotationY The rotationY value of the display list - * @param scaleX The scaleX value of the display list - * @param scaleY The scaleY value of the display list - * - * @hide - */ - public void setTransformationInfo(float alpha, - float translationX, float translationY, float translationZ, - float rotation, float rotationX, float rotationY, float scaleX, float scaleY) { - nSetTransformationInfo(mNativeDisplayList, alpha, - translationX, translationY, translationZ, - rotation, rotationX, rotationY, scaleX, scaleY); - } - - /** - * Sets the pivot value for the display list on the X axis - * - * @param pivotX The pivot value of the display list on the X axis, in pixels - * - * @see View#setPivotX(float) - * @see #getPivotX() - */ - public void setPivotX(float pivotX) { - nSetPivotX(mNativeDisplayList, pivotX); - } - - /** - * Returns the pivot value for this display list on the X axis, in pixels. - * - * @see #setPivotX(float) - */ - public float getPivotX() { - return nGetPivotX(mNativeDisplayList); - } - - /** - * Sets the pivot value for the display list on the Y axis - * - * @param pivotY The pivot value of the display list on the Y axis, in pixels - * - * @see View#setPivotY(float) - * @see #getPivotY() - */ - public void setPivotY(float pivotY) { - nSetPivotY(mNativeDisplayList, pivotY); - } - - /** - * Returns the pivot value for this display list on the Y axis, in pixels. - * - * @see #setPivotY(float) - */ - public float getPivotY() { - return nGetPivotY(mNativeDisplayList); - } - - /** - * Sets the camera distance for the display list. Refer to - * {@link View#setCameraDistance(float)} for more information on how to - * use this property. - * - * @param distance The distance in Z of the camera of the display list - * - * @see View#setCameraDistance(float) - * @see #getCameraDistance() - */ - public void setCameraDistance(float distance) { - nSetCameraDistance(mNativeDisplayList, distance); - } - - /** - * Returns the distance in Z of the camera of the display list. - * - * @see #setCameraDistance(float) - */ - public float getCameraDistance() { - return nGetCameraDistance(mNativeDisplayList); - } - - /** - * Sets the left position for the display list. - * - * @param left The left position, in pixels, of the display list - * - * @see View#setLeft(int) - * @see #getLeft() - */ - public void setLeft(int left) { - nSetLeft(mNativeDisplayList, left); - } - - /** - * Returns the left position for the display list in pixels. - * - * @see #setLeft(int) - */ - public float getLeft() { - return nGetLeft(mNativeDisplayList); - } - - /** - * Sets the top position for the display list. - * - * @param top The top position, in pixels, of the display list - * - * @see View#setTop(int) - * @see #getTop() - */ - public void setTop(int top) { - nSetTop(mNativeDisplayList, top); - } - - /** - * Returns the top position for the display list in pixels. - * - * @see #setTop(int) - */ - public float getTop() { - return nGetTop(mNativeDisplayList); - } - - /** - * Sets the right position for the display list. - * - * @param right The right position, in pixels, of the display list - * - * @see View#setRight(int) - * @see #getRight() - */ - public void setRight(int right) { - nSetRight(mNativeDisplayList, right); - } - - /** - * Returns the right position for the display list in pixels. - * - * @see #setRight(int) - */ - public float getRight() { - return nGetRight(mNativeDisplayList); - } - - /** - * Sets the bottom position for the display list. - * - * @param bottom The bottom position, in pixels, of the display list - * - * @see View#setBottom(int) - * @see #getBottom() - */ - public void setBottom(int bottom) { - nSetBottom(mNativeDisplayList, bottom); - } - - /** - * Returns the bottom position for the display list in pixels. - * - * @see #setBottom(int) - */ - public float getBottom() { - return nGetBottom(mNativeDisplayList); - } - - /** - * Sets the left and top positions for the display list - * - * @param left The left position of the display list, in pixels - * @param top The top position of the display list, in pixels - * @param right The right position of the display list, in pixels - * @param bottom The bottom position of the display list, in pixels - * - * @see View#setLeft(int) - * @see View#setTop(int) - * @see View#setRight(int) - * @see View#setBottom(int) - */ - public void setLeftTopRightBottom(int left, int top, int right, int bottom) { - nSetLeftTopRightBottom(mNativeDisplayList, left, top, right, bottom); - } - - /** - * Offsets the left and right positions for the display list - * - * @param offset The amount that the left and right positions of the display - * list are offset, in pixels - * - * @see View#offsetLeftAndRight(int) - */ - public void offsetLeftAndRight(float offset) { - nOffsetLeftAndRight(mNativeDisplayList, offset); - } - - /** - * Offsets the top and bottom values for the display list - * - * @param offset The amount that the top and bottom positions of the display - * list are offset, in pixels - * - * @see View#offsetTopAndBottom(int) - */ - public void offsetTopAndBottom(float offset) { - nOffsetTopAndBottom(mNativeDisplayList, offset); - } - - /** - * Outputs the display list to the log. This method exists for use by - * tools to output display lists for selected nodes to the log. - * - * @hide - */ - public void output() { - nOutput(mNativeDisplayList); - } - - /////////////////////////////////////////////////////////////////////////// - // Native methods - /////////////////////////////////////////////////////////////////////////// - - private static native long nCreate(); - private static native void nDestroyDisplayList(long displayList); - private static native void nSetDisplayListName(long displayList, String name); - - // Properties - - private static native void nOffsetTopAndBottom(long displayList, float offset); - private static native void nOffsetLeftAndRight(long displayList, float offset); - private static native void nSetLeftTopRightBottom(long displayList, int left, int top, - int right, int bottom); - private static native void nSetBottom(long displayList, int bottom); - private static native void nSetRight(long displayList, int right); - private static native void nSetTop(long displayList, int top); - private static native void nSetLeft(long displayList, int left); - private static native void nSetCameraDistance(long displayList, float distance); - private static native void nSetPivotY(long displayList, float pivotY); - private static native void nSetPivotX(long displayList, float pivotX); - private static native void nSetCaching(long displayList, boolean caching); - private static native void nSetClipToBounds(long displayList, boolean clipToBounds); - private static native void nSetProjectBackwards(long displayList, boolean shouldProject); - private static native void nSetProjectionReceiver(long displayList, boolean shouldRecieve); - private static native void nSetIsolatedZVolume(long displayList, boolean isolateZVolume); - private static native void nSetOutline(long displayList, long nativePath); - private static native void nSetClipToOutline(long displayList, boolean clipToOutline); - private static native void nSetCastsShadow(long displayList, boolean castsShadow); - private static native void nSetUsesGlobalCamera(long displayList, boolean usesGlobalCamera); - private static native void nSetAlpha(long displayList, float alpha); - private static native void nSetHasOverlappingRendering(long displayList, - boolean hasOverlappingRendering); - private static native void nSetTranslationX(long displayList, float translationX); - private static native void nSetTranslationY(long displayList, float translationY); - private static native void nSetTranslationZ(long displayList, float translationZ); - private static native void nSetRotation(long displayList, float rotation); - private static native void nSetRotationX(long displayList, float rotationX); - private static native void nSetRotationY(long displayList, float rotationY); - private static native void nSetScaleX(long displayList, float scaleX); - private static native void nSetScaleY(long displayList, float scaleY); - private static native void nSetTransformationInfo(long displayList, float alpha, - float translationX, float translationY, float translationZ, - float rotation, float rotationX, float rotationY, float scaleX, float scaleY); - private static native void nSetStaticMatrix(long displayList, long nativeMatrix); - private static native void nSetAnimationMatrix(long displayList, long animationMatrix); - - private static native boolean nHasOverlappingRendering(long displayList); - private static native float nGetAlpha(long displayList); - private static native float nGetLeft(long displayList); - private static native float nGetTop(long displayList); - private static native float nGetRight(long displayList); - private static native float nGetBottom(long displayList); - private static native float nGetCameraDistance(long displayList); - private static native float nGetScaleX(long displayList); - private static native float nGetScaleY(long displayList); - private static native float nGetTranslationX(long displayList); - private static native float nGetTranslationY(long displayList); - private static native float nGetTranslationZ(long displayList); - private static native float nGetRotation(long displayList); - private static native float nGetRotationX(long displayList); - private static native float nGetRotationY(long displayList); - private static native float nGetPivotX(long displayList); - private static native float nGetPivotY(long displayList); - private static native void nOutput(long displayList); - - /////////////////////////////////////////////////////////////////////////// - // Finalization - /////////////////////////////////////////////////////////////////////////// - - @Override - protected void finalize() throws Throwable { - try { - destroyDisplayListData(); - nDestroyDisplayList(mNativeDisplayList); - } finally { - super.finalize(); - } - } } diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 6c6fc9b..c274fc4 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -359,7 +359,7 @@ class GLES20Canvas extends HardwareCanvas { protected static native long nFinishRecording(long renderer); @Override - public int drawDisplayList(DisplayList displayList, Rect dirty, int flags) { + public int drawDisplayList(RenderNode displayList, Rect dirty, int flags) { return nDrawDisplayList(mRenderer, displayList.getNativeDisplayList(), dirty, flags); } diff --git a/core/java/android/view/GLRenderer.java b/core/java/android/view/GLRenderer.java index 81f778d..4d42c5d 100644 --- a/core/java/android/view/GLRenderer.java +++ b/core/java/android/view/GLRenderer.java @@ -1125,7 +1125,7 @@ public class GLRenderer extends HardwareRenderer { dirty = beginFrame(canvas, dirty, surfaceState); - DisplayList displayList = buildDisplayList(view, canvas); + RenderNode displayList = buildDisplayList(view, canvas); flushLayerChanges(); @@ -1137,7 +1137,7 @@ public class GLRenderer extends HardwareRenderer { } int saveCount = 0; - int status = DisplayList.STATUS_DONE; + int status = RenderNode.STATUS_DONE; long start = getSystemTime(); try { @@ -1201,7 +1201,7 @@ public class GLRenderer extends HardwareRenderer { } private static native void nSetDisplayListData(long displayList, long newData); - private DisplayList buildDisplayList(View view, HardwareCanvas canvas) { + private RenderNode buildDisplayList(View view, HardwareCanvas canvas) { if (mDrawDelta <= 0) { return view.mDisplayList; } @@ -1214,7 +1214,7 @@ public class GLRenderer extends HardwareRenderer { canvas.clearLayerUpdates(); Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); - DisplayList displayList = view.getDisplayList(); + RenderNode displayList = view.getDisplayList(); Trace.traceEnd(Trace.TRACE_TAG_VIEW); endBuildDisplayListProfiling(buildDisplayListStartTime); @@ -1279,7 +1279,7 @@ public class GLRenderer extends HardwareRenderer { } private int drawDisplayList(View.AttachInfo attachInfo, HardwareCanvas canvas, - DisplayList displayList, int status) { + RenderNode displayList, int status) { long drawDisplayListStartTime = 0; if (mProfileEnabled) { @@ -1289,7 +1289,7 @@ public class GLRenderer extends HardwareRenderer { Trace.traceBegin(Trace.TRACE_TAG_VIEW, "drawDisplayList"); try { status |= canvas.drawDisplayList(displayList, mRedrawClip, - DisplayList.FLAG_CLIP_CHILDREN); + RenderNode.FLAG_CLIP_CHILDREN); } finally { Trace.traceEnd(Trace.TRACE_TAG_VIEW); } @@ -1305,7 +1305,7 @@ public class GLRenderer extends HardwareRenderer { } private void swapBuffers(int status) { - if ((status & DisplayList.STATUS_DREW) == DisplayList.STATUS_DREW) { + if ((status & RenderNode.STATUS_DREW) == RenderNode.STATUS_DREW) { long eglSwapBuffersStartTime = 0; if (mProfileEnabled) { eglSwapBuffersStartTime = System.nanoTime(); @@ -1339,7 +1339,7 @@ public class GLRenderer extends HardwareRenderer { private void handleFunctorStatus(View.AttachInfo attachInfo, int status) { // If the draw flag is set, functors will be invoked while executing // the tree of display lists - if ((status & DisplayList.STATUS_DRAW) != 0) { + if ((status & RenderNode.STATUS_DRAW) != 0) { if (mRedrawClip.isEmpty()) { attachInfo.mViewRootImpl.invalidate(); } else { @@ -1348,7 +1348,7 @@ public class GLRenderer extends HardwareRenderer { } } - if ((status & DisplayList.STATUS_INVOKE) != 0 || + if ((status & RenderNode.STATUS_INVOKE) != 0 || attachInfo.mHandler.hasCallbacks(mFunctorsRunnable)) { attachInfo.mHandler.removeCallbacks(mFunctorsRunnable); mFunctorsRunnable.attachInfo = attachInfo; diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java index a3c7b63..f695b20 100644 --- a/core/java/android/view/HardwareCanvas.java +++ b/core/java/android/view/HardwareCanvas.java @@ -42,7 +42,7 @@ public abstract class HardwareCanvas extends Canvas { * Invoked before any drawing operation is performed in this canvas. * * @param dirty The dirty rectangle to update, can be null. - * @return {@link DisplayList#STATUS_DREW} if anything was drawn (such as a call to clear + * @return {@link RenderNode#STATUS_DREW} if anything was drawn (such as a call to clear * the canvas). * * @hide @@ -58,12 +58,12 @@ public abstract class HardwareCanvas extends Canvas { /** * Draws the specified display list onto this canvas. The display list can only - * be drawn if {@link android.view.DisplayList#isValid()} returns true. + * be drawn if {@link android.view.RenderNode#isValid()} returns true. * * @param displayList The display list to replay. */ - public void drawDisplayList(DisplayList displayList) { - drawDisplayList(displayList, null, DisplayList.FLAG_CLIP_CHILDREN); + public void drawDisplayList(RenderNode displayList) { + drawDisplayList(displayList, null, RenderNode.FLAG_CLIP_CHILDREN); } /** @@ -71,17 +71,17 @@ public abstract class HardwareCanvas extends Canvas { * * @param displayList The display list to replay. * @param dirty The dirty region to redraw in the next pass, matters only - * if this method returns {@link DisplayList#STATUS_DRAW}, can be null. - * @param flags Optional flags about drawing, see {@link DisplayList} for + * if this method returns {@link RenderNode#STATUS_DRAW}, can be null. + * @param flags Optional flags about drawing, see {@link RenderNode} for * the possible flags. * - * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW}, or - * {@link DisplayList#STATUS_INVOKE}, or'd with {@link DisplayList#STATUS_DREW} + * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW}, or + * {@link RenderNode#STATUS_INVOKE}, or'd with {@link RenderNode#STATUS_DREW} * if anything was drawn. * * @hide */ - public abstract int drawDisplayList(DisplayList displayList, Rect dirty, int flags); + public abstract int drawDisplayList(RenderNode displayList, Rect dirty, int flags); /** * Draws the specified layer onto this canvas. @@ -102,28 +102,28 @@ public abstract class HardwareCanvas extends Canvas { * * @param drawGLFunction A native function pointer * - * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW} or - * {@link DisplayList#STATUS_INVOKE} + * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW} or + * {@link RenderNode#STATUS_INVOKE} * * @hide */ public int callDrawGLFunction(long drawGLFunction) { // Noop - this is done in the display list recorder subclass - return DisplayList.STATUS_DONE; + return RenderNode.STATUS_DONE; } /** * Invoke all the functors who requested to be invoked during the previous frame. * - * @param dirty The region to redraw when the functors return {@link DisplayList#STATUS_DRAW} + * @param dirty The region to redraw when the functors return {@link RenderNode#STATUS_DRAW} * - * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW} or - * {@link DisplayList#STATUS_INVOKE} + * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW} or + * {@link RenderNode#STATUS_INVOKE} * * @hide */ public int invokeFunctors(Rect dirty) { - return DisplayList.STATUS_DONE; + return RenderNode.STATUS_DONE; } /** diff --git a/core/java/android/view/HardwareLayer.java b/core/java/android/view/HardwareLayer.java index 46e2690..4d78733 100644 --- a/core/java/android/view/HardwareLayer.java +++ b/core/java/android/view/HardwareLayer.java @@ -37,7 +37,7 @@ final class HardwareLayer { private HardwareRenderer mRenderer; private Finalizer mFinalizer; - private DisplayList mDisplayList; + private RenderNode mDisplayList; private final int mLayerType; private HardwareLayer(HardwareRenderer renderer, long deferredUpdater, int type) { @@ -122,11 +122,11 @@ final class HardwareLayer { } } - public DisplayList startRecording() { + public RenderNode startRecording() { assertType(LAYER_TYPE_DISPLAY_LIST); if (mDisplayList == null) { - mDisplayList = DisplayList.create("HardwareLayer"); + mDisplayList = RenderNode.create("HardwareLayer"); } return mDisplayList; } diff --git a/core/java/android/view/RenderNode.java b/core/java/android/view/RenderNode.java new file mode 100644 index 0000000..87ab20e --- /dev/null +++ b/core/java/android/view/RenderNode.java @@ -0,0 +1,910 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view; + +import android.graphics.Matrix; +import android.graphics.Path; + +/** + * <p>A display list records a series of graphics related operations and can replay + * them later. Display lists are usually built by recording operations on a + * {@link HardwareCanvas}. Replaying the operations from a display list avoids + * executing application code on every frame, and is thus much more efficient.</p> + * + * <p>Display lists are used internally for all views by default, and are not + * typically used directly. One reason to consider using a display is a custom + * {@link View} implementation that needs to issue a large number of drawing commands. + * When the view invalidates, all the drawing commands must be reissued, even if + * large portions of the drawing command stream stay the same frame to frame, which + * can become a performance bottleneck. To solve this issue, a custom View might split + * its content into several display lists. A display list is updated only when its + * content, and only its content, needs to be updated.</p> + * + * <p>A text editor might for instance store each paragraph into its own display list. + * Thus when the user inserts or removes characters, only the display list of the + * affected paragraph needs to be recorded again.</p> + * + * <h3>Hardware acceleration</h3> + * <p>Display lists can only be replayed using a {@link HardwareCanvas}. They are not + * supported in software. Always make sure that the {@link android.graphics.Canvas} + * you are using to render a display list is hardware accelerated using + * {@link android.graphics.Canvas#isHardwareAccelerated()}.</p> + * + * <h3>Creating a display list</h3> + * <pre class="prettyprint"> + * HardwareRenderer renderer = myView.getHardwareRenderer(); + * if (renderer != null) { + * DisplayList displayList = renderer.createDisplayList(); + * HardwareCanvas canvas = displayList.start(width, height); + * try { + * // Draw onto the canvas + * // For instance: canvas.drawBitmap(...); + * } finally { + * displayList.end(); + * } + * } + * </pre> + * + * <h3>Rendering a display list on a View</h3> + * <pre class="prettyprint"> + * protected void onDraw(Canvas canvas) { + * if (canvas.isHardwareAccelerated()) { + * HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas; + * hardwareCanvas.drawDisplayList(mDisplayList); + * } + * } + * </pre> + * + * <h3>Releasing resources</h3> + * <p>This step is not mandatory but recommended if you want to release resources + * held by a display list as soon as possible.</p> + * <pre class="prettyprint"> + * // Mark this display list invalid, it cannot be used for drawing anymore, + * // and release resources held by this display list + * displayList.clear(); + * </pre> + * + * <h3>Properties</h3> + * <p>In addition, a display list offers several properties, such as + * {@link #setScaleX(float)} or {@link #setLeft(int)}, that can be used to affect all + * the drawing commands recorded within. For instance, these properties can be used + * to move around a large number of images without re-issuing all the individual + * <code>drawBitmap()</code> calls.</p> + * + * <pre class="prettyprint"> + * private void createDisplayList() { + * mDisplayList = DisplayList.create("MyDisplayList"); + * HardwareCanvas canvas = mDisplayList.start(width, height); + * try { + * for (Bitmap b : mBitmaps) { + * canvas.drawBitmap(b, 0.0f, 0.0f, null); + * canvas.translate(0.0f, b.getHeight()); + * } + * } finally { + * displayList.end(); + * } + * } + * + * protected void onDraw(Canvas canvas) { + * if (canvas.isHardwareAccelerated()) { + * HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas; + * hardwareCanvas.drawDisplayList(mDisplayList); + * } + * } + * + * private void moveContentBy(int x) { + * // This will move all the bitmaps recorded inside the display list + * // by x pixels to the right and redraw this view. All the commands + * // recorded in createDisplayList() won't be re-issued, only onDraw() + * // will be invoked and will execute very quickly + * mDisplayList.offsetLeftAndRight(x); + * invalidate(); + * } + * </pre> + * + * <h3>Threading</h3> + * <p>Display lists must be created on and manipulated from the UI thread only.</p> + * + * @hide + */ +public class RenderNode { + /** + * Flag used when calling + * {@link HardwareCanvas#drawDisplayList(RenderNode, android.graphics.Rect, int)} + * When this flag is set, draw operations lying outside of the bounds of the + * display list will be culled early. It is recommeneded to always set this + * flag. + * + * @hide + */ + public static final int FLAG_CLIP_CHILDREN = 0x1; + + // NOTE: The STATUS_* values *must* match the enum in DrawGlInfo.h + + /** + * Indicates that the display list is done drawing. + * + * @see HardwareCanvas#drawDisplayList(RenderNode, android.graphics.Rect, int) + * + * @hide + */ + public static final int STATUS_DONE = 0x0; + + /** + * Indicates that the display list needs another drawing pass. + * + * @see HardwareCanvas#drawDisplayList(RenderNode, android.graphics.Rect, int) + * + * @hide + */ + public static final int STATUS_DRAW = 0x1; + + /** + * Indicates that the display list needs to re-execute its GL functors. + * + * @see HardwareCanvas#drawDisplayList(RenderNode, android.graphics.Rect, int) + * @see HardwareCanvas#callDrawGLFunction(long) + * + * @hide + */ + public static final int STATUS_INVOKE = 0x2; + + /** + * Indicates that the display list performed GL drawing operations. + * + * @see HardwareCanvas#drawDisplayList(RenderNode, android.graphics.Rect, int) + * + * @hide + */ + public static final int STATUS_DREW = 0x4; + + private boolean mValid; + private final long mNativeDisplayList; + private HardwareRenderer mRenderer; + + private RenderNode(String name) { + mNativeDisplayList = nCreate(); + nSetDisplayListName(mNativeDisplayList, name); + } + + /** + * Creates a new display list that can be used to record batches of + * drawing operations. + * + * @param name The name of the display list, used for debugging purpose. May be null. + * + * @return A new display list. + * + * @hide + */ + public static RenderNode create(String name) { + return new RenderNode(name); + } + + /** + * Starts recording the display list. All operations performed on the + * returned canvas are recorded and stored in this display list. + * + * Calling this method will mark the display list invalid until + * {@link #end()} is called. Only valid display lists can be replayed. + * + * @param width The width of the display list's viewport + * @param height The height of the display list's viewport + * + * @return A canvas to record drawing operations. + * + * @see #end() + * @see #isValid() + */ + public HardwareCanvas start(int width, int height) { + HardwareCanvas canvas = GLES20RecordingCanvas.obtain(); + canvas.setViewport(width, height); + // The dirty rect should always be null for a display list + canvas.onPreDraw(null); + return canvas; + } + + /** + * Ends the recording for this display list. A display list cannot be + * replayed if recording is not finished. Calling this method marks + * the display list valid and {@link #isValid()} will return true. + * + * @see #start(int, int) + * @see #isValid() + */ + public void end(HardwareRenderer renderer, HardwareCanvas endCanvas) { + if (!(endCanvas instanceof GLES20RecordingCanvas)) { + throw new IllegalArgumentException("Passed an invalid canvas to end!"); + } + + GLES20RecordingCanvas canvas = (GLES20RecordingCanvas) endCanvas; + canvas.onPostDraw(); + long displayListData = canvas.finishRecording(); + if (renderer != mRenderer) { + // If we are changing renderers first destroy with the old + // renderer, then set with the new one + destroyDisplayListData(); + } + mRenderer = renderer; + setDisplayListData(displayListData); + canvas.recycle(); + mValid = true; + } + + /** + * Reset native resources. This is called when cleaning up the state of display lists + * during destruction of hardware resources, to ensure that we do not hold onto + * obsolete resources after related resources are gone. + * + * @hide + */ + public void destroyDisplayListData() { + if (!mValid) return; + + setDisplayListData(0); + mRenderer = null; + mValid = false; + } + + private void setDisplayListData(long newData) { + if (mRenderer != null) { + mRenderer.setDisplayListData(mNativeDisplayList, newData); + } else { + throw new IllegalStateException("Trying to set data without a renderer! data=" + newData); + } + } + + /** + * Returns whether the display list is currently usable. If this returns false, + * the display list should be re-recorded prior to replaying it. + * + * @return boolean true if the display list is able to be replayed, false otherwise. + */ + public boolean isValid() { return mValid; } + + long getNativeDisplayList() { + if (!mValid) { + throw new IllegalStateException("The display list is not valid."); + } + return mNativeDisplayList; + } + + /////////////////////////////////////////////////////////////////////////// + // DisplayList Property Setters + /////////////////////////////////////////////////////////////////////////// + + /** + * Set the caching property on the display list, which indicates whether the display list + * holds a layer. Layer display lists should avoid creating an alpha layer, since alpha is + * handled in the drawLayer operation directly (and more efficiently). + * + * @param caching true if the display list represents a hardware layer, false otherwise. + * + * @hide + */ + public void setCaching(boolean caching) { + nSetCaching(mNativeDisplayList, caching); + } + + /** + * Set whether the display list should clip itself to its bounds. This property is controlled by + * the view's parent. + * + * @param clipToBounds true if the display list should clip to its bounds + */ + public void setClipToBounds(boolean clipToBounds) { + nSetClipToBounds(mNativeDisplayList, clipToBounds); + } + + /** + * Set whether the display list should collect and Z order all 3d composited descendents, and + * draw them in order with the default Z=0 content. + * + * @param isolatedZVolume true if the display list should collect and Z order descendents. + */ + public void setIsolatedZVolume(boolean isolatedZVolume) { + nSetIsolatedZVolume(mNativeDisplayList, isolatedZVolume); + } + + /** + * Sets whether the display list should be drawn immediately after the + * closest ancestor display list where isolateZVolume is true. If the + * display list itself satisfies this constraint, changing this attribute + * has no effect on drawing order. + * + * @param shouldProject true if the display list should be projected onto a + * containing volume. + */ + public void setProjectBackwards(boolean shouldProject) { + nSetProjectBackwards(mNativeDisplayList, shouldProject); + } + + /** + * Sets whether the display list is a projection receiver - that its parent + * DisplayList should draw any descendent DisplayLists with + * ProjectBackwards=true directly on top of it. Default value is false. + */ + public void setProjectionReceiver(boolean shouldRecieve) { + nSetProjectionReceiver(mNativeDisplayList, shouldRecieve); + } + + /** + * Sets the outline, defining the shape that casts a shadow, and the path to + * be clipped if setClipToOutline is set. + * + * Deep copies the native path to simplify reference ownership. + * + * @param outline Convex, CW Path to store in the DisplayList. May be null. + */ + public void setOutline(Path outline) { + long nativePath = (outline == null) ? 0 : outline.mNativePath; + nSetOutline(mNativeDisplayList, nativePath); + } + + /** + * Enables or disables clipping to the outline. + * + * @param clipToOutline true if clipping to the outline. + */ + public void setClipToOutline(boolean clipToOutline) { + nSetClipToOutline(mNativeDisplayList, clipToOutline); + } + + /** + * Set the static matrix on the display list. The specified matrix is combined with other + * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.) + * + * @param matrix A transform matrix to apply to this display list + * + * @see #getMatrix(android.graphics.Matrix) + * @see #getMatrix() + */ + public void setStaticMatrix(Matrix matrix) { + nSetStaticMatrix(mNativeDisplayList, matrix.native_instance); + } + + /** + * Set the Animation matrix on the display list. This matrix exists if an Animation is + * currently playing on a View, and is set on the display list during at draw() time. When + * the Animation finishes, the matrix should be cleared by sending <code>null</code> + * for the matrix parameter. + * + * @param matrix The matrix, null indicates that the matrix should be cleared. + * + * @hide + */ + public void setAnimationMatrix(Matrix matrix) { + nSetAnimationMatrix(mNativeDisplayList, + (matrix != null) ? matrix.native_instance : 0); + } + + /** + * Sets the translucency level for the display list. + * + * @param alpha The translucency of the display list, must be a value between 0.0f and 1.0f + * + * @see View#setAlpha(float) + * @see #getAlpha() + */ + public void setAlpha(float alpha) { + nSetAlpha(mNativeDisplayList, alpha); + } + + /** + * Returns the translucency level of this display list. + * + * @return A value between 0.0f and 1.0f + * + * @see #setAlpha(float) + */ + public float getAlpha() { + return nGetAlpha(mNativeDisplayList); + } + + /** + * Sets whether the display list renders content which overlaps. Non-overlapping rendering + * can use a fast path for alpha that avoids rendering to an offscreen buffer. By default + * display lists consider they do not have overlapping content. + * + * @param hasOverlappingRendering False if the content is guaranteed to be non-overlapping, + * true otherwise. + * + * @see android.view.View#hasOverlappingRendering() + * @see #hasOverlappingRendering() + */ + public void setHasOverlappingRendering(boolean hasOverlappingRendering) { + nSetHasOverlappingRendering(mNativeDisplayList, hasOverlappingRendering); + } + + /** + * Indicates whether the content of this display list overlaps. + * + * @return True if this display list renders content which overlaps, false otherwise. + * + * @see #setHasOverlappingRendering(boolean) + */ + public boolean hasOverlappingRendering() { + //noinspection SimplifiableIfStatement + return nHasOverlappingRendering(mNativeDisplayList); + } + + /** + * Sets the translation value for the display list on the X axis. + * + * @param translationX The X axis translation value of the display list, in pixels + * + * @see View#setTranslationX(float) + * @see #getTranslationX() + */ + public void setTranslationX(float translationX) { + nSetTranslationX(mNativeDisplayList, translationX); + } + + /** + * Returns the translation value for this display list on the X axis, in pixels. + * + * @see #setTranslationX(float) + */ + public float getTranslationX() { + return nGetTranslationX(mNativeDisplayList); + } + + /** + * Sets the translation value for the display list on the Y axis. + * + * @param translationY The Y axis translation value of the display list, in pixels + * + * @see View#setTranslationY(float) + * @see #getTranslationY() + */ + public void setTranslationY(float translationY) { + nSetTranslationY(mNativeDisplayList, translationY); + } + + /** + * Returns the translation value for this display list on the Y axis, in pixels. + * + * @see #setTranslationY(float) + */ + public float getTranslationY() { + return nGetTranslationY(mNativeDisplayList); + } + + /** + * Sets the translation value for the display list on the Z axis. + * + * @see View#setTranslationZ(float) + * @see #getTranslationZ() + */ + public void setTranslationZ(float translationZ) { + nSetTranslationZ(mNativeDisplayList, translationZ); + } + + /** + * Returns the translation value for this display list on the Z axis. + * + * @see #setTranslationZ(float) + */ + public float getTranslationZ() { + return nGetTranslationZ(mNativeDisplayList); + } + + /** + * Sets the rotation value for the display list around the Z axis. + * + * @param rotation The rotation value of the display list, in degrees + * + * @see View#setRotation(float) + * @see #getRotation() + */ + public void setRotation(float rotation) { + nSetRotation(mNativeDisplayList, rotation); + } + + /** + * Returns the rotation value for this display list around the Z axis, in degrees. + * + * @see #setRotation(float) + */ + public float getRotation() { + return nGetRotation(mNativeDisplayList); + } + + /** + * Sets the rotation value for the display list around the X axis. + * + * @param rotationX The rotation value of the display list, in degrees + * + * @see View#setRotationX(float) + * @see #getRotationX() + */ + public void setRotationX(float rotationX) { + nSetRotationX(mNativeDisplayList, rotationX); + } + + /** + * Returns the rotation value for this display list around the X axis, in degrees. + * + * @see #setRotationX(float) + */ + public float getRotationX() { + return nGetRotationX(mNativeDisplayList); + } + + /** + * Sets the rotation value for the display list around the Y axis. + * + * @param rotationY The rotation value of the display list, in degrees + * + * @see View#setRotationY(float) + * @see #getRotationY() + */ + public void setRotationY(float rotationY) { + nSetRotationY(mNativeDisplayList, rotationY); + } + + /** + * Returns the rotation value for this display list around the Y axis, in degrees. + * + * @see #setRotationY(float) + */ + public float getRotationY() { + return nGetRotationY(mNativeDisplayList); + } + + /** + * Sets the scale value for the display list on the X axis. + * + * @param scaleX The scale value of the display list + * + * @see View#setScaleX(float) + * @see #getScaleX() + */ + public void setScaleX(float scaleX) { + nSetScaleX(mNativeDisplayList, scaleX); + } + + /** + * Returns the scale value for this display list on the X axis. + * + * @see #setScaleX(float) + */ + public float getScaleX() { + return nGetScaleX(mNativeDisplayList); + } + + /** + * Sets the scale value for the display list on the Y axis. + * + * @param scaleY The scale value of the display list + * + * @see View#setScaleY(float) + * @see #getScaleY() + */ + public void setScaleY(float scaleY) { + nSetScaleY(mNativeDisplayList, scaleY); + } + + /** + * Returns the scale value for this display list on the Y axis. + * + * @see #setScaleY(float) + */ + public float getScaleY() { + return nGetScaleY(mNativeDisplayList); + } + + /** + * Sets all of the transform-related values of the display list + * + * @param alpha The alpha value of the display list + * @param translationX The translationX value of the display list + * @param translationY The translationY value of the display list + * @param rotation The rotation value of the display list + * @param rotationX The rotationX value of the display list + * @param rotationY The rotationY value of the display list + * @param scaleX The scaleX value of the display list + * @param scaleY The scaleY value of the display list + * + * @hide + */ + public void setTransformationInfo(float alpha, + float translationX, float translationY, float translationZ, + float rotation, float rotationX, float rotationY, float scaleX, float scaleY) { + nSetTransformationInfo(mNativeDisplayList, alpha, + translationX, translationY, translationZ, + rotation, rotationX, rotationY, scaleX, scaleY); + } + + /** + * Sets the pivot value for the display list on the X axis + * + * @param pivotX The pivot value of the display list on the X axis, in pixels + * + * @see View#setPivotX(float) + * @see #getPivotX() + */ + public void setPivotX(float pivotX) { + nSetPivotX(mNativeDisplayList, pivotX); + } + + /** + * Returns the pivot value for this display list on the X axis, in pixels. + * + * @see #setPivotX(float) + */ + public float getPivotX() { + return nGetPivotX(mNativeDisplayList); + } + + /** + * Sets the pivot value for the display list on the Y axis + * + * @param pivotY The pivot value of the display list on the Y axis, in pixels + * + * @see View#setPivotY(float) + * @see #getPivotY() + */ + public void setPivotY(float pivotY) { + nSetPivotY(mNativeDisplayList, pivotY); + } + + /** + * Returns the pivot value for this display list on the Y axis, in pixels. + * + * @see #setPivotY(float) + */ + public float getPivotY() { + return nGetPivotY(mNativeDisplayList); + } + + /** + * Sets the camera distance for the display list. Refer to + * {@link View#setCameraDistance(float)} for more information on how to + * use this property. + * + * @param distance The distance in Z of the camera of the display list + * + * @see View#setCameraDistance(float) + * @see #getCameraDistance() + */ + public void setCameraDistance(float distance) { + nSetCameraDistance(mNativeDisplayList, distance); + } + + /** + * Returns the distance in Z of the camera of the display list. + * + * @see #setCameraDistance(float) + */ + public float getCameraDistance() { + return nGetCameraDistance(mNativeDisplayList); + } + + /** + * Sets the left position for the display list. + * + * @param left The left position, in pixels, of the display list + * + * @see View#setLeft(int) + * @see #getLeft() + */ + public void setLeft(int left) { + nSetLeft(mNativeDisplayList, left); + } + + /** + * Returns the left position for the display list in pixels. + * + * @see #setLeft(int) + */ + public float getLeft() { + return nGetLeft(mNativeDisplayList); + } + + /** + * Sets the top position for the display list. + * + * @param top The top position, in pixels, of the display list + * + * @see View#setTop(int) + * @see #getTop() + */ + public void setTop(int top) { + nSetTop(mNativeDisplayList, top); + } + + /** + * Returns the top position for the display list in pixels. + * + * @see #setTop(int) + */ + public float getTop() { + return nGetTop(mNativeDisplayList); + } + + /** + * Sets the right position for the display list. + * + * @param right The right position, in pixels, of the display list + * + * @see View#setRight(int) + * @see #getRight() + */ + public void setRight(int right) { + nSetRight(mNativeDisplayList, right); + } + + /** + * Returns the right position for the display list in pixels. + * + * @see #setRight(int) + */ + public float getRight() { + return nGetRight(mNativeDisplayList); + } + + /** + * Sets the bottom position for the display list. + * + * @param bottom The bottom position, in pixels, of the display list + * + * @see View#setBottom(int) + * @see #getBottom() + */ + public void setBottom(int bottom) { + nSetBottom(mNativeDisplayList, bottom); + } + + /** + * Returns the bottom position for the display list in pixels. + * + * @see #setBottom(int) + */ + public float getBottom() { + return nGetBottom(mNativeDisplayList); + } + + /** + * Sets the left and top positions for the display list + * + * @param left The left position of the display list, in pixels + * @param top The top position of the display list, in pixels + * @param right The right position of the display list, in pixels + * @param bottom The bottom position of the display list, in pixels + * + * @see View#setLeft(int) + * @see View#setTop(int) + * @see View#setRight(int) + * @see View#setBottom(int) + */ + public void setLeftTopRightBottom(int left, int top, int right, int bottom) { + nSetLeftTopRightBottom(mNativeDisplayList, left, top, right, bottom); + } + + /** + * Offsets the left and right positions for the display list + * + * @param offset The amount that the left and right positions of the display + * list are offset, in pixels + * + * @see View#offsetLeftAndRight(int) + */ + public void offsetLeftAndRight(float offset) { + nOffsetLeftAndRight(mNativeDisplayList, offset); + } + + /** + * Offsets the top and bottom values for the display list + * + * @param offset The amount that the top and bottom positions of the display + * list are offset, in pixels + * + * @see View#offsetTopAndBottom(int) + */ + public void offsetTopAndBottom(float offset) { + nOffsetTopAndBottom(mNativeDisplayList, offset); + } + + /** + * Outputs the display list to the log. This method exists for use by + * tools to output display lists for selected nodes to the log. + * + * @hide + */ + public void output() { + nOutput(mNativeDisplayList); + } + + /////////////////////////////////////////////////////////////////////////// + // Native methods + /////////////////////////////////////////////////////////////////////////// + + private static native long nCreate(); + private static native void nDestroyDisplayList(long displayList); + private static native void nSetDisplayListName(long displayList, String name); + + // Properties + + private static native void nOffsetTopAndBottom(long displayList, float offset); + private static native void nOffsetLeftAndRight(long displayList, float offset); + private static native void nSetLeftTopRightBottom(long displayList, int left, int top, + int right, int bottom); + private static native void nSetBottom(long displayList, int bottom); + private static native void nSetRight(long displayList, int right); + private static native void nSetTop(long displayList, int top); + private static native void nSetLeft(long displayList, int left); + private static native void nSetCameraDistance(long displayList, float distance); + private static native void nSetPivotY(long displayList, float pivotY); + private static native void nSetPivotX(long displayList, float pivotX); + private static native void nSetCaching(long displayList, boolean caching); + private static native void nSetClipToBounds(long displayList, boolean clipToBounds); + private static native void nSetProjectBackwards(long displayList, boolean shouldProject); + private static native void nSetProjectionReceiver(long displayList, boolean shouldRecieve); + private static native void nSetIsolatedZVolume(long displayList, boolean isolateZVolume); + private static native void nSetOutline(long displayList, long nativePath); + private static native void nSetClipToOutline(long displayList, boolean clipToOutline); + private static native void nSetAlpha(long displayList, float alpha); + private static native void nSetHasOverlappingRendering(long displayList, + boolean hasOverlappingRendering); + private static native void nSetTranslationX(long displayList, float translationX); + private static native void nSetTranslationY(long displayList, float translationY); + private static native void nSetTranslationZ(long displayList, float translationZ); + private static native void nSetRotation(long displayList, float rotation); + private static native void nSetRotationX(long displayList, float rotationX); + private static native void nSetRotationY(long displayList, float rotationY); + private static native void nSetScaleX(long displayList, float scaleX); + private static native void nSetScaleY(long displayList, float scaleY); + private static native void nSetTransformationInfo(long displayList, float alpha, + float translationX, float translationY, float translationZ, + float rotation, float rotationX, float rotationY, float scaleX, float scaleY); + private static native void nSetStaticMatrix(long displayList, long nativeMatrix); + private static native void nSetAnimationMatrix(long displayList, long animationMatrix); + + private static native boolean nHasOverlappingRendering(long displayList); + private static native float nGetAlpha(long displayList); + private static native float nGetLeft(long displayList); + private static native float nGetTop(long displayList); + private static native float nGetRight(long displayList); + private static native float nGetBottom(long displayList); + private static native float nGetCameraDistance(long displayList); + private static native float nGetScaleX(long displayList); + private static native float nGetScaleY(long displayList); + private static native float nGetTranslationX(long displayList); + private static native float nGetTranslationY(long displayList); + private static native float nGetTranslationZ(long displayList); + private static native float nGetRotation(long displayList); + private static native float nGetRotationX(long displayList); + private static native float nGetRotationY(long displayList); + private static native float nGetPivotX(long displayList); + private static native float nGetPivotY(long displayList); + private static native void nOutput(long displayList); + + /////////////////////////////////////////////////////////////////////////// + // Finalization + /////////////////////////////////////////////////////////////////////////// + + @Override + protected void finalize() throws Throwable { + try { + destroyDisplayListData(); + nDestroyDisplayList(mNativeDisplayList); + } finally { + super.finalize(); + } + } +} diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index e693b9e..5a8d2c8 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -167,13 +167,6 @@ public class SurfaceControl { public static final int FX_SURFACE_DIM = 0x00020000; /** - * Surface creation flag: Creates a video plane Surface. - * This surface is backed by a hardware video plane. It is an error to lock - * a video plane surface, since it doesn't have a backing store. - */ - public static final int FX_SURFACE_VIDEO_PLANE = 0x00040000; - - /** * Mask used for FX values above. * */ diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 1f211c2..23123dd 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -422,10 +422,7 @@ public class SurfaceView extends View { mWindowType = type; } - /** - * @hide - */ - protected void updateWindow(boolean force, boolean redrawNeeded) { + private void updateWindow(boolean force, boolean redrawNeeded) { if (!mHaveFrame) { return; } diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java index a1fb123..2a488a0 100644 --- a/core/java/android/view/ThreadedRenderer.java +++ b/core/java/android/view/ThreadedRenderer.java @@ -163,7 +163,7 @@ public class ThreadedRenderer extends HardwareRenderer { view.mPrivateFlags &= ~View.PFLAG_INVALIDATED; Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); - DisplayList displayList = view.getDisplayList(); + RenderNode displayList = view.getDisplayList(); Trace.traceEnd(Trace.TRACE_TAG_VIEW); view.mRecreateDisplayList = false; diff --git a/core/java/android/view/VideoPlaneView.java b/core/java/android/view/VideoPlaneView.java deleted file mode 100644 index 81dcf9d..0000000 --- a/core/java/android/view/VideoPlaneView.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.view; - -import android.content.Context; -import android.util.AttributeSet; - -/** - * Provides a dedicated surface embedded inside of a view hierarchy much like a - * {@link SurfaceView}, but the surface is actually backed by a hardware video - * plane. - * - * TODO: Eventually this should be separate from SurfaceView. - * - * @hide - */ -public class VideoPlaneView extends SurfaceView { - public VideoPlaneView(Context context) { - super(context); - } - - public VideoPlaneView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public VideoPlaneView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public VideoPlaneView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override - protected void updateWindow(boolean force, boolean redrawNeeded) { - mLayout.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_VIDEO_PLANE; - super.updateWindow(force, redrawNeeded); - } -} diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 7a58d06..ecd73af 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2386,17 +2386,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ static final int PFLAG3_FITTING_SYSTEM_WINDOWS = 0x80; - /** - * Flag indicating that an view will cast a shadow onto the Z=0 plane if elevated. - */ - static final int PFLAG3_CASTS_SHADOW = 0x100; - - /** - * Flag indicating that view will be transformed by the global camera if rotated in 3d, or given - * a non-0 Z translation. - */ - static final int PFLAG3_USES_GLOBAL_CAMERA = 0x200; - /* End of masks for mPrivateFlags3 */ static final int DRAG_MASK = PFLAG2_DRAG_CAN_ACCEPT | PFLAG2_DRAG_HOVERED; @@ -3269,7 +3258,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * of the background drawable. It is cleared on temporary detach and reset * on cleanup. */ - private DisplayList mBackgroundDisplayList; + private RenderNode mBackgroundDisplayList; private int mBackgroundResource; private boolean mBackgroundSizeChanged; @@ -3559,7 +3548,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * of the View content. It is cleared on temporary detach and reset on * cleanup. */ - DisplayList mDisplayList; + RenderNode mDisplayList; /** * Set to true when the view is sending hover accessibility events because it @@ -4039,11 +4028,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, case R.styleable.View_layerType: setLayerType(a.getInt(attr, LAYER_TYPE_NONE), null); break; - case R.styleable.View_castsShadow: - if (a.getBoolean(attr, false)) { - mPrivateFlags3 |= PFLAG3_CASTS_SHADOW; - } - break; case R.styleable.View_textDirection: // Clear any text direction flag already set mPrivateFlags2 &= ~PFLAG2_TEXT_DIRECTION_MASK; @@ -10852,7 +10836,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @param outline The new outline of the view. Must be non-null, and convex. * - * @see #setCastsShadow(boolean) * @see #getOutline(Path) * @see #getClipToOutline() * @see #setClipToOutline(boolean) @@ -10916,95 +10899,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Returns whether the View will cast shadows when its - * {@link #setTranslationZ(float) z translation} is greater than 0, or it is - * rotated in 3D. - * - * @see #setTranslationZ(float) - * @see #setRotationX(float) - * @see #setRotationY(float) - * @see #setCastsShadow(boolean) - * @attr ref android.R.styleable#View_castsShadow - */ - public final boolean getCastsShadow() { - return ((mPrivateFlags3 & PFLAG3_CASTS_SHADOW) != 0); - } - - /** - * Set to true to enable this View to cast shadows. - * <p> - * If enabled, and the View has a z translation greater than 0, or is - * rotated in 3D, the shadow will be cast onto its parent at the z = 0 - * plane. - * <p> - * The shape of the shadow being cast is defined by the - * {@link #setOutline(Path) outline} of the view, or the rectangular bounds - * of the view if the outline is not set or is empty. - * - * @see #setTranslationZ(float) - * @see #getCastsShadow() - * @attr ref android.R.styleable#View_castsShadow - */ - public void setCastsShadow(boolean castsShadow) { - // TODO : Add a fast invalidation here. - if (getCastsShadow() != castsShadow) { - if (castsShadow) { - mPrivateFlags3 |= PFLAG3_CASTS_SHADOW; - } else { - mPrivateFlags3 &= ~PFLAG3_CASTS_SHADOW; - } - if (mDisplayList != null) { - mDisplayList.setCastsShadow(castsShadow); - } - } - } - - /** - * Returns whether the View will be transformed by the global camera. - * - * @see #setUsesGlobalCamera(boolean) - * - * @hide - */ - public final boolean getUsesGlobalCamera() { - return ((mPrivateFlags3 & PFLAG3_USES_GLOBAL_CAMERA) != 0); - } - - /** - * Sets whether the View should be transformed by the global camera. - * <p> - * If the view has a Z translation or 3D rotation, perspective from the - * global camera will be applied. This enables an app to transform multiple - * views in 3D with coherent perspective projection among them all. - * <p> - * Setting this to true will cause {@link #setCameraDistance() camera distance} - * to be ignored, as the global camera's position will dictate perspective - * transform. - * <p> - * This should not be used in conjunction with {@link android.graphics.Camera}. - * - * @see #getUsesGlobalCamera() - * @see #setTranslationZ(float) - * @see #setRotationX(float) - * @see #setRotationY(float) - * - * @hide - */ - public void setUsesGlobalCamera(boolean usesGlobalCamera) { - // TODO : Add a fast invalidation here. - if (getUsesGlobalCamera() != usesGlobalCamera) { - if (usesGlobalCamera) { - mPrivateFlags3 |= PFLAG3_USES_GLOBAL_CAMERA; - } else { - mPrivateFlags3 &= ~PFLAG3_USES_GLOBAL_CAMERA; - } - if (mDisplayList != null) { - mDisplayList.setUsesGlobalCamera(usesGlobalCamera); - } - } - } - - /** * Hit rectangle in parent's coordinates * * @param outRect The hit rectangle of the view. @@ -11567,7 +11461,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } // Damage the entire IsolatedZVolume recieving this view's shadow. - if (getCastsShadow() && getTranslationZ() != 0) { + if (getTranslationZ() != 0) { damageIsolatedZVolume(); } } @@ -11647,7 +11541,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } else { damageInParent(); } - if (invalidateParent && getCastsShadow() && getTranslationZ() != 0) { + if (invalidateParent && getTranslationZ() != 0) { damageIsolatedZVolume(); } } @@ -13802,7 +13696,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } mHardwareLayer.setLayerPaint(mLayerPaint); - DisplayList displayList = mHardwareLayer.startRecording(); + RenderNode displayList = mHardwareLayer.startRecording(); if (getDisplayList(displayList, true) != displayList) { throw new IllegalStateException("getDisplayList() didn't return" + " the input displaylist for a hardware layer!"); @@ -13952,7 +13846,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * the view will avoid creating a layer inside the resulting display list. * @return A new or reused DisplayList object. */ - private DisplayList getDisplayList(DisplayList displayList, boolean isLayer) { + private RenderNode getDisplayList(RenderNode displayList, boolean isLayer) { final HardwareRenderer renderer = getHardwareRenderer(); if (renderer == null || !canHaveDisplayList()) { return null; @@ -13978,7 +13872,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mRecreateDisplayList = true; } if (displayList == null) { - displayList = DisplayList.create(getClass().getName()); + displayList = RenderNode.create(getClass().getName()); // If we're creating a new display list, make sure our parent gets invalidated // since they will need to recreate their display list to account for this // new child display list. @@ -14065,7 +13959,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @hide */ - public DisplayList getDisplayList() { + public RenderNode getDisplayList() { mDisplayList = getDisplayList(mDisplayList, false); return mDisplayList; } @@ -14671,7 +14565,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * necessary when a display list is being re-created, because we need to make sure that * previously-set transform values */ - void setDisplayListProperties(DisplayList displayList) { + void setDisplayListProperties(RenderNode displayList) { if (displayList != null) { displayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom); displayList.setHasOverlappingRendering(hasOverlappingRendering()); @@ -14685,8 +14579,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } displayList.setOutline(mOutline); displayList.setClipToOutline(getClipToOutline()); - displayList.setCastsShadow(getCastsShadow()); - displayList.setUsesGlobalCamera(getUsesGlobalCamera()); float alpha = 1; if (mParent instanceof ViewGroup && (((ViewGroup) mParent).mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) { @@ -14816,7 +14708,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags &= ~PFLAG_INVALIDATED; } - DisplayList displayList = null; + RenderNode displayList = null; Bitmap cache = null; boolean hasDisplayList = false; if (caching) { @@ -15295,7 +15187,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, && mAttachInfo.mHardwareRenderer != null) { mBackgroundDisplayList = getDrawableDisplayList(background, mBackgroundDisplayList); - final DisplayList displayList = mBackgroundDisplayList; + final RenderNode displayList = mBackgroundDisplayList; if (displayList != null && displayList.isValid()) { setBackgroundDisplayListProperties(displayList); ((HardwareCanvas) canvas).drawDisplayList(displayList); @@ -15319,7 +15211,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @param displayList Valid display list for the background drawable */ - private void setBackgroundDisplayListProperties(DisplayList displayList) { + private void setBackgroundDisplayListProperties(RenderNode displayList) { displayList.setTranslationX(mScrollX); displayList.setTranslationY(mScrollY); } @@ -15332,9 +15224,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param displayList Existing display list, or {@code null} * @return A valid display list for the specified drawable */ - private DisplayList getDrawableDisplayList(Drawable drawable, DisplayList displayList) { + private RenderNode getDrawableDisplayList(Drawable drawable, RenderNode displayList) { if (displayList == null) { - displayList = DisplayList.create(drawable.getClass().getName()); + displayList = RenderNode.create(drawable.getClass().getName()); } final Rect bounds = drawable.getBounds(); diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index e67659c..5112b9a 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -80,7 +80,7 @@ public class ViewConfiguration { * is a tap or a scroll. If the user does not move within this interval, it is * considered to be a tap. */ - private static final int TAP_TIMEOUT = 180; + private static final int TAP_TIMEOUT = 100; /** * Defines the duration in milliseconds we will wait to see if a touch event diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index 1892aa7..563ffb7 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -925,7 +925,7 @@ public class ViewPropertyAnimator { */ private void setValue(int propertyConstant, float value) { final View.TransformationInfo info = mView.mTransformationInfo; - final DisplayList displayList = mView.mDisplayList; + final RenderNode displayList = mView.mDisplayList; switch (propertyConstant) { case TRANSLATION_X: info.mTranslationX = value; diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 18517c5..185cb65 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1465,7 +1465,7 @@ public final class ViewRootImpl implements ViewParent, mWidth, mHeight); } mResizeBuffer.prepare(mWidth, mHeight, false); - DisplayList layerDisplayList = mResizeBuffer.startRecording(); + RenderNode layerDisplayList = mResizeBuffer.startRecording(); HardwareCanvas layerCanvas = layerDisplayList.start(mWidth, mHeight); final int restoreCount = layerCanvas.save(); @@ -1484,10 +1484,10 @@ public final class ViewRootImpl implements ViewParent, mTranslator.translateCanvas(layerCanvas); } - DisplayList displayList = mView.mDisplayList; + RenderNode displayList = mView.mDisplayList; if (displayList != null && displayList.isValid()) { layerCanvas.drawDisplayList(displayList, null, - DisplayList.FLAG_CLIP_CHILDREN); + RenderNode.FLAG_CLIP_CHILDREN); } else { mView.draw(layerCanvas); } @@ -2178,7 +2178,7 @@ public final class ViewRootImpl implements ViewParent, * @hide */ void outputDisplayList(View view) { - DisplayList displayList = view.getDisplayList(); + RenderNode displayList = view.getDisplayList(); if (displayList != null) { displayList.output(); } @@ -5206,7 +5206,7 @@ public final class ViewRootImpl implements ViewParent, } private static void getGfxInfo(View view, int[] info) { - DisplayList displayList = view.mDisplayList; + RenderNode displayList = view.mDisplayList; info[0]++; if (displayList != null) { info[1] += 0; /* TODO: Memory used by display lists */ diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 55956bf..53a4c0d0 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -98,7 +98,7 @@ public interface WindowManager extends ViewManager { * the given view hierarchy's {@link View#onDetachedFromWindow() * View.onDetachedFromWindow()} methods before returning. This is not * for normal applications; using it correctly requires great care. - * + * * @param view The view to be removed. */ public void removeViewImmediate(View view); @@ -112,7 +112,7 @@ public interface WindowManager extends ViewManager { */ @ViewDebug.ExportedProperty public int x; - + /** * Y position for this window. With the default gravity it is ignored. * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides @@ -161,7 +161,7 @@ public interface WindowManager extends ViewManager { * be used by applications, and a special permission is required * to use them. * </ul> - * + * * @see #TYPE_BASE_APPLICATION * @see #TYPE_APPLICATION * @see #TYPE_APPLICATION_STARTING @@ -223,12 +223,12 @@ public interface WindowManager extends ViewManager { @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION") }) public int type; - + /** * Start of window types that represent normal application windows. */ public static final int FIRST_APPLICATION_WINDOW = 1; - + /** * Window type: an application window that serves as the "base" window * of the overall application; all other application windows will @@ -236,14 +236,14 @@ public interface WindowManager extends ViewManager { * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_BASE_APPLICATION = 1; - + /** * Window type: a normal application window. The {@link #token} must be * an Activity token identifying who the window belongs to. * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_APPLICATION = 2; - + /** * Window type: special application window that is displayed while the * application is starting. Not for use by applications themselves; @@ -252,12 +252,12 @@ public interface WindowManager extends ViewManager { * In multiuser systems shows on all users' windows. */ public static final int TYPE_APPLICATION_STARTING = 3; - + /** * End of types of application windows. */ public static final int LAST_APPLICATION_WINDOW = 99; - + /** * Start of types of sub-windows. The {@link #token} of these windows * must be set to the window they are attached to. These types of @@ -265,19 +265,19 @@ public interface WindowManager extends ViewManager { * coordinate space is relative to their attached window. */ public static final int FIRST_SUB_WINDOW = 1000; - + /** * Window type: a panel on top of an application window. These windows * appear on top of their attached window. */ public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW; - + /** * Window type: window for showing media (such as video). These windows * are displayed behind their attached window. */ public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1; - + /** * Window type: a sub-panel on top of an application window. These * windows are displayed on top their attached window and any @@ -290,7 +290,7 @@ public interface WindowManager extends ViewManager { * as a child of its container. */ public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3; - + /** * Window type: window for showing overlays on top of media windows. * These windows are displayed between TYPE_APPLICATION_MEDIA and the @@ -299,18 +299,18 @@ public interface WindowManager extends ViewManager { * @hide */ public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4; - + /** * End of types of sub-windows. */ public static final int LAST_SUB_WINDOW = 1999; - + /** * Start of system-specific window types. These are not normally * created by applications. */ public static final int FIRST_SYSTEM_WINDOW = 2000; - + /** * Window type: the status bar. There can be only one status bar * window; it is placed at the top of the screen, and all other @@ -318,14 +318,14 @@ public interface WindowManager extends ViewManager { * In multiuser systems shows on all users' windows. */ public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW; - + /** * Window type: the search bar. There can be only one search bar * window; it is placed at the top of the screen. * In multiuser systems shows on all users' windows. */ public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1; - + /** * Window type: phone. These are non-application windows providing * user interaction with the phone (in particular incoming calls). @@ -334,26 +334,26 @@ public interface WindowManager extends ViewManager { * In multiuser systems shows on all users' windows. */ public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; - + /** * Window type: system window, such as low power alert. These windows * are always on top of application windows. * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3; - + /** * Window type: keyguard window. * In multiuser systems shows on all users' windows. */ public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4; - + /** * Window type: transient notifications. * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5; - + /** * Window type: system overlay windows, which need to be displayed * on top of everything else. These windows must not take input @@ -361,7 +361,7 @@ public interface WindowManager extends ViewManager { * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6; - + /** * Window type: priority phone UI, which needs to be displayed even if * the keyguard is active. These windows must not take input @@ -369,26 +369,26 @@ public interface WindowManager extends ViewManager { * In multiuser systems shows on all users' windows. */ public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7; - + /** * Window type: panel that slides out from the status bar * In multiuser systems shows on all users' windows. */ public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8; - + /** * Window type: dialogs that the keyguard shows * In multiuser systems shows on all users' windows. */ public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9; - + /** * Window type: internal system error windows, appear on top of * everything they can. * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10; - + /** * Window type: internal input methods windows, which appear above * the normal UI. Application windows may be resized or panned to keep @@ -559,16 +559,16 @@ public interface WindowManager extends ViewManager { /** @deprecated this is ignored, this value is set automatically when needed. */ @Deprecated public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; - + /** * @deprecated this is ignored */ @Deprecated public int memoryType; - + /** Window flag: as long as this window is visible to the user, allow - * the lock screen to activate while the screen is on. - * This can be used independently, or in combination with + * the lock screen to activate while the screen is on. + * This can be used independently, or in combination with * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */ public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001; @@ -586,47 +586,47 @@ public interface WindowManager extends ViewManager { * instead go to whatever focusable window is behind it. This flag * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that * is explicitly set. - * + * * <p>Setting this flag also implies that the window will not need to * interact with - * a soft input method, so it will be Z-ordered and positioned + * a soft input method, so it will be Z-ordered and positioned * independently of any active input method (typically this means it * gets Z-ordered on top of the input method, so it can use the full * screen for its content and cover the input method if needed. You * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */ public static final int FLAG_NOT_FOCUSABLE = 0x00000008; - + /** Window flag: this window can never receive touch events. */ public static final int FLAG_NOT_TOUCHABLE = 0x00000010; - + /** Window flag: even when this window is focusable (its * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events * outside of the window to be sent to the windows behind it. Otherwise * it will consume all pointer events itself, regardless of whether they * are inside of the window. */ public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020; - + /** Window flag: when set, if the device is asleep when the touch * screen is pressed, you will receive this first touch event. Usually * the first touch event is consumed by the system since the user can * not see what they are pressing on. */ public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040; - + /** Window flag: as long as this window is visible to the user, keep * the device's screen turned on and bright. */ public static final int FLAG_KEEP_SCREEN_ON = 0x00000080; - + /** Window flag: place the window within the entire screen, ignoring * decorations around the border (such as the status bar). The * window must correctly position its contents to take the screen * decoration into account. This flag is normally set for you * by Window as described in {@link Window#setFlags}. */ public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100; - + /** Window flag: allow window to extend outside of the screen. */ public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200; - + /** * Window flag: hide all screen decorations (such as the status bar) while * this window is displayed. This allows the window to use the entire @@ -648,17 +648,17 @@ public interface WindowManager extends ViewManager { * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p> */ public static final int FLAG_FULLSCREEN = 0x00000400; - + /** Window flag: override {@link #FLAG_FULLSCREEN} and force the * screen decorations (such as the status bar) to be shown. */ public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; - + /** Window flag: turn on dithering when compositing this window to * the screen. * @deprecated This flag is no longer used. */ @Deprecated public static final int FLAG_DITHER = 0x00001000; - + /** Window flag: treat the content of the window as secure, preventing * it from appearing in screenshots or from being viewed on non-secure * displays. @@ -667,21 +667,21 @@ public interface WindowManager extends ViewManager { * secure surfaces and secure displays. */ public static final int FLAG_SECURE = 0x00002000; - + /** Window flag: a special mode where the layout parameters are used * to perform scaling of the surface when it is composited to the * screen. */ public static final int FLAG_SCALED = 0x00004000; - + /** Window flag: intended for windows that will often be used when the user is * holding the screen against their face, it will aggressively filter the event * stream to prevent unintended presses in this situation that may not be - * desired for a particular window, when such an event stream is detected, the + * desired for a particular window, when such an event stream is detected, the * application will receive a CANCEL motion event to indicate this so applications - * can handle this accordingly by taking no action on the event + * can handle this accordingly by taking no action on the event * until the finger is released. */ public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000; - + /** Window flag: a special option only for use in combination with * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the * screen your window may appear on top of or behind screen decorations @@ -690,7 +690,7 @@ public interface WindowManager extends ViewManager { * content is not covered by screen decorations. This flag is normally * set for you by Window as described in {@link Window#setFlags}.*/ public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; - + /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with * respect to how this window interacts with the current method. That * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the @@ -701,7 +701,7 @@ public interface WindowManager extends ViewManager { * to use more space and cover the input method. */ public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; - + /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you * can set this flag to receive a single special MotionEvent with * the action @@ -711,7 +711,7 @@ public interface WindowManager extends ViewManager { * first down as an ACTION_OUTSIDE. */ public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000; - + /** Window flag: special flag to let windows be shown when the screen * is locked. This will let application windows take precedence over * key guard or any other lock screens. Can be used with @@ -741,13 +741,13 @@ public interface WindowManager extends ViewManager { * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p> */ public static final int FLAG_SHOW_WALLPAPER = 0x00100000; - + /** Window flag: when set as a window is being added or made * visible, once the window has been shown then the system will * poke the power manager's user activity (as if the user had woken * up the device) to turn the screen on. */ public static final int FLAG_TURN_SCREEN_ON = 0x00200000; - + /** Window flag: when set the window will cause the keyguard to * be dismissed, only if it is not a secure lock keyguard. Because such * a keyguard is not needed for security, it will never re-appear if @@ -761,7 +761,7 @@ public interface WindowManager extends ViewManager { * also been set. */ public static final int FLAG_DISMISS_KEYGUARD = 0x00400000; - + /** Window flag: when set the window will accept for touch events * outside of its bounds to be sent to other windows that also * support split touch. When this flag is not set, the first pointer @@ -773,7 +773,7 @@ public interface WindowManager extends ViewManager { * to be split across multiple windows. */ public static final int FLAG_SPLIT_TOUCH = 0x00800000; - + /** * <p>Indicates whether this window should be hardware accelerated. * Requesting hardware acceleration does not guarantee it will happen.</p> @@ -916,7 +916,7 @@ public interface WindowManager extends ViewManager { /** * Various behavioral options/flags. Default is none. - * + * * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON * @see #FLAG_DIM_BEHIND * @see #FLAG_NOT_FOCUSABLE @@ -1014,10 +1014,10 @@ public interface WindowManager extends ViewManager { * as if it was. * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows * that need hardware acceleration (e.g. LockScreen), where hardware acceleration - * is generally disabled. This flag must be specified in addition to + * is generally disabled. This flag must be specified in addition to * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system * windows. - * + * * @hide */ public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001; @@ -1028,7 +1028,7 @@ public interface WindowManager extends ViewManager { * If certain parts of the UI that really do want to use hardware * acceleration, this flag can be set to force it. This is basically * for the lock screen. Anyone else using it, you are probably wrong. - * + * * @hide */ public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002; @@ -1086,11 +1086,6 @@ public interface WindowManager extends ViewManager { * {@hide} */ public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200; - /** Window flag: the window is backed by a video plane, instead of a - * regular surface. - * {@hide} */ - public static final int PRIVATE_FLAG_VIDEO_PLANE = 0x00000400; - /** * Control flags that are private to the platform. * @hide @@ -1105,9 +1100,9 @@ public interface WindowManager extends ViewManager { * flags and returns true if the combination of the two corresponds * to a window that needs to be behind the input method so that the * user can type into it. - * + * * @param flags The current window manager flags. - * + * * @return Returns true if such a window should be behind/interact * with an input method, false if not. */ @@ -1119,63 +1114,63 @@ public interface WindowManager extends ViewManager { } return false; } - + /** * Mask for {@link #softInputMode} of the bits that determine the * desired visibility state of the soft input area for this window. */ public static final int SOFT_INPUT_MASK_STATE = 0x0f; - + /** * Visibility state for {@link #softInputMode}: no state has been specified. */ public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; - + /** * Visibility state for {@link #softInputMode}: please don't change the state of * the soft input area. */ public static final int SOFT_INPUT_STATE_UNCHANGED = 1; - + /** * Visibility state for {@link #softInputMode}: please hide any soft input * area when normally appropriate (when the user is navigating * forward to your window). */ public static final int SOFT_INPUT_STATE_HIDDEN = 2; - + /** * Visibility state for {@link #softInputMode}: please always hide any * soft input area when this window receives focus. */ public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; - + /** * Visibility state for {@link #softInputMode}: please show the soft * input area when normally appropriate (when the user is navigating * forward to your window). */ public static final int SOFT_INPUT_STATE_VISIBLE = 4; - + /** * Visibility state for {@link #softInputMode}: please always make the * soft input area visible when this window receives input focus. */ public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; - + /** * Mask for {@link #softInputMode} of the bits that determine the * way that the window should be adjusted to accommodate the soft * input window. */ public static final int SOFT_INPUT_MASK_ADJUST = 0xf0; - + /** Adjustment option for {@link #softInputMode}: nothing specified. * The system will try to pick one or * the other depending on the contents of the window. */ public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00; - + /** Adjustment option for {@link #softInputMode}: set to allow the * window to be resized when an input * method is shown, so that its contents are not covered by the input @@ -1188,7 +1183,7 @@ public interface WindowManager extends ViewManager { * not resize, but will stay fullscreen. */ public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10; - + /** Adjustment option for {@link #softInputMode}: set to have a window * pan when an input method is * shown, so it doesn't need to deal with resizing but just panned @@ -1198,7 +1193,7 @@ public interface WindowManager extends ViewManager { * the other depending on the contents of the window. */ public static final int SOFT_INPUT_ADJUST_PAN = 0x20; - + /** Adjustment option for {@link #softInputMode}: set to have a window * not adjust for a shown input method. The window will not be resized, * and it will not be panned to make its focus visible. @@ -1217,7 +1212,7 @@ public interface WindowManager extends ViewManager { /** * Desired operating mode for any soft input area. May be any combination * of: - * + * * <ul> * <li> One of the visibility states * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED}, @@ -1234,7 +1229,7 @@ public interface WindowManager extends ViewManager { * {@link android.R.attr#windowSoftInputMode} attribute.</p> */ public int softInputMode; - + /** * Placement of window within the screen as per {@link Gravity}. Both * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, @@ -1251,7 +1246,7 @@ public interface WindowManager extends ViewManager { * @see Gravity */ public int gravity; - + /** * The horizontal margin, as a percentage of the container's width, * between the container and the widget. See @@ -1260,7 +1255,7 @@ public interface WindowManager extends ViewManager { * field is added with {@link #x} to supply the <var>xAdj</var> parameter. */ public float horizontalMargin; - + /** * The vertical margin, as a percentage of the container's height, * between the container and the widget. See @@ -1269,26 +1264,26 @@ public interface WindowManager extends ViewManager { * field is added with {@link #y} to supply the <var>yAdj</var> parameter. */ public float verticalMargin; - + /** * The desired bitmap format. May be one of the constants in * {@link android.graphics.PixelFormat}. Default is OPAQUE. */ public int format; - + /** * A style resource defining the animations to use for this window. * This must be a system resource; it can not be an application resource * because the window manager does not have access to applications. */ public int windowAnimations; - + /** * An alpha value to apply to this entire window. * An alpha of 1.0 means fully opaque and 0.0 means fully transparent */ public float alpha = 1.0f; - + /** * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming * to apply. Range is from 1.0 for completely opaque to 0.0 for no @@ -1316,7 +1311,7 @@ public interface WindowManager extends ViewManager { * to the hightest value when this window is in front. */ public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f; - + /** * This can be used to override the user's preferred brightness of * the screen. A value of less than 0, the default, means to use the @@ -1324,7 +1319,7 @@ public interface WindowManager extends ViewManager { * dark to full bright. */ public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE; - + /** * This can be used to override the standard behavior of the button and * keyboard backlights. A value of less than 0, the default, means to @@ -1358,7 +1353,7 @@ public interface WindowManager extends ViewManager { * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered * by other windows. All other situations default to the * {@link #ROTATION_ANIMATION_ROTATE} behavior. - * + * * @see #ROTATION_ANIMATION_ROTATE * @see #ROTATION_ANIMATION_CROSSFADE * @see #ROTATION_ANIMATION_JUMPCUT @@ -1370,18 +1365,18 @@ public interface WindowManager extends ViewManager { * you. */ public IBinder token = null; - + /** * Name of the package owning this window. */ public String packageName = null; - + /** * Specific orientation value for a window. * May be any of the same values allowed - * for {@link android.content.pm.ActivityInfo#screenOrientation}. - * If not set, a default value of - * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED} + * for {@link android.content.pm.ActivityInfo#screenOrientation}. + * If not set, a default value of + * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED} * will be used. */ public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; @@ -1403,7 +1398,7 @@ public interface WindowManager extends ViewManager { /** * Get callbacks about the system ui visibility changing. - * + * * TODO: Maybe there should be a bitfield of optional callbacks that we need. * * @hide @@ -1469,34 +1464,34 @@ public interface WindowManager extends ViewManager { type = TYPE_APPLICATION; format = PixelFormat.OPAQUE; } - + public LayoutParams(int _type) { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = _type; format = PixelFormat.OPAQUE; } - + public LayoutParams(int _type, int _flags) { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = _type; flags = _flags; format = PixelFormat.OPAQUE; } - + public LayoutParams(int _type, int _flags, int _format) { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = _type; flags = _flags; format = _format; } - + public LayoutParams(int w, int h, int _type, int _flags, int _format) { super(w, h); type = _type; flags = _flags; format = _format; } - + public LayoutParams(int w, int h, int xpos, int ypos, int _type, int _flags, int _format) { super(w, h); @@ -1506,18 +1501,18 @@ public interface WindowManager extends ViewManager { flags = _flags; format = _format; } - + public final void setTitle(CharSequence title) { if (null == title) title = ""; - + mTitle = TextUtils.stringOrSpannedString(title); } - + public final CharSequence getTitle() { return mTitle; } - + public int describeContents() { return 0; } @@ -1551,19 +1546,19 @@ public interface WindowManager extends ViewManager { out.writeInt(inputFeatures); out.writeLong(userActivityTimeout); } - + public static final Parcelable.Creator<LayoutParams> CREATOR = new Parcelable.Creator<LayoutParams>() { public LayoutParams createFromParcel(Parcel in) { return new LayoutParams(in); } - + public LayoutParams[] newArray(int size) { return new LayoutParams[size]; } }; - - + + public LayoutParams(Parcel in) { width = in.readInt(); height = in.readInt(); @@ -1593,7 +1588,7 @@ public interface WindowManager extends ViewManager { inputFeatures = in.readInt(); userActivityTimeout = in.readLong(); } - + @SuppressWarnings({"PointlessBitwiseExpression"}) public static final int LAYOUT_CHANGED = 1<<0; public static final int TYPE_CHANGED = 1<<1; @@ -1627,10 +1622,10 @@ public interface WindowManager extends ViewManager { // internal buffer to backup/restore parameters under compatibility mode. private int[] mCompatibilityParamsBackup = null; - + public final int copyFrom(LayoutParams o) { int changes = 0; - + if (width != o.width) { width = o.width; changes |= LAYOUT_CHANGED; @@ -1729,7 +1724,7 @@ public interface WindowManager extends ViewManager { rotationAnimation = o.rotationAnimation; changes |= ROTATION_ANIMATION_CHANGED; } - + if (screenOrientation != o.screenOrientation) { screenOrientation = o.screenOrientation; changes |= SCREEN_ORIENTATION_CHANGED; @@ -1759,7 +1754,7 @@ public interface WindowManager extends ViewManager { return changes; } - + @Override public String debug(String output) { output += "Contents of " + this + ":"; @@ -1770,7 +1765,7 @@ public interface WindowManager extends ViewManager { Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}"); return ""; } - + @Override public String toString() { StringBuilder sb = new StringBuilder(256); diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 53d9e28..333e631 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -74,7 +74,7 @@ import android.util.DisplayMetrics; import android.util.Log; import android.view.ActionMode; import android.view.ActionMode.Callback; -import android.view.DisplayList; +import android.view.RenderNode; import android.view.DragEvent; import android.view.Gravity; import android.view.HardwareCanvas; @@ -138,11 +138,11 @@ public class Editor { InputMethodState mInputMethodState; private static class TextDisplayList { - DisplayList displayList; + RenderNode displayList; boolean isDirty; public TextDisplayList(String name) { isDirty = true; - displayList = DisplayList.create(name); + displayList = RenderNode.create(name); } boolean needsRecord() { return isDirty || !displayList.isValid(); } } @@ -289,7 +289,7 @@ public class Editor { private void destroyDisplayListsData() { if (mTextDisplayLists != null) { for (int i = 0; i < mTextDisplayLists.length; i++) { - DisplayList displayList = mTextDisplayLists[i] != null + RenderNode displayList = mTextDisplayLists[i] != null ? mTextDisplayLists[i].displayList : null; if (displayList != null && displayList.isValid()) { displayList.destroyDisplayListData(); @@ -1371,7 +1371,7 @@ public class Editor { } final boolean blockDisplayListIsInvalid = mTextDisplayLists[blockIndex].needsRecord(); - DisplayList blockDisplayList = mTextDisplayLists[blockIndex].displayList; + RenderNode blockDisplayList = mTextDisplayLists[blockIndex].displayList; if (i >= indexFirstChangedBlock || blockDisplayListIsInvalid) { final int blockBeginLine = endOfPreviousBlock + 1; final int top = layout.getLineTop(blockBeginLine); |
