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

Commit eeac1b7c authored by Ashley Holton's avatar Ashley Holton Committed by Android (Google) Code Review
Browse files

Merge "Change native input manager interactiveness to per-display" into main

parents d01202d1 3c0b145f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -431,6 +431,11 @@ public abstract class DisplayManagerInternal {
     */
    public abstract IntArray getDisplayGroupIds();

    /**
     * Get all available display ids.
     */
    public abstract IntArray getDisplayIds();

    /**
     * Called upon presentation started/ended on the display.
     * @param displayId the id of the display where presentation started.
+11 −0
Original line number Diff line number Diff line
@@ -5292,6 +5292,17 @@ public final class DisplayManagerService extends SystemService {
            return displayGroupIds;
        }

        @Override
        public IntArray getDisplayIds() {
            IntArray displayIds = new IntArray();
            synchronized (mSyncRoot) {
                mLogicalDisplayMapper.forEachLocked((logicalDisplay -> {
                    displayIds.add(logicalDisplay.getDisplayIdLocked());
                }), /* includeDisabled= */ false);
            }
            return displayIds;
        }

        @Override
        public DisplayManagerInternal.DisplayOffloadSession registerDisplayOffloader(
                int displayId, @NonNull DisplayManagerInternal.DisplayOffloader displayOffloader) {
+5 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.PointF;
import android.hardware.display.DisplayViewport;
import android.hardware.input.KeyGestureEvent;
import android.os.IBinder;
import android.util.SparseBooleanArray;
import android.view.InputChannel;
import android.view.inputmethod.InputMethodSubtype;

@@ -45,9 +46,11 @@ public abstract class InputManagerInternal {

    /**
     * Called by the power manager to tell the input manager whether it should start
     * watching for wake events.
     * watching for wake events on given displays.
     *
     * @param displayInteractivities Map of display ids to their current interactive state.
     */
    public abstract void setInteractive(boolean interactive);
    public abstract void setDisplayInteractivities(SparseBooleanArray displayInteractivities);

    /**
     * Toggles Caps Lock state for input device with specific id.
+17 −4
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ import android.os.vibrator.VibrationEffectSegment;
import android.provider.DeviceConfig;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.IndentingPrintWriter;
import android.util.Log;
import android.util.Slog;
@@ -3337,10 +3338,22 @@ public class InputManagerService extends IInputManager.Stub
        }

        @Override
        public void setInteractive(boolean interactive) {
            mNative.setInteractive(interactive);
            mBatteryController.onInteractiveChanged(interactive);
            mKeyboardBacklightController.onInteractiveChanged(interactive);
        public void setDisplayInteractivities(SparseBooleanArray displayInteractivities) {
            boolean globallyInteractive = false;
            ArraySet<Integer> nonInteractiveDisplays = new ArraySet<>();
            for (int i = 0; i < displayInteractivities.size(); i++) {
                final int displayId = displayInteractivities.keyAt(i);
                final boolean displayInteractive = displayInteractivities.get(displayId);
                if (displayInteractive) {
                    globallyInteractive = true;
                } else {
                    nonInteractiveDisplays.add(displayId);
                }
            }
            mNative.setNonInteractiveDisplays(
                    nonInteractiveDisplays.stream().mapToInt(Integer::intValue).toArray());
            mBatteryController.onInteractiveChanged(globallyInteractive);
            mKeyboardBacklightController.onInteractiveChanged(globallyInteractive);
        }

        // TODO(b/358569822): Remove this method from InputManagerInternal after key gesture
+2 −2
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ interface NativeInputManagerService {

    void setShowTouches(boolean enabled);

    void setInteractive(boolean interactive);
    void setNonInteractiveDisplays(int[] displayIds);

    void reloadCalibration();

@@ -409,7 +409,7 @@ interface NativeInputManagerService {
        public native void setShowTouches(boolean enabled);

        @Override
        public native void setInteractive(boolean interactive);
        public native void setNonInteractiveDisplays(int[] displayIds);

        @Override
        public native void reloadCalibration();
Loading