Skip to content

Commit

Permalink
Bug 1237914 - Remove layers.screen-recording.enabled r=mwu
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotaro Ikeda committed Jan 14, 2016
1 parent 41edebe commit e6486fd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
1 change: 0 additions & 1 deletion gfx/thebes/gfxPrefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ class gfxPrefs final
DECL_GFX_PREF(Once, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, true);
#endif
DECL_GFX_PREF(Live, "layers.composer2d.enabled", Composer2DCompositionEnabled, bool, false);
DECL_GFX_PREF(Live, "layers.screen-recording.enabled", ScreenRecordingEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.d3d11.disable-warp", LayersD3D11DisableWARP, bool, false);
DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
DECL_GFX_PREF(Live, "layers.deaa.enabled", LayersDEAAEnabled, bool, false);
Expand Down
32 changes: 27 additions & 5 deletions widget/gonk/nativewindow/FakeSurfaceComposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <errno.h>
#include <cutils/log.h>
#include <cutils/properties.h>
#include <private/android_filesystem_config.h>

#include <gui/IDisplayEventConnection.h>
#include <gui/GraphicBufferAlloc.h>
Expand Down Expand Up @@ -59,6 +60,32 @@ FakeSurfaceComposer::~FakeSurfaceComposer()
{
}

status_t FakeSurfaceComposer::onTransact(uint32_t code, const Parcel& data,
Parcel* reply, uint32_t flags)
{
switch (code) {
case CREATE_CONNECTION:
case CREATE_DISPLAY:
case SET_TRANSACTION_STATE:
case CAPTURE_SCREEN:
{
// codes that require permission check
IPCThreadState* ipc = IPCThreadState::self();
const int pid = ipc->getCallingPid();
const int uid = ipc->getCallingUid();
// Accept request only when uid is root.
if (uid != AID_ROOT) {
ALOGE("Permission Denial: "
"can't access SurfaceFlinger pid=%d, uid=%d", pid, uid);
return PERMISSION_DENIED;
}
break;
}
}

return BnSurfaceComposer::onTransact(code, data, reply, flags);
}

sp<ISurfaceComposerClient> FakeSurfaceComposer::createConnection()
{
return nullptr;
Expand Down Expand Up @@ -109,11 +136,6 @@ sp<IBinder> FakeSurfaceComposer::createDisplay(const String8& displayName,
}
};

if (!gfxPrefs::ScreenRecordingEnabled()) {
ALOGE("screen recording is not permitted");
return nullptr;
}

sp<BBinder> token = new DisplayToken(this);

Mutex::Autolock _l(mStateLock);
Expand Down
6 changes: 6 additions & 0 deletions widget/gonk/nativewindow/FakeSurfaceComposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ class FakeSurfaceComposer : public BinderService<FakeSurfaceComposer>,
// We're reference counted, never destroy FakeSurfaceComposer directly
virtual ~FakeSurfaceComposer();

/* ------------------------------------------------------------------------
* IBinder interface
*/
virtual status_t onTransact(uint32_t code, const Parcel& data,
Parcel* reply, uint32_t flags);

/* ------------------------------------------------------------------------
* ISurfaceComposer interface
*/
Expand Down

0 comments on commit e6486fd

Please sign in to comment.