From 1abffbd101f77f100789dc7fb8b33f729bb64dc9 Mon Sep 17 00:00:00 2001 From: Chris Ye Date: Tue, 18 Aug 2020 12:50:12 -0700 Subject: Move KeyLayoutMap from RefBase to shared_ptr. Move KeyLayoutMap from inheriting RefBase and use shared_ptr to store in owner class like KeyMap. Bug: 160010896 Test: atest inputflinger, atest libinput_tests Change-Id: I565e07bdc501af644df5ebb8388fce10af185bce --- include/input/KeyLayoutMap.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include/input/KeyLayoutMap.h') diff --git a/include/input/KeyLayoutMap.h b/include/input/KeyLayoutMap.h index 26f35012e2..872dd45c73 100644 --- a/include/input/KeyLayoutMap.h +++ b/include/input/KeyLayoutMap.h @@ -17,11 +17,12 @@ #ifndef _LIBINPUT_KEY_LAYOUT_MAP_H #define _LIBINPUT_KEY_LAYOUT_MAP_H +#include #include #include #include -#include #include +#include namespace android { @@ -60,9 +61,12 @@ struct AxisInfo { * * This object is immutable after it has been loaded. */ -class KeyLayoutMap : public RefBase { +class KeyLayoutMap { public: - static status_t load(const std::string& filename, sp* outMap); + static base::Result> load(const std::string& filename); + static base::Result> load(Tokenizer* tokenizer); + static base::Result> loadContents(const std::string& filename, + const char* contents); status_t mapKey(int32_t scanCode, int32_t usageCode, int32_t* outKeyCode, uint32_t* outFlags) const; @@ -71,8 +75,8 @@ public: status_t findUsageCodeForLed(int32_t ledCode, int32_t* outUsageCode) const; status_t mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const; + const std::string getLoadFileName() const; -protected: virtual ~KeyLayoutMap(); private: @@ -91,6 +95,7 @@ private: KeyedVector mAxes; KeyedVector mLedsByScanCode; KeyedVector mLedsByUsageCode; + std::string mLoadFileName; KeyLayoutMap(); -- cgit v1.2.3-59-g8ed1b