Merge "Remove bluetooth state change logging from BatteryStats"

This commit is contained in:
William Escande
2023-05-18 17:38:15 +00:00
committed by Gerrit Code Review
3 changed files with 2 additions and 38 deletions

View File

@@ -520,14 +520,10 @@ public final class BatteryStatsManager {
* @param uid calling package uid * @param uid calling package uid
* @param reason why Bluetooth has been turned on * @param reason why Bluetooth has been turned on
* @param packageName package responsible for this change * @param packageName package responsible for this change
* @Deprecated Bluetooth self report its state and no longer call this
*/ */
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
public void reportBluetoothOn(int uid, int reason, @NonNull String packageName) { public void reportBluetoothOn(int uid, int reason, @NonNull String packageName) {
try {
mBatteryStats.noteBluetoothOn(uid, reason, packageName);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
} }
/** /**
@@ -536,14 +532,10 @@ public final class BatteryStatsManager {
* @param uid calling package uid * @param uid calling package uid
* @param reason why Bluetooth has been turned on * @param reason why Bluetooth has been turned on
* @param packageName package responsible for this change * @param packageName package responsible for this change
* @Deprecated Bluetooth self report its state and no longer call this
*/ */
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
public void reportBluetoothOff(int uid, int reason, @NonNull String packageName) { public void reportBluetoothOff(int uid, int reason, @NonNull String packageName) {
try {
mBatteryStats.noteBluetoothOff(uid, reason, packageName);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
} }
/** /**

View File

@@ -145,8 +145,6 @@ interface IBatteryStats {
long getAwakeTimeBattery(); long getAwakeTimeBattery();
long getAwakeTimePlugged(); long getAwakeTimePlugged();
void noteBluetoothOn(int uid, int reason, String packageName);
void noteBluetoothOff(int uid, int reason, String packageName);
void noteBleScanStarted(in WorkSource ws, boolean isUnoptimized); void noteBleScanStarted(in WorkSource ws, boolean isUnoptimized);
void noteBleScanStopped(in WorkSource ws, boolean isUnoptimized); void noteBleScanStopped(in WorkSource ws, boolean isUnoptimized);
void noteBleScanReset(); void noteBleScanReset();

View File

@@ -1982,32 +1982,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub
} }
} }
/**
* Bluetooth on stat logging
*/
public void noteBluetoothOn(int uid, int reason, String packageName) {
if (Binder.getCallingPid() != Process.myPid()) {
mContext.enforcePermission(android.Manifest.permission.BLUETOOTH_CONNECT,
Binder.getCallingPid(), uid, null);
}
FrameworkStatsLog.write_non_chained(FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED,
uid, null, FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED__STATE__ENABLED,
reason, packageName);
}
/**
* Bluetooth off stat logging
*/
public void noteBluetoothOff(int uid, int reason, String packageName) {
if (Binder.getCallingPid() != Process.myPid()) {
mContext.enforcePermission(android.Manifest.permission.BLUETOOTH_CONNECT,
Binder.getCallingPid(), uid, null);
}
FrameworkStatsLog.write_non_chained(FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED,
uid, null, FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED__STATE__DISABLED,
reason, packageName);
}
@Override @Override
public void noteBleScanStarted(final WorkSource ws, final boolean isUnoptimized) { public void noteBleScanStarted(final WorkSource ws, final boolean isUnoptimized) {
enforceCallingPermission(); enforceCallingPermission();