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

Commit e4f32071 authored by Peng Xu's avatar Peng Xu Committed by Android (Google) Code Review
Browse files

Merge "Support custom permission, slight adjust of dumpsys print"

parents 7c929590 48328dd8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ Sensor::Sensor(const char * name) :
        mName(name), mHandle(0), mType(0),
        mMinValue(0), mMaxValue(0), mResolution(0),
        mPower(0), mMinDelay(0), mVersion(0), mFifoReservedEventCount(0),
        mFifoMaxEventCount(0), mRequiredAppOp(0),
        mFifoMaxEventCount(0), mRequiredAppOp(-1),
        mMaxDelay(0), mFlags(0) {
}

@@ -412,6 +412,10 @@ bool Sensor::isDynamicSensor() const {
    return (mFlags & SENSOR_FLAG_DYNAMIC_SENSOR) != 0;
}

bool Sensor::isDataInjectionSupported() const {
    return (mFlags & SENSOR_FLAG_DATA_INJECTION) != 0;
}

bool Sensor::hasAdditionalInfo() const {
    return (mFlags & SENSOR_FLAG_ADDITIONAL_INFO) != 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ public:
    uint32_t getFlags() const;
    bool isWakeUpSensor() const;
    bool isDynamicSensor() const;
    bool isDataInjectionSupported() const;
    bool hasAdditionalInfo() const;
    int32_t getHighestDirectReportRateLevel() const;
    bool isDirectChannelTypeSupported(int32_t sharedMemType) const;
+8 −3
Original line number Diff line number Diff line
@@ -124,14 +124,15 @@ std::string SensorList::dump() const {
    forEachSensor([&result] (const Sensor& s) -> bool {
            result.appendFormat(
                    "%#010x) %-25s | %-15s | ver: %" PRId32 " | type: %20s(%" PRId32
                        ") | perm: %s\n",
                        ") | perm: %s | flags: 0x%08x\n",
                    s.getHandle(),
                    s.getName().string(),
                    s.getVendor().string(),
                    s.getVersion(),
                    s.getStringType().string(),
                    s.getType(),
                    s.getRequiredPermission().size() ? s.getRequiredPermission().string() : "n/a");
                    s.getRequiredPermission().size() ? s.getRequiredPermission().string() : "n/a",
                    static_cast<int>(s.getFlags()));

            result.append("\t");
            const int reportingMode = s.getReportingMode();
@@ -173,9 +174,14 @@ std::string SensorList::dump() const {
                result.appendFormat("non-wakeUp | ");
            }

            if (s.isDataInjectionSupported()) {
                result.appendFormat("data-injection, ");
            }

            if (s.isDynamicSensor()) {
                result.appendFormat("dynamic, ");
            }

            if (s.hasAdditionalInfo()) {
                result.appendFormat("has-additional-info, ");
            }
@@ -190,7 +196,6 @@ std::string SensorList::dump() const {
                if (s.isDirectChannelTypeSupported(SENSOR_DIRECT_MEM_TYPE_GRALLOC)) {
                    result.append("gralloc, ");
                }
                result.appendFormat("flag =0x%08x", static_cast<int>(s.getFlags()));
                result.append("\n");
            }
            return true;