diff options
| author | 2022-12-08 18:36:59 +0000 | |
|---|---|---|
| committer | 2022-12-08 18:36:59 +0000 | |
| commit | 7c097ba9672399a8800db3163362fe68ec49d4aa (patch) | |
| tree | 4e38790adaf5011f3856963154d37b4fab86f43e /libs/gui/LayerState.cpp | |
| parent | 18d16a7288c1aab3236f700f4bbd63041bc71cdb (diff) | |
| parent | 6bb12824db3c540775b2b737331ed3f448a50e2e (diff) | |
Merge "Add security check to getPhysicalDisplayToken binder function."
Diffstat (limited to 'libs/gui/LayerState.cpp')
| -rw-r--r-- | libs/gui/LayerState.cpp | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 95962afda1..59b62fe58c 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -388,6 +388,27 @@ void DisplayState::merge(const DisplayState& other) {      }  } +void DisplayState::sanitize(int32_t permissions) { +    if (what & DisplayState::eLayerStackChanged) { +        if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { +            what &= ~DisplayState::eLayerStackChanged; +            ALOGE("Stripped attempt to set eLayerStackChanged in sanitize"); +        } +    } +    if (what & DisplayState::eDisplayProjectionChanged) { +        if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { +            what &= ~DisplayState::eDisplayProjectionChanged; +            ALOGE("Stripped attempt to set eDisplayProjectionChanged in sanitize"); +        } +    } +    if (what & DisplayState::eSurfaceChanged) { +        if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { +            what &= ~DisplayState::eSurfaceChanged; +            ALOGE("Stripped attempt to set eSurfaceChanged in sanitize"); +        } +    } +} +  void layer_state_t::sanitize(int32_t permissions) {      // TODO: b/109894387      //  |