From 469e65e37f04fa3aa46e5116b6028cd7113308b3 Mon Sep 17 00:00:00 2001 From: Hidenari Koshimae Date: Fri, 5 Feb 2016 18:13:17 +0900 Subject: [PATCH] Increase priority for broadcast intent triggered by HW key Add the FLAG_RECEIVER_FOREGROUND flag to the broadcast intent triggered by hardware key. This prevents the framework from delaying the delivery of the intent to its recipients, and improves the response for hardware key event under heavy load on the system. Bug: 28735973 Change-Id: Ib7f219845be34794f4c7545927e53cc6c2b504a3 --- .../com/android/internal/policy/PhoneFallbackEventHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/com/android/internal/policy/PhoneFallbackEventHandler.java b/core/java/com/android/internal/policy/PhoneFallbackEventHandler.java index 2cb9c250d2d17..fb0edea398cee 100644 --- a/core/java/com/android/internal/policy/PhoneFallbackEventHandler.java +++ b/core/java/com/android/internal/policy/PhoneFallbackEventHandler.java @@ -150,6 +150,7 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler { sendCloseSystemWindows(); // Broadcast an intent that the Camera button was longpressed Intent intent = new Intent(Intent.ACTION_CAMERA_BUTTON, null); + intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); intent.putExtra(Intent.EXTRA_KEY_EVENT, event); mContext.sendOrderedBroadcastAsUser(intent, UserHandle.CURRENT_OR_SELF, null, null, null, 0, null, null);