Treat recentapps as home press for STK dialogs

For interactive STK dialogs which listen for user presses of the HOME
key, we will treat RECENTAPPS presses as equivalent. The reason for this
is because with new gesture-based navigation it's hard for the user to
trigger a HOME press, and the same user intention often triggers a
RECENTAPPS press.

Bug: 161207764
Test: manual
Change-Id: Ib64068f191e62b7103472d39525305be3dab59c8
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 9f86610..8bac03e 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -299,6 +299,7 @@
     // The reason based on Intent.ACTION_CLOSE_SYSTEM_DIALOGS.
     private static final String SYSTEM_DIALOG_REASON_KEY = "reason";
     private static final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey";
+    private static final String SYSTEM_DIALOG_REASON_RECENTAPPS_KEY = "recentapps";
     private BroadcastReceiver mHomeKeyEventReceiver = null;
 
     @Override
@@ -828,8 +829,11 @@
         }
         mHomeKeyEventReceiver = new BroadcastReceiver() {
             @Override public void onReceive(Context context, Intent intent) {
-                if (SYSTEM_DIALOG_REASON_HOME_KEY.equals(
-                        intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY))) {
+                final String reason = intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY);
+                // gesture-based launchers may interpret swipe-up as "recent apps" instead of
+                // "home" so we accept both here
+                if (SYSTEM_DIALOG_REASON_HOME_KEY.equals(reason)
+                    || SYSTEM_DIALOG_REASON_RECENTAPPS_KEY.equals(reason)) {
                     Message message = mServiceHandler.obtainMessage();
                     message.arg1 = OP_HOME_KEY_PRESSED;
                     mServiceHandler.sendMessage(message);