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

Commit 68ef9a17 authored by Arpit Singh's avatar Arpit Singh
Browse files

Add dev option override flag to connected display cursor flag

Adding the dev option flag that guards the dev option UI before checking
the override value. We will fall back to connected displays cursor flag
if dev option override is not available.

Test: manual and presubmit
Bug: 401213103
Flag: EXEMPT only changes the flagging logic
Change-Id: Ib9fb9a66deaf1d58b36218039d1854e287be7ce5
parent c93479c9
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -22,7 +22,21 @@ class InputFlags {
public:
    /**
     * Check if connected displays feature is enabled, either via the feature flag or settings
     * override.
     * override. Developer setting override allows enabling all the "desktop experiences" features
     * including input related connected_displays_cursor flag.
     *
     * The developer settings override is prioritised over aconfig flags. Any tests that require
     * applicable aconfig flags to be disabled with SCOPED_FLAG_OVERRIDE also need this developer
     * option to be reset locally.
     *
     * Also note the developer setting override is only applicable to the desktop experiences
     * related features.
     *
     * To enable only the input flag run:
     *      adb shell aflags enable com.android.input.flags.connected_displays_cursor
     * To override this flag and enable all "desktop experiences" features run:
     *      adb shell aflags enable com.android.window.flags.enable_desktop_mode_through_dev_option
     *      adb shell setprop persist.wm.debug.desktop_experience_devopts 1
     */
    static bool connectedDisplaysCursorEnabled();

+1 −0
Original line number Diff line number Diff line
@@ -270,6 +270,7 @@ cc_library {

    shared_libs: [
        "android.companion.virtualdevice.flags-aconfig-cc",
        "com.android.window.flags.window-aconfig_flags_c_lib",
        "libPlatformProperties",
        "libaconfig_storage_read_api_cc",
        "libbase",
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <android-base/logging.h>
#include <com_android_input_flags.h>
#include <com_android_window_flags.h>
#include <cutils/properties.h>

#include <string>
@@ -25,6 +26,9 @@
namespace android {

bool InputFlags::connectedDisplaysCursorEnabled() {
    if (!com::android::window::flags::enable_desktop_mode_through_dev_option()) {
        return com::android::input::flags::connected_displays_cursor();
    }
    static std::optional<bool> cachedDevOption;
    if (!cachedDevOption.has_value()) {
        char value[PROPERTY_VALUE_MAX];