summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityManagerInternal.java2
-rw-r--r--core/java/android/app/ContextImpl.java3
-rw-r--r--core/java/android/app/TaskInfo.java3
-rw-r--r--core/java/android/content/AttributionSource.java16
-rw-r--r--core/java/android/hardware/camera2/CaptureRequest.java10
-rw-r--r--core/java/android/hardware/camera2/CaptureResult.java10
-rw-r--r--core/java/android/hardware/camera2/impl/CameraMetadataNative.java45
-rw-r--r--core/java/android/permission/PermissionManager.java11
-rw-r--r--core/java/android/provider/Settings.java2
-rw-r--r--core/java/android/view/InsetsController.java16
-rw-r--r--core/java/android/view/ViewRootImpl.java36
-rw-r--r--core/java/android/view/ViewRootInsetsControllerHost.java18
-rw-r--r--core/java/com/android/internal/view/RecyclerViewCaptureHelper.java27
-rw-r--r--core/java/com/android/internal/view/ScrollCaptureInternal.java2
14 files changed, 121 insertions, 80 deletions
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index b7d9d9b67758..0d68df48c316 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -486,7 +486,7 @@ public abstract class ActivityManagerInternal {
* not associated with an FGS; ensure display; or only update if already displayed.
*/
public abstract ServiceNotificationPolicy applyForegroundServiceNotification(
- Notification notification, int id, String pkg, @UserIdInt int userId);
+ Notification notification, String tag, int id, String pkg, @UserIdInt int userId);
/**
* Callback from the notification subsystem that the given FGS notification has
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 5e99c79a7497..f52fdc562b13 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -3149,7 +3149,8 @@ class ContextImpl extends Context {
// If we want to access protected data on behalf of another app we need to
// tell the OS that we opt in to participate in the attribution chain.
if (nextAttributionSource != null) {
- getSystemService(PermissionManager.class).registerAttributionSource(attributionSource);
+ attributionSource = getSystemService(PermissionManager.class)
+ .registerAttributionSource(attributionSource);
}
return attributionSource;
}
diff --git a/core/java/android/app/TaskInfo.java b/core/java/android/app/TaskInfo.java
index c1871be80462..444cc4eedcb1 100644
--- a/core/java/android/app/TaskInfo.java
+++ b/core/java/android/app/TaskInfo.java
@@ -353,7 +353,8 @@ public class TaskInfo {
&& (!topActivityInSizeCompat || configuration.windowConfiguration.getBounds()
.equals(that.configuration.windowConfiguration.getBounds()))
&& (!topActivityInSizeCompat || configuration.getLayoutDirection()
- == that.configuration.getLayoutDirection());
+ == that.configuration.getLayoutDirection())
+ && (!topActivityInSizeCompat || isVisible == that.isVisible);
}
/**
diff --git a/core/java/android/content/AttributionSource.java b/core/java/android/content/AttributionSource.java
index c499f691b69a..d63ce0f4a943 100644
--- a/core/java/android/content/AttributionSource.java
+++ b/core/java/android/content/AttributionSource.java
@@ -88,6 +88,8 @@ import java.util.Set;
public final class AttributionSource implements Parcelable {
private static final String DESCRIPTOR = "android.content.AttributionSource";
+ private static final Binder sDefaultToken = new Binder(DESCRIPTOR);
+
private final @NonNull AttributionSourceState mAttributionSourceState;
private @Nullable AttributionSource mNextCached;
@@ -97,7 +99,7 @@ public final class AttributionSource implements Parcelable {
@TestApi
public AttributionSource(int uid, @Nullable String packageName,
@Nullable String attributionTag) {
- this(uid, packageName, attributionTag, new Binder(DESCRIPTOR));
+ this(uid, packageName, attributionTag, sDefaultToken);
}
/** @hide */
@@ -132,7 +134,7 @@ public final class AttributionSource implements Parcelable {
AttributionSource(int uid, @Nullable String packageName, @Nullable String attributionTag,
@Nullable String[] renouncedPermissions, @Nullable AttributionSource next) {
- this(uid, packageName, attributionTag, new Binder(DESCRIPTOR), renouncedPermissions, next);
+ this(uid, packageName, attributionTag, sDefaultToken, renouncedPermissions, next);
}
AttributionSource(int uid, @Nullable String packageName, @Nullable String attributionTag,
@@ -170,6 +172,12 @@ public final class AttributionSource implements Parcelable {
}
/** @hide */
+ public AttributionSource withToken(@NonNull Binder token) {
+ return new AttributionSource(getUid(), getPackageName(), getAttributionTag(),
+ token, mAttributionSourceState.renouncedPermissions, getNext());
+ }
+
+ /** @hide */
public @NonNull AttributionSourceState asState() {
return mAttributionSourceState;
}
@@ -543,7 +551,9 @@ public final class AttributionSource implements Parcelable {
if ((mBuilderFieldsSet & 0x10) == 0) {
mAttributionSourceState.next = null;
}
- mAttributionSourceState.token = new Binder(DESCRIPTOR);
+
+ mAttributionSourceState.token = sDefaultToken;
+
if (mAttributionSourceState.next == null) {
// The NDK aidl backend doesn't support null parcelable arrays.
mAttributionSourceState.next = new AttributionSourceState[0];
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 906256d70197..c78dd5366d31 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -2289,6 +2289,16 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is not 1.0, and {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} is set to be
* windowboxing, the camera framework will override the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be
* the active array.</p>
+ * <p>In the capture request, if the application sets {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} to a
+ * value != 1.0, the {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} tag in the capture result reflects the
+ * effective zoom ratio achieved by the camera device, and the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
+ * adjusts for additional crops that are not zoom related. Otherwise, if the application
+ * sets {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} to 1.0, or does not set it at all, the
+ * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} tag in the result metadata will also be 1.0.</p>
+ * <p>When the application requests a physical stream for a logical multi-camera, the
+ * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in the physical camera result metadata will be 1.0, and
+ * the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} tag reflects the amount of zoom and crop done by the
+ * physical camera device.</p>
* <p><b>Range of valid values:</b><br>
* {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}</p>
* <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index d32341fddff9..296bfbe2ba98 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -2567,6 +2567,16 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is not 1.0, and {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} is set to be
* windowboxing, the camera framework will override the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be
* the active array.</p>
+ * <p>In the capture request, if the application sets {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} to a
+ * value != 1.0, the {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} tag in the capture result reflects the
+ * effective zoom ratio achieved by the camera device, and the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}
+ * adjusts for additional crops that are not zoom related. Otherwise, if the application
+ * sets {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} to 1.0, or does not set it at all, the
+ * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} tag in the result metadata will also be 1.0.</p>
+ * <p>When the application requests a physical stream for a logical multi-camera, the
+ * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in the physical camera result metadata will be 1.0, and
+ * the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} tag reflects the amount of zoom and crop done by the
+ * physical camera device.</p>
* <p><b>Range of valid values:</b><br>
* {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}</p>
* <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
index e23bf78d6e76..6cbe107c96f5 100644
--- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
+++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
@@ -1869,38 +1869,28 @@ public class CameraMetadataNative implements Parcelable {
@FastNative
private static native void nativeUpdate(long dst, long src);
- @FastNative
- private static native void nativeWriteToParcel(Parcel dest, long ptr);
- @FastNative
- private static native void nativeReadFromParcel(Parcel source, long ptr);
- @FastNative
- private static native void nativeSwap(long ptr, long otherPtr)
+ private static synchronized native void nativeWriteToParcel(Parcel dest, long ptr);
+ private static synchronized native void nativeReadFromParcel(Parcel source, long ptr);
+ private static synchronized native void nativeSwap(long ptr, long otherPtr)
throws NullPointerException;
@FastNative
- private static native void nativeClose(long ptr);
- @FastNative
- private static native boolean nativeIsEmpty(long ptr);
- @FastNative
- private static native int nativeGetEntryCount(long ptr);
- @FastNative
- private static native long nativeGetBufferSize(long ptr);
+ private static native void nativeSetVendorId(long ptr, long vendorId);
+ private static synchronized native void nativeClose(long ptr);
+ private static synchronized native boolean nativeIsEmpty(long ptr);
+ private static synchronized native int nativeGetEntryCount(long ptr);
+ private static synchronized native long nativeGetBufferSize(long ptr);
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- @FastNative
- private static native byte[] nativeReadValues(int tag, long ptr);
- @FastNative
- private static native void nativeWriteValues(int tag, byte[] src, long ptr);
+ private static synchronized native byte[] nativeReadValues(int tag, long ptr);
+ private static synchronized native void nativeWriteValues(int tag, byte[] src, long ptr);
private static synchronized native void nativeDump(long ptr) throws IOException; // dump to LOGD
- @FastNative
- private static native ArrayList nativeGetAllVendorKeys(long ptr, Class keyClass);
+ private static synchronized native ArrayList nativeGetAllVendorKeys(long ptr, Class keyClass);
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- @FastNative
- private static native int nativeGetTagFromKeyLocal(long ptr, String keyName)
+ private static synchronized native int nativeGetTagFromKeyLocal(long ptr, String keyName)
throws IllegalArgumentException;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- @FastNative
- private static native int nativeGetTypeFromTagLocal(long ptr, int tag)
+ private static synchronized native int nativeGetTypeFromTagLocal(long ptr, int tag)
throws IllegalArgumentException;
@FastNative
private static native int nativeGetTagFromKey(String keyName, long vendorId)
@@ -1929,6 +1919,15 @@ public class CameraMetadataNative implements Parcelable {
}
/**
+ * Set the native metadata vendor id.
+ *
+ * @hide
+ */
+ public void setVendorId(long vendorId) {
+ nativeSetVendorId(mMetadataPtr, vendorId);
+ }
+
+ /**
* @hide
*/
public int getEntryCount() {
diff --git a/core/java/android/permission/PermissionManager.java b/core/java/android/permission/PermissionManager.java
index 4ef0e6e785e8..a52ede87880e 100644
--- a/core/java/android/permission/PermissionManager.java
+++ b/core/java/android/permission/PermissionManager.java
@@ -44,6 +44,7 @@ import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.content.pm.permission.SplitPermissionInfoParcelable;
import android.media.AudioManager;
+import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
@@ -1163,18 +1164,24 @@ public final class PermissionManager {
* that doesn't participate in an attribution chain.
*
* @param source The attribution source to register.
+ * @return The registered new attribution source.
*
* @see #isRegisteredAttributionSource(AttributionSource)
*
* @hide
*/
@TestApi
- public void registerAttributionSource(@NonNull AttributionSource source) {
+ public @NonNull AttributionSource registerAttributionSource(@NonNull AttributionSource source) {
+ // We use a shared static token for sources that are not registered since the token's
+ // only used for process death detection. If we are about to use the source for security
+ // enforcement we need to replace the binder with a unique one.
+ final AttributionSource registeredSource = source.withToken(new Binder());
try {
- mPermissionManager.registerAttributionSource(source);
+ mPermissionManager.registerAttributionSource(registeredSource);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
+ return registeredSource;
}
/**
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 6b2123dfbeeb..b191dfc561aa 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -8747,8 +8747,6 @@ public final class Settings {
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- @TestApi
- @Readable
public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
/**
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 145607ada4f4..6f915c9182d2 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -128,6 +128,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
*/
@Appearance int getSystemBarsAppearance();
+ default boolean isSystemBarsAppearanceControlled() {
+ return false;
+ }
+
/**
* @see WindowInsetsController#setSystemBarsBehavior
*/
@@ -138,6 +142,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
*/
@Behavior int getSystemBarsBehavior();
+ default boolean isSystemBarsBehaviorControlled() {
+ return false;
+ }
+
/**
* Releases a surface and ensure that this is done after {@link #applySurfaceParams} has
* finished applying params.
@@ -1520,6 +1528,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
@Override
public @Appearance int getSystemBarsAppearance() {
+ if (!mHost.isSystemBarsAppearanceControlled()) {
+ // We only return the requested appearance, not the implied one.
+ return 0;
+ }
return mHost.getSystemBarsAppearance();
}
@@ -1544,6 +1556,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
@Override
public @Behavior int getSystemBarsBehavior() {
+ if (!mHost.isSystemBarsBehaviorControlled()) {
+ // We only return the requested behavior, not the implied one.
+ return 0;
+ }
return mHost.getSystemBarsBehavior();
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 2bd2be12ca16..280685065aaf 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2778,6 +2778,7 @@ public final class ViewRootImpl implements ViewParent,
mView.onSystemBarAppearanceChanged(mDispatchedSystemBarAppearance);
}
}
+ final boolean wasReportNextDraw = mReportNextDraw;
if (mFirst || windowShouldResize || viewVisibilityChanged || params != null
|| mForceNextWindowRelayout) {
@@ -2824,6 +2825,16 @@ public final class ViewRootImpl implements ViewParent,
final boolean dockedResizing = (relayoutResult
& WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0;
final boolean dragResizing = freeformResizing || dockedResizing;
+ if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) {
+ if (DEBUG_BLAST) {
+ Log.d(mTag, "Relayout called with blastSync");
+ }
+ reportNextDraw();
+ if (isHardwareEnabled()) {
+ mNextDrawUseBlastSync = true;
+ }
+ }
+
if (mSurfaceControl.isValid()) {
updateOpacity(mWindowAttributes, dragResizing);
}
@@ -3042,7 +3053,16 @@ public final class ViewRootImpl implements ViewParent,
}
}
- if (!mStopped || mReportNextDraw) {
+ // TODO: In the CL "ViewRootImpl: Fix issue with early draw report in
+ // seamless rotation". We moved processing of RELAYOUT_RES_BLAST_SYNC
+ // earlier in the function, potentially triggering a call to
+ // reportNextDraw(). That same CL changed this and the next reference
+ // to wasReportNextDraw, such that this logic would remain undisturbed
+ // (it continues to operate as if the code was never moved). This was
+ // done to achieve a more hermetic fix for S, but it's entirely
+ // possible that checking the most recent value is actually more
+ // correct here.
+ if (!mStopped || wasReportNextDraw) {
boolean focusChangedDueToTouchMode = ensureTouchModeLocally(
(relayoutResult&WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE) != 0);
if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth()
@@ -3112,7 +3132,7 @@ public final class ViewRootImpl implements ViewParent,
prepareSurfaces();
}
- final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw);
+ final boolean didLayout = layoutRequested && (!mStopped || wasReportNextDraw);
boolean triggerGlobalLayoutListener = didLayout
|| mAttachInfo.mRecomputeGlobalAttributes;
if (didLayout) {
@@ -3268,21 +3288,10 @@ public final class ViewRootImpl implements ViewParent,
mImeFocusController.onTraversal(hasWindowFocus, mWindowAttributes);
- final boolean wasReportNextDraw = mReportNextDraw;
-
// Remember if we must report the next draw.
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
reportNextDraw();
}
- if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) {
- if (DEBUG_BLAST) {
- Log.d(mTag, "Relayout called with blastSync");
- }
- reportNextDraw();
- if (isHardwareEnabled()) {
- mNextDrawUseBlastSync = true;
- }
- }
boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible;
@@ -3293,7 +3302,6 @@ public final class ViewRootImpl implements ViewParent,
}
mPendingTransitions.clear();
}
-
performDraw();
} else {
if (isViewVisible) {
diff --git a/core/java/android/view/ViewRootInsetsControllerHost.java b/core/java/android/view/ViewRootInsetsControllerHost.java
index 27821fd6608d..ce882da1a6da 100644
--- a/core/java/android/view/ViewRootInsetsControllerHost.java
+++ b/core/java/android/view/ViewRootInsetsControllerHost.java
@@ -180,14 +180,15 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
@Override
public int getSystemBarsAppearance() {
- if ((mViewRoot.mWindowAttributes.privateFlags & PRIVATE_FLAG_APPEARANCE_CONTROLLED) == 0) {
- // We only return the requested appearance, not the implied one.
- return 0;
- }
return mViewRoot.mWindowAttributes.insetsFlags.appearance;
}
@Override
+ public boolean isSystemBarsAppearanceControlled() {
+ return (mViewRoot.mWindowAttributes.privateFlags & PRIVATE_FLAG_APPEARANCE_CONTROLLED) != 0;
+ }
+
+ @Override
public void setSystemBarsBehavior(int behavior) {
mViewRoot.mWindowAttributes.privateFlags |= PRIVATE_FLAG_BEHAVIOR_CONTROLLED;
if (mViewRoot.mWindowAttributes.insetsFlags.behavior != behavior) {
@@ -199,14 +200,15 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
@Override
public int getSystemBarsBehavior() {
- if ((mViewRoot.mWindowAttributes.privateFlags & PRIVATE_FLAG_BEHAVIOR_CONTROLLED) == 0) {
- // We only return the requested behavior, not the implied one.
- return 0;
- }
return mViewRoot.mWindowAttributes.insetsFlags.behavior;
}
@Override
+ public boolean isSystemBarsBehaviorControlled() {
+ return (mViewRoot.mWindowAttributes.privateFlags & PRIVATE_FLAG_BEHAVIOR_CONTROLLED) != 0;
+ }
+
+ @Override
public void releaseSurfaceControlFromRt(SurfaceControl surfaceControl) {
// At the time we receive new leashes (e.g. InsetsSourceConsumer is processing
diff --git a/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java b/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java
index 848a5ba77317..d14adf6f3c20 100644
--- a/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java
+++ b/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java
@@ -16,11 +16,6 @@
package com.android.internal.view;
-import static com.android.internal.view.ScrollCaptureViewSupport.computeScrollAmount;
-import static com.android.internal.view.ScrollCaptureViewSupport.findScrollingReferenceView;
-import static com.android.internal.view.ScrollCaptureViewSupport.transformFromContainerToRequest;
-import static com.android.internal.view.ScrollCaptureViewSupport.transformFromRequestToContainer;
-
import android.annotation.NonNull;
import android.graphics.Rect;
import android.util.Log;
@@ -43,6 +38,7 @@ import android.view.ViewParent;
*/
public class RecyclerViewCaptureHelper implements ScrollCaptureViewHelper<ViewGroup> {
private static final String TAG = "RVCaptureHelper";
+
private int mScrollDelta;
private boolean mScrollBarWasEnabled;
private int mOverScrollMode;
@@ -66,7 +62,6 @@ public class RecyclerViewCaptureHelper implements ScrollCaptureViewHelper<ViewGr
result.scrollDelta = mScrollDelta;
result.availableArea = new Rect(); // empty
- Log.d(TAG, "current scrollDelta: " + mScrollDelta);
if (!recyclerView.isVisibleToUser() || recyclerView.getChildCount() == 0) {
Log.w(TAG, "recyclerView is empty or not visible, cannot continue");
return result; // result.availableArea == empty Rect
@@ -76,22 +71,18 @@ public class RecyclerViewCaptureHelper implements ScrollCaptureViewHelper<ViewGr
Rect requestedContainerBounds = new Rect(requestRect);
requestedContainerBounds.offset(0, -mScrollDelta);
requestedContainerBounds.offset(scrollBounds.left, scrollBounds.top);
-
// requestedContainerBounds is now in recyclerview-local coordinates
- Log.d(TAG, "requestedContainerBounds: " + requestedContainerBounds);
// Save a copy for later
View anchor = findChildNearestTarget(recyclerView, requestedContainerBounds);
if (anchor == null) {
- Log.d(TAG, "Failed to locate anchor view");
- return result; // result.availableArea == null
+ Log.w(TAG, "Failed to locate anchor view");
+ return result; // result.availableArea == empty rect
}
- Log.d(TAG, "Anchor view:" + anchor);
Rect requestedContentBounds = new Rect(requestedContainerBounds);
recyclerView.offsetRectIntoDescendantCoords(anchor, requestedContentBounds);
- Log.d(TAG, "requestedContentBounds = " + requestedContentBounds);
int prevAnchorTop = anchor.getTop();
// Note: requestChildRectangleOnScreen may modify rectangle, must pass pass in a copy here
Rect input = new Rect(requestedContentBounds);
@@ -101,34 +92,27 @@ public class RecyclerViewCaptureHelper implements ScrollCaptureViewHelper<ViewGr
if (remainingHeight > 0) {
input.inset(0, -remainingHeight / 2);
}
- Log.d(TAG, "input (post center adjustment) = " + input);
if (recyclerView.requestChildRectangleOnScreen(anchor, input, true)) {
int scrolled = prevAnchorTop - anchor.getTop(); // inverse of movement
- Log.d(TAG, "RecyclerView scrolled by " + scrolled + " px");
mScrollDelta += scrolled; // view.top-- is equivalent to parent.scrollY++
result.scrollDelta = mScrollDelta;
- Log.d(TAG, "requestedContentBounds, (post-request-rect) = " + requestedContentBounds);
}
requestedContainerBounds.set(requestedContentBounds);
recyclerView.offsetDescendantRectToMyCoords(anchor, requestedContainerBounds);
- Log.d(TAG, "requestedContainerBounds, (post-scroll): " + requestedContainerBounds);
Rect recyclerLocalVisible = new Rect(scrollBounds);
recyclerView.getLocalVisibleRect(recyclerLocalVisible);
- Log.d(TAG, "recyclerLocalVisible: " + recyclerLocalVisible);
if (!requestedContainerBounds.intersect(recyclerLocalVisible)) {
// Requested area is still not visible
- Log.d(TAG, "requested bounds not visible!");
return result;
}
Rect available = new Rect(requestedContainerBounds);
available.offset(-scrollBounds.left, -scrollBounds.top);
available.offset(0, mScrollDelta);
result.availableArea = available;
- Log.d(TAG, "availableArea: " + result.availableArea);
return result;
}
@@ -154,22 +138,17 @@ public class RecyclerViewCaptureHelper implements ScrollCaptureViewHelper<ViewGr
Rect parentLocalVis = new Rect();
parent.getLocalVisibleRect(parentLocalVis);
- Log.d(TAG, "findChildNearestTarget: parentVis=" + parentLocalVis
- + " targetRect=" + targetRect);
Rect frame = new Rect();
for (int i = 0; i < parent.getChildCount(); i++) {
final View child = parent.getChildAt(i);
child.getHitRect(frame);
- Log.d(TAG, "child #" + i + " hitRect=" + frame);
if (child.getVisibility() != View.VISIBLE) {
- Log.d(TAG, "child #" + i + " is not visible");
continue;
}
int centerDistance = Math.abs(targetRect.centerY() - frame.centerY());
- Log.d(TAG, "child #" + i + " : center to center: " + centerDistance + "px");
if (centerDistance < minCenterDistance) {
// closer to center
diff --git a/core/java/com/android/internal/view/ScrollCaptureInternal.java b/core/java/com/android/internal/view/ScrollCaptureInternal.java
index ffee16a151df..e3a9fda7b000 100644
--- a/core/java/com/android/internal/view/ScrollCaptureInternal.java
+++ b/core/java/com/android/internal/view/ScrollCaptureInternal.java
@@ -34,7 +34,7 @@ public class ScrollCaptureInternal {
private static final String TAG = "ScrollCaptureInternal";
// Log found scrolling views
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
// Log all investigated views, as well as heuristic checks
private static final boolean DEBUG_VERBOSE = false;