Properly initialize recognition service if the recognizer component changed.

The getServiceInfo() call directly to IPackageManager does not throw an exception.
The return value needed to be checked for null.

Bug: 8031032
Change-Id: I701b9e8cf3b2406a3b35a486183330489b3d46f5
This commit is contained in:
Amith Yamasani
2013-01-18 11:04:09 -08:00
parent 0cf97d3217
commit 596532d9db

View File

@@ -89,17 +89,15 @@ public class RecognitionManagerService extends Binder {
private void initForUser(int userHandle) {
if (DEBUG) Slog.i(TAG, "initForUser user=" + userHandle);
ComponentName comp = getCurRecognizer(userHandle);
ServiceInfo info = null;
if (comp != null) {
// See if the current recognizer is no longer available.
// See if the current recognizer is still available.
try {
mIPm.getServiceInfo(comp, 0, userHandle);
info = mIPm.getServiceInfo(comp, 0, userHandle);
} catch (RemoteException e) {
comp = findAvailRecognizer(null, userHandle);
if (comp != null) {
setCurRecognizer(comp, userHandle);
}
}
} else {
}
if (info == null) {
comp = findAvailRecognizer(null, userHandle);
if (comp != null) {
setCurRecognizer(comp, userHandle);