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

Commit 4541a323 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Rename InputWindowHandle hasFocus to focusable

A window with hasFocus set to true, means the window can be focusable.
The current name is confusing when mutliple windows set the field to
true. Rename this to focusable and also remove canRecieveKeys field which
is not used.

Test: presubmit
Test: drag freeform windows

Bug: 151179149
Change-Id: I1b2354da0dc241d5e887e599e43f0426671289b8
parent 7d605ec3
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -70,11 +70,8 @@ public final class InputWindowHandle {
    // Window is visible.
    public boolean visible;

    // Window can receive keys.
    public boolean canReceiveKeys;

    // Window has focus.
    public boolean hasFocus;
    // Window can be focused.
    public boolean focusable;

    // Window has wallpaper.  (window is the current wallpaper target)
    public boolean hasWallpaper;
+3 −11
Original line number Diff line number Diff line
@@ -56,8 +56,7 @@ static struct {
    jfieldID scaleFactor;
    jfieldID touchableRegion;
    jfieldID visible;
    jfieldID canReceiveKeys;
    jfieldID hasFocus;
    jfieldID focusable;
    jfieldID hasWallpaper;
    jfieldID paused;
    jfieldID trustedOverlay;
@@ -145,10 +144,7 @@ bool NativeInputWindowHandle::updateInfo() {

    mInfo.visible = env->GetBooleanField(obj,
            gInputWindowHandleClassInfo.visible);
    mInfo.canReceiveKeys = env->GetBooleanField(obj,
            gInputWindowHandleClassInfo.canReceiveKeys);
    mInfo.hasFocus = env->GetBooleanField(obj,
            gInputWindowHandleClassInfo.hasFocus);
    mInfo.focusable = env->GetBooleanField(obj, gInputWindowHandleClassInfo.focusable);
    mInfo.hasWallpaper = env->GetBooleanField(obj,
            gInputWindowHandleClassInfo.hasWallpaper);
    mInfo.paused = env->GetBooleanField(obj,
@@ -320,11 +316,7 @@ int register_android_view_InputWindowHandle(JNIEnv* env) {
    GET_FIELD_ID(gInputWindowHandleClassInfo.visible, clazz,
            "visible", "Z");

    GET_FIELD_ID(gInputWindowHandleClassInfo.canReceiveKeys, clazz,
            "canReceiveKeys", "Z");

    GET_FIELD_ID(gInputWindowHandleClassInfo.hasFocus, clazz,
            "hasFocus", "Z");
    GET_FIELD_ID(gInputWindowHandleClassInfo.focusable, clazz, "focusable", "Z");

    GET_FIELD_ID(gInputWindowHandleClassInfo.hasWallpaper, clazz,
            "hasWallpaper", "Z");
+3 −2
Original line number Diff line number Diff line
@@ -283,8 +283,9 @@ class DragState {
            mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
            mDragWindowHandle.dispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
            mDragWindowHandle.visible = true;
            mDragWindowHandle.canReceiveKeys = false;
            mDragWindowHandle.hasFocus = true;
            // Allows the system to consume keys when dragging is active. This can also be used to
            // modify the drag state on key press. Example, cancel drag on escape key.
            mDragWindowHandle.focusable = true;
            mDragWindowHandle.hasWallpaper = false;
            mDragWindowHandle.paused = false;
            mDragWindowHandle.ownerPid = Process.myPid();
+1 −2
Original line number Diff line number Diff line
@@ -80,8 +80,7 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
        mWindowHandle.layoutParamsFlags = 0;
        mWindowHandle.dispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
        mWindowHandle.visible = true;
        mWindowHandle.canReceiveKeys = false;
        mWindowHandle.hasFocus = false;
        mWindowHandle.focusable = false;
        mWindowHandle.hasWallpaper = false;
        mWindowHandle.paused = false;
        mWindowHandle.ownerPid = Process.myPid();
+2 −4
Original line number Diff line number Diff line
@@ -271,8 +271,7 @@ final class InputMonitor {
        inputWindowHandle.layoutParamsType = type;
        inputWindowHandle.dispatchingTimeoutMillis = child.getInputDispatchingTimeoutMillis();
        inputWindowHandle.visible = isVisible;
        inputWindowHandle.canReceiveKeys = child.canReceiveKeys();
        inputWindowHandle.hasFocus = hasFocus;
        inputWindowHandle.focusable = hasFocus;
        inputWindowHandle.hasWallpaper = hasWallpaper;
        inputWindowHandle.paused = child.mActivityRecord != null ? child.mActivityRecord.paused : false;
        inputWindowHandle.ownerPid = child.mSession.mPid;
@@ -572,8 +571,7 @@ final class InputMonitor {
        inputWindowHandle.layoutParamsType = type;
        inputWindowHandle.dispatchingTimeoutMillis = 0; // it should never receive input
        inputWindowHandle.visible = isVisible;
        inputWindowHandle.canReceiveKeys = false;
        inputWindowHandle.hasFocus = false;
        inputWindowHandle.focusable = false;
        inputWindowHandle.inputFeatures = INPUT_FEATURE_NO_INPUT_CHANNEL;
        inputWindowHandle.scaleFactor = 1;
        inputWindowHandle.layoutParamsFlags =
Loading