Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c7dbeba authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "Remove bluetooth state change logging from BatteryStats"

parents 3c0960d6 5ae39ab8
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -520,14 +520,10 @@ public final class BatteryStatsManager {
     * @param uid calling package uid
     * @param reason why Bluetooth has been turned on
     * @param packageName package responsible for this change
     * @Deprecated Bluetooth self report its state and no longer call this
     */
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    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 reason why Bluetooth has been turned on
     * @param packageName package responsible for this change
     * @Deprecated Bluetooth self report its state and no longer call this
     */
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    public void reportBluetoothOff(int uid, int reason, @NonNull String packageName) {
        try {
            mBatteryStats.noteBluetoothOff(uid, reason, packageName);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }

    /**
+0 −2
Original line number Diff line number Diff line
@@ -145,8 +145,6 @@ interface IBatteryStats {
    long getAwakeTimeBattery();
    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 noteBleScanStopped(in WorkSource ws, boolean isUnoptimized);
    void noteBleScanReset();
+0 −26
Original line number Diff line number Diff line
@@ -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
    public void noteBleScanStarted(final WorkSource ws, final boolean isUnoptimized) {
        enforceCallingPermission();