diff options
| author | 2021-05-10 09:56:33 +0000 | |
|---|---|---|
| committer | 2021-05-21 09:30:13 +0000 | |
| commit | 9b85a194e4118819b2bd9ab0bfb489f78ae1b529 (patch) | |
| tree | fe21d0baf7d8eb4831f63861bf9244fdbc5e292a /libs/gui/Surface.cpp | |
| parent | 807ae39c936ddbc410207e852ecc25803f2b17a2 (diff) | |
Add robustness for permissions errors to Surface APIs.
Test: Tested ag/14424498 via testHevcTranscodingWithFileDescriptor on
Test: flame - ab/builds/forrest/run/L38000000884507245
Bug: 184903653
Bug: 184112407
Change-Id: I94dcaa31edcf0f810c6cf69ca6e73277470fa51f
Diffstat (limited to 'libs/gui/Surface.cpp')
| -rw-r--r-- | libs/gui/Surface.cpp | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index 2fc9d47b89..f4aa7b3d8b 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -1268,8 +1268,11 @@ int Surface::query(int what, int* value) const {                  if (err == NO_ERROR) {                      return NO_ERROR;                  } -                if (composerService()->authenticateSurfaceTexture( -                        mGraphicBufferProducer)) { +                sp<ISurfaceComposer> surfaceComposer = composerService(); +                if (surfaceComposer == nullptr) { +                    return -EPERM; // likely permissions error +                } +                if (surfaceComposer->authenticateSurfaceTexture(mGraphicBufferProducer)) {                      *value = 1;                  } else {                      *value = 0;  |