Add connect / disconnect action when connect / disconnect to bluetooth device

Bug: 215299757
Test: build pass
Change-Id: Ib6fd592f63d4035674dc60cd54f16ffd5550ecff
This commit is contained in:
Hugh Chen
2022-01-19 08:09:35 +00:00
parent 1002473fc2
commit 8849628106
3 changed files with 18 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.bluetooth;
import android.app.settings.SettingsEnums;
import android.content.Context;
import androidx.preference.PreferenceFragmentCompat;
@@ -70,7 +71,11 @@ public class BluetoothDetailsButtonsController extends BluetoothDetailsControlle
mActionButtons
.setButton2Text(R.string.bluetooth_device_context_disconnect)
.setButton2Icon(R.drawable.ic_settings_close)
.setButton2OnClickListener(view -> mCachedDevice.disconnect());
.setButton2OnClickListener(view -> {
mMetricsFeatureProvider.action(mContext,
SettingsEnums.ACTION_SETTINGS_BLUETOOTH_DISCONNECT);
mCachedDevice.disconnect();
});
mConnectButtonInitialized = true;
}
} else {
@@ -79,7 +84,11 @@ public class BluetoothDetailsButtonsController extends BluetoothDetailsControlle
.setButton2Text(R.string.bluetooth_device_context_connect)
.setButton2Icon(R.drawable.ic_add_24dp)
.setButton2OnClickListener(
view -> mCachedDevice.connect());
view -> {
mMetricsFeatureProvider.action(mContext,
SettingsEnums.ACTION_SETTINGS_BLUETOOTH_CONNECT);
mCachedDevice.connect();
});
mConnectButtonInitialized = true;
}
}