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
This commit is contained in:
Dianne Hackborn
2009-09-02 13:26:28 -07:00
parent 75f1d43b64
commit a34f1ad7c3
6 changed files with 99 additions and 73 deletions

View File

@@ -179,6 +179,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final HashMap<IBinder, ClientState> mClients
= new HashMap<IBinder, ClientState>();
/**
* Set once the system is ready to run third party code.
*/
boolean mSystemReady;
/**
* Id of the currently selected input method.
*/
@@ -508,6 +513,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
public void systemReady() {
synchronized (mMethodMap) {
if (!mSystemReady) {
mSystemReady = true;
startInputInnerLocked();
}
}
}
public List<InputMethodInfo> getInputMethodList() {
@@ -727,6 +738,20 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
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);