Loading core/java/android/view/KeyEvent.java +4 −1 Original line number Diff line number Diff line Loading @@ -804,8 +804,11 @@ public class KeyEvent extends InputEvent implements Parcelable { public static final int KEYCODE_SYSTEM_NAVIGATION_LEFT = 282; /** Key code constant: Consumed by the system for navigation right */ public static final int KEYCODE_SYSTEM_NAVIGATION_RIGHT = 283; /** Key code constant: Show all apps * @hide */ public static final int KEYCODE_ALL_APPS = 284; private static final int LAST_KEYCODE = KEYCODE_SYSTEM_NAVIGATION_RIGHT; private static final int LAST_KEYCODE = KEYCODE_ALL_APPS; // NOTE: If you add a new keycode here you must also add it to: // isSystem() Loading core/res/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1888,6 +1888,7 @@ <enum name="KEYCODE_SYSTEM_NAVIGATION_DOWN" value="281" /> <enum name="KEYCODE_SYSTEM_NAVIGATION_LEFT" value="282" /> <enum name="KEYCODE_SYSTEM_NAVIGATION_RIGHT" value="283" /> <enum name="KEYCODE_ALL_APPS" value="284" /> </attr> <!-- ***************************************************************** --> Loading services/core/java/com/android/server/am/ActivityManagerService.java +17 −11 Original line number Diff line number Diff line Loading @@ -13110,7 +13110,6 @@ public class ActivityManagerService extends IActivityManager.Stub return; } } // We are now ready to launch the assist activity. IResultReceiver sendReceiver = null; Bundle sendBundle = null; Loading Loading @@ -13140,18 +13139,25 @@ public class ActivityManagerService extends IActivityManager.Stub return; } long ident = Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity(); try { if (TextUtils.equals(pae.intent.getAction(), android.service.voice.VoiceInteractionService.SERVICE_INTERFACE)) { pae.intent.putExtras(pae.extras); mContext.startServiceAsUser(pae.intent, new UserHandle(pae.userHandle)); } else { pae.intent.replaceExtras(pae.extras); pae.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); closeSystemDialogs("assist"); try { mContext.startActivityAsUser(pae.intent, new UserHandle(pae.userHandle)); } catch (ActivityNotFoundException e) { Slog.w(TAG, "No activity to handle assist action.", e); } } } finally { Binder.restoreCallingIdentity(ident); } services/core/java/com/android/server/policy/PhoneWindowManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -835,6 +835,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private static final int MSG_BUGREPORT_TV = 22; private static final int MSG_ACCESSIBILITY_TV = 23; private static final int MSG_DISPATCH_BACK_KEY_TO_AUTOFILL = 24; private static final int MSG_HANDLE_ALL_APPS = 25; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS = 0; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_NAVIGATION = 1; Loading Loading @@ -924,6 +925,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { case MSG_DISPATCH_BACK_KEY_TO_AUTOFILL: mAutofillManagerInternal.onBackKeyPressed(); break; case MSG_HANDLE_ALL_APPS: launchAllAppsAction(); break; } } } Loading Loading @@ -1785,6 +1789,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { private void launchAllAppsAction() { Intent intent = new Intent(Intent.ACTION_ALL_APPS); if (mHasFeatureLeanback) { final PackageManager pm = mContext.getPackageManager(); Intent intentLauncher = new Intent(Intent.ACTION_MAIN); intentLauncher.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = pm.resolveActivityAsUser(intentLauncher, PackageManager.MATCH_SYSTEM_ONLY, mCurrentUserId); if (resolveInfo != null) { intent.setPackage(resolveInfo.activityInfo.packageName); } } startActivityAsUser(intent, UserHandle.CURRENT); } Loading Loading @@ -3620,6 +3635,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (interceptAccessibilityGestureTv()) { return -1; } } else if (keyCode == KeyEvent.KEYCODE_ALL_APPS) { if (!down) { mHandler.removeMessages(MSG_HANDLE_ALL_APPS); Message msg = mHandler.obtainMessage(MSG_HANDLE_ALL_APPS); msg.setAsynchronous(true); msg.sendToTarget(); } return -1; } // Toggle Caps Lock on META-ALT. Loading services/core/java/com/android/server/search/SearchManagerService.java +22 −16 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.search; import android.app.ActivityManager; import android.app.AppGlobals; import android.app.IActivityManager; import android.app.ISearchManager; import android.app.SearchManager; Loading @@ -26,7 +25,6 @@ import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.ContentObserver; Loading @@ -37,6 +35,7 @@ import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.service.voice.VoiceInteractionService; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -272,24 +271,25 @@ public class SearchManagerService extends ISearchManager.Stub { } } // Check and return VIS component private ComponentName getLegacyAssistComponent(int userHandle) { try { userHandle = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userHandle, true, false, "getLegacyAssistComponent", null); IPackageManager pm = AppGlobals.getPackageManager(); Intent assistIntent = new Intent(Intent.ACTION_ASSIST); ResolveInfo info = pm.resolveIntent(assistIntent, assistIntent.resolveTypeIfNeeded(mContext.getContentResolver()), PackageManager.MATCH_DEFAULT_ONLY, userHandle); if (info != null) { Binder.getCallingUid(), userHandle, true, false, "getLegacyAssistComponent", null); PackageManager pm = mContext.getPackageManager(); Intent intentAssistProbe = new Intent(VoiceInteractionService.SERVICE_INTERFACE); List<ResolveInfo> infoListVis = pm.queryIntentServicesAsUser(intentAssistProbe, PackageManager.MATCH_SYSTEM_ONLY, userHandle); if (infoListVis == null || infoListVis.isEmpty()) { return null; } else { ResolveInfo rInfo = infoListVis.get(0); return new ComponentName( info.activityInfo.applicationInfo.packageName, info.activityInfo.name); rInfo.serviceInfo.applicationInfo.packageName, rInfo.serviceInfo.name); } } catch (RemoteException re) { // Local call Log.e(TAG, "RemoteException in getLegacyAssistComponent: " + re); } catch (Exception e) { Log.e(TAG, "Exception in getLegacyAssistComponent: " + e); } Loading @@ -304,9 +304,15 @@ public class SearchManagerService extends ISearchManager.Stub { } long ident = Binder.clearCallingIdentity(); try { Intent intent = new Intent(Intent.ACTION_ASSIST); Intent intent = new Intent(VoiceInteractionService.SERVICE_INTERFACE); intent.setComponent(comp); IActivityManager am = ActivityManager.getService(); if (args != null) { args.putInt(Intent.EXTRA_KEY_EVENT, android.view.KeyEvent.KEYCODE_ASSIST); } intent.putExtras(args); return am.launchAssistIntent(intent, ActivityManager.ASSIST_CONTEXT_BASIC, hint, userHandle, args); } catch (RemoteException e) { Loading Loading
core/java/android/view/KeyEvent.java +4 −1 Original line number Diff line number Diff line Loading @@ -804,8 +804,11 @@ public class KeyEvent extends InputEvent implements Parcelable { public static final int KEYCODE_SYSTEM_NAVIGATION_LEFT = 282; /** Key code constant: Consumed by the system for navigation right */ public static final int KEYCODE_SYSTEM_NAVIGATION_RIGHT = 283; /** Key code constant: Show all apps * @hide */ public static final int KEYCODE_ALL_APPS = 284; private static final int LAST_KEYCODE = KEYCODE_SYSTEM_NAVIGATION_RIGHT; private static final int LAST_KEYCODE = KEYCODE_ALL_APPS; // NOTE: If you add a new keycode here you must also add it to: // isSystem() Loading
core/res/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1888,6 +1888,7 @@ <enum name="KEYCODE_SYSTEM_NAVIGATION_DOWN" value="281" /> <enum name="KEYCODE_SYSTEM_NAVIGATION_LEFT" value="282" /> <enum name="KEYCODE_SYSTEM_NAVIGATION_RIGHT" value="283" /> <enum name="KEYCODE_ALL_APPS" value="284" /> </attr> <!-- ***************************************************************** --> Loading
services/core/java/com/android/server/am/ActivityManagerService.java +17 −11 Original line number Diff line number Diff line Loading @@ -13110,7 +13110,6 @@ public class ActivityManagerService extends IActivityManager.Stub return; } } // We are now ready to launch the assist activity. IResultReceiver sendReceiver = null; Bundle sendBundle = null; Loading Loading @@ -13140,18 +13139,25 @@ public class ActivityManagerService extends IActivityManager.Stub return; } long ident = Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity(); try { if (TextUtils.equals(pae.intent.getAction(), android.service.voice.VoiceInteractionService.SERVICE_INTERFACE)) { pae.intent.putExtras(pae.extras); mContext.startServiceAsUser(pae.intent, new UserHandle(pae.userHandle)); } else { pae.intent.replaceExtras(pae.extras); pae.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); closeSystemDialogs("assist"); try { mContext.startActivityAsUser(pae.intent, new UserHandle(pae.userHandle)); } catch (ActivityNotFoundException e) { Slog.w(TAG, "No activity to handle assist action.", e); } } } finally { Binder.restoreCallingIdentity(ident); }
services/core/java/com/android/server/policy/PhoneWindowManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -835,6 +835,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private static final int MSG_BUGREPORT_TV = 22; private static final int MSG_ACCESSIBILITY_TV = 23; private static final int MSG_DISPATCH_BACK_KEY_TO_AUTOFILL = 24; private static final int MSG_HANDLE_ALL_APPS = 25; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS = 0; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_NAVIGATION = 1; Loading Loading @@ -924,6 +925,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { case MSG_DISPATCH_BACK_KEY_TO_AUTOFILL: mAutofillManagerInternal.onBackKeyPressed(); break; case MSG_HANDLE_ALL_APPS: launchAllAppsAction(); break; } } } Loading Loading @@ -1785,6 +1789,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { private void launchAllAppsAction() { Intent intent = new Intent(Intent.ACTION_ALL_APPS); if (mHasFeatureLeanback) { final PackageManager pm = mContext.getPackageManager(); Intent intentLauncher = new Intent(Intent.ACTION_MAIN); intentLauncher.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = pm.resolveActivityAsUser(intentLauncher, PackageManager.MATCH_SYSTEM_ONLY, mCurrentUserId); if (resolveInfo != null) { intent.setPackage(resolveInfo.activityInfo.packageName); } } startActivityAsUser(intent, UserHandle.CURRENT); } Loading Loading @@ -3620,6 +3635,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (interceptAccessibilityGestureTv()) { return -1; } } else if (keyCode == KeyEvent.KEYCODE_ALL_APPS) { if (!down) { mHandler.removeMessages(MSG_HANDLE_ALL_APPS); Message msg = mHandler.obtainMessage(MSG_HANDLE_ALL_APPS); msg.setAsynchronous(true); msg.sendToTarget(); } return -1; } // Toggle Caps Lock on META-ALT. Loading
services/core/java/com/android/server/search/SearchManagerService.java +22 −16 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.search; import android.app.ActivityManager; import android.app.AppGlobals; import android.app.IActivityManager; import android.app.ISearchManager; import android.app.SearchManager; Loading @@ -26,7 +25,6 @@ import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.ContentObserver; Loading @@ -37,6 +35,7 @@ import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.service.voice.VoiceInteractionService; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -272,24 +271,25 @@ public class SearchManagerService extends ISearchManager.Stub { } } // Check and return VIS component private ComponentName getLegacyAssistComponent(int userHandle) { try { userHandle = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userHandle, true, false, "getLegacyAssistComponent", null); IPackageManager pm = AppGlobals.getPackageManager(); Intent assistIntent = new Intent(Intent.ACTION_ASSIST); ResolveInfo info = pm.resolveIntent(assistIntent, assistIntent.resolveTypeIfNeeded(mContext.getContentResolver()), PackageManager.MATCH_DEFAULT_ONLY, userHandle); if (info != null) { Binder.getCallingUid(), userHandle, true, false, "getLegacyAssistComponent", null); PackageManager pm = mContext.getPackageManager(); Intent intentAssistProbe = new Intent(VoiceInteractionService.SERVICE_INTERFACE); List<ResolveInfo> infoListVis = pm.queryIntentServicesAsUser(intentAssistProbe, PackageManager.MATCH_SYSTEM_ONLY, userHandle); if (infoListVis == null || infoListVis.isEmpty()) { return null; } else { ResolveInfo rInfo = infoListVis.get(0); return new ComponentName( info.activityInfo.applicationInfo.packageName, info.activityInfo.name); rInfo.serviceInfo.applicationInfo.packageName, rInfo.serviceInfo.name); } } catch (RemoteException re) { // Local call Log.e(TAG, "RemoteException in getLegacyAssistComponent: " + re); } catch (Exception e) { Log.e(TAG, "Exception in getLegacyAssistComponent: " + e); } Loading @@ -304,9 +304,15 @@ public class SearchManagerService extends ISearchManager.Stub { } long ident = Binder.clearCallingIdentity(); try { Intent intent = new Intent(Intent.ACTION_ASSIST); Intent intent = new Intent(VoiceInteractionService.SERVICE_INTERFACE); intent.setComponent(comp); IActivityManager am = ActivityManager.getService(); if (args != null) { args.putInt(Intent.EXTRA_KEY_EVENT, android.view.KeyEvent.KEYCODE_ASSIST); } intent.putExtras(args); return am.launchAssistIntent(intent, ActivityManager.ASSIST_CONTEXT_BASIC, hint, userHandle, args); } catch (RemoteException e) { Loading