Commit 46eaf758 authored by DidntRead's avatar DidntRead
Browse files

remove useless libs

parent 901914c2
Loading
Loading
Loading
Loading

hidl/touch/Android.bp

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
cc_binary {
    name: "lineage.touch@1.0-service.lenovo",
    init_rc: ["lineage.touch@1.0-service.lenovo.rc"],
    defaults: ["hidl_defaults"],
    relative_install_path: "hw",
    srcs: [
        "GloveMode.cpp",
        "KeyDisabler.cpp",
        "service.cpp"
    ],
    shared_libs: [
        "libbase",
        "libbinder",
        "libhidlbase",
        "libhidltransport",
        "libutils",
        "vendor.lineage.touch@1.0",
    ],
}

hidl/touch/GloveMode.cpp

deleted100644 → 0
+0 −61
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <android-base/logging.h>
#include <utils/Errors.h>
#include "GloveMode.h"

#include <fstream>

namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace lenovo {

static constexpr const char *kTouchGlovePath = "/sys/lenovo_tp_gestures/tpd_glove_status";

// Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow.
Return<bool> GloveMode::isEnabled() {
    int result;

    std::ifstream file(kTouchGlovePath);
    if (!file.is_open()) {
        LOG(ERROR) << "Failed to open " << kTouchGlovePath << ", error=" << errno
                   << " (" << strerror(errno) << ")";
        return false;
    }

    file >> result;
    return !file.fail() && result > 0;
}

Return<bool> GloveMode::setEnabled(bool enabled) {
    std::ofstream file(kTouchGlovePath);
    if (!file.is_open()) {
        LOG(ERROR) << "Failed to open " << kTouchGlovePath << ", error=" << errno
                   << " (" << strerror(errno) << ")";
        return false;
    }
    file << (enabled ? "1" : "0");
    return !file.fail();
}

}  // namespace lenovo
}  // namespace V1_0
}  // namespace touch
}  // namespace lineage
}  // namespace vendor

hidl/touch/GloveMode.h

deleted100644 → 0
+0 −53
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H
#define VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H

#include <vendor/lineage/touch/1.0/IGloveMode.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>

namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace lenovo {

using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;

class GloveMode : public IGloveMode {
  public:
    GloveMode() = default;

    // Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow.
    Return<bool> isEnabled() override;
    Return<bool> setEnabled(bool enabled) override;
};

}  // namespace lenovo
}  // namespace V1_0
}  // namespace touch
}  // namespace lineage
}  // namespace vendor

#endif  // VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H

hidl/touch/KeyDisabler.cpp

deleted100644 → 0
+0 −60
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <android-base/logging.h>
#include <utils/Errors.h>
#include <fstream>

#include "KeyDisabler.h"

namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace lenovo {

const static std::string kControlPath = "/sys/lenovo_tp_gestures/tpd_keypad_status";

// Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow.
Return<bool> KeyDisabler::isEnabled() {
    int result;

    std::ifstream file(kControlPath);
    if (!file.is_open()) {
        LOG(ERROR) << "Failed to open " << kControlPath << ", error=" << errno
                   << " (" << strerror(errno) << ")";
        return false;
    }
    file >> result;
    return !file.fail() && result > 0;
}

Return<bool> KeyDisabler::setEnabled(bool enabled) {
    std::ofstream file(kControlPath);
    if (!file.is_open()) {
        LOG(ERROR) << "Failed to open " << kControlPath << ", error=" << errno
                   << " (" << strerror(errno) << ")";
        return false;
    }
    file << (enabled ? "1" : "0");
    return !file.fail();
}

}  // namespace lenovo
}  // namespace V1_0
}  // namespace touch
}  // namespace lineage
}  // namespace vendor

hidl/touch/KeyDisabler.h

deleted100644 → 0
+0 −53
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H
#define VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H

#include <vendor/lineage/touch/1.0/IKeyDisabler.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>

namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace lenovo {

using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;

class KeyDisabler : public IKeyDisabler {
  public:
    KeyDisabler() = default;

    // Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow.
    Return<bool> isEnabled() override;
    Return<bool> setEnabled(bool enabled) override;
};

}  // namespace lenovo
}  // namespace V1_0
}  // namespace touch
}  // namespace lineage
}  // namespace vendor

#endif  // VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H
Loading