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

Commit ab2d54ca authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Automerger Merge Worker
Browse files

Merge changes from topic "api-review-result-receiver" am: b7de2357 am: 9fd8b341 am: e238a492

parents 9ab5b436 e238a492
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -565,12 +565,25 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
                        new SynchronousResultReceiver("bluetooth");
                adapter.requestControllerActivityEnergyInfo(
                        Runnable::run,
                        info -> {
                        new BluetoothAdapter.OnBluetoothActivityEnergyInfoCallback() {
                            @Override
                            public void onBluetoothActivityEnergyInfoAvailable(
                                    BluetoothActivityEnergyInfo info) {
                                Bundle bundle = new Bundle();
                                bundle.putParcelable(
                                        BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, info);
                                resultReceiver.send(0, bundle);
                            }

                            @Override
                            public void onBluetoothActivityEnergyInfoError(int errorCode) {
                                Slog.w(TAG, "error reading Bluetooth stats: " + errorCode);
                                Bundle bundle = new Bundle();
                            bundle.putParcelable(BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY,
                                    info);
                                bundle.putParcelable(
                                        BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, null);
                                resultReceiver.send(0, bundle);
                            }
                        }
                );
                bluetoothReceiver = resultReceiver;
            }
+18 −4
Original line number Diff line number Diff line
@@ -1635,11 +1635,25 @@ public class StatsPullAtomService extends SystemService {
                    new SynchronousResultReceiver("bluetooth");
            adapter.requestControllerActivityEnergyInfo(
                    Runnable::run,
                    info -> {
                    new BluetoothAdapter.OnBluetoothActivityEnergyInfoCallback() {
                        @Override
                        public void onBluetoothActivityEnergyInfoAvailable(
                                BluetoothActivityEnergyInfo info) {
                            Bundle bundle = new Bundle();
                        bundle.putParcelable(BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, info);
                            bundle.putParcelable(
                                    BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, info);
                            bluetoothReceiver.send(0, bundle);
                        }

                        @Override
                        public void onBluetoothActivityEnergyInfoError(int errorCode) {
                            Slog.w(TAG, "error reading Bluetooth stats: " + errorCode);
                            Bundle bundle = new Bundle();
                            bundle.putParcelable(
                                    BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, null);
                            bluetoothReceiver.send(0, bundle);
                        }
                    }
            );
            return awaitControllerInfo(bluetoothReceiver);
        } else {