Merge "Update logs for BluetoothDetailsHearingAidsPresetsController" into main

This commit is contained in:
Treehugger Robot
2024-04-24 02:15:19 +00:00
committed by Android (Google) Code Review

View File

@@ -199,10 +199,8 @@ public class BluetoothDetailsHearingAidsPresetsController extends
@Override @Override
public void onPresetSelectionFailed(@NonNull BluetoothDevice device, int reason) { public void onPresetSelectionFailed(@NonNull BluetoothDevice device, int reason) {
if (device.equals(mCachedDevice.getDevice())) { if (device.equals(mCachedDevice.getDevice())) {
if (DEBUG) { Log.w(TAG, "onPresetSelectionFailed, device: " + device.getAddress()
Log.d(TAG, "onPresetSelectionFailed, device: " + device.getAddress() + ", reason: " + reason);
+ ", reason: " + reason);
}
mContext.getMainExecutor().execute(() -> { mContext.getMainExecutor().execute(() -> {
refresh(); refresh();
showErrorToast(); showErrorToast();
@@ -213,10 +211,8 @@ public class BluetoothDetailsHearingAidsPresetsController extends
@Override @Override
public void onPresetSelectionForGroupFailed(int hapGroupId, int reason) { public void onPresetSelectionForGroupFailed(int hapGroupId, int reason) {
if (hapGroupId == mHapClientProfile.getHapGroup(mCachedDevice.getDevice())) { if (hapGroupId == mHapClientProfile.getHapGroup(mCachedDevice.getDevice())) {
if (DEBUG) { Log.w(TAG, "onPresetSelectionForGroupFailed, group: " + hapGroupId
Log.d(TAG, "onPresetSelectionForGroupFailed, group: " + hapGroupId + ", reason: " + reason);
+ ", reason: " + reason);
}
// Try to set the preset independently if group operation failed // Try to set the preset independently if group operation failed
if (mPreference != null) { if (mPreference != null) {
selectPresetIndependently(Integer.parseInt(mPreference.getValue())); selectPresetIndependently(Integer.parseInt(mPreference.getValue()));
@@ -242,11 +238,8 @@ public class BluetoothDetailsHearingAidsPresetsController extends
@Override @Override
public void onSetPresetNameFailed(@NonNull BluetoothDevice device, int reason) { public void onSetPresetNameFailed(@NonNull BluetoothDevice device, int reason) {
if (device.equals(mCachedDevice.getDevice())) { if (device.equals(mCachedDevice.getDevice())) {
if (DEBUG) { Log.w(TAG, "onSetPresetNameFailed, device: " + device.getAddress()
Log.d(TAG, + ", reason: " + reason);
"onSetPresetNameFailed, device: " + device.getAddress()
+ ", reason: " + reason);
}
mContext.getMainExecutor().execute(() -> { mContext.getMainExecutor().execute(() -> {
refresh(); refresh();
showErrorToast(); showErrorToast();
@@ -257,10 +250,8 @@ public class BluetoothDetailsHearingAidsPresetsController extends
@Override @Override
public void onSetPresetNameForGroupFailed(int hapGroupId, int reason) { public void onSetPresetNameForGroupFailed(int hapGroupId, int reason) {
if (hapGroupId == mHapClientProfile.getHapGroup(mCachedDevice.getDevice())) { if (hapGroupId == mHapClientProfile.getHapGroup(mCachedDevice.getDevice())) {
if (DEBUG) { Log.w(TAG, "onSetPresetNameForGroupFailed, group: " + hapGroupId
Log.d(TAG, "onSetPresetNameForGroupFailed, group: " + hapGroupId + ", reason: " + reason);
+ ", reason: " + reason);
}
mContext.getMainExecutor().execute(() -> { mContext.getMainExecutor().execute(() -> {
refresh(); refresh();
showErrorToast(); showErrorToast();
@@ -288,9 +279,6 @@ public class BluetoothDetailsHearingAidsPresetsController extends
for (int i = 0; i < infoList.size(); i++) { for (int i = 0; i < infoList.size(); i++) {
presetNames[i] = infoList.get(i).getName(); presetNames[i] = infoList.get(i).getName();
presetIndexes[i] = Integer.toString(infoList.get(i).getIndex()); presetIndexes[i] = Integer.toString(infoList.get(i).getIndex());
if (DEBUG) {
Log.d(TAG, "loadAllPresetInfo, preset " + presetIndexes[i] + ": " + presetNames[i]);
}
} }
mPreference.setEntries(presetNames); mPreference.setEntries(presetNames);
mPreference.setEntryValues(presetIndexes); mPreference.setEntryValues(presetIndexes);