Merge "Maybe fix needing wifi permission to dump battery stats."
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 @@
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 @@
}
}
- // 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) {