diff options
Diffstat (limited to 'services/inputflinger/host/InputDriver.cpp')
-rw-r--r-- | services/inputflinger/host/InputDriver.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/services/inputflinger/host/InputDriver.cpp b/services/inputflinger/host/InputDriver.cpp index 2ebdbcfcc4..683c05d8a0 100644 --- a/services/inputflinger/host/InputDriver.cpp +++ b/services/inputflinger/host/InputDriver.cpp @@ -29,14 +29,14 @@ #include <hardware/input.h> #include <input/InputDevice.h> -#include <input/PropertyMap.h> #include <utils/Log.h> +#include <utils/PropertyMap.h> #include <utils/String8.h> #define INDENT2 " " struct input_property_map { - std::unique_ptr<android::PropertyMap> propertyMap; + android::PropertyMap* propertyMap; }; struct input_property { @@ -217,25 +217,22 @@ input_property_map_t* InputDriver::inputGetDevicePropertyMap(input_device_identi idi.product = id->productId; idi.version = id->version; - std::string configFile = - getInputDeviceConfigurationFilePathByDeviceIdentifier(idi, - InputDeviceConfigurationFileType:: - CONFIGURATION); + std::string configFile = getInputDeviceConfigurationFilePathByDeviceIdentifier( + idi, INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION); if (configFile.empty()) { ALOGD("No input device configuration file found for device '%s'.", idi.name.c_str()); } else { - std::unique_ptr<input_property_map_t> propMap = std::make_unique<input_property_map_t>(); - android::base::Result<std::unique_ptr<PropertyMap>> result = - PropertyMap::load(configFile.c_str()); - if (!result.ok()) { + auto propMap = new input_property_map_t(); + status_t status = PropertyMap::load(String8(configFile.c_str()), &propMap->propertyMap); + if (status) { ALOGE("Error loading input device configuration file for device '%s'. " "Using default configuration.", idi.name.c_str()); + delete propMap; return nullptr; } - propMap->propertyMap = std::move(*result); - return propMap.release(); + return propMap; } return nullptr; } @@ -279,6 +276,7 @@ void InputDriver::inputFreeDeviceProperty(input_property_t* property) { void InputDriver::inputFreeDevicePropertyMap(input_property_map_t* map) { if (map != nullptr) { + delete map->propertyMap; delete map; } } |