Keyboard shortcuts: minor Activity broadcast refactor
Since the broadcast intents have an action, specifying an explicit component name is not needed. Specified only the package name and left it for the system to resolve the full component name for the receiver that handles the action in that package. Also got rid of warning: "Calling a method in the system process without a qualified user" by correctly sending the broadcast as the SYSTEM user. Bug: 28012198 Change-Id: Ia572fb1b7f2f3c96160d16e2842d6aff3b7f10a1
This commit is contained in:
@@ -724,8 +724,6 @@ public class Activity extends ContextThemeWrapper
|
||||
private static final String REQUEST_PERMISSIONS_WHO_PREFIX = "@android:requestPermissions:";
|
||||
|
||||
private static final String KEYBOARD_SHORTCUTS_RECEIVER_PKG_NAME = "com.android.systemui";
|
||||
private static final String KEYBOARD_SHORTCUTS_RECEIVER_CLASS_NAME =
|
||||
"com.android.systemui.statusbar.KeyboardShortcutsReceiver";
|
||||
|
||||
private static class ManagedDialog {
|
||||
Dialog mDialog;
|
||||
@@ -1694,9 +1692,8 @@ public class Activity extends ContextThemeWrapper
|
||||
*/
|
||||
public final void requestShowKeyboardShortcuts() {
|
||||
Intent intent = new Intent(Intent.ACTION_SHOW_KEYBOARD_SHORTCUTS);
|
||||
intent.setComponent(new ComponentName(KEYBOARD_SHORTCUTS_RECEIVER_PKG_NAME,
|
||||
KEYBOARD_SHORTCUTS_RECEIVER_CLASS_NAME));
|
||||
sendBroadcast(intent);
|
||||
intent.setPackage(KEYBOARD_SHORTCUTS_RECEIVER_PKG_NAME);
|
||||
sendBroadcastAsUser(intent, UserHandle.SYSTEM);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1704,9 +1701,8 @@ public class Activity extends ContextThemeWrapper
|
||||
*/
|
||||
public final void dismissKeyboardShortcutsHelper() {
|
||||
Intent intent = new Intent(Intent.ACTION_DISMISS_KEYBOARD_SHORTCUTS);
|
||||
intent.setComponent(new ComponentName(KEYBOARD_SHORTCUTS_RECEIVER_PKG_NAME,
|
||||
KEYBOARD_SHORTCUTS_RECEIVER_CLASS_NAME));
|
||||
sendBroadcast(intent);
|
||||
intent.setPackage(KEYBOARD_SHORTCUTS_RECEIVER_PKG_NAME);
|
||||
sendBroadcastAsUser(intent, UserHandle.SYSTEM);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user