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
This commit is contained in:
Hidenari Koshimae
2016-02-05 18:13:17 +09:00
committed by Michael Wright
parent c3fddb984c
commit 469e65e37f

View File

@@ -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);