Move KeyCharacterMap from RefBase to shared_ptr.

Move KeyCharacterMap from RefBase and make it shared_ptr in it's owner
class like EventHub and InputDeviceInfo. When loaded from file, KeyCharacterMap
as shared_ptr is stored in both InputDeviceInfo and EventHub device.

Bug: 160010896
Test: atest inputflinger, atest libinput_tests
Change-Id: Ib3c489c3e87e04d68e4681994e430e43aa46164b
This commit is contained in:
Chris Ye
2020-08-18 12:15:28 -07:00
parent dc275f8c2a
commit e8da2d3a48
4 changed files with 40 additions and 40 deletions

View File

@@ -105,11 +105,10 @@ static bool validateFile(const char* filename) {
}
case FILETYPE_KEYCHARACTERMAP: {
sp<KeyCharacterMap> map;
status_t status = KeyCharacterMap::load(filename,
KeyCharacterMap::FORMAT_ANY, &map);
if (status) {
error("Error %d parsing key character map file.\n\n", status);
base::Result<std::shared_ptr<KeyCharacterMap>> ret = KeyCharacterMap::load(filename,
KeyCharacterMap::FORMAT_ANY);
if (!ret) {
error("Error %s parsing key character map file.\n\n", ret.error().message().c_str());
return false;
}
break;