summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ContextImpl.java9
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java16
-rw-r--r--core/java/android/content/Context.java11
-rw-r--r--core/java/android/content/Intent.java8
-rw-r--r--core/java/android/util/Patterns.java51
-rw-r--r--core/java/android/view/AccessibilityInteractionController.java2
-rw-r--r--core/java/android/view/DisplayList.java25
-rw-r--r--core/java/android/view/GLRenderer.java56
-rw-r--r--core/java/android/view/HardwareCanvas.java28
-rw-r--r--core/java/android/view/HardwareRenderer.java11
-rw-r--r--core/java/android/view/InputDevice.java12
-rw-r--r--core/java/android/view/LayoutInflater.java1
-rw-r--r--core/java/android/view/RenderNode.java4
-rw-r--r--core/java/android/view/ThreadedRenderer.java6
-rw-r--r--core/java/android/view/View.java248
-rw-r--r--core/java/android/view/ViewGroup.java9
-rw-r--r--core/java/android/view/ViewPropertyAnimator.java30
-rw-r--r--core/java/android/view/ViewRootImpl.java28
-rw-r--r--core/java/android/widget/ListPopupWindow.java10
-rw-r--r--core/java/android/widget/SearchView.java2
20 files changed, 312 insertions, 255 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 589c82f..b2b2571 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -75,6 +75,8 @@ import android.net.nsd.INsdManager;
import android.net.nsd.NsdManager;
import android.net.wifi.IWifiManager;
import android.net.wifi.WifiManager;
+import android.net.wifi.hotspot.IWifiHotspotManager;
+import android.net.wifi.hotspot.WifiHotspotManager;
import android.net.wifi.p2p.IWifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager;
import android.nfc.NfcManager;
@@ -552,6 +554,13 @@ class ContextImpl extends Context {
return new WifiManager(ctx.getOuterContext(), service);
}});
+ registerService(WIFI_HOTSPOT_SERVICE, new ServiceFetcher() {
+ public Object createService(ContextImpl ctx) {
+ IBinder b = ServiceManager.getService(WIFI_HOTSPOT_SERVICE);
+ IWifiHotspotManager service = IWifiHotspotManager.Stub.asInterface(b);
+ return new WifiHotspotManager(ctx.getOuterContext(), service);
+ }});
+
registerService(WIFI_P2P_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
IBinder b = ServiceManager.getService(WIFI_P2P_SERVICE);
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 7b9ced9..456af78 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1986,7 +1986,13 @@ public final class BluetoothAdapter {
public void onAdvertiseStateChange(int advertiseState, int status) {
Log.d(TAG, "on advertise call back, state: " + advertiseState + " status: " + status);
if (advertiseState == STATE_ADVERTISE_STARTED) {
- mAdvertiseCallback.onAdvertiseStart(status);
+ if (status == ADVERTISE_CALLBACK_SUCCESS) {
+ mAdvertiseCallback.onAdvertiseStart(status);
+ } else {
+ // If status is unsuccessful and advertise state is started, it means stop
+ // advertising fails.
+ mAdvertiseCallback.onAdvertiseStop(status);
+ }
} else {
synchronized (this) {
if (status == ADVERTISE_CALLBACK_SUCCESS) {
@@ -2008,7 +2014,13 @@ public final class BluetoothAdapter {
}
}
}
- mAdvertiseCallback.onAdvertiseStop(status);
+ if (status == ADVERTISE_CALLBACK_SUCCESS) {
+ mAdvertiseCallback.onAdvertiseStop(status);
+ } else{
+ // If status is unsuccesful and advertise state is stopped, it means start
+ // advertising fails.
+ mAdvertiseCallback.onAdvertiseStart(status);
+ }
}
}
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 9f0c384..cd91f3b 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -1974,6 +1974,7 @@ public abstract class Context {
//@hide: NETWORK_STATS_SERVICE,
//@hide: NETWORK_POLICY_SERVICE,
WIFI_SERVICE,
+ WIFI_HOTSPOT_SERVICE,
WIFI_P2P_SERVICE,
NSD_SERVICE,
AUDIO_SERVICE,
@@ -2324,6 +2325,16 @@ public abstract class Context {
/**
* Use with {@link #getSystemService} to retrieve a {@link
+ * android.net.wifi.hotspot.WifiHotspotManager} for handling management of
+ * Wi-Fi hotspot access.
+ *
+ * @see #getSystemService
+ * @see android.net.wifi.hotspot.WifiHotspotManager
+ */
+ public static final String WIFI_HOTSPOT_SERVICE = "wifihotspot";
+
+ /**
+ * Use with {@link #getSystemService} to retrieve a {@link
* android.net.wifi.p2p.WifiP2pManager} for handling management of
* Wi-Fi peer-to-peer connections.
*
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 102433b..d189a34 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2884,6 +2884,14 @@ public class Intent implements Parcelable, Cloneable {
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE";
+ /**
+ * An activity that provides a user interface for adjusting notification preferences for its
+ * containing application. Optional but recommended for apps that post
+ * {@link android.app.Notification Notifications}.
+ */
+ @SdkConstant(SdkConstantType.INTENT_CATEGORY)
+ public static final String CATEGORY_NOTIFICATION_PREFERENCES = "android.intent.category.NOTIFICATION_PREFERENCES";
+
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Application launch intent categories (see addCategory()).
diff --git a/core/java/android/util/Patterns.java b/core/java/android/util/Patterns.java
index 0f8da44..13cc88b 100644
--- a/core/java/android/util/Patterns.java
+++ b/core/java/android/util/Patterns.java
@@ -28,7 +28,12 @@ public class Patterns {
* List accurate as of 2011/07/18. List taken from:
* http://data.iana.org/TLD/tlds-alpha-by-domain.txt
* This pattern is auto-generated by frameworks/ex/common/tools/make-iana-tld-pattern.py
+ *
+ * @deprecated Due to the recent profileration of gTLDs, this API is
+ * expected to become out-of-date very quickly. Therefore it is now
+ * deprecated.
*/
+ @Deprecated
public static final String TOP_LEVEL_DOMAIN_STR =
"((aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
+ "|(biz|b[abdefghijmnorstvwyz])"
@@ -59,7 +64,9 @@ public class Patterns {
/**
* Regular expression pattern to match all IANA top-level domains.
+ * @deprecated This API is deprecated. See {@link #TOP_LEVEL_DOMAIN_STR}.
*/
+ @Deprecated
public static final Pattern TOP_LEVEL_DOMAIN =
Pattern.compile(TOP_LEVEL_DOMAIN_STR);
@@ -68,7 +75,10 @@ public class Patterns {
* List accurate as of 2011/07/18. List taken from:
* http://data.iana.org/TLD/tlds-alpha-by-domain.txt
* This pattern is auto-generated by frameworks/ex/common/tools/make-iana-tld-pattern.py
+ *
+ * @deprecated This API is deprecated. See {@link #TOP_LEVEL_DOMAIN_STR}.
*/
+ @Deprecated
public static final String TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL =
"(?:"
+ "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
@@ -107,6 +117,24 @@ public class Patterns {
public static final String GOOD_IRI_CHAR =
"a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF";
+ public static final Pattern IP_ADDRESS
+ = Pattern.compile(
+ "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
+ + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
+ + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
+ + "|[1-9][0-9]|[0-9]))");
+
+ /**
+ * RFC 1035 Section 2.3.4 limits the labels to a maximum 63 octets.
+ */
+ private static final String IRI
+ = "[" + GOOD_IRI_CHAR + "]([" + GOOD_IRI_CHAR + "\\-]{0,61}[" + GOOD_IRI_CHAR + "]){0,1}";
+
+ private static final String HOST_NAME = IRI + "(?:\\." + IRI + ")+";
+
+ public static final Pattern DOMAIN_NAME
+ = Pattern.compile("(" + HOST_NAME + "|" + IP_ADDRESS + ")");
+
/**
* Regular expression pattern to match most part of RFC 3987
* Internationalized URLs, aka IRIs. Commonly used Unicode characters are
@@ -116,13 +144,7 @@ public class Patterns {
"((?:(http|https|Http|Https|rtsp|Rtsp):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
+ "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_"
+ "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?"
- + "((?:(?:[" + GOOD_IRI_CHAR + "][" + GOOD_IRI_CHAR + "\\-]{0,64}\\.)+" // named host
- + TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL
- + "|(?:(?:25[0-5]|2[0-4]" // or ip address
- + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]"
- + "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]"
- + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
- + "|[1-9][0-9]|[0-9])))"
+ + "(?:" + DOMAIN_NAME + ")"
+ "(?:\\:\\d{1,5})?)" // plus option port number
+ "(\\/(?:(?:[" + GOOD_IRI_CHAR + "\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params
+ "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?"
@@ -130,19 +152,6 @@ public class Patterns {
// input. This is to stop foo.sure from
// matching as foo.su
- public static final Pattern IP_ADDRESS
- = Pattern.compile(
- "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
- + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
- + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
- + "|[1-9][0-9]|[0-9]))");
-
- public static final Pattern DOMAIN_NAME
- = Pattern.compile(
- "(((([" + GOOD_IRI_CHAR + "][" + GOOD_IRI_CHAR + "\\-]*)*[" + GOOD_IRI_CHAR + "]\\.)+"
- + TOP_LEVEL_DOMAIN + ")|"
- + IP_ADDRESS + ")");
-
public static final Pattern EMAIL_ADDRESS
= Pattern.compile(
"[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" +
@@ -159,7 +168,7 @@ public class Patterns {
* might be phone numbers in arbitrary text, not for validating whether
* something is in fact a phone number. It will miss many things that
* are legitimate phone numbers.
- *
+ *
* <p> The pattern matches the following:
* <ul>
* <li>Optionally, a + sign followed immediately by one or more digits. Spaces, dots, or dashes
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index abae068..477c994 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -52,7 +52,7 @@ import java.util.Queue;
*/
final class AccessibilityInteractionController {
- private static final boolean ENFORCE_NODE_TREE_CONSISTENT = Build.IS_DEBUGGABLE;
+ private static final boolean ENFORCE_NODE_TREE_CONSISTENT = false;
private final ArrayList<AccessibilityNodeInfo> mTempAccessibilityNodeInfoList =
new ArrayList<AccessibilityNodeInfo>();
diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java
deleted file mode 100644
index ed52803..0000000
--- a/core/java/android/view/DisplayList.java
+++ /dev/null
@@ -1,25 +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;
-
-/** TODO: Remove once frameworks/webview is updated
- * @hide
- */
-public class DisplayList {
- /** @hide */
- public static final int STATUS_DONE = 0x0;
-}
diff --git a/core/java/android/view/GLRenderer.java b/core/java/android/view/GLRenderer.java
index 90824ab..d6e1781 100644
--- a/core/java/android/view/GLRenderer.java
+++ b/core/java/android/view/GLRenderer.java
@@ -555,6 +555,32 @@ public class GLRenderer extends HardwareRenderer {
}
@Override
+ public void invokeFunctor(long functor, boolean waitForCompletion) {
+ boolean needsContext = !isEnabled() || checkRenderContext() == SURFACE_STATE_ERROR;
+ boolean hasContext = !needsContext;
+
+ if (needsContext) {
+ GLRendererEglContext managedContext =
+ (GLRendererEglContext) sEglContextStorage.get();
+ if (managedContext != null) {
+ usePbufferSurface(managedContext.getContext());
+ hasContext = true;
+ }
+ }
+
+ try {
+ nInvokeFunctor(functor, hasContext);
+ } finally {
+ if (needsContext) {
+ sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE,
+ EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ }
+ }
+ }
+
+ private static native void nInvokeFunctor(long functor, boolean hasContext);
+
+ @Override
void destroyHardwareResources(final View view) {
if (view != null) {
safelyRun(new Runnable() {
@@ -1096,8 +1122,7 @@ public class GLRenderer extends HardwareRenderer {
}
if (checkRenderContext() != SURFACE_STATE_ERROR) {
- int status = mCanvas.invokeFunctors(mRedrawClip);
- handleFunctorStatus(attachInfo, status);
+ mCanvas.invokeFunctors(mRedrawClip);
}
}
}
@@ -1203,7 +1228,7 @@ public class GLRenderer extends HardwareRenderer {
private RenderNode buildDisplayList(View view, HardwareCanvas canvas) {
if (mDrawDelta <= 0) {
- return view.mDisplayList;
+ return view.mRenderNode;
}
view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED)
@@ -1214,12 +1239,12 @@ public class GLRenderer extends HardwareRenderer {
canvas.clearLayerUpdates();
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList");
- RenderNode displayList = view.getDisplayList();
+ RenderNode renderNode = view.getDisplayList();
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
endBuildDisplayListProfiling(buildDisplayListStartTime);
- return displayList;
+ return renderNode;
}
private Rect beginFrame(HardwareCanvas canvas, Rect dirty, int surfaceState) {
@@ -1301,7 +1326,6 @@ public class GLRenderer extends HardwareRenderer {
mProfileData[mProfileCurrentFrame + 1] = total;
}
- handleFunctorStatus(attachInfo, status);
return status;
}
@@ -1337,26 +1361,6 @@ 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 & RenderNode.STATUS_DRAW) != 0) {
- if (mRedrawClip.isEmpty()) {
- attachInfo.mViewRootImpl.invalidate();
- } else {
- attachInfo.mViewRootImpl.invalidateChildInParent(null, mRedrawClip);
- mRedrawClip.setEmpty();
- }
- }
-
- if ((status & RenderNode.STATUS_INVOKE) != 0 ||
- attachInfo.mHandler.hasCallbacks(mFunctorsRunnable)) {
- attachInfo.mHandler.removeCallbacks(mFunctorsRunnable);
- mFunctorsRunnable.attachInfo = attachInfo;
- attachInfo.mHandler.postDelayed(mFunctorsRunnable, FUNCTOR_PROCESS_DELAY);
- }
- }
-
@Override
void detachFunctor(long functor) {
if (mCanvas != null) {
diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java
index f695b20..233f846 100644
--- a/core/java/android/view/HardwareCanvas.java
+++ b/core/java/android/view/HardwareCanvas.java
@@ -23,7 +23,7 @@ import android.graphics.Rect;
/**
* Hardware accelerated canvas.
- *
+ *
* @hide
*/
public abstract class HardwareCanvas extends Canvas {
@@ -40,7 +40,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 RenderNode#STATUS_DREW} if anything was drawn (such as a call to clear
* the canvas).
@@ -70,13 +70,11 @@ public abstract class HardwareCanvas extends Canvas {
* Draws the specified display list onto this 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 RenderNode#STATUS_DRAW}, can be null.
+ * @param dirty Ignored, can be null.
* @param flags Optional flags about drawing, see {@link RenderNode} for
* the possible flags.
*
- * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW}, or
- * {@link RenderNode#STATUS_INVOKE}, or'd with {@link RenderNode#STATUS_DREW}
+ * @return One of {@link RenderNode#STATUS_DONE} or {@link RenderNode#STATUS_DREW}
* if anything was drawn.
*
* @hide
@@ -101,9 +99,8 @@ public abstract class HardwareCanvas extends Canvas {
* This function may return true if an invalidation is needed after the call.
*
* @param drawGLFunction A native function pointer
- *
- * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW} or
- * {@link RenderNode#STATUS_INVOKE}
+ *
+ * @return {@link RenderNode#STATUS_DONE}
*
* @hide
*/
@@ -114,11 +111,10 @@ public abstract class HardwareCanvas extends Canvas {
/**
* Invoke all the functors who requested to be invoked during the previous frame.
- *
- * @param dirty The region to redraw when the functors return {@link RenderNode#STATUS_DRAW}
- *
- * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW} or
- * {@link RenderNode#STATUS_INVOKE}
+ *
+ * @param dirty Ignored
+ *
+ * @return Ignored
*
* @hide
*/
@@ -154,7 +150,7 @@ public abstract class HardwareCanvas extends Canvas {
/**
* Indicates that the specified layer must be updated as soon as possible.
- *
+ *
* @param layer The layer to update
*
* @see #clearLayerUpdates()
@@ -187,7 +183,7 @@ public abstract class HardwareCanvas extends Canvas {
/**
* Removes all enqueued layer updates.
- *
+ *
* @see #pushLayerUpdate(HardwareLayer)
*
* @hide
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 34efcf5..4f646e1 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -438,6 +438,17 @@ public abstract class HardwareRenderer {
abstract void attachFunctor(View.AttachInfo attachInfo, long functor);
/**
+ * Schedules the functor for execution in either kModeProcess or
+ * kModeProcessNoContext, depending on whether or not there is an EGLContext.
+ *
+ * @param functor The native functor to invoke
+ * @param waitForCompletion If true, this will not return until the functor
+ * has invoked. If false, the functor may be invoked
+ * asynchronously.
+ */
+ public abstract void invokeFunctor(long functor, boolean waitForCompletion);
+
+ /**
* Initializes the hardware renderer for the specified surface and setup the
* renderer for drawing, if needed. This is invoked when the ViewAncestor has
* potentially lost the hardware renderer. The hardware renderer should be
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 0b12cbe..ae5f37e 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -579,6 +579,18 @@ public final class InputDevice implements Parcelable {
}
/**
+ * Determines whether the input device supports the given source or sources.
+ *
+ * @param source The input source or sources to check against. This can be a generic device
+ * type such as {@link InputDevice#SOURCE_MOUSE}, a more generic device class, such as
+ * {@link InputDevice#SOURCE_CLASS_POINTER}, or a combination of sources bitwise ORed together.
+ * @return Whether the device can produce all of the given sources.
+ */
+ public boolean supportsSource(int source) {
+ return (mSources & source) == source;
+ }
+
+ /**
* Gets the keyboard type.
* @return The keyboard type.
*/
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index c4fac46..e19bda9 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -590,6 +590,7 @@ public abstract class LayoutInflater {
Object[] args = mConstructorArgs;
args[1] = attrs;
+ constructor.setAccessible(true);
final View view = constructor.newInstance(args);
if (view instanceof ViewStub) {
// always use ourselves when inflating ViewStub later
diff --git a/core/java/android/view/RenderNode.java b/core/java/android/view/RenderNode.java
index 6c8c3c7..a27c313 100644
--- a/core/java/android/view/RenderNode.java
+++ b/core/java/android/view/RenderNode.java
@@ -269,8 +269,8 @@ public class RenderNode {
}
/**
- * Returns whether the display list is currently usable. If this returns false,
- * the display list should be re-recorded prior to replaying it.
+ * Returns whether the RenderNode's display list content 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.
*/
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 2a488a0..7b8a1ff 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -186,6 +186,11 @@ public class ThreadedRenderer extends HardwareRenderer {
}
@Override
+ public void invokeFunctor(long functor, boolean waitForCompletion) {
+ nInvokeFunctor(mNativeProxy, functor, waitForCompletion);
+ }
+
+ @Override
HardwareLayer createDisplayListLayer(int width, int height) {
long layer = nCreateDisplayListLayer(mNativeProxy, width, height);
return HardwareLayer.adoptDisplayListLayer(this, layer);
@@ -266,6 +271,7 @@ public class ThreadedRenderer extends HardwareRenderer {
private static native void nAttachFunctor(long nativeProxy, long functor);
private static native void nDetachFunctor(long nativeProxy, long functor);
+ private static native void nInvokeFunctor(long nativeProxy, long functor, boolean waitForCompletion);
private static native long nCreateDisplayListLayer(long nativeProxy, int width, int height);
private static native long nCreateTextureLayer(long nativeProxy);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 22ca418..50d4df3 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3551,13 +3551,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
private Bitmap mUnscaledDrawingCache;
/**
- * Display list used for the View content.
+ * RenderNode holding View properties, potentially holding a DisplayList of View content.
* <p>
* When non-null and valid, this is expected to contain an up-to-date copy
- * of the View content. It is cleared on temporary detach and reset on
+ * of the View content. Its DisplayList content is cleared on temporary detach and reset on
* cleanup.
*/
- RenderNode mDisplayList;
+ RenderNode mRenderNode;
/**
* Set to true when the view is sending hover accessibility events because it
@@ -9018,10 +9018,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @return True if the event was handled, false otherwise.
*/
public boolean onTouchEvent(MotionEvent event) {
+ final float x = event.getX();
+ final float y = event.getY();
final int viewFlags = mViewFlags;
if ((viewFlags & ENABLED_MASK) == DISABLED) {
if (event.getAction() == MotionEvent.ACTION_UP && (mPrivateFlags & PFLAG_PRESSED) != 0) {
+ clearHotspot(R.attr.state_pressed);
setPressed(false);
}
// A disabled view that is clickable still consumes the touch
@@ -9054,6 +9057,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// showed it as pressed. Make it show the pressed
// state now (before scheduling the click) to ensure
// the user sees it.
+ setHotspot(R.attr.state_pressed, x, y);
setPressed(true);
}
@@ -9086,6 +9090,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// If the post failed, unpress right now
mUnsetPressedState.run();
}
+
removeTapCallback();
}
break;
@@ -9107,23 +9112,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if (mPendingCheckForTap == null) {
mPendingCheckForTap = new CheckForTap();
}
+ mPendingCheckForTap.x = event.getX();
+ mPendingCheckForTap.y = event.getY();
postDelayed(mPendingCheckForTap, ViewConfiguration.getTapTimeout());
} else {
// Not inside a scrolling container, so show the feedback right away
+ setHotspot(R.attr.state_pressed, x, y);
setPressed(true);
checkForLongClick(0);
}
break;
case MotionEvent.ACTION_CANCEL:
+ clearHotspot(R.attr.state_pressed);
setPressed(false);
removeTapCallback();
removeLongPressCallback();
break;
case MotionEvent.ACTION_MOVE:
- final int x = (int) event.getX();
- final int y = (int) event.getY();
+ setHotspot(R.attr.state_pressed, x, y);
// Be lenient about moving outside of buttons
if (!pointInView(x, y, mTouchSlop)) {
@@ -9139,46 +9147,24 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
break;
}
- if (mBackground != null && mBackground.supportsHotspots()) {
- manageTouchHotspot(event);
- }
-
return true;
}
return false;
}
- private void manageTouchHotspot(MotionEvent event) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_POINTER_DOWN: {
- final int index = event.getActionIndex();
- setPointerHotspot(event, index);
- } break;
- case MotionEvent.ACTION_MOVE: {
- final int count = event.getPointerCount();
- for (int index = 0; index < count; index++) {
- setPointerHotspot(event, index);
- }
- } break;
- case MotionEvent.ACTION_POINTER_UP: {
- final int actionIndex = event.getActionIndex();
- final int pointerId = event.getPointerId(actionIndex);
- mBackground.removeHotspot(pointerId);
- } break;
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- mBackground.clearHotspots();
- break;
+ private void setHotspot(int id, float x, float y) {
+ final Drawable bg = mBackground;
+ if (bg != null && bg.supportsHotspots()) {
+ bg.setHotspot(id, x, y);
}
}
- private void setPointerHotspot(MotionEvent event, int index) {
- final int id = event.getPointerId(index);
- final float x = event.getX(index);
- final float y = event.getY(index);
- mBackground.setHotspot(id, x, y);
+ private void clearHotspot(int id) {
+ final Drawable bg = mBackground;
+ if (bg != null && bg.supportsHotspots()) {
+ bg.removeHotspot(id);
+ }
}
/**
@@ -9733,6 +9719,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
}
+ void ensureRenderNode() {
+ if (mRenderNode == null) {
+ mRenderNode = RenderNode.create(getClass().getName());
+ }
+ }
+
/**
* Recomputes the transform matrix if necessary.
*/
@@ -9875,8 +9867,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mMatrixDirty = true;
invalidateViewProperty(false, false);
- if (mDisplayList != null) {
- mDisplayList.setCameraDistance(-Math.abs(distance) / dpi);
+ if (mRenderNode != null) {
+ mRenderNode.setCameraDistance(-Math.abs(distance) / dpi);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -9921,8 +9913,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mRotation = rotation;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setRotation(rotation);
+ if (mRenderNode != null) {
+ mRenderNode.setRotation(rotation);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -9972,8 +9964,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mRotationY = rotationY;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setRotationY(rotationY);
+ if (mRenderNode != null) {
+ mRenderNode.setRotationY(rotationY);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10023,8 +10015,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mRotationX = rotationX;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setRotationX(rotationX);
+ if (mRenderNode != null) {
+ mRenderNode.setRotationX(rotationX);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10066,8 +10058,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mScaleX = scaleX;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setScaleX(scaleX);
+ if (mRenderNode != null) {
+ mRenderNode.setScaleX(scaleX);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10109,8 +10101,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mScaleY = scaleY;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setScaleY(scaleY);
+ if (mRenderNode != null) {
+ mRenderNode.setScaleY(scaleY);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10162,8 +10154,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mPivotX = pivotX;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setPivotX(pivotX);
+ if (mRenderNode != null) {
+ mRenderNode.setPivotX(pivotX);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10214,8 +10206,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mPivotY = pivotY;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setPivotY(pivotY);
+ if (mRenderNode != null) {
+ mRenderNode.setPivotY(pivotY);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10298,8 +10290,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
} else {
mPrivateFlags &= ~PFLAG_ALPHA_SET;
invalidateViewProperty(true, false);
- if (mDisplayList != null) {
- mDisplayList.setAlpha(getFinalAlpha());
+ if (mRenderNode != null) {
+ mRenderNode.setAlpha(getFinalAlpha());
}
}
}
@@ -10325,8 +10317,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return true;
} else {
mPrivateFlags &= ~PFLAG_ALPHA_SET;
- if (mDisplayList != null) {
- mDisplayList.setAlpha(getFinalAlpha());
+ if (mRenderNode != null) {
+ mRenderNode.setAlpha(getFinalAlpha());
}
}
}
@@ -10348,8 +10340,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mTransformationInfo.mTransitionAlpha = alpha;
mPrivateFlags &= ~PFLAG_ALPHA_SET;
invalidateViewProperty(true, false);
- if (mDisplayList != null) {
- mDisplayList.setAlpha(getFinalAlpha());
+ if (mRenderNode != null) {
+ mRenderNode.setAlpha(getFinalAlpha());
}
}
}
@@ -10422,8 +10414,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
int oldHeight = mBottom - mTop;
mTop = top;
- if (mDisplayList != null) {
- mDisplayList.setTop(mTop);
+ if (mRenderNode != null) {
+ mRenderNode.setTop(mTop);
}
sizeChange(width, mBottom - mTop, width, oldHeight);
@@ -10495,8 +10487,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
int oldHeight = mBottom - mTop;
mBottom = bottom;
- if (mDisplayList != null) {
- mDisplayList.setBottom(mBottom);
+ if (mRenderNode != null) {
+ mRenderNode.setBottom(mBottom);
}
sizeChange(width, mBottom - mTop, width, oldHeight);
@@ -10562,8 +10554,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
int height = mBottom - mTop;
mLeft = left;
- if (mDisplayList != null) {
- mDisplayList.setLeft(left);
+ if (mRenderNode != null) {
+ mRenderNode.setLeft(left);
}
sizeChange(mRight - mLeft, height, oldWidth, height);
@@ -10626,8 +10618,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
int height = mBottom - mTop;
mRight = right;
- if (mDisplayList != null) {
- mDisplayList.setRight(mRight);
+ if (mRenderNode != null) {
+ mRenderNode.setRight(mRight);
}
sizeChange(mRight - mLeft, height, oldWidth, height);
@@ -10727,8 +10719,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mTranslationX = translationX;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setTranslationX(translationX);
+ if (mRenderNode != null) {
+ mRenderNode.setTranslationX(translationX);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10768,8 +10760,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mTranslationY = translationY;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setTranslationY(translationY);
+ if (mRenderNode != null) {
+ mRenderNode.setTranslationY(translationY);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10801,8 +10793,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
info.mTranslationZ = translationZ;
info.mMatrixDirty = true;
invalidateViewProperty(false, true);
- if (mDisplayList != null) {
- mDisplayList.setTranslationZ(translationZ);
+ if (mRenderNode != null) {
+ mRenderNode.setTranslationZ(translationZ);
}
if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
// View was rejected last time it was drawn by its parent; this may have changed
@@ -10853,8 +10845,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mOutline.set(outline);
}
- if (mDisplayList != null) {
- mDisplayList.setOutline(mOutline);
+ if (mRenderNode != null) {
+ mRenderNode.setOutline(mOutline);
}
}
@@ -10890,8 +10882,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
} else {
mPrivateFlags3 &= ~PFLAG3_CLIP_TO_OUTLINE;
}
- if (mDisplayList != null) {
- mDisplayList.setClipToOutline(clipToOutline);
+ if (mRenderNode != null) {
+ mRenderNode.setClipToOutline(clipToOutline);
}
}
}
@@ -10903,8 +10895,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
public void setRevealClip(boolean shouldClip, boolean inverseClip,
float x, float y, float radius) {
- if (mDisplayList != null) {
- mDisplayList.setRevealClip(shouldClip, inverseClip, x, y, radius);
+ if (mRenderNode != null) {
+ mRenderNode.setRevealClip(shouldClip, inverseClip, x, y, radius);
// TODO: Handle this invalidate in a better way, or purely in native.
invalidate();
}
@@ -11016,7 +11008,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
final boolean matrixIsIdentity = mTransformationInfo == null
|| mTransformationInfo.mMatrixIsIdentity;
if (matrixIsIdentity) {
- if (mDisplayList != null) {
+ if (mRenderNode != null) {
invalidateViewProperty(false, false);
} else {
final ViewParent p = mParent;
@@ -11044,8 +11036,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mTop += offset;
mBottom += offset;
- if (mDisplayList != null) {
- mDisplayList.offsetTopAndBottom(offset);
+ if (mRenderNode != null) {
+ mRenderNode.offsetTopAndBottom(offset);
invalidateViewProperty(false, false);
} else {
if (!matrixIsIdentity) {
@@ -11067,7 +11059,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
final boolean matrixIsIdentity = mTransformationInfo == null
|| mTransformationInfo.mMatrixIsIdentity;
if (matrixIsIdentity) {
- if (mDisplayList != null) {
+ if (mRenderNode != null) {
invalidateViewProperty(false, false);
} else {
final ViewParent p = mParent;
@@ -11092,8 +11084,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mLeft += offset;
mRight += offset;
- if (mDisplayList != null) {
- mDisplayList.offsetLeftAndRight(offset);
+ if (mRenderNode != null) {
+ mRenderNode.offsetLeftAndRight(offset);
invalidateViewProperty(false, false);
} else {
if (!matrixIsIdentity) {
@@ -11536,7 +11528,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* list properties are not being used in this view
*/
void invalidateViewProperty(boolean invalidateParent, boolean forceRedraw) {
- if (mDisplayList == null || (mPrivateFlags & PFLAG_DRAW_ANIMATION) == PFLAG_DRAW_ANIMATION) {
+ if (mRenderNode == null || (mPrivateFlags & PFLAG_DRAW_ANIMATION) == PFLAG_DRAW_ANIMATION) {
if (invalidateParent) {
invalidateParentCaches();
}
@@ -13703,10 +13695,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mHardwareLayer.setLayerPaint(mLayerPaint);
RenderNode displayList = mHardwareLayer.startRecording();
- if (getDisplayList(displayList, true) != displayList) {
- throw new IllegalStateException("getDisplayList() didn't return"
- + " the input displaylist for a hardware layer!");
- }
+ updateDisplayListIfDirty(displayList, true);
mHardwareLayer.endRecording(mLocalDirtyRect);
mLocalDirtyRect.setEmpty();
}
@@ -13847,29 +13836,34 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* Otherwise, the same display list will be returned (after having been rendered into
* along the way, depending on the invalidation state of the view).
*
- * @param displayList The previous version of this displayList, could be null.
+ * @param renderNode The previous version of this displayList, could be null.
* @param isLayer Whether the requester of the display list is a layer. If so,
* the view will avoid creating a layer inside the resulting display list.
* @return A new or reused DisplayList object.
*/
- private RenderNode getDisplayList(RenderNode displayList, boolean isLayer) {
+ private void updateDisplayListIfDirty(@NonNull RenderNode renderNode, boolean isLayer) {
final HardwareRenderer renderer = getHardwareRenderer();
+ if (renderNode == null) {
+ throw new IllegalArgumentException("RenderNode must not be null");
+ }
if (renderer == null || !canHaveDisplayList()) {
- return null;
+ // can't populate RenderNode, don't try
+ return;
}
- if (((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0 ||
- displayList == null || !displayList.isValid() ||
- (!isLayer && mRecreateDisplayList))) {
+ if ((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0
+ || !renderNode.isValid()
+ || (!isLayer && mRecreateDisplayList)) {
// Don't need to recreate the display list, just need to tell our
// children to restore/recreate theirs
- if (displayList != null && displayList.isValid() &&
- !isLayer && !mRecreateDisplayList) {
+ if (renderNode.isValid()
+ && !isLayer
+ && !mRecreateDisplayList) {
mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
mPrivateFlags &= ~PFLAG_DIRTY_MASK;
dispatchGetDisplayList();
- return displayList;
+ return; // no work needed
}
if (!isLayer) {
@@ -13877,20 +13871,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// we copy in child display lists into ours in drawChild()
mRecreateDisplayList = true;
}
- if (displayList == null) {
- 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.
- invalidateParentCaches();
- }
boolean caching = false;
int width = mRight - mLeft;
int height = mBottom - mTop;
int layerType = getLayerType();
- final HardwareCanvas canvas = displayList.start(width, height);
+ final HardwareCanvas canvas = renderNode.start(width, height);
try {
if (!isLayer && layerType != LAYER_TYPE_NONE) {
@@ -13933,12 +13920,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
}
} finally {
- displayList.end(renderer, canvas);
- displayList.setCaching(caching);
+ renderNode.end(renderer, canvas);
+ renderNode.setCaching(caching);
if (isLayer) {
- displayList.setLeftTopRightBottom(0, 0, width, height);
+ renderNode.setLeftTopRightBottom(0, 0, width, height);
} else {
- setDisplayListProperties(displayList);
+ setDisplayListProperties(renderNode);
}
if (renderer != getHardwareRenderer()) {
@@ -13953,26 +13940,25 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
mPrivateFlags &= ~PFLAG_DIRTY_MASK;
}
-
- return displayList;
}
/**
- * <p>Returns a display list that can be used to draw this view again
- * without executing its draw method.</p>
+ * Returns a RenderNode with View draw content recorded, which can be
+ * used to draw this view again without executing its draw method.
*
- * @return A DisplayList ready to replay, or null if caching is not enabled.
+ * @return A RenderNode ready to replay, or null if caching is not enabled.
*
* @hide
*/
public RenderNode getDisplayList() {
- mDisplayList = getDisplayList(mDisplayList, false);
- return mDisplayList;
+ ensureRenderNode();
+ updateDisplayListIfDirty(mRenderNode, false);
+ return mRenderNode;
}
private void resetDisplayList() {
- if (mDisplayList != null && mDisplayList.isValid()) {
- mDisplayList.destroyDisplayListData();
+ if (mRenderNode != null && mRenderNode.isValid()) {
+ mRenderNode.destroyDisplayListData();
}
if (mBackgroundDisplayList != null && mBackgroundDisplayList.isValid()) {
@@ -14670,9 +14656,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
transformToApply = parent.getChildTransformation();
} else {
if ((mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_TRANSFORM) ==
- PFLAG3_VIEW_IS_ANIMATING_TRANSFORM && mDisplayList != null) {
+ PFLAG3_VIEW_IS_ANIMATING_TRANSFORM && mRenderNode != null) {
// No longer animating: clear out old animation matrix
- mDisplayList.setAnimationMatrix(null);
+ mRenderNode.setAnimationMatrix(null);
mPrivateFlags3 &= ~PFLAG3_VIEW_IS_ANIMATING_TRANSFORM;
}
if (!useDisplayListProperties &&
@@ -15185,8 +15171,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if ((mPrivateFlags3 & PFLAG3_OUTLINE_DEFINED) == 0) {
// Outline not currently define, query from background
mOutline = background.getOutline();
- if (mDisplayList != null) {
- mDisplayList.setOutline(mOutline);
+ if (mRenderNode != null) {
+ mRenderNode.setOutline(mOutline);
}
}
}
@@ -15522,8 +15508,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mTop = top;
mRight = right;
mBottom = bottom;
- if (mDisplayList != null) {
- mDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+ if (mRenderNode != null) {
+ mRenderNode.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
}
mPrivateFlags |= PFLAG_HAS_BOUNDS;
@@ -19109,10 +19095,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
}
- class CheckForLongPress implements Runnable {
-
+ private final class CheckForLongPress implements Runnable {
private int mOriginalWindowAttachCount;
+ @Override
public void run() {
if (isPressed() && (mParent != null)
&& mOriginalWindowAttachCount == mWindowAttachCount) {
@@ -19128,14 +19114,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
private final class CheckForTap implements Runnable {
+ public float x;
+ public float y;
+
+ @Override
public void run() {
mPrivateFlags &= ~PFLAG_PREPRESSED;
+ setHotspot(R.attr.state_pressed, x, y);
setPressed(true);
checkForLongClick(ViewConfiguration.getTapTimeout());
}
}
private final class PerformClick implements Runnable {
+ @Override
public void run() {
performClick();
}
@@ -19414,7 +19406,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
private final class UnsetPressedState implements Runnable {
+ @Override
public void run() {
+ clearHotspot(R.attr.state_pressed);
setPressed(false);
}
}
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index aadaa7f..bcc82fb 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -31,7 +31,6 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.os.Build;
-import android.os.Bundle;
import android.os.Parcelable;
import android.os.SystemClock;
import android.util.AttributeSet;
@@ -3174,8 +3173,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
setBooleanFlag(FLAG_CLIP_CHILDREN, clipChildren);
for (int i = 0; i < mChildrenCount; ++i) {
View child = getChildAt(i);
- if (child.mDisplayList != null) {
- child.mDisplayList.setClipToBounds(clipChildren);
+ if (child.mRenderNode != null) {
+ child.mRenderNode.setClipToBounds(clipChildren);
}
}
}
@@ -4610,9 +4609,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
final View v = children[i];
v.mTop += offset;
v.mBottom += offset;
- if (v.mDisplayList != null) {
+ if (v.mRenderNode != null) {
invalidate = true;
- v.mDisplayList.offsetTopAndBottom(offset);
+ v.mRenderNode.offsetTopAndBottom(offset);
}
}
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java
index 563ffb7..bbae0ca 100644
--- a/core/java/android/view/ViewPropertyAnimator.java
+++ b/core/java/android/view/ViewPropertyAnimator.java
@@ -925,51 +925,51 @@ public class ViewPropertyAnimator {
*/
private void setValue(int propertyConstant, float value) {
final View.TransformationInfo info = mView.mTransformationInfo;
- final RenderNode displayList = mView.mDisplayList;
+ final RenderNode renderNode = mView.mRenderNode;
switch (propertyConstant) {
case TRANSLATION_X:
info.mTranslationX = value;
- if (displayList != null) displayList.setTranslationX(value);
+ if (renderNode != null) renderNode.setTranslationX(value);
break;
case TRANSLATION_Y:
info.mTranslationY = value;
- if (displayList != null) displayList.setTranslationY(value);
+ if (renderNode != null) renderNode.setTranslationY(value);
break;
case TRANSLATION_Z:
info.mTranslationZ = value;
- if (displayList != null) displayList.setTranslationZ(value);
+ if (renderNode != null) renderNode.setTranslationZ(value);
break;
case ROTATION:
info.mRotation = value;
- if (displayList != null) displayList.setRotation(value);
+ if (renderNode != null) renderNode.setRotation(value);
break;
case ROTATION_X:
info.mRotationX = value;
- if (displayList != null) displayList.setRotationX(value);
+ if (renderNode != null) renderNode.setRotationX(value);
break;
case ROTATION_Y:
info.mRotationY = value;
- if (displayList != null) displayList.setRotationY(value);
+ if (renderNode != null) renderNode.setRotationY(value);
break;
case SCALE_X:
info.mScaleX = value;
- if (displayList != null) displayList.setScaleX(value);
+ if (renderNode != null) renderNode.setScaleX(value);
break;
case SCALE_Y:
info.mScaleY = value;
- if (displayList != null) displayList.setScaleY(value);
+ if (renderNode != null) renderNode.setScaleY(value);
break;
case X:
info.mTranslationX = value - mView.mLeft;
- if (displayList != null) displayList.setTranslationX(value - mView.mLeft);
+ if (renderNode != null) renderNode.setTranslationX(value - mView.mLeft);
break;
case Y:
info.mTranslationY = value - mView.mTop;
- if (displayList != null) displayList.setTranslationY(value - mView.mTop);
+ if (renderNode != null) renderNode.setTranslationY(value - mView.mTop);
break;
case ALPHA:
info.mAlpha = value;
- if (displayList != null) displayList.setAlpha(value);
+ if (renderNode != null) renderNode.setAlpha(value);
break;
}
}
@@ -1093,7 +1093,7 @@ public class ViewPropertyAnimator {
// Shouldn't happen, but just to play it safe
return;
}
- boolean useDisplayListProperties = mView.mDisplayList != null;
+ boolean useRenderNodeProperties = mView.mRenderNode != null;
// alpha requires slightly different treatment than the other (transform) properties.
// The logic in setAlpha() is not simply setting mAlpha, plus the invalidation
@@ -1101,7 +1101,7 @@ public class ViewPropertyAnimator {
// We track what kinds of properties are set, and how alpha is handled when it is
// set, and perform the invalidation steps appropriately.
boolean alphaHandled = false;
- if (!useDisplayListProperties) {
+ if (!useRenderNodeProperties) {
mView.invalidateParentCaches();
}
float fraction = animation.getAnimatedFraction();
@@ -1124,7 +1124,7 @@ public class ViewPropertyAnimator {
}
if ((propertyMask & TRANSFORM_MASK) != 0) {
mView.mTransformationInfo.mMatrixDirty = true;
- if (!useDisplayListProperties) {
+ if (!useRenderNodeProperties) {
mView.mPrivateFlags |= View.PFLAG_DRAWN; // force another invalidation
}
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index fd85df9..b617f68 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1465,8 +1465,8 @@ public final class ViewRootImpl implements ViewParent,
mWidth, mHeight);
}
mResizeBuffer.prepare(mWidth, mHeight, false);
- RenderNode layerDisplayList = mResizeBuffer.startRecording();
- HardwareCanvas layerCanvas = layerDisplayList.start(mWidth, mHeight);
+ RenderNode layerRenderNode = mResizeBuffer.startRecording();
+ HardwareCanvas layerCanvas = layerRenderNode.start(mWidth, mHeight);
final int restoreCount = layerCanvas.save();
int yoff;
@@ -1484,9 +1484,9 @@ public final class ViewRootImpl implements ViewParent,
mTranslator.translateCanvas(layerCanvas);
}
- RenderNode displayList = mView.mDisplayList;
- if (displayList != null && displayList.isValid()) {
- layerCanvas.drawDisplayList(displayList, null,
+ RenderNode renderNode = mView.mRenderNode;
+ if (renderNode != null && renderNode.isValid()) {
+ layerCanvas.drawDisplayList(renderNode, null,
RenderNode.FLAG_CLIP_CHILDREN);
} else {
mView.draw(layerCanvas);
@@ -1499,9 +1499,9 @@ public final class ViewRootImpl implements ViewParent,
com.android.internal.R.integer.config_mediumAnimTime);
layerCanvas.restoreToCount(restoreCount);
- layerDisplayList.end(mAttachInfo.mHardwareRenderer, layerCanvas);
- layerDisplayList.setCaching(true);
- layerDisplayList.setLeftTopRightBottom(0, 0, mWidth, mHeight);
+ layerRenderNode.end(mAttachInfo.mHardwareRenderer, layerCanvas);
+ layerRenderNode.setCaching(true);
+ layerRenderNode.setLeftTopRightBottom(0, 0, mWidth, mHeight);
mTempRect.set(0, 0, mWidth, mHeight);
mResizeBuffer.endRecording(mTempRect);
mAttachInfo.mHardwareRenderer.flushLayerUpdates();
@@ -2178,9 +2178,9 @@ public final class ViewRootImpl implements ViewParent,
* @hide
*/
void outputDisplayList(View view) {
- RenderNode displayList = view.getDisplayList();
- if (displayList != null) {
- displayList.output();
+ RenderNode renderNode = view.getDisplayList();
+ if (renderNode != null) {
+ renderNode.output();
}
}
@@ -5218,10 +5218,10 @@ public final class ViewRootImpl implements ViewParent,
}
private static void getGfxInfo(View view, int[] info) {
- RenderNode displayList = view.mDisplayList;
+ RenderNode renderNode = view.mRenderNode;
info[0]++;
- if (displayList != null) {
- info[1] += 0; /* TODO: Memory used by display lists */
+ if (renderNode != null) {
+ info[1] += 0; /* TODO: Memory used by RenderNodes (properties + DisplayLists) */
}
if (view instanceof ViewGroup) {
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index 64953f8..b47177a 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -24,6 +24,7 @@ import android.database.DataSetObserver;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
+import android.os.SystemClock;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.IntProperty;
@@ -1225,6 +1226,15 @@ public class ListPopupWindow {
forwarding = onTouchForwarded(event) || !onForwardingStopped();
} else {
forwarding = onTouchObserved(event) && onForwardingStarted();
+
+ if (forwarding) {
+ // Make sure we cancel any ongoing source event stream.
+ final long now = SystemClock.uptimeMillis();
+ final MotionEvent e = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL,
+ 0.0f, 0.0f, 0);
+ mSrc.onTouchEvent(e);
+ e.recycle();
+ }
}
mForwarding = forwarding;
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 1eedc5d..d8a6867 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -1171,8 +1171,8 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|| !mOnQueryChangeListener.onQueryTextSubmit(query.toString())) {
if (mSearchable != null) {
launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, query.toString());
- setImeVisibility(false);
}
+ setImeVisibility(false);
dismissSuggestions();
}
}