Skip to content

Commit 914450f

Browse files
neobuddy89darknius09
authored andcommitted
InputMethodUtils: Fix system bootloop when no IME found
* In case of faulty gapps, there are no default IME left on the system. This shouldn't be situation where user cannot boot at all. * Handle InputMethodUtils to prevent PackageManagerService crashing system. Log: 12-31 23:07:42.668 2559 2559 E System : ****************************************** 12-31 23:07:42.668 2559 2559 E System : ************ Failure starting system services 12-31 23:07:42.668 2559 2559 E System : java.lang.RuntimeException: Failed to boot service com.android.server.inputmethod.InputMethodManagerService$Lifecycle: onBootPhase threw an exception during phase 550 12-31 23:07:42.668 2559 2559 E System : at com.android.server.SystemServiceManager.startBootPhase(SystemServiceManager.java:211) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.SystemServer.lambda$startOtherServices$6$SystemServer(SystemServer.java:2294) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.SystemServer$$ExternalSyntheticLambda4.run(Unknown Source:30) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.am.ActivityManagerService.systemReady(ActivityManagerService.java:9653) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.SystemServer.startOtherServices(SystemServer.java:2291) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.SystemServer.run(SystemServer.java:608) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.SystemServer.main(SystemServer.java:424) 12-31 23:07:42.668 2559 2559 E System : at java.lang.reflect.Method.invoke(Native Method) 12-31 23:07:42.668 2559 2559 E System : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 12-31 23:07:42.668 2559 2559 E System : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925) 12-31 23:07:42.668 2559 2559 E System : Caused by: java.lang.IllegalArgumentException: Unknown package: com.google.android.inputmethod.latin 12-31 23:07:42.668 2559 2559 E System : at com.android.server.pm.PackageManagerService.getApplicationEnabledSetting(PackageManagerService.java:21539) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.inputmethod.InputMethodUtils.setDisabledUntilUsed(InputMethodUtils.java:681) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.inputmethod.InputMethodUtils.setNonSelectedSystemImesDisabledUntilUsed(InputMethodUtils.java:673) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.inputmethod.InputMethodManagerService.systemRunning(InputMethodManagerService.java:1913) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.inputmethod.InputMethodManagerService$Lifecycle.onBootPhase(InputMethodManagerService.java:1636) 12-31 23:07:42.668 2559 2559 E System : at com.android.server.SystemServiceManager.startBootPhase(SystemServiceManager.java:208) 12-31 23:07:42.668 2559 2559 E System : ... 9 more 12-31 23:07:42.668 2559 2559 E Zygote : System zygote died with exception 12-31 23:07:42.668 2559 2559 E Zygote : java.lang.RuntimeException: Failed to boot service com.android.server.inputmethod.InputMethodManagerService$Lifecycle: onBootPhase threw an exception during phase 550 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.SystemServiceManager.startBootPhase(SystemServiceManager.java:211) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.SystemServer.lambda$startOtherServices$6$SystemServer(SystemServer.java:2294) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.SystemServer$$ExternalSyntheticLambda4.run(Unknown Source:30) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.am.ActivityManagerService.systemReady(ActivityManagerService.java:9653) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.SystemServer.startOtherServices(SystemServer.java:2291) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.SystemServer.run(SystemServer.java:608) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.SystemServer.main(SystemServer.java:424) 12-31 23:07:42.668 2559 2559 E Zygote : at java.lang.reflect.Method.invoke(Native Method) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925) 12-31 23:07:42.668 2559 2559 E Zygote : Caused by: java.lang.IllegalArgumentException: Unknown package: com.google.android.inputmethod.latin 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.pm.PackageManagerService.getApplicationEnabledSetting(PackageManagerService.java:21539) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.inputmethod.InputMethodUtils.setDisabledUntilUsed(InputMethodUtils.java:681) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.inputmethod.InputMethodUtils.setNonSelectedSystemImesDisabledUntilUsed(InputMethodUtils.java:673) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.inputmethod.InputMethodManagerService.systemRunning(InputMethodManagerService.java:1913) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.inputmethod.InputMethodManagerService$Lifecycle.onBootPhase(InputMethodManagerService.java:1636) 12-31 23:07:42.668 2559 2559 E Zygote : at com.android.server.SystemServiceManager.startBootPhase(SystemServiceManager.java:208) 12-31 23:07:42.668 2559 2559 E Zygote : ... 9 more 12-31 23:07:42.668 2559 2559 D AndroidRuntime: Shutting down VM 12-31 23:07:42.669 2559 2559 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main 12-31 23:07:42.669 2559 2559 E AndroidRuntime: java.lang.RuntimeException: Failed to boot service com.android.server.inputmethod.InputMethodManagerService$Lifecycle: onBootPhase threw an exception during phase 550 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.SystemServiceManager.startBootPhase(SystemServiceManager.java:211) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.SystemServer.lambda$startOtherServices$6$SystemServer(SystemServer.java:2294) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.SystemServer$$ExternalSyntheticLambda4.run(Unknown Source:30) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.am.ActivityManagerService.systemReady(ActivityManagerService.java:9653) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.SystemServer.startOtherServices(SystemServer.java:2291) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.SystemServer.run(SystemServer.java:608) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.SystemServer.main(SystemServer.java:424) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unknown package: com.google.android.inputmethod.latin 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.pm.PackageManagerService.getApplicationEnabledSetting(PackageManagerService.java:21539) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.inputmethod.InputMethodUtils.setDisabledUntilUsed(InputMethodUtils.java:681) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.inputmethod.InputMethodUtils.setNonSelectedSystemImesDisabledUntilUsed(InputMethodUtils.java:673) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.inputmethod.InputMethodManagerService.systemRunning(InputMethodManagerService.java:1913) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.inputmethod.InputMethodManagerService$Lifecycle.onBootPhase(InputMethodManagerService.java:1636) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: at com.android.server.SystemServiceManager.startBootPhase(SystemServiceManager.java:208) 12-31 23:07:42.669 2559 2559 E AndroidRuntime: ... 9 more Signed-off-by: Pranav Vashi <[email protected]>
1 parent 685b9d8 commit 914450f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/core/java/com/android/server/inputmethod/InputMethodUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ private static void setDisabledUntilUsed(IPackageManager packageManager, String
679679
final int state;
680680
try {
681681
state = packageManager.getApplicationEnabledSetting(packageName, userId);
682-
} catch (RemoteException e) {
682+
} catch (Exception e) {
683683
Slog.w(TAG, "getApplicationEnabledSetting failed. packageName=" + packageName
684684
+ " userId=" + userId, e);
685685
return;
@@ -693,7 +693,7 @@ private static void setDisabledUntilUsed(IPackageManager packageManager, String
693693
packageManager.setApplicationEnabledSetting(packageName,
694694
PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
695695
0 /* newState */, userId, callingPackage);
696-
} catch (RemoteException e) {
696+
} catch (Exception e) {
697697
Slog.w(TAG, "setApplicationEnabledSetting failed. packageName=" + packageName
698698
+ " userId=" + userId + " callingPackage=" + callingPackage, e);
699699
return;

0 commit comments

Comments
 (0)