mirror of
https://github.com/openharmony/graphic_wms.git
synced 2026-07-20 20:06:25 -04:00
Description: add precheck for dfx sreenshot interface
IssueNo:I5SWPU Feature or Bugfix: Feature Binary Source:No Signed-off-by: jiadexiang <jiadexiang@huawei.com>
This commit is contained in:
@@ -79,6 +79,9 @@ executable("wms_server") {
|
||||
include_dirs = [
|
||||
"frameworks/ims",
|
||||
"interfaces/innerkits",
|
||||
"//base/security/permission_lite/services/pms_client/include",
|
||||
"//base/security/permission_lite/interfaces/innerkits",
|
||||
"//base/security/permission_lite/interfaces/kits",
|
||||
"//drivers/peripheral/input/interfaces/include",
|
||||
"//third_party/FreeBSD/sys/dev/evdev",
|
||||
]
|
||||
@@ -91,6 +94,7 @@ executable("wms_server") {
|
||||
"-ldisplay_layer",
|
||||
]
|
||||
deps = [
|
||||
"//base/security/permission_lite/services/pms_client:pms_client",
|
||||
"//drivers/peripheral/input/hal:hdi_input",
|
||||
"//foundation/graphic/utils:lite_graphic_hals",
|
||||
]
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "gfx_utils/graphic_log.h"
|
||||
#include "lite_wm.h"
|
||||
#include "lite_wm_type.h"
|
||||
#include "pms_interface.h"
|
||||
#include "surface.h"
|
||||
#include "surface_impl.h"
|
||||
|
||||
@@ -214,6 +215,13 @@ void LiteWMS::GetEventData(IpcIo* req, IpcIo* reply)
|
||||
|
||||
void LiteWMS::Screenshot(IpcIo* req, IpcIo* reply)
|
||||
{
|
||||
const char *writeMediaImagePermissionName = "ohos.permission.WRITE_MEDIA_IMAGES";
|
||||
pid_t uid = GetCallingUid();
|
||||
if (CheckPermission(uid, writeMediaImagePermissionName) != GRANTED) {
|
||||
GRAPHIC_LOGE("permission denied");
|
||||
WriteInt32(reply, LiteWMS_EUNKNOWN);
|
||||
return;
|
||||
}
|
||||
Surface* surface = SurfaceImpl::GenericSurfaceByIpcIo(*req);
|
||||
bool ret = LiteWM::GetInstance()->OnScreenshot(surface);
|
||||
WriteInt32(reply, ret ? LiteWMS_EOK : LiteWMS_EUNKNOWN);
|
||||
|
||||
Reference in New Issue
Block a user