OSDN Git Service

Fix an error with hardware keyboard shortcuts
authornyz93 <nyikoszoltan0@gmail.com>
Sat, 13 May 2017 12:35:06 +0000 (14:35 +0200)
committerSimon Shields <simon@lineageos.org>
Wed, 25 Jul 2018 07:42:59 +0000 (09:42 +0200)
Fixes the error which prevents keyboard shortcuts working when there is
no assistant application set up.

Change-Id: I2dd4af332ce58229e22007c154df4d38782d693a

packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java

index 016e1f2..9972d0d 100644 (file)
@@ -420,11 +420,13 @@ public final class KeyboardShortcuts {
         final AssistUtils assistUtils = new AssistUtils(mContext);
         final ComponentName assistComponent = assistUtils.getAssistComponentForUser(userId);
         PackageInfo assistPackageInfo = null;
-        try {
-            assistPackageInfo = mPackageManager.getPackageInfo(
-                    assistComponent.getPackageName(), 0, userId);
-        } catch (RemoteException e) {
-            Log.e(TAG, "PackageManagerService is dead");
+        if (assistComponent != null) {
+            try {
+                assistPackageInfo = mPackageManager.getPackageInfo(
+                        assistComponent.getPackageName(), 0, userId);
+            } catch (RemoteException e) {
+                Log.e(TAG, "PackageManagerService is dead");
+            }
         }
 
         if (assistPackageInfo != null) {