Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3febd17c authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 14099962 from 0452feec to 25Q4-release

Change-Id: I1e797294698ca9290fdf1ec53dad18386a20cfcf
parents 62d01bef 0452feec
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -159,9 +159,7 @@ public final class ComputerControlSession implements AutoCloseable {
    /**
     * Launches an application's launcher activity in the computer control session.
     *
     * <p>The application with the given package name must have a launcher activity and the
     * package name must have been declared during the session creation.</p>
     *
     * @throws IllegalArgumentException if the package does not have a launcher activity.
     * @see ComputerControlSessionParams#getTargetPackageNames()
     */
    public void launchApplication(@NonNull String packageName) {
+20 −6
Original line number Diff line number Diff line
@@ -18,10 +18,10 @@ package android.view;

import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DEEP_PRESS;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DOUBLE_TAP;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__FLING;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__LONG_PRESS;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__SCROLL;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__SINGLE_TAP;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__UNKNOWN_CLASSIFICATION;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -797,7 +797,6 @@ public class GestureDetector {
                        mDoubleTapListener.onSingleTapConfirmed(ev);
                    }
                } else if (!mIgnoreNextUpEvent) {

                    // A fling must travel the minimum tap distance
                    final VelocityTracker velocityTracker = mVelocityTracker;
                    final int pointerId = ev.getPointerId(0);
@@ -807,6 +806,9 @@ public class GestureDetector {

                    if ((Math.abs(velocityY) > mMinimumFlingVelocity)
                            || (Math.abs(velocityX) > mMinimumFlingVelocity)) {
                        recordGestureClassification(
                                TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__FLING,
                                (float) Math.hypot(velocityX, velocityY) / 1000);
                        handled = mListener.onFling(mCurrentDownEvent, ev, velocityX, velocityY);
                    }
                }
@@ -942,10 +944,14 @@ public class GestureDetector {
    }

    private void recordGestureClassification(int classification) {
        recordGestureClassification(classification, 0 /* velocity */);
    }

    private void recordGestureClassification(int classification, float velocity) {
        // Only record the first classification for an event stream -- except for FLING,
        // which can occur at the end of an event stream after a SCROLL.
        if (mHasRecordedClassification
                || classification
                    == TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__UNKNOWN_CLASSIFICATION) {
            // Only record the first classification for an event stream.
                && classification != TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__FLING) {
            return;
        }
        if (mCurrentDownEvent == null || mCurrentMotionEvent == null) {
@@ -953,13 +959,21 @@ public class GestureDetector {
            mHasRecordedClassification = true;
            return;
        }
        if (velocity == 0 && mVelocityTracker != null) {
            // Compute velocity if it was not provided (i.e. for non-FLING gestures).
            mVelocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
            final int pointerId = mCurrentMotionEvent.getPointerId(0);
            velocity = (float) Math.hypot(mVelocityTracker.getXVelocity(pointerId),
                                          mVelocityTracker.getYVelocity(pointerId)) / 1000;
        }
        FrameworkStatsLog.write(
                FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED,
                getClass().getName(),
                classification,
                (int) (SystemClock.uptimeMillis() - mCurrentMotionEvent.getDownTime()),
                (float) Math.hypot(mCurrentMotionEvent.getRawX() - mCurrentDownEvent.getRawX(),
                                   mCurrentMotionEvent.getRawY() - mCurrentDownEvent.getRawY()));
                                   mCurrentMotionEvent.getRawY() - mCurrentDownEvent.getRawY()),
                (float) velocity);
        mHasRecordedClassification = true;
    }
}
+0 −24
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.os.Build;
import android.os.IBinder;
import android.os.Looper;
import android.os.MessageQueue;
import android.os.Trace;
import android.util.Log;
import android.util.SparseIntArray;

@@ -270,35 +269,12 @@ public abstract class InputEventReceiver {
        return nativeGetToken(mReceiverPtr);
    }

    private String getShortDescription(InputEvent event) {
        if (event instanceof MotionEvent motion) {
            return "MotionEvent " + MotionEvent.actionToString(motion.getAction()) + " deviceId="
                    + motion.getDeviceId() + " source=0x"
                    + Integer.toHexString(motion.getSource()) +  " historySize="
                    + motion.getHistorySize();
        } else if (event instanceof KeyEvent key) {
            return "KeyEvent " + KeyEvent.actionToString(key.getAction())
                    + " deviceId=" + key.getDeviceId();
        } else {
            Log.wtf(TAG, "Illegal InputEvent type: " + event);
            return "InputEvent";
        }
    }

    // Called from native code.
    @SuppressWarnings("unused")
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private void dispatchInputEvent(int seq, InputEvent event) {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_INPUT)) {
            // This 'if' block is an optimization - without it, 'getShortDescription' will be
            // called unconditionally, which is expensive.
            Trace.traceBegin(Trace.TRACE_TAG_INPUT,
                    "dispatchInputEvent " + getShortDescription(event));
        }
        mSeqMap.put(event.getSequenceNumber(), seq);
        onInputEvent(event);
        // If tracing is not enabled, `traceEnd` is a no-op (so we don't need to guard it with 'if')
        Trace.traceEnd(Trace.TRACE_TAG_INPUT);
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -31928,7 +31928,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        // To avoid negatively impacting View performance, the latency and displacement metrics
        // are omitted.
        FrameworkStatsLog.write(FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED, getClass().getName(),
                classification);
                classification, (int) 0 /* latency_millis */, (float) 0 /* displacement_px */,
                (float) 0 /* velocity_px_millis */);
    }
    /**
+17 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ import android.view.ViewGroup;
 */
public class WearGestureInterceptionDetector {
    private static final boolean DEBUG = false;
    private static final String TAG = "WearGestureInterceptionDetector";
    private static final String TAG = "WearGestureInterceptor";

    private final DecorView mInstalledDecorView;
    private final float mTouchSlop;
@@ -54,6 +54,9 @@ public class WearGestureInterceptionDetector {
        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
        mInstalledDecorView = installedDecorView;
        mSwipingStartThreshold = mTouchSlop * 2;
        if (DEBUG) {
            Log.i(TAG, "mTouchSlop=" + mTouchSlop);
        }
    }

    /** Check if this gesture interception detector should be enabled. */
@@ -91,9 +94,15 @@ public class WearGestureInterceptionDetector {
        }
        float deltaX = ev.getRawX() - mDownX;
        float deltaY = ev.getRawY() - mDownY;
        if (DEBUG) {
            Log.i(TAG, "updateSwiping: deltaX=" + deltaX + ",Y=" + deltaY);
        }
        // Check if we have left the touch slop area.
        if ((deltaX * deltaX) + (deltaY * deltaY) > (mTouchSlop * mTouchSlop)) {
            mSwiping = deltaX > mSwipingStartThreshold && Math.abs(deltaY) < Math.abs(deltaX);
            if (DEBUG) {
                Log.i(TAG, "updateSwiping: mSwiping=" + mSwiping);
            }
        }
    }

@@ -109,12 +118,18 @@ public class WearGestureInterceptionDetector {
        final float x = ev.getX(pointerIndex);
        final float y = ev.getY(pointerIndex);
        if (canScroll(mInstalledDecorView, false, checkLeft, x, y)) {
            if (DEBUG) {
                Log.i(TAG, "updateDiscardIntercept: canScroll, discardIntercept=true");
            }
            mDiscardIntercept = true;
        }
    }

    /** Resets internal members when canceling. */
    private void resetMembers() {
        if (DEBUG) {
            Log.i(TAG, "resetMembers");
        }
        mDownX = 0;
        mDownY = 0;
        mSwiping = false;
@@ -159,6 +174,7 @@ public class WearGestureInterceptionDetector {
                updateDiscardIntercept(ev, pointerIndex);
                break;
            case MotionEvent.ACTION_CANCEL:
                break;
            case MotionEvent.ACTION_UP:
                resetMembers();
                break;
Loading