Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64bbf52c authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9803320 from 49075cc3 to udc-release

Change-Id: Ib1b78062108d88a9c0287e6c15e5507844ff57d5
parents 5be46f64 49075cc3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -816,6 +816,8 @@ void Dumpstate::PrintHeader() const {
    printf("Kernel: ");
    DumpFileToFd(STDOUT_FILENO, "", "/proc/version");
    printf("Command line: %s\n", strtok(cmdline_buf, "\n"));
    printf("Bootconfig: ");
    DumpFileToFd(STDOUT_FILENO, "", "/proc/bootconfig");
    printf("Uptime: ");
    RunCommandToFd(STDOUT_FILENO, "", {"uptime", "-p"},
                   CommandOptions::WithTimeout(1).Always().Build());
+6 −2
Original line number Diff line number Diff line
@@ -36,8 +36,12 @@ enum class BinderCallType {
// Based on where we are in recursion of nested binder/hwbinder calls, determine
// which one we are closer to.
inline static BinderCallType getCurrentServingCall() {
    const void* hwbinderSp = android::hardware::IPCThreadState::self()->getServingStackPointer();
    const void* binderSp = android::IPCThreadState::self()->getServingStackPointer();
    auto* hwState = android::hardware::IPCThreadState::selfOrNull();
    auto* state = android::IPCThreadState::selfOrNull();

    // getServingStackPointer can also return nullptr
    const void* hwbinderSp = hwState ? hwState->getServingStackPointer() : nullptr;
    const void* binderSp = state ? state->getServingStackPointer() : nullptr;

    if (hwbinderSp == nullptr && binderSp == nullptr) return BinderCallType::NONE;
    if (hwbinderSp == nullptr) return BinderCallType::BINDER;
+19 −0
Original line number Diff line number Diff line
@@ -16,11 +16,16 @@

#include <BnAidlStuff.h>
#include <android-base/logging.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binderthreadstate/CallerUtils.h>
#include <binderthreadstateutilstest/1.0/IHidlStuff.h>
#include <gtest/gtest.h>
#include <hidl/HidlTransportSupport.h>
#include <hwbinder/IPCThreadState.h>

#include <thread>

#include <linux/prctl.h>
#include <sys/prctl.h>

@@ -154,6 +159,20 @@ TEST(BinderThreadState, LocalAidlCall) {
    EXPECT_TRUE(server->callLocal().isOk());
}

TEST(BinderThreadState, DoesntInitializeBinderDriver) {
    // this is on another thread, because it's testing thread-specific
    // state and we expect it not to be initialized.
    std::thread([&] {
        EXPECT_EQ(nullptr, android::IPCThreadState::selfOrNull());
        EXPECT_EQ(nullptr, android::hardware::IPCThreadState::selfOrNull());

        (void)getCurrentServingCall();

        EXPECT_EQ(nullptr, android::IPCThreadState::selfOrNull());
        EXPECT_EQ(nullptr, android::hardware::IPCThreadState::selfOrNull());
    }).join();
}

TEST(BindThreadState, RemoteHidlCall) {
    auto stuff = IHidlStuff::getService(id2name(kP1Id));
    ASSERT_NE(nullptr, stuff);
+6 −14
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@
 * limitations under the License.
 */

// clang-format off
#include "../Macros.h"
// clang-format on
#include "gestures/HardwareStateConverter.h"

#include <chrono>
@@ -80,14 +83,9 @@ SelfContainedHardwareState HardwareStateConverter::produceHardwareState(nsecs_t
    schs.fingers.clear();
    for (size_t i = 0; i < mMotionAccumulator.getSlotCount(); i++) {
        MultiTouchMotionAccumulator::Slot slot = mMotionAccumulator.getSlot(i);
        if (!slot.isInUse()) {
            continue;
        }
        // Some touchpads continue to report contacts even after they've identified them as palms.
        // We want to exclude these contacts from the HardwareStates, but still need to report a
        // tracking ID of -1 if a finger turns into a palm.
        const bool isPalm = slot.getToolType() == AMOTION_EVENT_TOOL_TYPE_PALM;
        if (isPalm && mFingerSlots.find(i) == mFingerSlots.end()) {
        // We want to exclude these contacts from the HardwareStates.
        if (!slot.isInUse() || slot.getToolType() == AMOTION_EVENT_TOOL_TYPE_PALM) {
            continue;
        }

@@ -101,12 +99,7 @@ SelfContainedHardwareState HardwareStateConverter::produceHardwareState(nsecs_t
        fingerState.orientation = slot.getOrientation();
        fingerState.position_x = slot.getX();
        fingerState.position_y = slot.getY();
        fingerState.tracking_id = isPalm ? -1 : slot.getTrackingId();
        if (fingerState.tracking_id == -1) {
            mFingerSlots.erase(i);
        } else {
            mFingerSlots.insert(i);
        }
        fingerState.tracking_id = slot.getTrackingId();
    }
    schs.state.fingers = schs.fingers.data();
    schs.state.finger_cnt = schs.fingers.size();
@@ -117,7 +110,6 @@ SelfContainedHardwareState HardwareStateConverter::produceHardwareState(nsecs_t
void HardwareStateConverter::reset() {
    mCursorButtonAccumulator.reset(mDeviceContext);
    mTouchButtonAccumulator.reset();
    mFingerSlots.clear();
    mMscTimestamp = 0;
}

+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ private:
    MultiTouchMotionAccumulator mMotionAccumulator;
    TouchButtonAccumulator mTouchButtonAccumulator;
    int32_t mMscTimestamp = 0;
    std::set<size_t> mFingerSlots;
};

} // namespace android
Loading