Loading PREUPLOAD.cfg +12 −0 Original line number Diff line number Diff line [Builtin Hooks] clang_format = true [Builtin Hooks Options] # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp libs/gui/ libs/ui/ libs/vr/ services/surfaceflinger/ services/vr/ [Hook Scripts] owners_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "OWNERS$" installd_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "^cmds/installd/" Loading include/input/DisplayViewport.h +44 −11 Original line number Diff line number Diff line Loading @@ -17,11 +17,37 @@ #ifndef _LIBINPUT_DISPLAY_VIEWPORT_H #define _LIBINPUT_DISPLAY_VIEWPORT_H #include <android-base/stringprintf.h> #include <ui/DisplayInfo.h> #include <input/Input.h> using android::base::StringPrintf; namespace android { /** * Describes the different type of viewports supported by input flinger. * Keep in sync with values in InputManagerService.java. */ enum class ViewportType : int32_t { VIEWPORT_INTERNAL = 1, VIEWPORT_EXTERNAL = 2, VIEWPORT_VIRTUAL = 3, }; static const char* viewportTypeToString(ViewportType type) { switch(type) { case ViewportType::VIEWPORT_INTERNAL: return "INTERNAL"; case ViewportType::VIEWPORT_EXTERNAL: return "EXTERNAL"; case ViewportType::VIEWPORT_VIRTUAL: return "VIRTUAL"; default: return "UNKNOWN"; } } /* * Describes how coordinates are mapped on a physical display. * See com.android.server.display.DisplayViewport. Loading @@ -40,12 +66,13 @@ struct DisplayViewport { int32_t deviceWidth; int32_t deviceHeight; std::string uniqueId; ViewportType type; DisplayViewport() : displayId(ADISPLAY_ID_NONE), orientation(DISPLAY_ORIENTATION_0), logicalLeft(0), logicalTop(0), logicalRight(0), logicalBottom(0), physicalLeft(0), physicalTop(0), physicalRight(0), physicalBottom(0), deviceWidth(0), deviceHeight(0), uniqueId() { deviceWidth(0), deviceHeight(0), uniqueId(), type(ViewportType::VIEWPORT_INTERNAL) { } bool operator==(const DisplayViewport& other) const { Loading @@ -61,7 +88,8 @@ struct DisplayViewport { && physicalBottom == other.physicalBottom && deviceWidth == other.deviceWidth && deviceHeight == other.deviceHeight && uniqueId == other.uniqueId; && uniqueId == other.uniqueId && type == other.type; } bool operator!=(const DisplayViewport& other) const { Loading @@ -86,17 +114,22 @@ struct DisplayViewport { deviceWidth = width; deviceHeight = height; uniqueId.clear(); type = ViewportType::VIEWPORT_INTERNAL; } }; /** * Describes the different type of viewports supported by input flinger. * Keep in sync with values in InputManagerService.java. */ enum class ViewportType : int32_t { VIEWPORT_INTERNAL = 1, VIEWPORT_EXTERNAL = 2, VIEWPORT_VIRTUAL = 3, std::string toString() const { return StringPrintf("Viewport %s: displayId=%d, orientation=%d, " "logicalFrame=[%d, %d, %d, %d], " "physicalFrame=[%d, %d, %d, %d], " "deviceSize=[%d, %d]", viewportTypeToString(type), displayId, orientation, logicalLeft, logicalTop, logicalRight, logicalBottom, physicalLeft, physicalTop, physicalRight, physicalBottom, deviceWidth, deviceHeight); } }; } // namespace android Loading libs/binder/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ cc_library_shared { "liblog", "libcutils", "libutils", "libbinderthreadstate", ], header_libs: [ Loading libs/binder/IPCThreadState.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define LOG_TAG "IPCThreadState" #include <binder/IPCThreadState.h> #include <binderthreadstate/IPCThreadStateBase.h> #include <binder/Binder.h> #include <binder/BpBinder.h> Loading Loading @@ -742,6 +743,7 @@ IPCThreadState::IPCThreadState() clearCaller(); mIn.setDataCapacity(256); mOut.setDataCapacity(256); mIPCThreadStateBase = IPCThreadStateBase::self(); } IPCThreadState::~IPCThreadState() Loading Loading @@ -1082,6 +1084,9 @@ status_t IPCThreadState::executeCommand(int32_t cmd) "Not enough command data for brTRANSACTION"); if (result != NO_ERROR) break; //Record the fact that we're in a binder call. mIPCThreadStateBase->pushCurrentState( IPCThreadStateBase::CallState::BINDER); Parcel buffer; buffer.ipcSetDataReference( reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer), Loading Loading @@ -1129,6 +1134,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd) error = the_context_object->transact(tr.code, buffer, &reply, tr.flags); } mIPCThreadStateBase->popCurrentState(); //ALOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n", // mCallingPid, origPid, origUid); Loading Loading @@ -1192,6 +1198,10 @@ status_t IPCThreadState::executeCommand(int32_t cmd) return result; } bool IPCThreadState::isServingCall() const { return mIPCThreadStateBase->getCurrentBinderCallState() == IPCThreadStateBase::CallState::BINDER; } void IPCThreadState::threadDestructor(void *st) { IPCThreadState* const self = static_cast<IPCThreadState*>(st); Loading libs/binder/include/binder/IPCThreadState.h +30 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ typedef int uid_t; // --------------------------------------------------------------------------- namespace android { class IPCThreadStateBase; class IPCThreadState { public: Loading Loading @@ -89,6 +91,33 @@ public: // the maximum number of binder threads threads allowed for this process. void blockUntilThreadAvailable(); // Is this thread currently serving a binder call. This method // returns true if while traversing backwards from the function call // stack for this thread, we encounter a function serving a binder // call before encountering a hwbinder call / hitting the end of the // call stack. // Eg: If thread T1 went through the following call pattern // 1) T1 receives and executes hwbinder call H1. // 2) While handling H1, T1 makes binder call B1. // 3) The handler of B1, calls into T1 with a callback B2. // If isServingCall() is called during H1 before 3), this method // will return false, else true. // // ---- // | B2 | ---> While callback B2 is being handled, during 3). // ---- // | H1 | ---> While H1 is being handled. // ---- // Fig: Thread Call stack while handling B2 // // This is since after 3), while traversing the thread call stack, // we hit a binder call before a hwbinder call / end of stack. This // method may be typically used to determine whether to use // hardware::IPCThreadState methods or IPCThreadState methods to // infer information about thread state. bool isServingCall() const; private: IPCThreadState(); ~IPCThreadState(); Loading Loading @@ -128,6 +157,7 @@ private: uid_t mCallingUid; int32_t mStrictModePolicy; int32_t mLastTransactionBinderFlags; IPCThreadStateBase *mIPCThreadStateBase; }; }; // namespace android Loading Loading
PREUPLOAD.cfg +12 −0 Original line number Diff line number Diff line [Builtin Hooks] clang_format = true [Builtin Hooks Options] # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp libs/gui/ libs/ui/ libs/vr/ services/surfaceflinger/ services/vr/ [Hook Scripts] owners_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "OWNERS$" installd_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "^cmds/installd/" Loading
include/input/DisplayViewport.h +44 −11 Original line number Diff line number Diff line Loading @@ -17,11 +17,37 @@ #ifndef _LIBINPUT_DISPLAY_VIEWPORT_H #define _LIBINPUT_DISPLAY_VIEWPORT_H #include <android-base/stringprintf.h> #include <ui/DisplayInfo.h> #include <input/Input.h> using android::base::StringPrintf; namespace android { /** * Describes the different type of viewports supported by input flinger. * Keep in sync with values in InputManagerService.java. */ enum class ViewportType : int32_t { VIEWPORT_INTERNAL = 1, VIEWPORT_EXTERNAL = 2, VIEWPORT_VIRTUAL = 3, }; static const char* viewportTypeToString(ViewportType type) { switch(type) { case ViewportType::VIEWPORT_INTERNAL: return "INTERNAL"; case ViewportType::VIEWPORT_EXTERNAL: return "EXTERNAL"; case ViewportType::VIEWPORT_VIRTUAL: return "VIRTUAL"; default: return "UNKNOWN"; } } /* * Describes how coordinates are mapped on a physical display. * See com.android.server.display.DisplayViewport. Loading @@ -40,12 +66,13 @@ struct DisplayViewport { int32_t deviceWidth; int32_t deviceHeight; std::string uniqueId; ViewportType type; DisplayViewport() : displayId(ADISPLAY_ID_NONE), orientation(DISPLAY_ORIENTATION_0), logicalLeft(0), logicalTop(0), logicalRight(0), logicalBottom(0), physicalLeft(0), physicalTop(0), physicalRight(0), physicalBottom(0), deviceWidth(0), deviceHeight(0), uniqueId() { deviceWidth(0), deviceHeight(0), uniqueId(), type(ViewportType::VIEWPORT_INTERNAL) { } bool operator==(const DisplayViewport& other) const { Loading @@ -61,7 +88,8 @@ struct DisplayViewport { && physicalBottom == other.physicalBottom && deviceWidth == other.deviceWidth && deviceHeight == other.deviceHeight && uniqueId == other.uniqueId; && uniqueId == other.uniqueId && type == other.type; } bool operator!=(const DisplayViewport& other) const { Loading @@ -86,17 +114,22 @@ struct DisplayViewport { deviceWidth = width; deviceHeight = height; uniqueId.clear(); type = ViewportType::VIEWPORT_INTERNAL; } }; /** * Describes the different type of viewports supported by input flinger. * Keep in sync with values in InputManagerService.java. */ enum class ViewportType : int32_t { VIEWPORT_INTERNAL = 1, VIEWPORT_EXTERNAL = 2, VIEWPORT_VIRTUAL = 3, std::string toString() const { return StringPrintf("Viewport %s: displayId=%d, orientation=%d, " "logicalFrame=[%d, %d, %d, %d], " "physicalFrame=[%d, %d, %d, %d], " "deviceSize=[%d, %d]", viewportTypeToString(type), displayId, orientation, logicalLeft, logicalTop, logicalRight, logicalBottom, physicalLeft, physicalTop, physicalRight, physicalBottom, deviceWidth, deviceHeight); } }; } // namespace android Loading
libs/binder/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ cc_library_shared { "liblog", "libcutils", "libutils", "libbinderthreadstate", ], header_libs: [ Loading
libs/binder/IPCThreadState.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define LOG_TAG "IPCThreadState" #include <binder/IPCThreadState.h> #include <binderthreadstate/IPCThreadStateBase.h> #include <binder/Binder.h> #include <binder/BpBinder.h> Loading Loading @@ -742,6 +743,7 @@ IPCThreadState::IPCThreadState() clearCaller(); mIn.setDataCapacity(256); mOut.setDataCapacity(256); mIPCThreadStateBase = IPCThreadStateBase::self(); } IPCThreadState::~IPCThreadState() Loading Loading @@ -1082,6 +1084,9 @@ status_t IPCThreadState::executeCommand(int32_t cmd) "Not enough command data for brTRANSACTION"); if (result != NO_ERROR) break; //Record the fact that we're in a binder call. mIPCThreadStateBase->pushCurrentState( IPCThreadStateBase::CallState::BINDER); Parcel buffer; buffer.ipcSetDataReference( reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer), Loading Loading @@ -1129,6 +1134,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd) error = the_context_object->transact(tr.code, buffer, &reply, tr.flags); } mIPCThreadStateBase->popCurrentState(); //ALOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n", // mCallingPid, origPid, origUid); Loading Loading @@ -1192,6 +1198,10 @@ status_t IPCThreadState::executeCommand(int32_t cmd) return result; } bool IPCThreadState::isServingCall() const { return mIPCThreadStateBase->getCurrentBinderCallState() == IPCThreadStateBase::CallState::BINDER; } void IPCThreadState::threadDestructor(void *st) { IPCThreadState* const self = static_cast<IPCThreadState*>(st); Loading
libs/binder/include/binder/IPCThreadState.h +30 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ typedef int uid_t; // --------------------------------------------------------------------------- namespace android { class IPCThreadStateBase; class IPCThreadState { public: Loading Loading @@ -89,6 +91,33 @@ public: // the maximum number of binder threads threads allowed for this process. void blockUntilThreadAvailable(); // Is this thread currently serving a binder call. This method // returns true if while traversing backwards from the function call // stack for this thread, we encounter a function serving a binder // call before encountering a hwbinder call / hitting the end of the // call stack. // Eg: If thread T1 went through the following call pattern // 1) T1 receives and executes hwbinder call H1. // 2) While handling H1, T1 makes binder call B1. // 3) The handler of B1, calls into T1 with a callback B2. // If isServingCall() is called during H1 before 3), this method // will return false, else true. // // ---- // | B2 | ---> While callback B2 is being handled, during 3). // ---- // | H1 | ---> While H1 is being handled. // ---- // Fig: Thread Call stack while handling B2 // // This is since after 3), while traversing the thread call stack, // we hit a binder call before a hwbinder call / end of stack. This // method may be typically used to determine whether to use // hardware::IPCThreadState methods or IPCThreadState methods to // infer information about thread state. bool isServingCall() const; private: IPCThreadState(); ~IPCThreadState(); Loading Loading @@ -128,6 +157,7 @@ private: uid_t mCallingUid; int32_t mStrictModePolicy; int32_t mLastTransactionBinderFlags; IPCThreadStateBase *mIPCThreadStateBase; }; }; // namespace android Loading