Merge "Support sending KEYCODE_HEADSETHOOK KeyEvent from an a11y service" into rvc-dev am: fdea871287

Change-Id: Id633c979a0e98f08408f2f601a97eba09cdaf56a
This commit is contained in:
Sally Yuen
2020-04-20 22:35:56 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 0 deletions

View File

@@ -494,6 +494,13 @@ public abstract class AccessibilityService extends Service {
*/
public static final int GLOBAL_ACTION_TAKE_SCREENSHOT = 9;
/**
* Action to send the KEYCODE_HEADSETHOOK KeyEvent, which is used to answer/hang up calls and
* play/stop media
* @hide
*/
public static final int GLOBAL_ACTION_KEYCODE_HEADSETHOOK = 10;
private static final String LOG_TAG = "AccessibilityService";
/**

View File

@@ -301,6 +301,9 @@ public class SystemActionPerformer {
return lockScreen();
case AccessibilityService.GLOBAL_ACTION_TAKE_SCREENSHOT:
return takeScreenshot();
case AccessibilityService.GLOBAL_ACTION_KEYCODE_HEADSETHOOK :
sendDownAndUpKeyEvents(KeyEvent.KEYCODE_HEADSETHOOK);
return true;
default:
return false;
}