composer: do not allow TUI if target display is not powered on
Change-Id: I279da7b78edda2bcca47c785f98d4b566ec6987a
diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp
index bd67a46..67bfe0b 100644
--- a/composer/hwc_session.cpp
+++ b/composer/hwc_session.cpp
@@ -4162,10 +4162,12 @@
}
std::bitset<kSecureMax> secure_sessions = 0;
+ HWC2::PowerMode current_power_mode = HWC2::PowerMode::Off;
{
SEQUENCE_WAIT_SCOPE_LOCK(locker_[target_display]);
if (hwc_display_[target_display]) {
hwc_display_[target_display]->GetActiveSecureSession(&secure_sessions);
+ current_power_mode = hwc_display_[target_display]->GetCurrentPowerMode();
}
}
@@ -4174,6 +4176,11 @@
return -ENOTSUP;
}
+ if (current_power_mode != HWC2::PowerMode::On) {
+ DLOGW("TUI session not allowed as target display is not powered On");
+ return -ENOTSUP;
+ }
+
std::vector<DisplayMapInfo> map_info = {map_info_primary_};
std::copy(map_info_builtin_.begin(), map_info_builtin_.end(), std::back_inserter(map_info));
std::copy(map_info_pluggable_.begin(), map_info_pluggable_.end(), std::back_inserter(map_info));