Add mechanism for a task's windows to be trusted overlays (SF)
- Add a layer state to indicate that this layer and its children
in the hierarchy are trusted. This can only be set by callers
holding ACCESS_SURFACE_FLINGER, and will be used for the PIP
task layer to indicate that activities in PIP are trusted (as
they are controlled only by the user and SystemUI)
Bug: 191529039
Test: TBD
Change-Id: Id92ccb087bd0d8dbaeeef3ba50b67fe015e53db8
diff --git a/services/surfaceflinger/SurfaceInterceptor.cpp b/services/surfaceflinger/SurfaceInterceptor.cpp
index 8ca241e..23ab7c8 100644
--- a/services/surfaceflinger/SurfaceInterceptor.cpp
+++ b/services/surfaceflinger/SurfaceInterceptor.cpp
@@ -149,6 +149,7 @@
getLayerIdFromWeakRef(layer->mDrawingState.zOrderRelativeOf),
layer->mDrawingState.z);
addShadowRadiusLocked(transaction, layerId, layer->mDrawingState.shadowRadius);
+ addTrustedOverlayLocked(transaction, layerId, layer->mDrawingState.isTrustedOverlay);
}
void SurfaceInterceptor::addInitialDisplayStateLocked(Increment* increment,
@@ -397,6 +398,13 @@
overrideChange->set_radius(shadowRadius);
}
+void SurfaceInterceptor::addTrustedOverlayLocked(Transaction* transaction, int32_t layerId,
+ bool isTrustedOverlay) {
+ SurfaceChange* change(createSurfaceChangeLocked(transaction, layerId));
+ TrustedOverlayChange* overrideChange(change->mutable_trusted_overlay());
+ overrideChange->set_is_trusted_overlay(isTrustedOverlay);
+}
+
void SurfaceInterceptor::addSurfaceChangesLocked(Transaction* transaction,
const layer_state_t& state)
{
@@ -460,6 +468,9 @@
if (state.what & layer_state_t::eShadowRadiusChanged) {
addShadowRadiusLocked(transaction, layerId, state.shadowRadius);
}
+ if (state.what & layer_state_t::eTrustedOverlayChanged) {
+ addTrustedOverlayLocked(transaction, layerId, state.isTrustedOverlay);
+ }
if (state.what & layer_state_t::eStretchChanged) {
ALOGW("SurfaceInterceptor not implemented for eStretchChanged");
}