Merge "Logs hearing aid information when a hearing aid is bonded" into tm-qpr-dev
This commit is contained in:
@@ -28,6 +28,7 @@ import static com.android.settings.accessibility.TextReadingPreferenceFragment.R
|
|||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
|
||||||
|
import com.android.internal.util.FrameworkStatsLog;
|
||||||
import com.android.settings.core.instrumentation.SettingsStatsLog;
|
import com.android.settings.core.instrumentation.SettingsStatsLog;
|
||||||
|
|
||||||
/** Methods for logging accessibility states. */
|
/** 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;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,8 +29,11 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.settings.R;
|
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.BluetoothDeviceFilter;
|
||||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||||
|
import com.android.settingslib.bluetooth.HearingAidStatsLogUtils;
|
||||||
import com.android.settingslib.search.Indexable;
|
import com.android.settingslib.search.Indexable;
|
||||||
import com.android.settingslib.widget.FooterPreference;
|
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.
|
// If one device is connected(bonded), then close this fragment.
|
||||||
finish();
|
finish();
|
||||||
return;
|
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) {
|
if (mSelectedDevice != null && cachedDevice != null) {
|
||||||
BluetoothDevice device = cachedDevice.getDevice();
|
BluetoothDevice device = cachedDevice.getDevice();
|
||||||
|
Reference in New Issue
Block a user