- if (wrapper != null) {
- // Contains sipper. Link to Battery Blaming page.
-
- // We're listing by UID rather than package. Check whether the entry has been used
- // before to prevent the same UID from showing up twice.
- if (!wrapper.used()) {
- BatterySipper sipper = wrapper.batterySipper();
- sipper.loadNameAndIcon();
- pref = createRecentLocationEntry(
- getIcon(sipper, ops),
- sipper.getLabel(),
- highBattery,
- new UidEntryClickedListener(sipper));
- wrapper.setUsed();
- }
- } else {
- // No corresponding sipper. Link to App Info page.
-
- // This is grouped by package rather than UID, but that's OK because this branch
- // shouldn't happen in practice.
- try {
- ApplicationInfo appInfo = mPackageManager.getApplicationInfo(
- packageName, PackageManager.GET_META_DATA);
- // Multiple users can install the same package. Each user gets a different Uid for
- // the same package.
- //
- // Here we retrieve the Uid with package name, that will be the Uid for that package
- // associated with the current active user. If the Uid differs from the Uid in ops,
- // that means this entry belongs to another inactive user and we should ignore that.
- if (appInfo.uid == ops.getUid()) {
- pref = createRecentLocationEntry(
- mPackageManager.getApplicationIcon(appInfo),
- mPackageManager.getApplicationLabel(appInfo),
- highBattery,
- new PackageEntryClickedListener(packageName));
- } else if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.v(TAG, "package " + packageName + " with Uid " + ops.getUid() +
- " belongs to another inactive account, ignored.");
- }
- } catch (PackageManager.NameNotFoundException e) {
- Log.wtf(TAG, "Package not found: " + packageName, e);
- }
+ try {
+ ApplicationInfo appInfo = mPackageManager.getApplicationInfo(
+ packageName, PackageManager.GET_META_DATA);
+ // Multiple users can install the same package. Each user gets a different Uid for
+ // the same package.
+ //
+ // Here we retrieve the Uid with package name, that will be the Uid for that package
+ // associated with the current active user. If the Uid differs from the Uid in ops,
+ // that means this entry belongs to another inactive user and we should ignore that.
+ if (appInfo.uid == ops.getUid()) {
+ pref = createRecentLocationEntry(
+ mPackageManager.getApplicationIcon(appInfo),
+ mPackageManager.getApplicationLabel(appInfo),
+ highBattery,
+ new PackageEntryClickedListener(packageName));
+ } else if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "package " + packageName + " with Uid " + ops.getUid() +
+ " belongs to another inactive account, ignored.");
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.wtf(TAG, "Package not found: " + packageName, e);