From daf29a6dbfafc6c06654a3878c0ad2a7f8ebc063 Mon Sep 17 00:00:00 2001 From: Michael Wachenschwanz Date: Tue, 15 Oct 2019 11:49:22 -0700 Subject: Resize object capacity when shrinking Parcel Bug: 140419401 Test: atest android.os.cts.ParcelTest Change-Id: I04edee415e1984ba5fb97c5c1b09892a360cf221 (cherry picked from commit c67d9f33b36cbb95b121d058f51d6653f1ec4334) (cherry picked from commit d9d10dbdf2f20af3dd01376d2130c71c052e42f3) --- libs/binder/Parcel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index afa3d33349..5ad30271d7 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -2839,11 +2839,13 @@ status_t Parcel::continueWrite(size_t desired) if (objectsSize == 0) { free(mObjects); mObjects = nullptr; + mObjectsCapacity = 0; } else { binder_size_t* objects = (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); if (objects) { mObjects = objects; + mObjectsCapacity = objectsSize; } } mObjectsSize = objectsSize; -- cgit v1.2.3 From 7fb8682cbf494e3f1d5c79ebfbd9b020e1191679 Mon Sep 17 00:00:00 2001 From: Ashwini Oruganti Date: Wed, 4 Dec 2019 17:05:19 -0800 Subject: Don't leak input events to dumpsys on user builds Remove the details of KeyEvent and MotionEvent logs. Bug: 139945049 Test: Tested on a device, the input functions work as expected and input event logs are not leaked to dumpsys on user builds. Change-Id: I98c9c375f18963177bf0c1d8829a217b4ad4acc6 Merged-In: I98c9c375f18963177bf0c1d8829a217b4ad4acc6 (cherry picked from commit a70a3ff7f2d34c68e2af738c1a1bcb66fe25e4a7) --- services/inputflinger/InputDispatcher.cpp | 52 ++----------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp index c2ff4c9629..b921d954dc 100644 --- a/services/inputflinger/InputDispatcher.cpp +++ b/services/inputflinger/InputDispatcher.cpp @@ -109,36 +109,6 @@ static inline const char* toString(bool value) { return value ? "true" : "false"; } -static std::string motionActionToString(int32_t action) { - // Convert MotionEvent action to string - switch(action & AMOTION_EVENT_ACTION_MASK) { - case AMOTION_EVENT_ACTION_DOWN: - return "DOWN"; - case AMOTION_EVENT_ACTION_MOVE: - return "MOVE"; - case AMOTION_EVENT_ACTION_UP: - return "UP"; - case AMOTION_EVENT_ACTION_POINTER_DOWN: - return "POINTER_DOWN"; - case AMOTION_EVENT_ACTION_POINTER_UP: - return "POINTER_UP"; - } - return StringPrintf("%" PRId32, action); -} - -static std::string keyActionToString(int32_t action) { - // Convert KeyEvent action to string - switch (action) { - case AKEY_EVENT_ACTION_DOWN: - return "DOWN"; - case AKEY_EVENT_ACTION_UP: - return "UP"; - case AKEY_EVENT_ACTION_MULTIPLE: - return "MULTIPLE"; - } - return StringPrintf("%" PRId32, action); -} - static std::string dispatchModeToString(int32_t dispatchMode) { switch (dispatchMode) { case InputTarget::FLAG_DISPATCH_AS_IS: @@ -4614,11 +4584,7 @@ InputDispatcher::KeyEntry::~KeyEntry() { } void InputDispatcher::KeyEntry::appendDescription(std::string& msg) const { - msg += StringPrintf("KeyEvent(deviceId=%d, source=0x%08x, displayId=%" PRId32 ", action=%s, " - "flags=0x%08x, keyCode=%d, scanCode=%d, metaState=0x%08x, " - "repeatCount=%d), policyFlags=0x%08x", - deviceId, source, displayId, keyActionToString(action).c_str(), flags, keyCode, - scanCode, metaState, repeatCount, policyFlags); + msg += StringPrintf("KeyEvent"); } void InputDispatcher::KeyEntry::recycle() { @@ -4661,21 +4627,7 @@ InputDispatcher::MotionEntry::~MotionEntry() { } void InputDispatcher::MotionEntry::appendDescription(std::string& msg) const { - msg += StringPrintf("MotionEvent(deviceId=%d, source=0x%08x, displayId=%" PRId32 - ", action=%s, actionButton=0x%08x, flags=0x%08x, metaState=0x%08x, buttonState=0x%08x, " - "classification=%s, edgeFlags=0x%08x, xPrecision=%.1f, yPrecision=%.1f, pointers=[", - deviceId, source, displayId, motionActionToString(action).c_str(), actionButton, flags, - metaState, buttonState, motionClassificationToString(classification), edgeFlags, - xPrecision, yPrecision); - - for (uint32_t i = 0; i < pointerCount; i++) { - if (i) { - msg += ", "; - } - msg += StringPrintf("%d: (%.1f, %.1f)", pointerProperties[i].id, - pointerCoords[i].getX(), pointerCoords[i].getY()); - } - msg += StringPrintf("]), policyFlags=0x%08x", policyFlags); + msg += StringPrintf("MotionEvent"); } -- cgit v1.2.3