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:
Zhen Zhang
2020-03-10 14:33:43 -07:00
parent a8bee76d11
commit 63c7c202d7
4 changed files with 83 additions and 4 deletions

View File

@@ -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);