Bug 1237914 - Remove layers.screen-recording.enabled r=mwu

This commit is contained in:
Sotaro Ikeda 2016-01-13 20:45:57 -08:00
parent 0237cd4356
commit 6bca25738e
3 changed files with 33 additions and 6 deletions

View File

@ -321,7 +321,6 @@ private:
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);

View File

@ -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>
@ -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;
@ -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);

View File

@ -87,6 +87,12 @@ private:
// 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
*/