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

Commit 8cdb9fed authored by Daniel Hsieh's avatar Daniel Hsieh
Browse files

Support following typing foucs in window mode [2/n].

There are 3 milestones in this feature.
1. Refactor the callbacks for Accessibility in WindowManagerInternal.
2. Implement this feature in such new architecture.
3. Implement the setting choice in preference page.

This CL is for the 2nd milestone.

We move the window magnification to the typing focus' center position
based on the condition of whether a user takes control or not. We only
make a movement when the control is not taken by a user or we don't
preform the movement for the window magnification.

There are 2 methods for a user to take the control.
1. A user use 1 finger to drag the window magnification.
2. A user use 2 finger to drag the window magnification.

There is 1 method for a user to release the control.
1. When IME is shown, the control would be released.

So, we can decide whether we should make a movement to typing focus
given the condition of who take the control.

Bug: 194668976
Test: atest MagnificationControllerTest
	atest WindowMagnificationTest
	atest WindowMagnificationControllerTest
	atest WindowMagnificationManagerTest
Change-Id: I145f893d412b74c20afe1685449370d1dba99961
parent 9191d837
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -67,4 +67,13 @@ import android.graphics.Rect;
     */
     */
    void onAccessibilityActionPerformed(int displayId);
    void onAccessibilityActionPerformed(int displayId);


    /**
     * Called when the user is performing dragging gesture. It is started after the offset
     * between the down location and the move event location exceed
     * {@link ViewConfiguration#getScaledTouchSlop()}.
     *
     * @param displayId The logical display id.
     */
    void onDrag(int displayId);

}
}
+7 −0
Original line number Original line Diff line number Diff line
@@ -224,6 +224,13 @@ public class WindowMagnification extends CoreStartable implements WindowMagnifie
        }
        }
    }
    }


    @Override
    public void onDrag(int displayId) {
        if (mWindowMagnificationConnectionImpl != null) {
            mWindowMagnificationConnectionImpl.onDrag(displayId);
        }
    }

    @Override
    @Override
    public void requestWindowMagnificationConnection(boolean connect) {
    public void requestWindowMagnificationConnection(boolean connect) {
        if (connect) {
        if (connect) {
+10 −0
Original line number Original line Diff line number Diff line
@@ -142,4 +142,14 @@ class WindowMagnificationConnectionImpl extends IWindowMagnificationConnection.S
            }
            }
        }
        }
    }
    }

    void onDrag(int displayId) {
        if (mConnectionCallback != null) {
            try {
                mConnectionCallback.onDrag(displayId);
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to inform taking control by a user", e);
            }
        }
    }
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -960,6 +960,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
    @Override
    @Override
    public boolean onDrag(float offsetX, float offsetY) {
    public boolean onDrag(float offsetX, float offsetY) {
        moveWindowMagnifier(offsetX, offsetY);
        moveWindowMagnifier(offsetX, offsetY);
        mWindowMagnifierCallback.onDrag(mDisplayId);
        return true;
        return true;
    }
    }


+10 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.accessibility;
package com.android.systemui.accessibility;


import android.graphics.Rect;
import android.graphics.Rect;
import android.view.ViewConfiguration;


/**
/**
 * A callback to inform {@link com.android.server.accessibility.AccessibilityManagerService} about
 * A callback to inform {@link com.android.server.accessibility.AccessibilityManagerService} about
@@ -53,4 +54,13 @@ interface WindowMagnifierCallback {
     * @param displayId The logical display id.
     * @param displayId The logical display id.
     */
     */
    void onAccessibilityActionPerformed(int displayId);
    void onAccessibilityActionPerformed(int displayId);

    /**
     * Called when the user is performing dragging gesture. It is started after the offset
     * between the down location and the move event location exceed
     * {@link ViewConfiguration#getScaledTouchSlop()}.
     *
     * @param displayId The logical display id.
     */
    void onDrag(int displayId);
}
}
Loading