Loading core/java/com/android/internal/app/IBatteryStats.aidl +0 −7 Original line number Diff line number Diff line Loading @@ -68,13 +68,6 @@ interface IBatteryStats { @EnforcePermission("BATTERY_STATS") List<BatteryUsageStats> getBatteryUsageStats(in List<BatteryUsageStatsQuery> queries); @UnsupportedAppUsage @EnforcePermission("BATTERY_STATS") byte[] getStatistics(); @EnforcePermission("BATTERY_STATS") ParcelFileDescriptor getStatisticsStream(boolean updateAll); // Return true if we see the battery as currently charging. @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) @RequiresNoPermission Loading services/core/java/com/android/server/am/BatteryStatsService.java +0 −51 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.os.HandlerThread; import android.os.IBinder; import android.os.INetworkManagementService; import android.os.Parcel; import android.os.ParcelFileDescriptor; import android.os.ParcelFormatException; import android.os.PowerManager.ServiceType; import android.os.PowerManagerInternal; Loading Loading @@ -728,56 +727,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub return mBatteryUsageStatsProvider.getBatteryUsageStats(queries); } @Override @EnforcePermission(BATTERY_STATS) public byte[] getStatistics() { //Slog.i("foo", "SENDING BATTERY INFO:"); //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM)); Parcel out = Parcel.obtain(); // Drain the handler queue to make sure we've handled all pending works, so we'll get // an accurate stats. awaitCompletion(); syncStats("get-stats", BatteryExternalStatsWorker.UPDATE_ALL); synchronized (mStats) { mStats.writeToParcel(out, 0); } byte[] data = out.marshall(); out.recycle(); return data; } /** * Returns parceled BatteryStats as a MemoryFile. * * @param forceUpdate If true, runs a sync to get fresh battery stats. Otherwise, * returns the current values. */ @Override @EnforcePermission(BATTERY_STATS) public ParcelFileDescriptor getStatisticsStream(boolean forceUpdate) { //Slog.i("foo", "SENDING BATTERY INFO:"); //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM)); Parcel out = Parcel.obtain(); if (forceUpdate) { // Drain the handler queue to make sure we've handled all pending works, so we'll get // an accurate stats. awaitCompletion(); syncStats("get-stats", BatteryExternalStatsWorker.UPDATE_ALL); } synchronized (mStats) { mStats.writeToParcel(out, 0); } byte[] data = out.marshall(); if (DBG) Slog.d(TAG, "getStatisticsStream parcel size is:" + data.length); out.recycle(); try { return ParcelFileDescriptor.fromData(data, "battery-stats"); } catch (IOException e) { Slog.w(TAG, "Unable to create shared memory", e); return null; } } /** Register callbacks for statsd pulled atoms. */ private void registerStatsCallbacks() { final StatsManager statsManager = mContext.getSystemService(StatsManager.class); Loading Loading
core/java/com/android/internal/app/IBatteryStats.aidl +0 −7 Original line number Diff line number Diff line Loading @@ -68,13 +68,6 @@ interface IBatteryStats { @EnforcePermission("BATTERY_STATS") List<BatteryUsageStats> getBatteryUsageStats(in List<BatteryUsageStatsQuery> queries); @UnsupportedAppUsage @EnforcePermission("BATTERY_STATS") byte[] getStatistics(); @EnforcePermission("BATTERY_STATS") ParcelFileDescriptor getStatisticsStream(boolean updateAll); // Return true if we see the battery as currently charging. @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) @RequiresNoPermission Loading
services/core/java/com/android/server/am/BatteryStatsService.java +0 −51 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.os.HandlerThread; import android.os.IBinder; import android.os.INetworkManagementService; import android.os.Parcel; import android.os.ParcelFileDescriptor; import android.os.ParcelFormatException; import android.os.PowerManager.ServiceType; import android.os.PowerManagerInternal; Loading Loading @@ -728,56 +727,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub return mBatteryUsageStatsProvider.getBatteryUsageStats(queries); } @Override @EnforcePermission(BATTERY_STATS) public byte[] getStatistics() { //Slog.i("foo", "SENDING BATTERY INFO:"); //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM)); Parcel out = Parcel.obtain(); // Drain the handler queue to make sure we've handled all pending works, so we'll get // an accurate stats. awaitCompletion(); syncStats("get-stats", BatteryExternalStatsWorker.UPDATE_ALL); synchronized (mStats) { mStats.writeToParcel(out, 0); } byte[] data = out.marshall(); out.recycle(); return data; } /** * Returns parceled BatteryStats as a MemoryFile. * * @param forceUpdate If true, runs a sync to get fresh battery stats. Otherwise, * returns the current values. */ @Override @EnforcePermission(BATTERY_STATS) public ParcelFileDescriptor getStatisticsStream(boolean forceUpdate) { //Slog.i("foo", "SENDING BATTERY INFO:"); //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM)); Parcel out = Parcel.obtain(); if (forceUpdate) { // Drain the handler queue to make sure we've handled all pending works, so we'll get // an accurate stats. awaitCompletion(); syncStats("get-stats", BatteryExternalStatsWorker.UPDATE_ALL); } synchronized (mStats) { mStats.writeToParcel(out, 0); } byte[] data = out.marshall(); if (DBG) Slog.d(TAG, "getStatisticsStream parcel size is:" + data.length); out.recycle(); try { return ParcelFileDescriptor.fromData(data, "battery-stats"); } catch (IOException e) { Slog.w(TAG, "Unable to create shared memory", e); return null; } } /** Register callbacks for statsd pulled atoms. */ private void registerStatsCallbacks() { final StatsManager statsManager = mContext.getSystemService(StatsManager.class); Loading