summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2013-01-18 11:04:09 -0800
committerAmith Yamasani <yamasani@google.com>2013-01-22 15:35:49 -0800
commit596532d9dbea3460dbc989b0316c721ca69f4915 (patch)
tree6d55cb09d7ab6342ab3e001cdabd2f9c613da324 /services
parent0cf97d32178b689184866e731c0a4105d8223d80 (diff)
downloadframeworks_base-596532d9dbea3460dbc989b0316c721ca69f4915.zip
frameworks_base-596532d9dbea3460dbc989b0316c721ca69f4915.tar.gz
frameworks_base-596532d9dbea3460dbc989b0316c721ca69f4915.tar.bz2
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
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/RecognitionManagerService.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/services/java/com/android/server/RecognitionManagerService.java b/services/java/com/android/server/RecognitionManagerService.java
index 1e0755d..c2e749d 100644
--- a/services/java/com/android/server/RecognitionManagerService.java
+++ b/services/java/com/android/server/RecognitionManagerService.java
@@ -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);