Loading include/input/KeyCharacterMap.h +14 −6 Original line number Diff line number Diff line Loading @@ -125,14 +125,21 @@ public: bool getEvents(int32_t deviceId, const char16_t* chars, size_t numChars, Vector<KeyEvent>& outEvents) const; /* Maps an Android key code to another Android key code. This mapping is applied after scanCode * and usageCodes are mapped to corresponding Android Keycode */ void addKeyRemapping(int32_t fromKeyCode, int32_t toKeyCode); /* Maps a scan code and usage code to a key code, in case this key map overrides * the mapping in some way. */ status_t mapKey(int32_t scanCode, int32_t usageCode, int32_t* outKeyCode) const; /* Tries to find a replacement key code for a given key code and meta state * in character map. */ void tryRemapKey(int32_t scanCode, int32_t metaState, int32_t* outKeyCode, int32_t* outMetaState) const; /* Returns keycode after applying Android key code remapping defined in mKeyRemapping */ int32_t applyKeyRemapping(int32_t fromKeyCode) const; /* Returns the <keyCode, metaState> pair after applying key behavior defined in the kcm file, * that tries to find a replacement key code based on current meta state */ std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode, int32_t metaState) const; #ifdef __linux__ /* Reads a key map from a parcel. */ Loading Loading @@ -227,8 +234,9 @@ private: std::string mLoadFileName; bool mLayoutOverlayApplied; KeyedVector<int32_t, int32_t> mKeysByScanCode; KeyedVector<int32_t, int32_t> mKeysByUsageCode; std::map<int32_t /* fromAndroidKeyCode */, int32_t /* toAndroidKeyCode */> mKeyRemapping; std::map<int32_t /* fromScanCode */, int32_t /* toAndroidKeyCode */> mKeysByScanCode; std::map<int32_t /* fromHidUsageCode */, int32_t /* toAndroidKeyCode */> mKeysByUsageCode; KeyCharacterMap(const std::string& filename); Loading libs/binder/ndk/include_ndk/android/binder_ibinder.h +2 −1 Original line number Diff line number Diff line Loading @@ -613,7 +613,8 @@ __attribute__((warn_unused_result)) AIBinder_DeathRecipient* AIBinder_DeathRecip * * 1. If the binder died, shortly after the call to onBinderDied. * 2. If the binder is explicitly unlinked with AIBinder_unlinkToDeath or * AIBinder_DeathRecipient_delete. * AIBinder_DeathRecipient_delete, after any pending onBinderDied calls * finish. * 3. During or shortly after the AIBinder_linkToDeath call if it returns an error. * * It is guaranteed that the callback is called exactly once for each call to linkToDeath unless the Loading libs/binder/ndk/include_platform/android/binder_stability.h +18 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,15 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { * requirements associated with that higher stability level. For instance, a * VINTF stability binder is required to be in the VINTF manifest. This API * can be called to use that same interface within the vendor partition. * * WARNING: you must hold on to a binder instance after this is set, while you * are using it. If you get a binder (e.g. `...->asBinder().get()`), you must * save this binder and then * use it. For instance: * * auto binder = ...->asBinder(); * AIBinder_forceDowngradeToVendorStability(binder.get()); * doSomething(binder); */ void AIBinder_forceDowngradeToVendorStability(AIBinder* binder); Loading Loading @@ -79,6 +88,15 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { * requirements associated with that higher stability level. For instance, a * VINTF stability binder is required to be in the VINTF manifest. This API * can be called to use that same interface within the system partition. * * WARNING: you must hold on to a binder instance after this is set, while you * are using it. If you get a binder (e.g. `...->asBinder().get()`), you must * save this binder and then * use it. For instance: * * auto binder = ...->asBinder(); * AIBinder_forceDowngradeToSystemStability(binder.get()); * doSomething(binder); */ void AIBinder_forceDowngradeToSystemStability(AIBinder* binder); Loading libs/gui/LayerState.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -388,6 +388,27 @@ void DisplayState::merge(const DisplayState& other) { } } void DisplayState::sanitize(int32_t permissions) { if (what & DisplayState::eLayerStackChanged) { if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { what &= ~DisplayState::eLayerStackChanged; ALOGE("Stripped attempt to set eLayerStackChanged in sanitize"); } } if (what & DisplayState::eDisplayProjectionChanged) { if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { what &= ~DisplayState::eDisplayProjectionChanged; ALOGE("Stripped attempt to set eDisplayProjectionChanged in sanitize"); } } if (what & DisplayState::eSurfaceChanged) { if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { what &= ~DisplayState::eSurfaceChanged; ALOGE("Stripped attempt to set eSurfaceChanged in sanitize"); } } } void layer_state_t::sanitize(int32_t permissions) { // TODO: b/109894387 // Loading libs/gui/SurfaceComposerClient.cpp +69 −50 Original line number Diff line number Diff line Loading @@ -2260,12 +2260,12 @@ status_t SurfaceComposerClient::getDisplayState(const sp<IBinder>& display, return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getStaticDisplayInfo(const sp<IBinder>& display, status_t SurfaceComposerClient::getStaticDisplayInfo(int64_t displayId, ui::StaticDisplayInfo* outInfo) { using Tag = android::gui::DeviceProductInfo::ManufactureOrModelDate::Tag; gui::StaticDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getStaticDisplayInfo(display, &ginfo); ComposerServiceAIDL::getComposerService()->getStaticDisplayInfo(displayId, &ginfo); if (status.isOk()) { // convert gui::StaticDisplayInfo to ui::StaticDisplayInfo outInfo->connectionType = static_cast<ui::DisplayConnectionType>(ginfo.connectionType); Loading Loading @@ -2309,12 +2309,8 @@ status_t SurfaceComposerClient::getStaticDisplayInfo(const sp<IBinder>& display, return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getDynamicDisplayInfo(const sp<IBinder>& display, ui::DynamicDisplayInfo* outInfo) { gui::DynamicDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getDynamicDisplayInfo(display, &ginfo); if (status.isOk()) { void SurfaceComposerClient::getDynamicDisplayInfoInternal(gui::DynamicDisplayInfo& ginfo, ui::DynamicDisplayInfo*& outInfo) { // convert gui::DynamicDisplayInfo to ui::DynamicDisplayInfo outInfo->supportedDisplayModes.clear(); outInfo->supportedDisplayModes.reserve(ginfo.supportedDisplayModes.size()); Loading Loading @@ -2360,13 +2356,36 @@ status_t SurfaceComposerClient::getDynamicDisplayInfo(const sp<IBinder>& display outInfo->gameContentTypeSupported = ginfo.gameContentTypeSupported; outInfo->preferredBootDisplayMode = ginfo.preferredBootDisplayMode; } status_t SurfaceComposerClient::getDynamicDisplayInfoFromId(int64_t displayId, ui::DynamicDisplayInfo* outInfo) { gui::DynamicDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getDynamicDisplayInfoFromId(displayId, &ginfo); if (status.isOk()) { getDynamicDisplayInfoInternal(ginfo, outInfo); } return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getDynamicDisplayInfoFromToken(const sp<IBinder>& display, ui::DynamicDisplayInfo* outInfo) { gui::DynamicDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getDynamicDisplayInfoFromToken(display, &ginfo); if (status.isOk()) { getDynamicDisplayInfoInternal(ginfo, outInfo); } return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getActiveDisplayMode(const sp<IBinder>& display, ui::DisplayMode* mode) { ui::DynamicDisplayInfo info; status_t result = getDynamicDisplayInfo(display, &info); status_t result = getDynamicDisplayInfoFromToken(display, &info); if (result != NO_ERROR) { return result; } Loading Loading @@ -2542,7 +2561,7 @@ status_t SurfaceComposerClient::onPullAtom(const int32_t atomId, std::string* ou gui::PullAtomData pad; binder::Status status = ComposerServiceAIDL::getComposerService()->onPullAtom(atomId, &pad); if (status.isOk()) { outData->assign((const char*)pad.data.data(), pad.data.size()); outData->assign(pad.data.begin(), pad.data.end()); *success = pad.success; } return statusTFromBinderStatus(status); Loading Loading
include/input/KeyCharacterMap.h +14 −6 Original line number Diff line number Diff line Loading @@ -125,14 +125,21 @@ public: bool getEvents(int32_t deviceId, const char16_t* chars, size_t numChars, Vector<KeyEvent>& outEvents) const; /* Maps an Android key code to another Android key code. This mapping is applied after scanCode * and usageCodes are mapped to corresponding Android Keycode */ void addKeyRemapping(int32_t fromKeyCode, int32_t toKeyCode); /* Maps a scan code and usage code to a key code, in case this key map overrides * the mapping in some way. */ status_t mapKey(int32_t scanCode, int32_t usageCode, int32_t* outKeyCode) const; /* Tries to find a replacement key code for a given key code and meta state * in character map. */ void tryRemapKey(int32_t scanCode, int32_t metaState, int32_t* outKeyCode, int32_t* outMetaState) const; /* Returns keycode after applying Android key code remapping defined in mKeyRemapping */ int32_t applyKeyRemapping(int32_t fromKeyCode) const; /* Returns the <keyCode, metaState> pair after applying key behavior defined in the kcm file, * that tries to find a replacement key code based on current meta state */ std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode, int32_t metaState) const; #ifdef __linux__ /* Reads a key map from a parcel. */ Loading Loading @@ -227,8 +234,9 @@ private: std::string mLoadFileName; bool mLayoutOverlayApplied; KeyedVector<int32_t, int32_t> mKeysByScanCode; KeyedVector<int32_t, int32_t> mKeysByUsageCode; std::map<int32_t /* fromAndroidKeyCode */, int32_t /* toAndroidKeyCode */> mKeyRemapping; std::map<int32_t /* fromScanCode */, int32_t /* toAndroidKeyCode */> mKeysByScanCode; std::map<int32_t /* fromHidUsageCode */, int32_t /* toAndroidKeyCode */> mKeysByUsageCode; KeyCharacterMap(const std::string& filename); Loading
libs/binder/ndk/include_ndk/android/binder_ibinder.h +2 −1 Original line number Diff line number Diff line Loading @@ -613,7 +613,8 @@ __attribute__((warn_unused_result)) AIBinder_DeathRecipient* AIBinder_DeathRecip * * 1. If the binder died, shortly after the call to onBinderDied. * 2. If the binder is explicitly unlinked with AIBinder_unlinkToDeath or * AIBinder_DeathRecipient_delete. * AIBinder_DeathRecipient_delete, after any pending onBinderDied calls * finish. * 3. During or shortly after the AIBinder_linkToDeath call if it returns an error. * * It is guaranteed that the callback is called exactly once for each call to linkToDeath unless the Loading
libs/binder/ndk/include_platform/android/binder_stability.h +18 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,15 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { * requirements associated with that higher stability level. For instance, a * VINTF stability binder is required to be in the VINTF manifest. This API * can be called to use that same interface within the vendor partition. * * WARNING: you must hold on to a binder instance after this is set, while you * are using it. If you get a binder (e.g. `...->asBinder().get()`), you must * save this binder and then * use it. For instance: * * auto binder = ...->asBinder(); * AIBinder_forceDowngradeToVendorStability(binder.get()); * doSomething(binder); */ void AIBinder_forceDowngradeToVendorStability(AIBinder* binder); Loading Loading @@ -79,6 +88,15 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { * requirements associated with that higher stability level. For instance, a * VINTF stability binder is required to be in the VINTF manifest. This API * can be called to use that same interface within the system partition. * * WARNING: you must hold on to a binder instance after this is set, while you * are using it. If you get a binder (e.g. `...->asBinder().get()`), you must * save this binder and then * use it. For instance: * * auto binder = ...->asBinder(); * AIBinder_forceDowngradeToSystemStability(binder.get()); * doSomething(binder); */ void AIBinder_forceDowngradeToSystemStability(AIBinder* binder); Loading
libs/gui/LayerState.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -388,6 +388,27 @@ void DisplayState::merge(const DisplayState& other) { } } void DisplayState::sanitize(int32_t permissions) { if (what & DisplayState::eLayerStackChanged) { if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { what &= ~DisplayState::eLayerStackChanged; ALOGE("Stripped attempt to set eLayerStackChanged in sanitize"); } } if (what & DisplayState::eDisplayProjectionChanged) { if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { what &= ~DisplayState::eDisplayProjectionChanged; ALOGE("Stripped attempt to set eDisplayProjectionChanged in sanitize"); } } if (what & DisplayState::eSurfaceChanged) { if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { what &= ~DisplayState::eSurfaceChanged; ALOGE("Stripped attempt to set eSurfaceChanged in sanitize"); } } } void layer_state_t::sanitize(int32_t permissions) { // TODO: b/109894387 // Loading
libs/gui/SurfaceComposerClient.cpp +69 −50 Original line number Diff line number Diff line Loading @@ -2260,12 +2260,12 @@ status_t SurfaceComposerClient::getDisplayState(const sp<IBinder>& display, return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getStaticDisplayInfo(const sp<IBinder>& display, status_t SurfaceComposerClient::getStaticDisplayInfo(int64_t displayId, ui::StaticDisplayInfo* outInfo) { using Tag = android::gui::DeviceProductInfo::ManufactureOrModelDate::Tag; gui::StaticDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getStaticDisplayInfo(display, &ginfo); ComposerServiceAIDL::getComposerService()->getStaticDisplayInfo(displayId, &ginfo); if (status.isOk()) { // convert gui::StaticDisplayInfo to ui::StaticDisplayInfo outInfo->connectionType = static_cast<ui::DisplayConnectionType>(ginfo.connectionType); Loading Loading @@ -2309,12 +2309,8 @@ status_t SurfaceComposerClient::getStaticDisplayInfo(const sp<IBinder>& display, return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getDynamicDisplayInfo(const sp<IBinder>& display, ui::DynamicDisplayInfo* outInfo) { gui::DynamicDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getDynamicDisplayInfo(display, &ginfo); if (status.isOk()) { void SurfaceComposerClient::getDynamicDisplayInfoInternal(gui::DynamicDisplayInfo& ginfo, ui::DynamicDisplayInfo*& outInfo) { // convert gui::DynamicDisplayInfo to ui::DynamicDisplayInfo outInfo->supportedDisplayModes.clear(); outInfo->supportedDisplayModes.reserve(ginfo.supportedDisplayModes.size()); Loading Loading @@ -2360,13 +2356,36 @@ status_t SurfaceComposerClient::getDynamicDisplayInfo(const sp<IBinder>& display outInfo->gameContentTypeSupported = ginfo.gameContentTypeSupported; outInfo->preferredBootDisplayMode = ginfo.preferredBootDisplayMode; } status_t SurfaceComposerClient::getDynamicDisplayInfoFromId(int64_t displayId, ui::DynamicDisplayInfo* outInfo) { gui::DynamicDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getDynamicDisplayInfoFromId(displayId, &ginfo); if (status.isOk()) { getDynamicDisplayInfoInternal(ginfo, outInfo); } return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getDynamicDisplayInfoFromToken(const sp<IBinder>& display, ui::DynamicDisplayInfo* outInfo) { gui::DynamicDisplayInfo ginfo; binder::Status status = ComposerServiceAIDL::getComposerService()->getDynamicDisplayInfoFromToken(display, &ginfo); if (status.isOk()) { getDynamicDisplayInfoInternal(ginfo, outInfo); } return statusTFromBinderStatus(status); } status_t SurfaceComposerClient::getActiveDisplayMode(const sp<IBinder>& display, ui::DisplayMode* mode) { ui::DynamicDisplayInfo info; status_t result = getDynamicDisplayInfo(display, &info); status_t result = getDynamicDisplayInfoFromToken(display, &info); if (result != NO_ERROR) { return result; } Loading Loading @@ -2542,7 +2561,7 @@ status_t SurfaceComposerClient::onPullAtom(const int32_t atomId, std::string* ou gui::PullAtomData pad; binder::Status status = ComposerServiceAIDL::getComposerService()->onPullAtom(atomId, &pad); if (status.isOk()) { outData->assign((const char*)pad.data.data(), pad.data.size()); outData->assign(pad.data.begin(), pad.data.end()); *success = pad.success; } return statusTFromBinderStatus(status); Loading