语言

Menu
Sites
Language
E_PRIVILEGE_DENIED result for GenerateKeyEvent() in Thread

Hi,

Created a Service app to simulate keys. Override the Thread class to MyThread class to simulate keys.

Code Snippet:

Object*
MyThread::Run(void)
{
	AppLog("MyThread :: Object* Run(void)");

	Tizen::Ui::KeyCode keyToSimulate = Tizen::Ui::KEY_A;

	result r = Tizen::Ui::SystemUtil::GenerateKeyEvent(Tizen::Ui::KEY_EVENT_TYPE_PRESSED, keyToSimulate);
	AppLog("KEY_EVENT_TYPE_PRESSED [%d] and result :: %s", keyToSimulate, GetErrorMessage(r));

	r = Tizen::Ui::SystemUtil::GenerateKeyEvent(Tizen::Ui::KEY_EVENT_TYPE_RELEASED, keyToSimulate);
	AppLog("KEY_EVENT_TYPE_RELEASED [%d] and result :: %s", keyToSimulate, GetErrorMessage(r));

    return null;
}

In OnAppInitialized() created a Thread instance and started as below:

    mpMyThread = new MyThread;

    mpMyThread->Construct();

    mpMyThread->Start();

result of GenerateKeyEvent shows E_PRIVILEGE_DENIED. My question here does MyThread class has the privileges same as parent? If not how can i send events in MyThread class?

Thanks,

Anil

响应

3 回复
Kamil N

Anil,

Did you add privilege http://tizen.org/privilege/inputmanager into manifest? In my opinion MyThread class should have same privileges as a parent. 

hgw7

The api's present the Tizen::Ui::SystemUtil Class require platform privelege. Please refer -> https://developer.tizen.org/dev-guide/2.2.1/org.tizen.gettingstarted/html/tizen_overview/platform_privileges.htm

Alex Ashirov

Right. But it seems that it's possible to use platform level privileges in the IDE Emulator:

https://developer.tizen.org/dev-guide/2.2.1/org.tizen.gettingstarted/html/tizen_overview/platform_privileges.htm