Merge "fixing rare NPE" into tm-qpr-dev am: 1e42ff6353 am: 5864113904

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21692845

Change-Id: I3890dbce16468aec1bbe03e19260f81cc8c3cd7d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Randy Pfohl
2023-03-08 00:26:59 +00:00
committed by Automerger Merge Worker
+8 -2
View File
@@ -1370,8 +1370,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
int velocity = (int) mOrientationHandler.getPrimaryVelocity(velocityTracker,
mActivePointerId);
float delta = primaryDirection - mDownMotionPrimary;
int pageOrientedSize = (int) (mOrientationHandler.getMeasuredSize(
getPageAt(mCurrentPage))
View current = getPageAt(mCurrentPage);
if (current == null) {
Log.e(TAG, "current page was null. this should not happen.");
return true;
}
int pageOrientedSize = (int) (mOrientationHandler.getMeasuredSize(current)
* mOrientationHandler.getPrimaryScale(this));
boolean isSignificantMove = isSignificantMove(Math.abs(delta), pageOrientedSize);