mirror of
https://github.com/LineageOS/android_device_xiaomi_whyred.git
synced 2025-10-05 19:41:57 +02:00
whyred: light: Minor cleanup
Change-Id: I42215a38ea3f98d5e202308bc80fab672ed8d776
This commit is contained in:
parent
ac9beafcbc
commit
44aa3a9119
4 changed files with 6 additions and 8 deletions
|
@ -1,4 +1,3 @@
|
|||
//
|
||||
// Copyright (C) 2018 The LineageOS Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -181,12 +181,12 @@ static std::vector<std::pair<Type, LightState>> notificationStates = {
|
|||
static void handleNotification(Type type, const LightState& state) {
|
||||
bool handled = false;
|
||||
|
||||
for(auto it : notificationStates) {
|
||||
for (auto it : notificationStates) {
|
||||
if (it.first == type) {
|
||||
it.second = state;
|
||||
}
|
||||
|
||||
if (!handled && isLit(it.second)) {
|
||||
if (!handled && isLit(it.second)) {
|
||||
setNotification(it.second);
|
||||
handled = true;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ static void handleNotification(Type type, const LightState& state) {
|
|||
}
|
||||
}
|
||||
|
||||
static std::map<Type, std::function<void(Type type, const LightState&)>> lights = {
|
||||
static std::map<Type, std::function<void(Type, const LightState&)>> lights = {
|
||||
{ Type::ATTENTION, handleNotification },
|
||||
{ Type::NOTIFICATIONS, handleNotification },
|
||||
{ Type::BATTERY, handleNotification },
|
||||
|
@ -205,7 +205,7 @@ static std::map<Type, std::function<void(Type type, const LightState&)>> lights
|
|||
{ Type::BUTTONS, handleButtons },
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
} // anonymous namespace
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
#include <hardware/lights.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::light::V2_0::ILight;
|
||||
using ::android::hardware::light::V2_0::Flash;
|
||||
using ::android::hardware::light::V2_0::LightState;
|
||||
|
|
|
@ -31,7 +31,7 @@ using android::sp;
|
|||
using android::status_t;
|
||||
|
||||
int main() {
|
||||
android::sp<ILight> service = new Light();
|
||||
sp<ILight> service = new Light();
|
||||
|
||||
configureRpcThreadpool(1, true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue