am ede3db51: Merge "Fix a crash on a secondary user" into jb-mr2-dev
* commit 'ede3db51f0fb16559c27aa29a7cf07784bb9431c': Fix a crash on a secondary usermain
commit
e2bee5b134
|
@ -54,6 +54,13 @@ public final class RichInputMethodManager {
|
||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Caveat: This may cause IPC
|
||||||
|
public static boolean isInputMethodManagerValidForUserOfThisProcess(final Context context) {
|
||||||
|
// Basically called to check whether this IME has been triggered by the current user or not
|
||||||
|
return !((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).
|
||||||
|
getInputMethodList().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public static void init(final Context context) {
|
public static void init(final Context context) {
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
sInstance.initInternal(context, prefs);
|
sInstance.initInternal(context, prefs);
|
||||||
|
|
|
@ -68,8 +68,15 @@ public final class LauncherIconVisibilityManager extends BroadcastReceiver {
|
||||||
// 1) the package has been re-installed, 2) the device has been booted,
|
// 1) the package has been re-installed, 2) the device has been booted,
|
||||||
// 3) a multiuser has been created.
|
// 3) a multiuser has been created.
|
||||||
// There is no good reason to keep the process alive if this IME isn't a current IME.
|
// There is no good reason to keep the process alive if this IME isn't a current IME.
|
||||||
RichInputMethodManager.init(context);
|
final boolean isCurrentImeOfCurrentUser;
|
||||||
if (!SetupActivity.isThisImeCurrent(context)) {
|
if (RichInputMethodManager.isInputMethodManagerValidForUserOfThisProcess(context)) {
|
||||||
|
RichInputMethodManager.init(context);
|
||||||
|
isCurrentImeOfCurrentUser = SetupActivity.isThisImeCurrent(context);
|
||||||
|
} else {
|
||||||
|
isCurrentImeOfCurrentUser = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isCurrentImeOfCurrentUser) {
|
||||||
final int myPid = Process.myPid();
|
final int myPid = Process.myPid();
|
||||||
Log.i(TAG, "Killing my process: pid=" + myPid);
|
Log.i(TAG, "Killing my process: pid=" + myPid);
|
||||||
Process.killProcess(myPid);
|
Process.killProcess(myPid);
|
||||||
|
|
Loading…
Reference in New Issue