diff options
-rw-r--r-- | services/core/java/com/android/server/am/BatteryStatsService.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index 905adc0..58665d7 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -982,9 +982,18 @@ public final class BatteryStatsService extends IBatteryStats.Stub if (noOutput) { return; } - if (BatteryStatsHelper.checkWifiOnly(mContext)) { - flags |= BatteryStats.DUMP_DEVICE_WIFI_ONLY; + + long ident = Binder.clearCallingIdentity(); + try { + if (BatteryStatsHelper.checkWifiOnly(mContext)) { + flags |= BatteryStats.DUMP_DEVICE_WIFI_ONLY; + } + // Fetch data from external sources and update the BatteryStatsImpl object with them. + updateExternalStats("dump"); + } finally { + Binder.restoreCallingIdentity(ident); } + if (reqUid >= 0) { // By default, if the caller is only interested in a specific package, then // we only dump the aggregated data since charged. @@ -995,9 +1004,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub } } - // Fetch data from external sources and update the BatteryStatsImpl object with them. - updateExternalStats("dump"); - if (useCheckinFormat) { List<ApplicationInfo> apps = mContext.getPackageManager().getInstalledApplications(0); if (isRealCheckin) { |