OSDN Git Service

Fix NullPointerException at RunningState
authorJohan Redestig <johan.redestig@sonymobile.com>
Fri, 5 Oct 2012 08:33:16 +0000 (10:33 +0200)
committerThe Android Automerger <android-build@android.com>
Wed, 19 Jun 2013 02:11:30 +0000 (19:11 -0700)
getServiceInfo returns null if you have a service defined in the
manifest as: <service android:name=".Xxx" android:exported="false" />
or and in an <application> with no label or icon.
Dont crash the Settings application because of that.

Change-Id: I6f9f69c130e610b7e4ab66426177b7bade1e1515

src/com/android/settings/applications/RunningState.java

index 5797dfa..d373fdd 100644 (file)
@@ -462,6 +462,12 @@ public class RunningState {
                     si.mServiceInfo = ActivityThread.getPackageManager().getServiceInfo(
                             service.service, PackageManager.GET_UNINSTALLED_PACKAGES,
                             UserHandle.getUserId(service.uid));
+
+                    if (si.mServiceInfo == null) {
+                        Log.d("RunningService", "getServiceInfo returned null for: "
+                                + service.service);
+                        return false;
+                    }
                 } catch (RemoteException e) {
                 }
                 si.mDisplayLabel = makeLabel(pm,