Merge changes from topic "api-review-result-receiver" am: b7de235729
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2038904 Change-Id: Idddcd7bcbb10e30e477b6fd8e23ea33b2019353a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -560,11 +560,24 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
|
||||
new SynchronousResultReceiver("bluetooth");
|
||||
adapter.requestControllerActivityEnergyInfo(
|
||||
Runnable::run,
|
||||
info -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY,
|
||||
info);
|
||||
resultReceiver.send(0, bundle);
|
||||
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, null);
|
||||
resultReceiver.send(0, bundle);
|
||||
}
|
||||
}
|
||||
);
|
||||
bluetoothReceiver = resultReceiver;
|
||||
|
||||
@@ -1620,10 +1620,24 @@ public class StatsPullAtomService extends SystemService {
|
||||
new SynchronousResultReceiver("bluetooth");
|
||||
adapter.requestControllerActivityEnergyInfo(
|
||||
Runnable::run,
|
||||
info -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, info);
|
||||
bluetoothReceiver.send(0, bundle);
|
||||
new BluetoothAdapter.OnBluetoothActivityEnergyInfoCallback() {
|
||||
@Override
|
||||
public void onBluetoothActivityEnergyInfoAvailable(
|
||||
BluetoothActivityEnergyInfo info) {
|
||||
Bundle bundle = new Bundle();
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user