java.lang.Object | |
↳ | com.samsung.android.knox.remotecontrol.RemoteInjection |
This class provides APIs to support remote injection of key, pointer, and trackball events into the device UI.
API level 3 |
MDM 2.1 |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
API to inject a key event into the device UI.
| |||||||||||
Deprecated
in API level 39
NOTE: This API is not available since Android 16. | |||||||||||
API to inject a pointer (touch) event into the device UI.
| |||||||||||
Deprecated
in API level 39
NOTE: This API is not available since Android 16. | |||||||||||
API to inject a track ball (navigation device) event into the device UI.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
API to inject a key event into the device UI.
ev | Key event describing the keystroke action. |
---|---|
sync | If true , waits for the event to be completed before returning to
the caller. Otherwise, returns immediately without blocking. |
true
if event was dispatched, false
if it was dropped
for any reason.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to inject key events into the device remotely.
Setting sync to false causes the method to block while waiting for a current
input event to be dispatched.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); RemoteInjection remoteInjection = edm.getRemoteInjection(); try { int keycode = KeyEvent.KEYCODE_0; remoteInjection.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, keycode), true); } catch (SecurityException se) { Log.w(TAG,"Exception: " + se); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_REMOTE_CONTROL" permission which has a protection level of signature. |
API level 3 |
MDM 2.1 |
Deprecated
in API level 39
NOTE: This API is not available since Android 16.
API to inject a key event into the Dex screen UI.
ev | Key event describing the keystroke action. |
---|---|
sync | If true , waits for the event to be completed before returning to
the caller. Otherwise, returns immediately without blocking. |
true
if event was dispatched, false
if it was dropped
for any reason.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to inject key events into the Dex screen of device
remotely when Dex mode is ON. Setting sync to false causes the method to block
while waiting for a current input event to be dispatched.
NOTE 2: Since API level 38, if caller is neither a Device owner nor Profile owner,
application needs to be authorized via
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); RemoteInjection remoteInjection = edm.getRemoteInjection(); try { int keycode = KeyEvent.KEYCODE_0; remoteInjection.injectKeyEventDex(new KeyEvent(KeyEvent.ACTION_DOWN, keycode), true); } catch (SecurityException se) { Log.w(TAG,"Exception: " + se); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature. |
API level 30 |
KNOX 3.4.1 |
API to inject a pointer (touch) event into the device UI.
ev | Motion event describing the pointer (touch) action. |
---|---|
sync | If true , waits for the event to be completed before returning
to the caller. Otherwise, returns immediately without blocking. |
true
if event was dispatched, false
if
it was dropped for any reason.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to inject a pointer event into the device remotely.
Setting sync to false causes the method to block while waiting for the
current input event to be dispatched.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); RemoteInjection remoteInjection = edm.getRemoteInjection(); try { int x = 100, y = 200,flags = 0; remoteInjection.injectPointerEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, x, y, flags), true); } catch (SecurityException se) { Log.w(TAG,"Exception: " + se); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_REMOTE_CONTROL" permission which has a protection level of signature. |
API level 3 |
MDM 2.1 |
Deprecated
in API level 39
NOTE: This API is not available since Android 16.
API to inject a pointer (touch) event into the Dex screen UI.
ev | Motion event describing the pointer (touch) action. |
---|---|
sync | If true , waits for the event to be completed before returning
to the caller. Otherwise, returns immediately without blocking. |
true
if event was dispatched, false
if
it was dropped for any reason.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to inject a pointer event into Dex screen of device
remotely when Dex mode is ON. Setting sync to false causes the method to block
while waiting for the current input event to be dispatched.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); RemoteInjection remoteInjection = edm.getRemoteInjection(); try { int x = 100, y = 200,flags = 0; remoteInjection.injectPointerEventDex(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, x, y, flags), true); } catch (SecurityException se) { Log.w(TAG,"Exception: " + se); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature. |
API level 30 |
KNOX 3.4.1 |
API to inject a track ball (navigation device) event into the device UI.
ev | Trackball event describing the trackball action. |
---|---|
sync | If true , waits for the event to be completed before returning
to the caller. Otherwise, returns immediately without blocking. |
true
if event was dispatched, false
if it
was dropped for any reason.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to inject a trackball event into the
device remotely. Setting sync to false causes the method to block
while waiting for the current input event to be dispatched.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); RemoteInjection remoteInjection = edm.getRemoteInjection(); try { int x = 100, y = 200, flags = 0; remoteInjection.injectTrackballEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, x, y, flags), true); } catch (SecurityException se) { Log.w(TAG,"Exception: " + se); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_REMOTE_CONTROL" permission which has a protection level of signature. |
API level 3 |
MDM 2.1 |