mirror of
https://github.com/LineageOS/android_device_xiaomi_whyred.git
synced 2025-10-03 09:49:16 +02:00
whyred: light: update state after notification is handled
Change-Id: Ic36b112c58316da802a6dfd011cbd25a0e842eef
This commit is contained in:
parent
d76a0057be
commit
ac9beafcbc
1 changed files with 7 additions and 3 deletions
|
@ -179,19 +179,23 @@ static std::vector<std::pair<Type, LightState>> notificationStates = {
|
|||
};
|
||||
|
||||
static void handleNotification(Type type, const LightState& state) {
|
||||
bool handled = false;
|
||||
|
||||
for(auto it : notificationStates) {
|
||||
if (it.first == type) {
|
||||
it.second = state;
|
||||
}
|
||||
|
||||
if (isLit(it.second)) {
|
||||
if (!handled && isLit(it.second)) {
|
||||
setNotification(it.second);
|
||||
return;
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
setNotification(offState);
|
||||
}
|
||||
}
|
||||
|
||||
static std::map<Type, std::function<void(Type type, const LightState&)>> lights = {
|
||||
{ Type::ATTENTION, handleNotification },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue