Add logging to Bluetooth settings.
- Add logging when users selects the listed devices to connect or disconnect, and when connection error is shown - Update the event for the top level bluetooth master switch toggle to have its own event. Change-Id: I58f21256fdd07fad9d733ff987ff38df1148f4f8 Fix: 35065258 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -34,7 +34,10 @@ import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.Index;
|
||||
import com.android.settings.search.SearchIndexableRaw;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
@@ -205,11 +208,20 @@ public final class BluetoothDevicePreference extends Preference implements
|
||||
void onClicked() {
|
||||
int bondState = mCachedDevice.getBondState();
|
||||
|
||||
final MetricsFeatureProvider metricsFeatureProvider =
|
||||
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
|
||||
|
||||
if (mCachedDevice.isConnected()) {
|
||||
metricsFeatureProvider.action(getContext(),
|
||||
MetricsEvent.ACTION_SETTINGS_BLUETOOTH_DISCONNECT);
|
||||
askDisconnect();
|
||||
} else if (bondState == BluetoothDevice.BOND_BONDED) {
|
||||
metricsFeatureProvider.action(getContext(),
|
||||
MetricsEvent.ACTION_SETTINGS_BLUETOOTH_CONNECT);
|
||||
mCachedDevice.connect(true);
|
||||
} else if (bondState == BluetoothDevice.BOND_NONE) {
|
||||
metricsFeatureProvider.action(getContext(),
|
||||
MetricsEvent.ACTION_SETTINGS_BLUETOOTH_PAIR);
|
||||
pair();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user