blob: f866f9b8f0a25cd1b93e96b63d6861c9cbcabbff [file] [log] [blame]
Arpit Singh10719472025-02-10 12:38:26 +00001/*
2 * Copyright 2025 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <input/InputFlags.h>
18
19#include <android-base/logging.h>
20#include <com_android_input_flags.h>
21#include <cutils/properties.h>
22
23#include <string>
24
25namespace android {
26
27bool InputFlags::connectedDisplaysCursorEnabled() {
28 static std::optional<bool> cachedDevOption;
29 if (!cachedDevOption.has_value()) {
30 char value[PROPERTY_VALUE_MAX];
31 constexpr static auto sysprop_name = "persist.wm.debug.desktop_experience_devopts";
32 const int devOptionEnabled =
33 property_get(sysprop_name, value, nullptr) > 0 ? std::atoi(value) : 0;
34 cachedDevOption = devOptionEnabled == 1;
35 }
36 if (cachedDevOption.value_or(false)) {
37 return true;
38 }
39 return com::android::input::flags::connected_displays_cursor();
40}
41
nergi96df7be2025-02-17 17:20:24 +090042bool InputFlags::connectedDisplaysCursorAndAssociatedDisplayCursorBugfixEnabled() {
43 return connectedDisplaysCursorEnabled() &&
44 com::android::input::flags::connected_displays_associated_display_cursor_bugfix();
45}
46
Arpit Singh10719472025-02-10 12:38:26 +000047} // namespace android