Loading data/etc/android.hardware.device_unique_attestation.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2020 The Android Open Source 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. --> <!-- Feature for devices with Keymaster that support unique attestation. --> <permissions> <feature name="android.hardware.device_unique_attestation" /> </permissions> services/inputflinger/BlockingQueue.h +1 −4 Original line number Diff line number Diff line Loading @@ -45,10 +45,7 @@ public: T pop() { std::unique_lock lock(mLock); android::base::ScopedLockAssertion assumeLock(mLock); mHasElements.wait(lock, [this]{ android::base::ScopedLockAssertion assumeLock(mLock); return !this->mQueue.empty(); }); mHasElements.wait(lock, [this]() REQUIRES(mLock) { return !this->mQueue.empty(); }); T t = std::move(mQueue.front()); mQueue.erase(mQueue.begin()); return t; Loading services/inputflinger/InputClassifier.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ void MotionClassifier::callInputClassifierHal() { case ClassifierEventType::DEVICE_RESET: { const int32_t deviceId = *(event.getDeviceId()); halResponseOk = mService->resetDevice(deviceId).isOk(); setClassification(deviceId, MotionClassification::NONE); clearDeviceState(deviceId); break; } case ClassifierEventType::HAL_RESET: { Loading Loading @@ -321,6 +321,12 @@ void MotionClassifier::updateLastDownTime(int32_t deviceId, nsecs_t downTime) { mClassifications[deviceId] = MotionClassification::NONE; } void MotionClassifier::clearDeviceState(int32_t deviceId) { std::scoped_lock lock(mLock); mClassifications.erase(deviceId); mLastDownTimes.erase(deviceId); } MotionClassification MotionClassifier::classify(const NotifyMotionArgs& args) { if ((args.action & AMOTION_EVENT_ACTION_MASK) == AMOTION_EVENT_ACTION_DOWN) { updateLastDownTime(args.deviceId, args.downTime); Loading Loading @@ -455,6 +461,7 @@ void InputClassifier::serviceDied(uint64_t /*cookie*/, void InputClassifier::dump(std::string& dump) { std::scoped_lock lock(mLock); dump += "Input Classifier State:\n"; dump += StringPrintf(INDENT1 "Deep press: %s\n", deepPressEnabled() ? "enabled" : "disabled"); dump += INDENT1 "Motion Classifier:\n"; if (mMotionClassifier) { Loading services/inputflinger/InputClassifier.h +2 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,8 @@ private: void updateLastDownTime(int32_t deviceId, nsecs_t downTime); void clearDeviceState(int32_t deviceId); /** * Exit the InputClassifier HAL thread. * Useful for tests to ensure proper cleanup. Loading services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp +23 −18 Original line number Diff line number Diff line Loading @@ -124,24 +124,20 @@ public: static std::unique_ptr<HalWrapper> connect() { // Power HAL 1.3 is not guaranteed to be available, thus we need to query // Power HAL 1.0 first and try to cast it to Power HAL 1.3. // Power HAL 1.0 is always available, thus if we fail to query it, it means // Power HAL is not available temporarily and we should retry later. However, // if Power HAL 1.0 is available and we can't cast it to Power HAL 1.3, // it means Power HAL 1.3 is not available at all, so we should stop trying. sp<V1_3::IPower> powerHal = nullptr; if (sHasPowerHal_1_3) { sp<V1_0::IPower> powerHal_1_0 = V1_0::IPower::getService(); if (powerHal_1_0 != nullptr) { // Try to cast to Power HAL 1.3 powerHal = V1_3::IPower::castFrom(powerHal_1_0); if (powerHal == nullptr) { ALOGW("No Power HAL 1.3 service in system"); sHasPowerHal_1_3 = false; ALOGW("No Power HAL 1.3 service in system, disabling PowerAdvisor"); } else { ALOGI("Loaded Power HAL 1.3 service"); } } else { ALOGW("No Power HAL found, disabling PowerAdvisor"); } } if (powerHal == nullptr) { return nullptr; } Loading @@ -162,12 +158,9 @@ public: } private: static bool sHasPowerHal_1_3; const sp<V1_3::IPower> mPowerHal = nullptr; }; bool HidlPowerHalWrapper::sHasPowerHal_1_3 = true; class AidlPowerHalWrapper : public PowerAdvisor::HalWrapper { public: AidlPowerHalWrapper(sp<IPower> powerHal) : mPowerHal(std::move(powerHal)) { Loading Loading @@ -226,7 +219,13 @@ private: PowerAdvisor::HalWrapper* PowerAdvisor::getPowerHal() { static std::unique_ptr<HalWrapper> sHalWrapper = nullptr; static bool sHasHal = true; if (!sHasHal) { return nullptr; } // If we used to have a HAL, but it stopped responding, attempt to reconnect if (mReconnectPowerHal) { sHalWrapper = nullptr; mReconnectPowerHal = false; Loading @@ -244,6 +243,12 @@ PowerAdvisor::HalWrapper* PowerAdvisor::getPowerHal() { sHalWrapper = HidlPowerHalWrapper::connect(); } // If we make it to this point and still don't have a HAL, it's unlikely we // will, so stop trying if (sHalWrapper == nullptr) { sHasHal = false; } return sHalWrapper.get(); } Loading Loading
data/etc/android.hardware.device_unique_attestation.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2020 The Android Open Source 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. --> <!-- Feature for devices with Keymaster that support unique attestation. --> <permissions> <feature name="android.hardware.device_unique_attestation" /> </permissions>
services/inputflinger/BlockingQueue.h +1 −4 Original line number Diff line number Diff line Loading @@ -45,10 +45,7 @@ public: T pop() { std::unique_lock lock(mLock); android::base::ScopedLockAssertion assumeLock(mLock); mHasElements.wait(lock, [this]{ android::base::ScopedLockAssertion assumeLock(mLock); return !this->mQueue.empty(); }); mHasElements.wait(lock, [this]() REQUIRES(mLock) { return !this->mQueue.empty(); }); T t = std::move(mQueue.front()); mQueue.erase(mQueue.begin()); return t; Loading
services/inputflinger/InputClassifier.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ void MotionClassifier::callInputClassifierHal() { case ClassifierEventType::DEVICE_RESET: { const int32_t deviceId = *(event.getDeviceId()); halResponseOk = mService->resetDevice(deviceId).isOk(); setClassification(deviceId, MotionClassification::NONE); clearDeviceState(deviceId); break; } case ClassifierEventType::HAL_RESET: { Loading Loading @@ -321,6 +321,12 @@ void MotionClassifier::updateLastDownTime(int32_t deviceId, nsecs_t downTime) { mClassifications[deviceId] = MotionClassification::NONE; } void MotionClassifier::clearDeviceState(int32_t deviceId) { std::scoped_lock lock(mLock); mClassifications.erase(deviceId); mLastDownTimes.erase(deviceId); } MotionClassification MotionClassifier::classify(const NotifyMotionArgs& args) { if ((args.action & AMOTION_EVENT_ACTION_MASK) == AMOTION_EVENT_ACTION_DOWN) { updateLastDownTime(args.deviceId, args.downTime); Loading Loading @@ -455,6 +461,7 @@ void InputClassifier::serviceDied(uint64_t /*cookie*/, void InputClassifier::dump(std::string& dump) { std::scoped_lock lock(mLock); dump += "Input Classifier State:\n"; dump += StringPrintf(INDENT1 "Deep press: %s\n", deepPressEnabled() ? "enabled" : "disabled"); dump += INDENT1 "Motion Classifier:\n"; if (mMotionClassifier) { Loading
services/inputflinger/InputClassifier.h +2 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,8 @@ private: void updateLastDownTime(int32_t deviceId, nsecs_t downTime); void clearDeviceState(int32_t deviceId); /** * Exit the InputClassifier HAL thread. * Useful for tests to ensure proper cleanup. Loading
services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp +23 −18 Original line number Diff line number Diff line Loading @@ -124,24 +124,20 @@ public: static std::unique_ptr<HalWrapper> connect() { // Power HAL 1.3 is not guaranteed to be available, thus we need to query // Power HAL 1.0 first and try to cast it to Power HAL 1.3. // Power HAL 1.0 is always available, thus if we fail to query it, it means // Power HAL is not available temporarily and we should retry later. However, // if Power HAL 1.0 is available and we can't cast it to Power HAL 1.3, // it means Power HAL 1.3 is not available at all, so we should stop trying. sp<V1_3::IPower> powerHal = nullptr; if (sHasPowerHal_1_3) { sp<V1_0::IPower> powerHal_1_0 = V1_0::IPower::getService(); if (powerHal_1_0 != nullptr) { // Try to cast to Power HAL 1.3 powerHal = V1_3::IPower::castFrom(powerHal_1_0); if (powerHal == nullptr) { ALOGW("No Power HAL 1.3 service in system"); sHasPowerHal_1_3 = false; ALOGW("No Power HAL 1.3 service in system, disabling PowerAdvisor"); } else { ALOGI("Loaded Power HAL 1.3 service"); } } else { ALOGW("No Power HAL found, disabling PowerAdvisor"); } } if (powerHal == nullptr) { return nullptr; } Loading @@ -162,12 +158,9 @@ public: } private: static bool sHasPowerHal_1_3; const sp<V1_3::IPower> mPowerHal = nullptr; }; bool HidlPowerHalWrapper::sHasPowerHal_1_3 = true; class AidlPowerHalWrapper : public PowerAdvisor::HalWrapper { public: AidlPowerHalWrapper(sp<IPower> powerHal) : mPowerHal(std::move(powerHal)) { Loading Loading @@ -226,7 +219,13 @@ private: PowerAdvisor::HalWrapper* PowerAdvisor::getPowerHal() { static std::unique_ptr<HalWrapper> sHalWrapper = nullptr; static bool sHasHal = true; if (!sHasHal) { return nullptr; } // If we used to have a HAL, but it stopped responding, attempt to reconnect if (mReconnectPowerHal) { sHalWrapper = nullptr; mReconnectPowerHal = false; Loading @@ -244,6 +243,12 @@ PowerAdvisor::HalWrapper* PowerAdvisor::getPowerHal() { sHalWrapper = HidlPowerHalWrapper::connect(); } // If we make it to this point and still don't have a HAL, it's unlikely we // will, so stop trying if (sHalWrapper == nullptr) { sHasHal = false; } return sHalWrapper.get(); } Loading