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

Commit a55f74e4 authored by Eugene Susla's avatar Eugene Susla
Browse files

Magnification Gestures CTS test

Test: ensure affected CTS tests pass
Change-Id: I2ad9ef57098d1e9343d571e0d59504851ac691eb
parent 00d31c27
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35400,6 +35400,7 @@ package android.provider {
    method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String);
    method public static final deprecated void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean);
    field public static final java.lang.String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled";
    field public static final java.lang.String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = "accessibility_display_magnification_enabled";
    field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled";
    field public static final deprecated java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
    field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled";
+12 −0
Original line number Diff line number Diff line
@@ -427,6 +427,18 @@ public final class GestureDescription {
            mY = other.mY;
        }

        @Override
        public String toString() {
            return "TouchPoint{"
                    + "mStrokeId=" + mStrokeId
                    + ", mContinuedStrokeId=" + mContinuedStrokeId
                    + ", mIsStartOfPath=" + mIsStartOfPath
                    + ", mIsEndOfPath=" + mIsEndOfPath
                    + ", mX=" + mX
                    + ", mY=" + mY
                    + '}';
        }

        @Override
        public int describeContents() {
            return 0;
+1 −0
Original line number Diff line number Diff line
@@ -5708,6 +5708,7 @@ public final class Settings {
         *
         * @hide
         */
        @TestApi
        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
                "accessibility_display_magnification_enabled";

+14 −1
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ package com.android.server.accessibility;
import android.content.Context;
import android.os.Handler;
import android.os.PowerManager;
import android.util.DebugUtils;
import android.util.ExceptionUtils;
import android.util.Log;
import android.util.Pools.SimplePool;
import android.util.Slog;
import android.util.SparseBooleanArray;
@@ -31,6 +34,7 @@ import android.view.MotionEvent;
import android.view.WindowManagerPolicy;
import android.view.accessibility.AccessibilityEvent;

import com.android.internal.util.BitUtils;
import com.android.server.LocalServices;

/**
@@ -188,6 +192,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
        }

        if (mEventHandler == null) {
            if (DEBUG) Slog.d(TAG, "mEventHandler == null for event " + event);
            super.onInputEvent(event, policyFlags);
            return;
        }
@@ -339,6 +344,8 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
            MotionEvent transformedEvent = MotionEvent.obtain(event);
            mEventHandler.onMotionEvent(transformedEvent, event, policyFlags);
            transformedEvent.recycle();
        } else {
            if (DEBUG) Slog.d(TAG, "mEventHandler == null for " + event);
        }
    }

@@ -376,6 +383,10 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
    }

    void setUserAndEnabledFeatures(int userId, int enabledFeatures) {
        if (DEBUG) {
            Slog.i(TAG, "setUserAndEnabledFeatures(userId = " + userId + ", enabledFeatures = 0x"
                    + Integer.toHexString(enabledFeatures) + ")");
        }
        if (mEnabledFeatures == enabledFeatures && mUserId == userId) {
            return;
        }
@@ -402,6 +413,8 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
    }

    private void enableFeatures() {
        if (DEBUG) Slog.i(TAG, "enableFeatures()");

        resetStreamState();

        if ((mEnabledFeatures & FLAG_FEATURE_AUTOCLICK) != 0) {
+18 −1
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import java.util.Locale;
 * constraints.
 */
class MagnificationController implements Handler.Callback {
    private static final boolean DEBUG = false;
    private static final String LOG_TAG = "MagnificationController";

    public static final float MIN_SCALE = 1.0f;
@@ -509,6 +510,12 @@ class MagnificationController implements Handler.Callback {

    private boolean setScaleAndCenterLocked(float scale, float centerX, float centerY,
            boolean animate, int id) {
        if (DEBUG) {
            Slog.i(LOG_TAG,
                    "setScaleAndCenterLocked(scale = " + scale + ", centerX = " + centerX
                            + ", centerY = " + centerY + ", animate = " + animate + ", id = " + id
                            + ")");
        }
        final boolean changed = updateMagnificationSpecLocked(scale, centerX, centerY);
        sendSpecToAnimation(mCurrentMagnificationSpec, animate);
        if (isMagnifying() && (id != INVALID_ID)) {
@@ -535,7 +542,9 @@ class MagnificationController implements Handler.Callback {

            final float nonNormOffsetX = mCurrentMagnificationSpec.offsetX - offsetX;
            final float nonNormOffsetY = mCurrentMagnificationSpec.offsetY - offsetY;
            updateCurrentSpecWithOffsetsLocked(nonNormOffsetX, nonNormOffsetY);
            if (updateCurrentSpecWithOffsetsLocked(nonNormOffsetX, nonNormOffsetY)) {
                onMagnificationChangedLocked();
            }
            if (id != INVALID_ID) {
                mIdOfLastServiceToMagnify = id;
            }
@@ -633,6 +642,11 @@ class MagnificationController implements Handler.Callback {
    }

    private boolean updateCurrentSpecWithOffsetsLocked(float nonNormOffsetX, float nonNormOffsetY) {
        if (DEBUG) {
            Slog.i(LOG_TAG,
                    "updateCurrentSpecWithOffsetsLocked(nonNormOffsetX = " + nonNormOffsetX
                            + ", nonNormOffsetY = " + nonNormOffsetY + ")");
        }
        boolean changed = false;
        final float offsetX = MathUtils.constrain(nonNormOffsetX, getMinOffsetXLocked(), 0);
        if (Float.compare(mCurrentMagnificationSpec.offsetX, offsetX) != 0) {
@@ -750,6 +764,9 @@ class MagnificationController implements Handler.Callback {
    }

    private void sendSpecToAnimation(MagnificationSpec spec, boolean animate) {
        if (DEBUG) {
            Slog.i(LOG_TAG, "sendSpecToAnimation(spec = " + spec + ", animate = " + animate + ")");
        }
        if (Thread.currentThread().getId() == mMainThreadId) {
            mSpecAnimationBridge.updateSentSpecMainThread(spec, animate);
        } else {
Loading