summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityManager.java17
-rw-r--r--core/java/android/app/AppOpsManager.java2
-rw-r--r--core/java/android/app/ApplicationPackageManager.java33
-rw-r--r--core/java/android/app/ContextImpl.java10
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java2
-rw-r--r--core/java/android/content/Context.java10
-rw-r--r--core/java/android/content/Intent.java55
-rw-r--r--core/java/android/content/pm/ComponentInfo.java18
-rw-r--r--core/java/android/content/pm/PackageItemInfo.java52
-rw-r--r--core/java/android/content/pm/PackageManager.java99
-rw-r--r--core/java/android/content/pm/PackageParser.java43
-rw-r--r--core/java/android/content/pm/RegisteredServicesCache.java25
-rw-r--r--core/java/android/hardware/ICameraService.aidl8
-rw-r--r--core/java/android/hardware/camera2/CameraCharacteristics.java58
-rw-r--r--core/java/android/hardware/camera2/CameraManager.java10
-rw-r--r--core/java/android/hardware/camera2/CameraMetadata.java15
-rw-r--r--core/java/android/hardware/camera2/CaptureRequest.java26
-rw-r--r--core/java/android/hardware/camera2/CaptureResult.java55
-rw-r--r--core/java/android/hardware/camera2/impl/CameraMetadataNative.java12
-rw-r--r--core/java/android/hardware/camera2/utils/CameraBinderDecorator.java90
-rw-r--r--core/java/android/net/EthernetDataTracker.java41
-rw-r--r--core/java/android/os/Build.java13
-rw-r--r--core/java/android/print/PrintManager.java11
-rw-r--r--core/java/android/print/PrinterCapabilitiesInfo.java6
-rw-r--r--core/java/android/speech/SpeechRecognizer.java2
-rw-r--r--core/java/android/view/DisplayList.java914
-rw-r--r--core/java/android/view/GLES20Canvas.java2
-rw-r--r--core/java/android/view/GLRenderer.java18
-rw-r--r--core/java/android/view/HardwareCanvas.java32
-rw-r--r--core/java/android/view/HardwareLayer.java6
-rw-r--r--core/java/android/view/RenderNode.java910
-rw-r--r--core/java/android/view/SurfaceControl.java7
-rw-r--r--core/java/android/view/SurfaceView.java5
-rw-r--r--core/java/android/view/ThreadedRenderer.java2
-rw-r--r--core/java/android/view/VideoPlaneView.java53
-rw-r--r--core/java/android/view/View.java149
-rw-r--r--core/java/android/view/ViewConfiguration.java2
-rw-r--r--core/java/android/view/ViewPropertyAnimator.java2
-rw-r--r--core/java/android/view/ViewRootImpl.java10
-rw-r--r--core/java/android/view/WindowManager.java223
-rw-r--r--core/java/android/widget/Editor.java10
41 files changed, 1693 insertions, 1365 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/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index e71d47d..079cf7a 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -878,7 +878,7 @@ public class AppOpsManager {
}
/**
- * Like {@link #checkOp but instead of throwing a {@link SecurityException} it
+ * Like {@link #checkOp} but instead of throwing a {@link SecurityException} it
* returns {@link #MODE_ERRORED}.
*/
public int checkOpNoThrow(String op, int uid, String packageName) {
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 061e5a5..8165fa1 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -727,6 +727,39 @@ final class ApplicationPackageManager extends PackageManager {
}
@Override
+ public Drawable getActivityBanner(ComponentName activityName)
+ throws NameNotFoundException {
+ return getActivityInfo(activityName, 0).loadBanner(this);
+ }
+
+ @Override
+ public Drawable getActivityBanner(Intent intent)
+ throws NameNotFoundException {
+ if (intent.getComponent() != null) {
+ return getActivityBanner(intent.getComponent());
+ }
+
+ ResolveInfo info = resolveActivity(
+ intent, PackageManager.MATCH_DEFAULT_ONLY);
+ if (info != null) {
+ return info.activityInfo.loadBanner(this);
+ }
+
+ throw new NameNotFoundException(intent.toUri(0));
+ }
+
+ @Override
+ public Drawable getApplicationBanner(ApplicationInfo info) {
+ return info.loadBanner(this);
+ }
+
+ @Override
+ public Drawable getApplicationBanner(String packageName)
+ throws NameNotFoundException {
+ return getApplicationBanner(getApplicationInfo(packageName, 0));
+ }
+
+ @Override
public Drawable getActivityLogo(ComponentName activityName)
throws NameNotFoundException {
return getActivityInfo(activityName, 0).loadLogo(this);
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/content/Intent.java b/core/java/android/content/Intent.java
index 96479e2..0175d62 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -3457,7 +3457,16 @@ public class Intent implements Parcelable, Cloneable {
*/
public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000;
/**
- * <strong>Do not use this flag unless you are implementing your own
+ * This flag is used to create a new task and launch an activity into it.
+ * This flag is always paired with either {@link #FLAG_ACTIVITY_NEW_DOCUMENT}
+ * or {@link #FLAG_ACTIVITY_NEW_TASK}. In both cases these flags alone would
+ * search through existing tasks for ones matching this Intent. Only if no such
+ * task is found would a new task be created. When paired with
+ * FLAG_ACTIVITY_MULTIPLE_TASK both of these behaviors are modified to skip
+ * the search for a matching task and unconditionally start a new task.
+ *
+ * <strong>When used with {@link #FLAG_ACTIVITY_NEW_TASK} do not use this
+ * flag unless you are implementing your own
* top-level application launcher.</strong> Used in conjunction with
* {@link #FLAG_ACTIVITY_NEW_TASK} to disable the
* behavior of bringing an existing task to the foreground. When set,
@@ -3469,12 +3478,18 @@ public class Intent implements Parcelable, Cloneable {
* you should not use this flag unless you provide some way for a user to
* return back to the tasks you have launched.</strong>
*
- * <p>This flag is ignored if
- * {@link #FLAG_ACTIVITY_NEW_TASK} is not set.
+ * See {@link #FLAG_ACTIVITY_NEW_DOCUMENT} for details of this flag's use for
+ * creating new document tasks.
+ *
+ * <p>This flag is ignored if one of {@link #FLAG_ACTIVITY_NEW_TASK} or
+ * {@link #FLAG_ACTIVITY_NEW_TASK} is not also set.
*
* <p>See
* <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back
* Stack</a> for more information about tasks.
+ *
+ * @see #FLAG_ACTIVITY_NEW_DOCUMENT
+ * @see #FLAG_ACTIVITY_NEW_TASK
*/
public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000;
/**
@@ -3581,6 +3596,34 @@ public class Intent implements Parcelable, Cloneable {
*/
public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000;
/**
+ * This flag is used to break out "documents" into separate tasks that can
+ * be reached via the Recents mechanism. Such a document is any kind of
+ * item for which an application may want to maintain multiple simultaneous
+ * instances. Examples might be text files, web pages, spreadsheets, or
+ * emails. Each such document will be in a separate task in the Recents list.
+ *
+ * <p>When set, the activity specified by this Intent will launch into a
+ * separate task rooted at that activity. The activity launched must be
+ * defined with {@link android.R.attr#launchMode} "standard" or "singleTop".
+ *
+ * <p>If FLAG_ACTIVITY_NEW_DOCUMENT is used without
+ * {@link #FLAG_ACTIVITY_MULTIPLE_TASK} then the activity manager will
+ * search for an existing task with a matching target activity and Intent
+ * data URI and relaunch that task, first finishing all activities down to
+ * the root activity and then calling the root activity's
+ * {@link android.app.Activity#onNewIntent(Intent)} method. If no existing
+ * task's root activity matches the Intent's data URI then a new task will
+ * be launched with the target activity as root.
+ *
+ * <p>When paired with {@link #FLAG_ACTIVITY_MULTIPLE_TASK} this will
+ * always create a new task. Thus the same document may be made to appear
+ * more than one time in Recents.
+ *
+ * @see #FLAG_ACTIVITY_MULTIPLE_TASK
+ */
+ public static final int FLAG_ACTIVITY_NEW_DOCUMENT =
+ FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | FLAG_ACTIVITY_NEW_TASK;
+ /**
* If set, this flag will prevent the normal {@link android.app.Activity#onUserLeaveHint}
* callback from occurring on the current frontmost activity before it is
* paused as the newly-started activity is brought to the front.
@@ -6246,6 +6289,7 @@ public class Intent implements Parcelable, Cloneable {
* @see #FLAG_ACTIVITY_FORWARD_RESULT
* @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
* @see #FLAG_ACTIVITY_MULTIPLE_TASK
+ * @see #FLAG_ACTIVITY_NEW_DOCUMENT
* @see #FLAG_ACTIVITY_NEW_TASK
* @see #FLAG_ACTIVITY_NO_ANIMATION
* @see #FLAG_ACTIVITY_NO_HISTORY
@@ -7342,4 +7386,9 @@ public class Intent implements Parcelable, Cloneable {
String htmlText = htmlTexts != null ? htmlTexts.get(which) : null;
return new ClipData.Item(text, htmlText, null, uri);
}
+
+ /** @hide */
+ public boolean isDocument() {
+ return (mFlags & FLAG_ACTIVITY_NEW_DOCUMENT) == FLAG_ACTIVITY_NEW_DOCUMENT;
+ }
}
diff --git a/core/java/android/content/pm/ComponentInfo.java b/core/java/android/content/pm/ComponentInfo.java
index 4dbcf23..7e8f285 100644
--- a/core/java/android/content/pm/ComponentInfo.java
+++ b/core/java/android/content/pm/ComponentInfo.java
@@ -128,6 +128,17 @@ public class ComponentInfo extends PackageItemInfo {
return logo != 0 ? logo : applicationInfo.logo;
}
+ /**
+ * Return the banner resource identifier to use for this component. If the
+ * component defines a banner, that is used; else, the application banner is
+ * used.
+ *
+ * @return The banner associated with this component.
+ */
+ public final int getBannerResource() {
+ return banner != 0 ? banner : applicationInfo.banner;
+ }
+
protected void dumpFront(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
pw.println(prefix + "enabled=" + enabled + " exported=" + exported
@@ -175,6 +186,13 @@ public class ComponentInfo extends PackageItemInfo {
/**
* @hide
*/
+ @Override protected Drawable loadDefaultBanner(PackageManager pm) {
+ return applicationInfo.loadBanner(pm);
+ }
+
+ /**
+ * @hide
+ */
@Override
protected Drawable loadDefaultLogo(PackageManager pm) {
return applicationInfo.loadLogo(pm);
diff --git a/core/java/android/content/pm/PackageItemInfo.java b/core/java/android/content/pm/PackageItemInfo.java
index a67326e..58f1c84 100644
--- a/core/java/android/content/pm/PackageItemInfo.java
+++ b/core/java/android/content/pm/PackageItemInfo.java
@@ -68,6 +68,12 @@ public class PackageItemInfo {
/**
* A drawable resource identifier (in the package's resources) of this
+ * component's banner. From the "banner" attribute or, if not set, 0.
+ */
+ public int banner;
+
+ /**
+ * A drawable resource identifier (in the package's resources) of this
* component's logo. Logos may be larger/wider than icons and are
* displayed by certain UI elements in place of a name or name/icon
* combination. From the "logo" attribute or, if not set, 0.
@@ -92,6 +98,7 @@ public class PackageItemInfo {
nonLocalizedLabel = orig.nonLocalizedLabel;
if (nonLocalizedLabel != null) nonLocalizedLabel = nonLocalizedLabel.toString().trim();
icon = orig.icon;
+ banner = orig.banner;
logo = orig.logo;
metaData = orig.metaData;
}
@@ -146,6 +153,27 @@ public class PackageItemInfo {
}
/**
+ * Retrieve the current graphical banner associated with this item. This
+ * will call back on the given PackageManager to load the banner from
+ * the application.
+ *
+ * @param pm A PackageManager from which the banner can be loaded; usually
+ * the PackageManager from which you originally retrieved this item.
+ *
+ * @return Returns a Drawable containing the item's banner. If the item
+ * does not have a banner, this method will return null.
+ */
+ public Drawable loadBanner(PackageManager pm) {
+ if (banner != 0) {
+ Drawable dr = pm.getDrawable(packageName, banner, getApplicationInfo());
+ if (dr != null) {
+ return dr;
+ }
+ }
+ return loadDefaultBanner(pm);
+ }
+
+ /**
* Retrieve the default graphical icon associated with this item.
*
* @param pm A PackageManager from which the icon can be loaded; usually
@@ -159,7 +187,22 @@ public class PackageItemInfo {
protected Drawable loadDefaultIcon(PackageManager pm) {
return pm.getDefaultActivityIcon();
}
-
+
+ /**
+ * Retrieve the default graphical banner associated with this item.
+ *
+ * @param pm A PackageManager from which the banner can be loaded; usually
+ * the PackageManager from which you originally retrieved this item.
+ *
+ * @return Returns a Drawable containing the item's default banner
+ * or null if no default logo is available.
+ *
+ * @hide
+ */
+ protected Drawable loadDefaultBanner(PackageManager pm) {
+ return null;
+ }
+
/**
* Retrieve the current graphical logo associated with this item. This
* will call back on the given PackageManager to load the logo from
@@ -224,10 +267,11 @@ public class PackageItemInfo {
pw.println(prefix + "name=" + name);
}
pw.println(prefix + "packageName=" + packageName);
- if (labelRes != 0 || nonLocalizedLabel != null || icon != 0) {
+ if (labelRes != 0 || nonLocalizedLabel != null || icon != 0 || banner != 0) {
pw.println(prefix + "labelRes=0x" + Integer.toHexString(labelRes)
+ " nonLocalizedLabel=" + nonLocalizedLabel
- + " icon=0x" + Integer.toHexString(icon));
+ + " icon=0x" + Integer.toHexString(icon)
+ + " banner=0x" + Integer.toHexString(banner));
}
}
@@ -243,6 +287,7 @@ public class PackageItemInfo {
dest.writeInt(icon);
dest.writeInt(logo);
dest.writeBundle(metaData);
+ dest.writeInt(banner);
}
protected PackageItemInfo(Parcel source) {
@@ -254,6 +299,7 @@ public class PackageItemInfo {
icon = source.readInt();
logo = source.readInt();
metaData = source.readBundle();
+ banner = source.readInt();
}
/**
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index b648930..e86833b 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1233,6 +1233,26 @@ public abstract class PackageManager {
/**
* Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device supports leanback UI. This is
+ * typically used in a living room television experience, but is a software
+ * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
+ * feature will use resources associated with the "television" UI mode.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_LEANBACK = "android.software.leanback";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device supports only leanback UI. Only
+ * applications designed for this experience should be run, though this is
+ * not enforced by the system.
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
*/
@SdkConstant(SdkConstantType.FEATURE)
@@ -1252,6 +1272,7 @@ public abstract class PackageManager {
* room television experience: displayed on a big screen, where the user
* is sitting far away from it, and the dominant form of input will be
* something like a DPAD, not through touch or mouse.
+ * @deprecated use {@link #FEATURE_LEANBACK} instead.
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TELEVISION = "android.hardware.type.television";
@@ -2400,9 +2421,43 @@ public abstract class PackageManager {
throws NameNotFoundException;
/**
+ * Retrieve the banner associated with an activity. Given the full name of
+ * an activity, retrieves the information about it and calls
+ * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
+ * banner. If the activity cannot be found, NameNotFoundException is thrown.
+ *
+ * @param activityName Name of the activity whose banner is to be retrieved.
+ * @return Returns the image of the banner, or null if the activity has no
+ * banner specified.
+ * @throws NameNotFoundException Thrown if the resources for the given
+ * activity could not be loaded.
+ * @see #getActivityBanner(Intent)
+ */
+ public abstract Drawable getActivityBanner(ComponentName activityName)
+ throws NameNotFoundException;
+
+ /**
+ * Retrieve the banner associated with an Intent. If intent.getClassName()
+ * is set, this simply returns the result of
+ * getActivityBanner(intent.getClassName()). Otherwise it resolves the
+ * intent's component and returns the banner associated with the resolved
+ * component. If intent.getClassName() cannot be found or the Intent cannot
+ * be resolved to a component, NameNotFoundException is thrown.
+ *
+ * @param intent The intent for which you would like to retrieve a banner.
+ * @return Returns the image of the banner, or null if the activity has no
+ * banner specified.
+ * @throws NameNotFoundException Thrown if the resources for application
+ * matching the given intent could not be loaded.
+ * @see #getActivityBanner(ComponentName)
+ */
+ public abstract Drawable getActivityBanner(Intent intent)
+ throws NameNotFoundException;
+
+ /**
* Return the generic icon for an activity that is used when no specific
* icon is defined.
- *
+ *
* @return Drawable Image of the icon.
*/
public abstract Drawable getDefaultActivityIcon();
@@ -2440,19 +2495,43 @@ public abstract class PackageManager {
throws NameNotFoundException;
/**
- * Retrieve the logo associated with an activity. Given the full name of
- * an activity, retrieves the information about it and calls
- * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo.
- * If the activity cannot be found, NameNotFoundException is thrown.
+ * Retrieve the banner associated with an application.
*
- * @param activityName Name of the activity whose logo is to be retrieved.
- *
- * @return Returns the image of the logo or null if the activity has no
- * logo specified.
+ * @param info Information about application being queried.
+ * @return Returns the image of the banner or null if the application has no
+ * banner specified.
+ * @see #getApplicationBanner(String)
+ */
+ public abstract Drawable getApplicationBanner(ApplicationInfo info);
+
+ /**
+ * Retrieve the banner associated with an application. Given the name of the
+ * application's package, retrieves the information about it and calls
+ * getApplicationIcon() to return its banner. If the application cannot be
+ * found, NameNotFoundException is thrown.
*
+ * @param packageName Name of the package whose application banner is to be
+ * retrieved.
+ * @return Returns the image of the banner or null if the application has no
+ * banner specified.
* @throws NameNotFoundException Thrown if the resources for the given
- * activity could not be loaded.
+ * application could not be loaded.
+ * @see #getApplicationBanner(ApplicationInfo)
+ */
+ public abstract Drawable getApplicationBanner(String packageName)
+ throws NameNotFoundException;
+
+ /**
+ * Retrieve the logo associated with an activity. Given the full name of an
+ * activity, retrieves the information about it and calls
+ * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
+ * logo. If the activity cannot be found, NameNotFoundException is thrown.
*
+ * @param activityName Name of the activity whose logo is to be retrieved.
+ * @return Returns the image of the logo or null if the activity has no logo
+ * specified.
+ * @throws NameNotFoundException Thrown if the resources for the given
+ * activity could not be loaded.
* @see #getActivityLogo(Intent)
*/
public abstract Drawable getActivityLogo(ComponentName activityName)
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index c222003..f76aada 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -167,18 +167,20 @@ public class PackageParser {
final int labelRes;
final int iconRes;
final int logoRes;
+ final int bannerRes;
String tag;
TypedArray sa;
ParsePackageItemArgs(Package _owner, String[] _outError,
- int _nameRes, int _labelRes, int _iconRes, int _logoRes) {
+ int _nameRes, int _labelRes, int _iconRes, int _logoRes, int _bannerRes) {
owner = _owner;
outError = _outError;
nameRes = _nameRes;
labelRes = _labelRes;
iconRes = _iconRes;
logoRes = _logoRes;
+ bannerRes = _bannerRes;
}
}
@@ -190,10 +192,10 @@ public class PackageParser {
int flags;
ParseComponentArgs(Package _owner, String[] _outError,
- int _nameRes, int _labelRes, int _iconRes, int _logoRes,
+ int _nameRes, int _labelRes, int _iconRes, int _logoRes, int _bannerRes,
String[] _sepProcesses, int _processRes,
int _descriptionRes, int _enabledRes) {
- super(_owner, _outError, _nameRes, _labelRes, _iconRes, _logoRes);
+ super(_owner, _outError, _nameRes, _labelRes, _iconRes, _logoRes, _bannerRes);
sepProcesses = _sepProcesses;
processRes = _processRes;
descriptionRes = _descriptionRes;
@@ -1688,7 +1690,8 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestPermissionGroup_name,
com.android.internal.R.styleable.AndroidManifestPermissionGroup_label,
com.android.internal.R.styleable.AndroidManifestPermissionGroup_icon,
- com.android.internal.R.styleable.AndroidManifestPermissionGroup_logo)) {
+ com.android.internal.R.styleable.AndroidManifestPermissionGroup_logo,
+ com.android.internal.R.styleable.AndroidManifestPermissionGroup_banner)) {
sa.recycle();
mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
return null;
@@ -1731,7 +1734,8 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestPermission_name,
com.android.internal.R.styleable.AndroidManifestPermission_label,
com.android.internal.R.styleable.AndroidManifestPermission_icon,
- com.android.internal.R.styleable.AndroidManifestPermission_logo)) {
+ com.android.internal.R.styleable.AndroidManifestPermission_logo,
+ com.android.internal.R.styleable.AndroidManifestPermission_banner)) {
sa.recycle();
mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
return null;
@@ -1800,7 +1804,8 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestPermissionTree_name,
com.android.internal.R.styleable.AndroidManifestPermissionTree_label,
com.android.internal.R.styleable.AndroidManifestPermissionTree_icon,
- com.android.internal.R.styleable.AndroidManifestPermissionTree_logo)) {
+ com.android.internal.R.styleable.AndroidManifestPermissionTree_logo,
+ com.android.internal.R.styleable.AndroidManifestPermissionTree_banner)) {
sa.recycle();
mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
return null;
@@ -1845,7 +1850,8 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestInstrumentation_name,
com.android.internal.R.styleable.AndroidManifestInstrumentation_label,
com.android.internal.R.styleable.AndroidManifestInstrumentation_icon,
- com.android.internal.R.styleable.AndroidManifestInstrumentation_logo);
+ com.android.internal.R.styleable.AndroidManifestInstrumentation_logo,
+ com.android.internal.R.styleable.AndroidManifestInstrumentation_banner);
mParseInstrumentationArgs.tag = "<instrumentation>";
}
@@ -1961,6 +1967,8 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestApplication_icon, 0);
ai.logo = sa.getResourceId(
com.android.internal.R.styleable.AndroidManifestApplication_logo, 0);
+ ai.banner = sa.getResourceId(
+ com.android.internal.R.styleable.AndroidManifestApplication_banner, 0);
ai.theme = sa.getResourceId(
com.android.internal.R.styleable.AndroidManifestApplication_theme, 0);
ai.descriptionRes = sa.getResourceId(
@@ -2256,7 +2264,7 @@ public class PackageParser {
private boolean parsePackageItemInfo(Package owner, PackageItemInfo outInfo,
String[] outError, String tag, TypedArray sa,
- int nameRes, int labelRes, int iconRes, int logoRes) {
+ int nameRes, int labelRes, int iconRes, int logoRes, int bannerRes) {
String name = sa.getNonConfigurationString(nameRes, 0);
if (name == null) {
outError[0] = tag + " does not specify android:name";
@@ -2280,6 +2288,11 @@ public class PackageParser {
outInfo.logo = logoVal;
}
+ int bannerVal = sa.getResourceId(bannerRes, 0);
+ if (bannerVal != 0) {
+ outInfo.banner = bannerVal;
+ }
+
TypedValue v = sa.peekValue(labelRes);
if (v != null && (outInfo.labelRes=v.resourceId) == 0) {
outInfo.nonLocalizedLabel = v.coerceToString();
@@ -2303,6 +2316,7 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestActivity_label,
com.android.internal.R.styleable.AndroidManifestActivity_icon,
com.android.internal.R.styleable.AndroidManifestActivity_logo,
+ com.android.internal.R.styleable.AndroidManifestActivity_banner,
mSeparateProcesses,
com.android.internal.R.styleable.AndroidManifestActivity_process,
com.android.internal.R.styleable.AndroidManifestActivity_description,
@@ -2588,6 +2602,7 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestActivityAlias_label,
com.android.internal.R.styleable.AndroidManifestActivityAlias_icon,
com.android.internal.R.styleable.AndroidManifestActivityAlias_logo,
+ com.android.internal.R.styleable.AndroidManifestActivityAlias_banner,
mSeparateProcesses,
0,
com.android.internal.R.styleable.AndroidManifestActivityAlias_description,
@@ -2622,6 +2637,7 @@ public class PackageParser {
info.flags = target.info.flags;
info.icon = target.info.icon;
info.logo = target.info.logo;
+ info.banner = target.info.banner;
info.labelRes = target.info.labelRes;
info.nonLocalizedLabel = target.info.nonLocalizedLabel;
info.launchMode = target.info.launchMode;
@@ -2735,6 +2751,7 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestProvider_label,
com.android.internal.R.styleable.AndroidManifestProvider_icon,
com.android.internal.R.styleable.AndroidManifestProvider_logo,
+ com.android.internal.R.styleable.AndroidManifestProvider_banner,
mSeparateProcesses,
com.android.internal.R.styleable.AndroidManifestProvider_process,
com.android.internal.R.styleable.AndroidManifestProvider_description,
@@ -3041,6 +3058,7 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestService_label,
com.android.internal.R.styleable.AndroidManifestService_icon,
com.android.internal.R.styleable.AndroidManifestService_logo,
+ com.android.internal.R.styleable.AndroidManifestService_banner,
mSeparateProcesses,
com.android.internal.R.styleable.AndroidManifestService_process,
com.android.internal.R.styleable.AndroidManifestService_description,
@@ -3338,6 +3356,9 @@ public class PackageParser {
outInfo.logo = sa.getResourceId(
com.android.internal.R.styleable.AndroidManifestIntentFilter_logo, 0);
+ outInfo.banner = sa.getResourceId(
+ com.android.internal.R.styleable.AndroidManifestIntentFilter_banner, 0);
+
sa.recycle();
int outerDepth = parser.getDepth();
@@ -3707,6 +3728,11 @@ public class PackageParser {
outInfo.logo = logoVal;
}
+ int bannerVal = args.sa.getResourceId(args.bannerRes, 0);
+ if (bannerVal != 0) {
+ outInfo.banner = bannerVal;
+ }
+
TypedValue v = args.sa.peekValue(args.labelRes);
if (v != null && (outInfo.labelRes=v.resourceId) == 0) {
outInfo.nonLocalizedLabel = v.coerceToString();
@@ -4131,6 +4157,7 @@ public class PackageParser {
public CharSequence nonLocalizedLabel;
public int icon;
public int logo;
+ public int banner;
public int preferred;
}
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index 875e8de..4a743a5 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -140,12 +140,33 @@ public abstract class RegisteredServicesCache<V> {
mContext.registerReceiver(mExternalReceiver, sdFilter);
}
+ private final void handlePackageEvent(Intent intent, int userId) {
+ // Don't regenerate the services map when the package is removed or its
+ // ASEC container unmounted as a step in replacement. The subsequent
+ // _ADDED / _AVAILABLE call will regenerate the map in the final state.
+ final String action = intent.getAction();
+ // it's a new-component action if it isn't some sort of removal
+ final boolean isRemoval = Intent.ACTION_PACKAGE_REMOVED.equals(action)
+ || Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action);
+ // if it's a removal, is it part of an update-in-place step?
+ final boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false);
+
+ if (isRemoval && replacing) {
+ // package is going away, but it's the middle of an upgrade: keep the current
+ // state and do nothing here. This clause is intentionally empty.
+ } else {
+ // either we're adding/changing, or it's a removal without replacement, so
+ // we need to recalculate the set of available services
+ generateServicesMap(userId);
+ }
+ }
+
private final BroadcastReceiver mPackageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final int uid = intent.getIntExtra(Intent.EXTRA_UID, -1);
if (uid != -1) {
- generateServicesMap(UserHandle.getUserId(uid));
+ handlePackageEvent(intent, UserHandle.getUserId(uid));
}
}
};
@@ -154,7 +175,7 @@ public abstract class RegisteredServicesCache<V> {
@Override
public void onReceive(Context context, Intent intent) {
// External apps can't coexist with multi-user, so scan owner
- generateServicesMap(UserHandle.USER_OWNER);
+ handlePackageEvent(intent, UserHandle.USER_OWNER);
}
};
diff --git a/core/java/android/hardware/ICameraService.aidl b/core/java/android/hardware/ICameraService.aidl
index 542af6a..4c50dda 100644
--- a/core/java/android/hardware/ICameraService.aidl
+++ b/core/java/android/hardware/ICameraService.aidl
@@ -61,4 +61,12 @@ interface ICameraService
int removeListener(ICameraServiceListener listener);
int getCameraCharacteristics(int cameraId, out CameraMetadataNative info);
+
+ /**
+ * The java stubs for this method are not intended to be used. Please use
+ * the native stub in frameworks/av/include/camera/ICameraService.h instead.
+ * The BinderHolder output is being used as a placeholder, and will not be
+ * well-formatted in the generated java method.
+ */
+ int getCameraVendorTagDescriptor(out BinderHolder desc);
}
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index d27485b..45d6e88 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -148,7 +148,7 @@ public final class CameraCharacteristics extends CameraMetadata {
* <p>All camera devices support ON, and all camera devices with
* flash units support ON_AUTO_FLASH and
* ON_ALWAYS_FLASH.</p>
- * <p>Full-capability camera devices always support OFF mode,
+ * <p>FULL mode camera devices always support OFF mode,
* which enables application control of camera exposure time,
* sensitivity, and frame duration.</p>
*
@@ -244,7 +244,7 @@ public final class CameraCharacteristics extends CameraMetadata {
* given camera device. This entry lists the valid modes for
* {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} for this camera device.</p>
* <p>All camera devices will support ON mode.</p>
- * <p>Full-capability camera devices will always support OFF mode,
+ * <p>FULL mode camera devices will always support OFF mode,
* which enables application control of white balance, by using
* {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}({@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} must be set to TRANSFORM_MATRIX).</p>
*
@@ -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
@@ -280,6 +290,17 @@ public final class CameraCharacteristics extends CameraMetadata {
new Key<Boolean>("android.flash.info.available", boolean.class);
/**
+ * <p>The set of hot pixel correction modes that are supported by this
+ * camera device.</p>
+ * <p>This tag lists valid modes for {@link CaptureRequest#HOT_PIXEL_MODE android.hotPixel.mode}.</p>
+ * <p>FULL mode camera devices will always support FAST.</p>
+ *
+ * @see CaptureRequest#HOT_PIXEL_MODE
+ */
+ public static final Key<byte[]> HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES =
+ new Key<byte[]>("android.hotPixel.availableHotPixelModes", byte[].class);
+
+ /**
* <p>Supported resolutions for the JPEG thumbnail</p>
* <p>Below condiditions will be satisfied for this size list:</p>
* <ul>
@@ -406,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>
@@ -1088,6 +1119,18 @@ public final class CameraCharacteristics extends CameraMetadata {
new Key<Integer>("android.statistics.info.maxFaceCount", int.class);
/**
+ * <p>The set of hot pixel map output modes supported by this camera device.</p>
+ * <p>This tag lists valid output modes for {@link CaptureRequest#STATISTICS_HOT_PIXEL_MAP_MODE android.statistics.hotPixelMapMode}.</p>
+ * <p>If no hotpixel map is available for this camera device, this will contain
+ * only OFF. If the hotpixel map is available, this should include both
+ * the ON and OFF options.</p>
+ *
+ * @see CaptureRequest#STATISTICS_HOT_PIXEL_MAP_MODE
+ */
+ public static final Key<boolean[]> STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES =
+ new Key<boolean[]>("android.statistics.info.availableHotPixelMapModes", boolean[].class);
+
+ /**
* <p>Maximum number of supported points in the
* tonemap curve that can be used for {@link CaptureRequest#TONEMAP_CURVE_RED android.tonemap.curveRed}, or
* {@link CaptureRequest#TONEMAP_CURVE_GREEN android.tonemap.curveGreen}, or {@link CaptureRequest#TONEMAP_CURVE_BLUE android.tonemap.curveBlue}.</p>
@@ -1107,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 2ac50e4..0fcd598 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -48,6 +48,8 @@ import java.util.ArrayList;
*/
public final class CameraManager {
+ private static final String TAG = "CameraManager";
+
/**
* This should match the ICameraService definition
*/
@@ -79,6 +81,14 @@ public final class CameraManager {
mCameraService = CameraBinderDecorator.newInstance(cameraServiceRaw);
try {
+ CameraBinderDecorator.throwOnError(
+ CameraMetadataNative.nativeSetupGlobalVendorTagDescriptor());
+ } catch(CameraRuntimeException e) {
+ throw new IllegalStateException("Failed to setup camera vendor tags",
+ e.asChecked());
+ }
+
+ try {
mCameraService.addListener(new CameraServiceListener());
} catch(CameraRuntimeException e) {
throw new IllegalStateException("Failed to register a camera service listener",
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index a62df0f..a3fbfbe 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -1199,7 +1199,10 @@ public abstract class CameraMetadata {
/**
* <p>The frame rate must not be reduced relative to sensor raw output
* for this option.</p>
- * <p>No hot pixel correction is applied.</p>
+ * <p>No hot pixel correction is applied.
+ * The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
+ *
+ * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
* @see CaptureRequest#HOT_PIXEL_MODE
*/
public static final int HOT_PIXEL_MODE_OFF = 0;
@@ -1207,7 +1210,10 @@ public abstract class CameraMetadata {
/**
* <p>The frame rate must not be reduced relative to sensor raw output
* for this option.</p>
- * <p>Hot pixel correction is applied.</p>
+ * <p>Hot pixel correction is applied.
+ * The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
+ *
+ * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
* @see CaptureRequest#HOT_PIXEL_MODE
*/
public static final int HOT_PIXEL_MODE_FAST = 1;
@@ -1215,7 +1221,10 @@ public abstract class CameraMetadata {
/**
* <p>The frame rate may be reduced relative to sensor raw output
* for this option.</p>
- * <p>A high-quality hot pixel correction is applied.</p>
+ * <p>A high-quality hot pixel correction is applied.
+ * The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
+ *
+ * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
* @see CaptureRequest#HOT_PIXEL_MODE
*/
public static final int HOT_PIXEL_MODE_HIGH_QUALITY = 2;
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index a8caba0..f6a6f96 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
@@ -876,9 +879,13 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable {
/**
* <p>Set operational mode for hot pixel correction.</p>
+ * <p>Valid modes for this camera device are listed in
+ * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}.</p>
* <p>Hotpixel correction interpolates out, or otherwise removes, pixels
* that do not accurately encode the incoming light (i.e. pixels that
* are stuck at an arbitrary value).</p>
+ *
+ * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
* @see #HOT_PIXEL_MODE_OFF
* @see #HOT_PIXEL_MODE_FAST
* @see #HOT_PIXEL_MODE_HIGH_QUALITY
@@ -1047,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
@@ -1286,6 +1297,18 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable {
new Key<Integer>("android.statistics.faceDetectMode", int.class);
/**
+ * <p>Operating mode for hotpixel map generation.</p>
+ * <p>If set to ON, a hotpixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
+ * If set to OFF, no hotpixel map should be returned.</p>
+ * <p>This must be set to a valid mode from {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}.</p>
+ *
+ * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
+ * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
+ */
+ public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
+ new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
+
+ /**
* <p>Whether the camera device will output the lens
* shading map in output result metadata.</p>
* <p>When set to ON,
@@ -1388,6 +1411,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}.
@@ -1397,6 +1422,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 0f2c7f7..7eb63d6 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
@@ -1166,24 +1169,14 @@ public final class CaptureResult extends CameraMetadata {
new Key<Integer>("android.flash.state", int.class);
/**
- * <p>List of <code>(x, y)</code> coordinates of hot/defective pixels on the
- * sensor, where <code>(x, y)</code> lies between <code>(0, 0)</code>, which is the top-left
- * of the pixel array, and the width,height of the pixel array given in
- * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}. This may include hot pixels
- * that lie outside of the active array bounds given by
- * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
- *
- * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
- * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
- */
- public static final Key<int[]> HOT_PIXEL_MAP =
- new Key<int[]>("android.hotPixel.map", int[].class);
-
- /**
* <p>Set operational mode for hot pixel correction.</p>
+ * <p>Valid modes for this camera device are listed in
+ * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}.</p>
* <p>Hotpixel correction interpolates out, or otherwise removes, pixels
* that do not accurately encode the incoming light (i.e. pixels that
* are stuck at an arbitrary value).</p>
+ *
+ * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
* @see #HOT_PIXEL_MODE_OFF
* @see #HOT_PIXEL_MODE_FAST
* @see #HOT_PIXEL_MODE_HIGH_QUALITY
@@ -1388,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
@@ -1971,6 +1968,33 @@ public final class CaptureResult extends CameraMetadata {
new Key<Integer>("android.statistics.sceneFlicker", int.class);
/**
+ * <p>Operating mode for hotpixel map generation.</p>
+ * <p>If set to ON, a hotpixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
+ * If set to OFF, no hotpixel map should be returned.</p>
+ * <p>This must be set to a valid mode from {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}.</p>
+ *
+ * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
+ * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
+ */
+ public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
+ new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
+
+ /**
+ * <p>List of <code>(x, y)</code> coordinates of hot/defective pixels on the sensor.</p>
+ * <p>A coordinate <code>(x, y)</code> must lie between <code>(0, 0)</code>, and
+ * <code>(width - 1, height - 1)</code> (inclusive), which are the top-left and
+ * bottom-right of the pixel array, respectively. The width and
+ * height dimensions are given in {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.
+ * This may include hot pixels that lie outside of the active array
+ * bounds given by {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
+ *
+ * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
+ */
+ public static final Key<int[]> STATISTICS_HOT_PIXEL_MAP =
+ new Key<int[]>("android.statistics.hotPixelMap", int[].class);
+
+ /**
* <p>Tonemapping / contrast / gamma curve for the blue
* channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
* CONTRAST_CURVE.</p>
@@ -2059,6 +2083,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}.
@@ -2068,6 +2094,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/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
index 2ddcb14..0d4a4cb 100644
--- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
+++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
@@ -105,6 +105,18 @@ public class CameraMetadataNative extends CameraMetadata implements Parcelable {
}
/**
+ * Set the global client-side vendor tag descriptor to allow use of vendor
+ * tags in camera applications.
+ *
+ * @return int A native status_t value corresponding to one of the
+ * {@link CameraBinderDecorator} integer constants.
+ * @see CameraBinderDecorator#throwOnError
+ *
+ * @hide
+ */
+ public static native int nativeSetupGlobalVendorTagDescriptor();
+
+ /**
* Set a camera metadata field to a value. The field definitions can be
* found in {@link CameraCharacteristics}, {@link CaptureResult}, and
* {@link CaptureRequest}.
diff --git a/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java b/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java
index e535e00..328ccbe 100644
--- a/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java
+++ b/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java
@@ -64,47 +64,7 @@ public class CameraBinderDecorator {
// int return type => status_t => convert to exception
if (m.getReturnType() == Integer.TYPE) {
int returnValue = (Integer) result;
-
- switch (returnValue) {
- case NO_ERROR:
- return;
- case PERMISSION_DENIED:
- throw new SecurityException("Lacking privileges to access camera service");
- case ALREADY_EXISTS:
- // This should be handled at the call site. Typically this isn't bad,
- // just means we tried to do an operation that already completed.
- return;
- case BAD_VALUE:
- throw new IllegalArgumentException("Bad argument passed to camera service");
- case DEAD_OBJECT:
- UncheckedThrow.throwAnyException(new CameraRuntimeException(
- CAMERA_DISCONNECTED));
- case EACCES:
- UncheckedThrow.throwAnyException(new CameraRuntimeException(
- CAMERA_DISABLED));
- case EBUSY:
- UncheckedThrow.throwAnyException(new CameraRuntimeException(
- CAMERA_IN_USE));
- case EUSERS:
- UncheckedThrow.throwAnyException(new CameraRuntimeException(
- MAX_CAMERAS_IN_USE));
- case ENODEV:
- UncheckedThrow.throwAnyException(new CameraRuntimeException(
- CAMERA_DISCONNECTED));
- case EOPNOTSUPP:
- UncheckedThrow.throwAnyException(new CameraRuntimeException(
- CAMERA_DEPRECATED_HAL));
- }
-
- /**
- * Trap the rest of the negative return values. If we have known
- * error codes i.e. ALREADY_EXISTS that aren't really runtime
- * errors, then add them to the top switch statement
- */
- if (returnValue < 0) {
- throw new UnsupportedOperationException(String.format("Unknown error %d",
- returnValue));
- }
+ throwOnError(returnValue);
}
}
@@ -131,6 +91,54 @@ public class CameraBinderDecorator {
}
/**
+ * Throw error codes returned by the camera service as exceptions.
+ *
+ * @param errorFlag error to throw as an exception.
+ */
+ public static void throwOnError(int errorFlag) {
+ switch (errorFlag) {
+ case NO_ERROR:
+ return;
+ case PERMISSION_DENIED:
+ throw new SecurityException("Lacking privileges to access camera service");
+ case ALREADY_EXISTS:
+ // This should be handled at the call site. Typically this isn't bad,
+ // just means we tried to do an operation that already completed.
+ return;
+ case BAD_VALUE:
+ throw new IllegalArgumentException("Bad argument passed to camera service");
+ case DEAD_OBJECT:
+ UncheckedThrow.throwAnyException(new CameraRuntimeException(
+ CAMERA_DISCONNECTED));
+ case EACCES:
+ UncheckedThrow.throwAnyException(new CameraRuntimeException(
+ CAMERA_DISABLED));
+ case EBUSY:
+ UncheckedThrow.throwAnyException(new CameraRuntimeException(
+ CAMERA_IN_USE));
+ case EUSERS:
+ UncheckedThrow.throwAnyException(new CameraRuntimeException(
+ MAX_CAMERAS_IN_USE));
+ case ENODEV:
+ UncheckedThrow.throwAnyException(new CameraRuntimeException(
+ CAMERA_DISCONNECTED));
+ case EOPNOTSUPP:
+ UncheckedThrow.throwAnyException(new CameraRuntimeException(
+ CAMERA_DEPRECATED_HAL));
+ }
+
+ /**
+ * Trap the rest of the negative return values. If we have known
+ * error codes i.e. ALREADY_EXISTS that aren't really runtime
+ * errors, then add them to the top switch statement
+ */
+ if (errorFlag < 0) {
+ throw new UnsupportedOperationException(String.format("Unknown error %d",
+ errorFlag));
+ }
+ }
+
+ /**
* <p>
* Wraps the type T with a proxy that will check 'status_t' return codes
* from the native side of the camera service, and throw Java exceptions
diff --git a/core/java/android/net/EthernetDataTracker.java b/core/java/android/net/EthernetDataTracker.java
index ec44661..6c61046 100644
--- a/core/java/android/net/EthernetDataTracker.java
+++ b/core/java/android/net/EthernetDataTracker.java
@@ -106,6 +106,24 @@ public class EthernetDataTracker extends BaseNetworkStateTracker {
mLinkCapabilities = new LinkCapabilities();
}
+ private void interfaceUpdated() {
+ // we don't get link status indications unless the iface is up - bring it up
+ try {
+ mNMService.setInterfaceUp(mIface);
+ String hwAddr = null;
+ InterfaceConfiguration config = mNMService.getInterfaceConfig(mIface);
+ if (config != null) {
+ hwAddr = config.getHardwareAddress();
+ }
+ synchronized (this) {
+ mHwAddr = hwAddr;
+ mNetworkInfo.setExtraInfo(mHwAddr);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error upping interface " + mIface + ": " + e);
+ }
+ }
+
private void interfaceAdded(String iface) {
if (!iface.matches(sIfaceMatch))
return;
@@ -118,12 +136,7 @@ public class EthernetDataTracker extends BaseNetworkStateTracker {
mIface = iface;
}
- // we don't get link status indications unless the iface is up - bring it up
- try {
- mNMService.setInterfaceUp(iface);
- } catch (Exception e) {
- Log.e(TAG, "Error upping interface " + iface + ": " + e);
- }
+ interfaceUpdated();
mNetworkInfo.setIsAvailable(true);
Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
@@ -159,7 +172,11 @@ public class EthernetDataTracker extends BaseNetworkStateTracker {
Log.d(TAG, "Removing " + iface);
disconnect();
- mIface = "";
+ synchronized (this) {
+ mIface = "";
+ mHwAddr = null;
+ mNetworkInfo.setExtraInfo(null);
+ }
}
private void runDhcp() {
@@ -220,15 +237,7 @@ public class EthernetDataTracker extends BaseNetworkStateTracker {
for (String iface : ifaces) {
if (iface.matches(sIfaceMatch)) {
mIface = iface;
- mNMService.setInterfaceUp(iface);
- InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
- mLinkUp = config.hasFlag("up");
- if (config != null && mHwAddr == null) {
- mHwAddr = config.getHardwareAddress();
- if (mHwAddr != null) {
- mNetworkInfo.setExtraInfo(mHwAddr);
- }
- }
+ interfaceUpdated();
// if a DHCP client had previously been started for this interface, then stop it
NetworkUtils.stopDhcp(mIface);
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/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/print/PrinterCapabilitiesInfo.java b/core/java/android/print/PrinterCapabilitiesInfo.java
index b615600..806a89d 100644
--- a/core/java/android/print/PrinterCapabilitiesInfo.java
+++ b/core/java/android/print/PrinterCapabilitiesInfo.java
@@ -475,6 +475,12 @@ public final class PrinterCapabilitiesInfo implements Parcelable {
* @param colorModes The color mode bit mask.
* @param defaultColorMode The default color mode.
* @return This builder.
+ * <p>
+ * <strong>Note:</strong> On platform version 19 (Kitkat) specifying
+ * only PrintAttributes#COLOR_MODE_MONOCHROME leads to a print spooler
+ * crash. Hence, you should declare either both color modes or
+ * PrintAttributes#COLOR_MODE_COLOR.
+ * </p>
*
* @throws IllegalArgumentException If color modes contains an invalid
* mode bit or if the default color mode is invalid.
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 d72f810..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,8 +13846,9 @@ 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) {
- if (!canHaveDisplayList()) {
+ private RenderNode getDisplayList(RenderNode displayList, boolean isLayer) {
+ final HardwareRenderer renderer = getHardwareRenderer();
+ if (renderer == null || !canHaveDisplayList()) {
return null;
}
@@ -13977,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.
@@ -14032,13 +13927,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
}
} finally {
- displayList.end(getHardwareRenderer(), canvas);
+ displayList.end(renderer, canvas);
displayList.setCaching(caching);
if (isLayer) {
displayList.setLeftTopRightBottom(0, 0, width, height);
} else {
setDisplayListProperties(displayList);
}
+
+ if (renderer != getHardwareRenderer()) {
+ Log.w(VIEW_LOG_TAG, "View was detached during a draw() call!");
+ // TODO: Should this be elevated to a crash?
+ // For now have it behaves the same as it previously did, it
+ // will result in the DisplayListData being destroyed later
+ // than it could be but oh well...
+ }
}
} else if (!isLayer) {
mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
@@ -14056,7 +13959,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @hide
*/
- public DisplayList getDisplayList() {
+ public RenderNode getDisplayList() {
mDisplayList = getDisplayList(mDisplayList, false);
return mDisplayList;
}
@@ -14662,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());
@@ -14676,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) {
@@ -14807,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) {
@@ -15286,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);
@@ -15310,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);
}
@@ -15323,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);