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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user