summaryrefslogtreecommitdiffstats
path: root/libs/gui/include
diff options
context:
space:
mode:
authorRobert Carr <racarr@google.com>2019-04-02 16:31:39 -0700
committerRobert Carr <racarr@google.com>2019-04-05 09:21:29 -0700
commit4293e9d75d5b0d033126f529ab61dd1f4a8d8420 (patch)
treede561d03f17b200afad30b6b8d5058d595058566 /libs/gui/include
parent866455f07c21964af5c195709bc2081121965200 (diff)
downloadandroid_frameworks_native-4293e9d75d5b0d033126f529ab61dd1f4a8d8420.tar.gz
android_frameworks_native-4293e9d75d5b0d033126f529ab61dd1f4a8d8420.tar.bz2
android_frameworks_native-4293e9d75d5b0d033126f529ab61dd1f4a8d8420.zip
SurfaceFlinger: Validate layers before casting.
Reinterpret casting random IBinder = no-fun. I first attempted to use inheritance of "getInterfaceDescriptor" in Layer::Handle but departing from "standard-layout" (e.g. using virtual methods) means that downcasting with static/reinterpret_cast is no longer valid. Instead I opted for the pattern the system-server uses of maintaing a map. Bug: 129768960 Test: InvalidHandles_test.cpp Change-Id: Ica8d08a2daf5e80d187e818adbff0c7901db69f7
Diffstat (limited to 'libs/gui/include')
-rw-r--r--libs/gui/include/gui/SurfaceControl.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/libs/gui/include/gui/SurfaceControl.h b/libs/gui/include/gui/SurfaceControl.h
index 55efcbfb3..23bfc0256 100644
--- a/libs/gui/include/gui/SurfaceControl.h
+++ b/libs/gui/include/gui/SurfaceControl.h
@@ -84,6 +84,9 @@ public:
explicit SurfaceControl(const sp<SurfaceControl>& other);
+ SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle,
+ const sp<IGraphicBufferProducer>& gbp, bool owned);
+
private:
// can't be copied
SurfaceControl& operator = (SurfaceControl& rhs);
@@ -92,12 +95,6 @@ private:
friend class SurfaceComposerClient;
friend class Surface;
- SurfaceControl(
- const sp<SurfaceComposerClient>& client,
- const sp<IBinder>& handle,
- const sp<IGraphicBufferProducer>& gbp,
- bool owned);
-
~SurfaceControl();
sp<Surface> generateSurfaceLocked() const;