Log some actions for changing wifi hotspot config
Log following actions: - wifi hotspot name changed - wifi hotspot password changed Added tests for logging actions in each controller's test. Bug: 151113705 Test: WifiTetherSSIDPrefereceControllerTest; WifiTetherPasswordPreferenceControllerTest; CodeInspectionTest Change-Id: I84b1cd8449e575a6ee1ad8868e7791dc601e726f
This commit is contained in:
@@ -22,6 +22,7 @@ import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.wifi.SoftApConfiguration;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -48,6 +49,15 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
|
||||
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
// This constructor is used for testing.
|
||||
@VisibleForTesting
|
||||
WifiTetherSSIDPreferenceController(Context context, OnTetherConfigUpdateListener listener,
|
||||
MetricsFeatureProvider provider) {
|
||||
super(context, listener);
|
||||
mWifiDeviceNameTextValidator = new WifiDeviceNameTextValidator();
|
||||
mMetricsFeatureProvider = provider;
|
||||
}
|
||||
|
||||
public WifiTetherSSIDPreferenceController(Context context,
|
||||
OnTetherConfigUpdateListener listener) {
|
||||
super(context, listener);
|
||||
@@ -93,6 +103,10 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (!TextUtils.equals(mSSID, (String) newValue)) {
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_SETTINGS_CHANGE_WIFI_HOTSPOT_NAME);
|
||||
}
|
||||
mSSID = (String) newValue;
|
||||
updateSsidDisplay((EditTextPreference) preference);
|
||||
mListener.onTetherConfigUpdated(this);
|
||||
|
||||
Reference in New Issue
Block a user