Add global key configuration file

Add global key configuration file. A global key is one that is handled by
PhoneWindowManager before dispatching and sent to a given component via
broadcast instead of going to the foreground app.
Bug: 8510681

Change-Id: Ic6a8e559680d005613ed22874b27eb78bbfc4499
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 0efd6b0..c9b9a1a 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2578,6 +2578,14 @@
     public static final String ACTION_SHOW_BRIGHTNESS_DIALOG =
             "android.intent.action.SHOW_BRIGHTNESS_DIALOG";
 
+    /**
+     * Broadcast Action:  A global button was pressed.  Includes a single
+     * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that
+     * caused the broadcast.
+     * @hide
+     */
+    public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON";
+
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     // Standard intent categories (see addCategory()).
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 757bbc8..ced0851 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1142,6 +1142,7 @@
   <java-symbol type="xml" name="time_zones_by_country" />
   <java-symbol type="xml" name="sms_short_codes" />
   <java-symbol type="xml" name="audio_assets" />
+  <java-symbol type="xml" name="global_keys" />
 
   <java-symbol type="raw" name="accessibility_gestures" />
   <java-symbol type="raw" name="incognito_mode_start_page" />
diff --git a/core/res/res/xml/global_keys.xml b/core/res/res/xml/global_keys.xml
new file mode 100644
index 0000000..8fa6902
--- /dev/null
+++ b/core/res/res/xml/global_keys.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2013, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<!-- Mapping of keycodes to components which will be handled globally.
+     Modify this file to add global keys.
+     A global key will NOT go to the foreground application and instead only ever be sent via targeted
+     broadcast to the specified component. The action of the intent will be
+     android.intent.action.GLOBAL_BUTTON and the KeyEvent will be included in the intent as
+     android.intent.extra.KEY_EVENT.
+-->
+
+<global_keys version="1">
+    <!-- Example format: keyCode = keycode to handle globally. component = component which will handle this key. -->
+    <!-- <key keyCode="KEYCODE_VOLUME_UP" component="com.android.example.keys/.VolumeKeyHandler" /> -->
+</global_keys>