Snap for 9077201 from 4313b81f57 to tm-qpr1-release

Change-Id: I76bc4ac28a2b7d39905223090fb0a1de6fe39ddd
This commit is contained in:
Android Build Coastguard Worker
2022-09-18 00:45:28 +00:00
2 changed files with 33 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ import static com.android.settings.accessibility.TextReadingPreferenceFragment.R
import android.content.ComponentName;
import com.android.internal.util.FrameworkStatsLog;
import com.android.settings.core.instrumentation.SettingsStatsLog;
/** Methods for logging accessibility states. */
@@ -112,4 +113,26 @@ public final class AccessibilityStatsLogUtils {
return SettingsStatsLog.ACCESSIBILITY_TEXT_READING_OPTIONS_CHANGED__ENTRY_POINT__TEXT_READING_UNKNOWN_ENTRY;
}
}
/**
* Converts the entering page id where the hearing aid binding process starts for logging.
*
* @param pageId the entry page id where the hearing aid binding process starts
* @return the int value for logging mapped from some page ids defined in
* {@link SettingsStatsLog}
*/
public static int convertToHearingAidInfoBondEntry(int pageId) {
switch (pageId) {
case SettingsStatsLog.SETTINGS_UICHANGED__PAGE_ID__SETTINGS_CONNECTED_DEVICE_CATEGORY:
return FrameworkStatsLog.HEARING_AID_INFO_REPORTED__BOND_ENTRY__CONNECTED_DEVICES;
case SettingsStatsLog.SETTINGS_UICHANGED__PAGE_ID__DIALOG_ACCESSIBILITY_HEARINGAID:
return FrameworkStatsLog.HEARING_AID_INFO_REPORTED__BOND_ENTRY__ACCESSIBILITY_HEARING_AIDS;
case SettingsStatsLog.SETTINGS_UICHANGED__PAGE_ID__DIALOG_ACCESSIBILITY_HEARING_AID_PAIR_ANOTHER:
return FrameworkStatsLog.HEARING_AID_INFO_REPORTED__BOND_ENTRY__ACCESSIBILITY_HEARING_AID_PAIR_ANOTHER;
case SettingsStatsLog.SETTINGS_UICHANGED__PAGE_ID__BLUETOOTH_FRAGMENT:
return FrameworkStatsLog.HEARING_AID_INFO_REPORTED__BOND_ENTRY__BLUETOOTH;
default:
return FrameworkStatsLog.HEARING_AID_INFO_REPORTED__BOND_ENTRY__PAGE_UNKNOWN;
}
}
}

View File

@@ -29,8 +29,11 @@ import android.widget.Toast;
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.accessibility.AccessibilityStatsLogUtils;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.bluetooth.BluetoothDeviceFilter;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.HearingAidStatsLogUtils;
import com.android.settingslib.search.Indexable;
import com.android.settingslib.widget.FooterPreference;
@@ -179,6 +182,13 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
// If one device is connected(bonded), then close this fragment.
finish();
return;
} else if (bondState == BluetoothDevice.BOND_BONDING) {
// Set the bond entry where binding process starts for logging hearing aid device info
final int pageId = FeatureFactory.getFactory(
getContext()).getMetricsFeatureProvider().getAttribution(getActivity());
final int bondEntry = AccessibilityStatsLogUtils.convertToHearingAidInfoBondEntry(
pageId);
HearingAidStatsLogUtils.setBondEntryForDevice(bondEntry, cachedDevice);
}
if (mSelectedDevice != null && cachedDevice != null) {
BluetoothDevice device = cachedDevice.getDevice();