Fiddle system boot ordering.
This makes the system a little more careful to not start third party
code until it is ready to.
Also fix a little bug in SyncManager that would cause it to crash
during boot if sync was in a failure state.
Change-Id: Ib2d287d8441d155d393fe740a5f98690895fd358
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 4198154..3c37b49 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -180,6 +180,11 @@
= new HashMap<IBinder, ClientState>();
/**
+ * Set once the system is ready to run third party code.
+ */
+ boolean mSystemReady;
+
+ /**
* Id of the currently selected input method.
*/
String mCurMethodId;
@@ -508,6 +513,12 @@
}
public void systemReady() {
+ synchronized (mMethodMap) {
+ if (!mSystemReady) {
+ mSystemReady = true;
+ startInputInnerLocked();
+ }
+ }
}
public List<InputMethodInfo> getInputMethodList() {
@@ -727,6 +738,20 @@
}
}
+ return startInputInnerLocked();
+ }
+
+ InputBindResult startInputInnerLocked() {
+ if (mCurMethodId == null) {
+ return mNoBinding;
+ }
+
+ if (!mSystemReady) {
+ // If the system is not yet ready, we shouldn't be running third
+ // party code.
+ return new InputBindResult(null, mCurId, mCurSeq);
+ }
+
InputMethodInfo info = mMethodMap.get(mCurMethodId);
if (info == null) {
throw new IllegalArgumentException("Unknown id: " + mCurMethodId);