mirror of
https://github.com/LineageOS/android_device_xiaomi_whyred.git
synced 2025-10-03 17:59:24 +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,18 +179,22 @@ static std::vector<std::pair<Type, LightState>> notificationStates = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void handleNotification(Type type, const LightState& state) {
|
static void handleNotification(Type type, const LightState& state) {
|
||||||
|
bool handled = false;
|
||||||
|
|
||||||
for(auto it : notificationStates) {
|
for(auto it : notificationStates) {
|
||||||
if (it.first == type) {
|
if (it.first == type) {
|
||||||
it.second = state;
|
it.second = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLit(it.second)) {
|
if (!handled && isLit(it.second)) {
|
||||||
setNotification(it.second);
|
setNotification(it.second);
|
||||||
return;
|
handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setNotification(offState);
|
if (!handled) {
|
||||||
|
setNotification(offState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::map<Type, std::function<void(Type type, const LightState&)>> lights = {
|
static std::map<Type, std::function<void(Type type, const LightState&)>> lights = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue