summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/WindowInfo.cpp10
-rw-r--r--libs/gui/include/gui/WindowInfo.h69
-rw-r--r--libs/gui/tests/WindowInfo_test.cpp2
-rw-r--r--libs/input/Android.bp7
-rw-r--r--libs/input/android/os/IInputConstants.aidl49
-rw-r--r--libs/input/android/os/InputConfig.aidl147
6 files changed, 185 insertions, 99 deletions
diff --git a/libs/gui/WindowInfo.cpp b/libs/gui/WindowInfo.cpp
index 80bd6389a0..b02bae49d3 100644
--- a/libs/gui/WindowInfo.cpp
+++ b/libs/gui/WindowInfo.cpp
@@ -51,11 +51,11 @@ bool WindowInfo::supportsSplitTouch() const {
}
bool WindowInfo::isSpy() const {
- return inputFeatures.test(Feature::SPY);
+ return inputConfig.test(InputConfig::SPY);
}
bool WindowInfo::interceptsStylus() const {
- return inputFeatures.test(Feature::INTERCEPTS_STYLUS);
+ return inputConfig.test(InputConfig::INTERCEPTS_STYLUS);
}
bool WindowInfo::overlaps(const WindowInfo* other) const {
@@ -73,8 +73,7 @@ bool WindowInfo::operator==(const WindowInfo& info) const {
info.touchableRegion.hasSameRects(touchableRegion) &&
info.touchOcclusionMode == touchOcclusionMode && info.ownerPid == ownerPid &&
info.ownerUid == ownerUid && info.packageName == packageName &&
- info.inputFeatures == inputFeatures && info.inputConfig == inputConfig &&
- info.displayId == displayId &&
+ info.inputConfig == inputConfig && info.displayId == displayId &&
info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop &&
info.applicationInfo == applicationInfo && info.layoutParamsType == layoutParamsType &&
info.layoutParamsFlags == layoutParamsFlags;
@@ -92,7 +91,6 @@ status_t WindowInfo::writeToParcel(android::Parcel* parcel) const {
parcel->writeInt32(1);
// Ensure that the size of the flags that we use is 32 bits for writing into the parcel.
- static_assert(sizeof(inputFeatures) == 4u);
static_assert(sizeof(inputConfig) == 4u);
// clang-format off
@@ -120,7 +118,6 @@ status_t WindowInfo::writeToParcel(android::Parcel* parcel) const {
parcel->writeInt32(ownerPid) ?:
parcel->writeInt32(ownerUid) ?:
parcel->writeUtf8AsUtf16(packageName) ?:
- parcel->writeInt32(inputFeatures.get()) ?:
parcel->writeInt32(inputConfig.get()) ?:
parcel->writeInt32(displayId) ?:
applicationInfo.writeToParcel(parcel) ?:
@@ -178,7 +175,6 @@ status_t WindowInfo::readFromParcel(const android::Parcel* parcel) {
touchOcclusionMode = static_cast<TouchOcclusionMode>(touchOcclusionModeInt);
- inputFeatures = Flags<Feature>(parcel->readInt32());
inputConfig = Flags<InputConfig>(parcel->readInt32());
// clang-format off
status = parcel->readInt32(&displayId) ?:
diff --git a/libs/gui/include/gui/WindowInfo.h b/libs/gui/include/gui/WindowInfo.h
index b9bffaa6a0..ef0b98b5cb 100644
--- a/libs/gui/include/gui/WindowInfo.h
+++ b/libs/gui/include/gui/WindowInfo.h
@@ -17,7 +17,7 @@
#pragma once
#include <android/gui/TouchOcclusionMode.h>
-#include <android/os/IInputConstants.h>
+#include <android/os/InputConfig.h>
#include <binder/Parcel.h>
#include <binder/Parcelable.h>
#include <ftl/Flags.h>
@@ -132,49 +132,45 @@ struct WindowInfo : public Parcelable {
ftl_last = FIRST_SYSTEM_WINDOW + 15
};
- // This is a conversion of os::IInputConstants::InputFeature to an enum backed by an unsigned
+ // Flags used to determine configuration of this input window.
+ // This is a conversion of os::InputConfig to an enum backed by an unsigned
// type. This indicates that they are flags, so it can be used with ftl/enum.h.
- enum class Feature : uint32_t {
+ enum class InputConfig : uint32_t {
// clang-format off
+ DEFAULT =
+ static_cast<uint32_t>(os::InputConfig::DEFAULT),
NO_INPUT_CHANNEL =
- static_cast<uint32_t>(os::IInputConstants::InputFeature::NO_INPUT_CHANNEL),
+ static_cast<uint32_t>(os::InputConfig::NO_INPUT_CHANNEL),
+ NOT_VISIBLE =
+ static_cast<uint32_t>(os::InputConfig::NOT_VISIBLE),
+ NOT_FOCUSABLE =
+ static_cast<uint32_t>(os::InputConfig::NOT_FOCUSABLE),
+ NOT_TOUCHABLE =
+ static_cast<uint32_t>(os::InputConfig::NOT_TOUCHABLE),
+ PREVENT_SPLITTING =
+ static_cast<uint32_t>(os::InputConfig::PREVENT_SPLITTING),
+ DUPLICATE_TOUCH_TO_WALLPAPER =
+ static_cast<uint32_t>(os::InputConfig::DUPLICATE_TOUCH_TO_WALLPAPER),
+ IS_WALLPAPER =
+ static_cast<uint32_t>(os::InputConfig::IS_WALLPAPER),
+ PAUSE_DISPATCHING =
+ static_cast<uint32_t>(os::InputConfig::PAUSE_DISPATCHING),
+ TRUSTED_OVERLAY =
+ static_cast<uint32_t>(os::InputConfig::TRUSTED_OVERLAY),
+ WATCH_OUTSIDE_TOUCH =
+ static_cast<uint32_t>(os::InputConfig::WATCH_OUTSIDE_TOUCH),
+ SLIPPERY =
+ static_cast<uint32_t>(os::InputConfig::SLIPPERY),
DISABLE_USER_ACTIVITY =
- static_cast<uint32_t>(os::IInputConstants::InputFeature::DISABLE_USER_ACTIVITY),
+ static_cast<uint32_t>(os::InputConfig::DISABLE_USER_ACTIVITY),
DROP_INPUT =
- static_cast<uint32_t>(os::IInputConstants::InputFeature::DROP_INPUT),
+ static_cast<uint32_t>(os::InputConfig::DROP_INPUT),
DROP_INPUT_IF_OBSCURED =
- static_cast<uint32_t>(os::IInputConstants::InputFeature::DROP_INPUT_IF_OBSCURED),
+ static_cast<uint32_t>(os::InputConfig::DROP_INPUT_IF_OBSCURED),
SPY =
- static_cast<uint32_t>(os::IInputConstants::InputFeature::SPY),
+ static_cast<uint32_t>(os::InputConfig::SPY),
INTERCEPTS_STYLUS =
- static_cast<uint32_t>(os::IInputConstants::InputFeature::INTERCEPTS_STYLUS),
- // clang-format on
- };
-
- // Flags used to determine configuration of this input window.
- // Input windows can be configured with two sets of flags: InputFeature (WindowInfo::Feature
- // defined above), and InputConfig. When adding a new configuration for an input window:
- // - If you are adding a new flag that's visible and accessible to apps, it should be added
- // as an InputFeature.
- // - If you are adding an internal behaviour that is used within the system or shell and is
- // not exposed to apps, it should be added as an InputConfig.
- enum class InputConfig : uint32_t {
- // clang-format off
- NONE = 0,
- NOT_VISIBLE = 1 << 0,
- NOT_FOCUSABLE = 1 << 1,
- NOT_TOUCHABLE = 1 << 2,
- PREVENT_SPLITTING = 1 << 3,
- DUPLICATE_TOUCH_TO_WALLPAPER = 1 << 4,
- IS_WALLPAPER = 1 << 5,
- PAUSE_DISPATCHING = 1 << 6,
- // This flag is set when the window is of a trusted type that is allowed to silently
- // overlay other windows for the purpose of implementing the secure views feature.
- // Trusted overlays, such as IME windows, can partly obscure other windows without causing
- // motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED.
- TRUSTED_OVERLAY = 1 << 7,
- WATCH_OUTSIDE_TOUCH = 1 << 8,
- SLIPPERY = 1 << 9,
+ static_cast<uint32_t>(os::InputConfig::INTERCEPTS_STYLUS),
// clang-format on
};
@@ -228,7 +224,6 @@ struct WindowInfo : public Parcelable {
int32_t ownerPid = -1;
int32_t ownerUid = -1;
std::string packageName;
- Flags<Feature> inputFeatures;
Flags<InputConfig> inputConfig;
int32_t displayId = ADISPLAY_ID_NONE;
InputApplicationInfo applicationInfo;
diff --git a/libs/gui/tests/WindowInfo_test.cpp b/libs/gui/tests/WindowInfo_test.cpp
index ff9bae2800..c51b244c50 100644
--- a/libs/gui/tests/WindowInfo_test.cpp
+++ b/libs/gui/tests/WindowInfo_test.cpp
@@ -64,7 +64,6 @@ TEST(WindowInfo, Parcelling) {
i.ownerPid = 19;
i.ownerUid = 24;
i.packageName = "com.example.package";
- i.inputFeatures = WindowInfo::Feature::DISABLE_USER_ACTIVITY;
i.inputConfig = WindowInfo::InputConfig::NOT_FOCUSABLE;
i.displayId = 34;
i.replaceTouchableRegionWithCrop = true;
@@ -97,7 +96,6 @@ TEST(WindowInfo, Parcelling) {
ASSERT_EQ(i.ownerPid, i2.ownerPid);
ASSERT_EQ(i.ownerUid, i2.ownerUid);
ASSERT_EQ(i.packageName, i2.packageName);
- ASSERT_EQ(i.inputFeatures, i2.inputFeatures);
ASSERT_EQ(i.inputConfig, i2.inputConfig);
ASSERT_EQ(i.displayId, i2.displayId);
ASSERT_EQ(i.replaceTouchableRegionWithCrop, i2.replaceTouchableRegionWithCrop);
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index 930d8194d5..606fe2a59d 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -30,6 +30,7 @@ filegroup {
"android/os/IInputConstants.aidl",
"android/os/InputEventInjectionResult.aidl",
"android/os/InputEventInjectionSync.aidl",
+ "android/os/InputConfig.aidl",
],
}
@@ -79,11 +80,8 @@ cc_library {
android: {
srcs: [
"InputTransport.cpp",
- "android/os/BlockUntrustedTouchesMode.aidl",
- "android/os/IInputConstants.aidl",
"android/os/IInputFlinger.aidl",
- "android/os/InputEventInjectionResult.aidl",
- "android/os/InputEventInjectionSync.aidl",
+ ":inputconstants_aidl",
],
export_shared_lib_headers: ["libbinder"],
@@ -119,6 +117,7 @@ cc_library {
"InputTransport.cpp",
"android/os/IInputConstants.aidl",
"android/os/IInputFlinger.aidl",
+ "android/os/InputConfig.aidl",
],
static_libs: [
"libhostgraphics",
diff --git a/libs/input/android/os/IInputConstants.aidl b/libs/input/android/os/IInputConstants.aidl
index 265cbf0c0b..5ce10a4a50 100644
--- a/libs/input/android/os/IInputConstants.aidl
+++ b/libs/input/android/os/IInputConstants.aidl
@@ -47,55 +47,6 @@ interface IInputConstants
*/
const int INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800;
- @Backing(type="int")
- enum InputFeature {
- /**
- * Does not construct an input channel for this window. The channel will therefore
- * be incapable of receiving input.
- */
- NO_INPUT_CHANNEL = 0x00000002,
-
- /**
- * When this window has focus, does not call user activity for all input events so
- * the application will have to do it itself. Should only be used by
- * the keyguard and phone app.
- *
- * Should only be used by the keyguard and phone app.
- */
- DISABLE_USER_ACTIVITY = 0x00000004,
-
- /**
- * Internal flag used to indicate that input should be dropped on this window.
- */
- DROP_INPUT = 0x00000008,
-
- /**
- * Internal flag used to indicate that input should be dropped on this window if this window
- * is obscured.
- */
- DROP_INPUT_IF_OBSCURED = 0x00000010,
-
- /**
- * An input spy window. This window will receive all pointer events within its touchable
- * area, but will will not stop events from being sent to other windows below it in z-order.
- * An input event will be dispatched to all spy windows above the top non-spy window at the
- * event's coordinates.
- */
- SPY = 0x00000020,
-
- /**
- * When used with the window flag {@link #FLAG_NOT_TOUCHABLE}, this window will continue
- * to receive events from a stylus device within its touchable region. All other pointer
- * events, such as from a mouse or touchscreen, will be dispatched to the windows behind it.
- *
- * This input feature has no effect when the window flag {@link #FLAG_NOT_TOUCHABLE} is
- * not set.
- *
- * The window must be a trusted overlay to use this input feature.
- */
- INTERCEPTS_STYLUS = 0x00000040,
- }
-
/* The default pointer acceleration value. */
const int DEFAULT_POINTER_ACCELERATION = 3;
}
diff --git a/libs/input/android/os/InputConfig.aidl b/libs/input/android/os/InputConfig.aidl
new file mode 100644
index 0000000000..6d1b3967f7
--- /dev/null
+++ b/libs/input/android/os/InputConfig.aidl
@@ -0,0 +1,147 @@
+/**
+ * Copyright (c) 2022, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os;
+
+
+/**
+ * Input configurations flags used to determine the behavior of input windows.
+ * @hide
+ */
+@Backing(type="int")
+enum InputConfig {
+
+ /**
+ * The default InputConfig value with no flags set.
+ */
+ DEFAULT = 0,
+
+ /**
+ * Does not construct an input channel for this window. The channel will therefore
+ * be incapable of receiving input.
+ */
+ NO_INPUT_CHANNEL = 1 << 0,
+
+ /**
+ * Indicates that this input window is not visible, and thus will not be considered as
+ * an input target and will not obscure other windows.
+ */
+ NOT_VISIBLE = 1 << 1,
+
+ /**
+ * Indicates that this input window cannot be a focus target, and this will not
+ * receive any input events that can only be directed for the focused window, such
+ * as key events.
+ */
+ NOT_FOCUSABLE = 1 << 2,
+
+ /**
+ * Indicates that this input window cannot receive any events directed at a
+ * specific location on the screen, such as touchscreen, mouse, and stylus events.
+ * The window will not be considered as a touch target, but can still obscure other
+ * windows.
+ */
+ NOT_TOUCHABLE = 1 << 3,
+
+ /**
+ * Indicates that this window will not accept a touch event that is split between
+ * more than one window. When set:
+ * - If this window receives a DOWN event with the first pointer, all successive
+ * pointers that go down, regardless of their location on the screen, will be
+ * directed to this window;
+ * - If the DOWN event lands outside the touchable bounds of this window, no
+ * successive pointers that go down, regardless of their location on the screen,
+ * will be directed to this window.
+ */
+ PREVENT_SPLITTING = 1 << 4,
+
+ /**
+ * Indicates that this window shows the wallpaper behind it, so all touch events
+ * that it receives should also be sent to the wallpaper.
+ */
+ DUPLICATE_TOUCH_TO_WALLPAPER = 1 << 5,
+
+ /** Indicates that this the wallpaper's input window. */
+ IS_WALLPAPER = 1 << 6,
+
+ /**
+ * Indicates that input events should not be dispatched to this window. When set,
+ * input events directed towards this window will simply be dropped, and will not
+ * be dispatched to windows behind it.
+ */
+ PAUSE_DISPATCHING = 1 << 7,
+
+ /**
+ * This flag is set when the window is of a trusted type that is allowed to silently
+ * overlay other windows for the purpose of implementing the secure views feature.
+ * Trusted overlays, such as IME windows, can partly obscure other windows without causing
+ * motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED.
+ */
+ TRUSTED_OVERLAY = 1 << 8,
+
+ /**
+ * Indicates that this window wants to listen for when there is a touch DOWN event
+ * that occurs outside its touchable bounds. When such an event occurs, this window
+ * will receive a MotionEvent with ACTION_OUTSIDE.
+ */
+ WATCH_OUTSIDE_TOUCH = 1 << 9,
+
+ /**
+ * When set, this flag allows touches to leave the current window whenever the finger
+ * moves above another window. When this happens, the window that touch has just left
+ * (the current window) will receive ACTION_CANCEL, and the window that touch has entered
+ * will receive ACTION_DOWN, and the remainder of the touch gesture will only go to the
+ * new window. Without this flag, the entire gesture is sent to the current window, even
+ * if the touch leaves the window's bounds.
+ */
+ SLIPPERY = 1 << 10,
+
+ /**
+ * When this window has focus, does not call user activity for all input events so
+ * the application will have to do it itself.
+ */
+ DISABLE_USER_ACTIVITY = 1 << 11,
+
+ /**
+ * Internal flag used to indicate that input should be dropped on this window.
+ */
+ DROP_INPUT = 1 << 12,
+
+ /**
+ * Internal flag used to indicate that input should be dropped on this window if this window
+ * is obscured.
+ */
+ DROP_INPUT_IF_OBSCURED = 1 << 13,
+
+ /**
+ * An input spy window. This window will receive all pointer events within its touchable
+ * area, but will not stop events from being sent to other windows below it in z-order.
+ * An input event will be dispatched to all spy windows above the top non-spy window at the
+ * event's coordinates.
+ */
+ SPY = 1 << 14,
+
+ /**
+ * When used with {@link #NOT_TOUCHABLE}, this window will continue to receive events from
+ * a stylus device within its touchable region. All other pointer events, such as from a
+ * mouse or touchscreen, will be dispatched to the windows behind it.
+ *
+ * This configuration has no effect when the config {@link #NOT_TOUCHABLE} is not set.
+ *
+ * It is not valid to set this configuration if {@link #TRUSTED_OVERLAY} is not set.
+ */
+ INTERCEPTS_STYLUS = 1 << 15,
+}