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

Commit 7ead73ed authored by Jaekyun Seok's avatar Jaekyun Seok
Browse files

Treblize input device config file location

Treblization requires to locate partner-specific configs in its own
partition. So the input device config file could be located in
/odm/usr or /vendor/usr.
This CL is to support those locations for the config.

Test: building succeeded and tested on sailfish.
Bug: 35815587
Change-Id: Ib6ae230118c8dc45dc030b32eb59441c3a544535
parent 0ee1d0ed
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <ctype.h>

#include <input/InputDevice.h>
#include <input/InputEventLabels.h>

namespace android {

@@ -87,11 +88,16 @@ String8 getInputDeviceConfigurationFilePathByName(
        const String8& name, InputDeviceConfigurationFileType type) {
    // Search system repository.
    String8 path;
    path.setTo(getenv("ANDROID_ROOT"));

    // Treblized input device config files will be located /odm/usr or /vendor/usr.
    char *rootsForPartition[] {"/odm", "/vendor", getenv("ANDROID_ROOT")};
    for (size_t i = 0; i < size(rootsForPartition); i++) {
        path.setTo(rootsForPartition[i]);
        path.append("/usr/");
        appendInputDeviceConfigurationFileRelativePath(path, name, type);
#if DEBUG_PROBE
    ALOGD("Probing for system provided input device configuration file: path='%s'", path.string());
        ALOGD("Probing for system provided input device configuration file: path='%s'",
              path.string());
#endif
        if (!access(path.string(), R_OK)) {
#if DEBUG_PROBE
@@ -99,6 +105,7 @@ String8 getInputDeviceConfigurationFilePathByName(
#endif
            return path;
        }
    }

    // Search user repository.
    // TODO Should only look here if not in safe mode.