Access IMMS#mSettings only inside the lock
This is a preparation CL before addresssing Bug 35361128. IMMS.MyPackageMonitor#isChangingPackagesOfCurrentUser() needs to be called after taking a lock for IMMS#mMethodMap because it internally relies on InputMethodManagerService#mSettings. Test: Made sure that the device can boot and the IME is available. Bug: 35361128 Change-Id: I66752a275f20f6ba33bc211ffb8d6fd269250c0d
This commit is contained in:
@@ -727,7 +727,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
mPackagesToMonitorComponentChange.add(packageName);
|
||||
}
|
||||
|
||||
private boolean isChangingPackagesOfCurrentUser() {
|
||||
@GuardedBy("mMethodMap")
|
||||
private boolean isChangingPackagesOfCurrentUserLocked() {
|
||||
final int userId = getChangingUserId();
|
||||
final boolean retval = userId == mSettings.getCurrentUserId();
|
||||
if (DEBUG) {
|
||||
@@ -740,10 +741,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
|
||||
@Override
|
||||
public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) {
|
||||
if (!isChangingPackagesOfCurrentUser()) {
|
||||
return false;
|
||||
}
|
||||
synchronized (mMethodMap) {
|
||||
if (!isChangingPackagesOfCurrentUserLocked()) {
|
||||
return false;
|
||||
}
|
||||
String curInputMethodId = mSettings.getSelectedInputMethod();
|
||||
final int N = mMethodList.size();
|
||||
if (curInputMethodId != null) {
|
||||
@@ -777,10 +778,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
|
||||
@Override
|
||||
public void onSomePackagesChanged() {
|
||||
if (!isChangingPackagesOfCurrentUser()) {
|
||||
return;
|
||||
}
|
||||
synchronized (mMethodMap) {
|
||||
if (!isChangingPackagesOfCurrentUserLocked()) {
|
||||
return;
|
||||
}
|
||||
InputMethodInfo curIm = null;
|
||||
String curInputMethodId = mSettings.getSelectedInputMethod();
|
||||
final int N = mMethodList.size();
|
||||
|
||||
Reference in New Issue
Block a user