Add action metrics for Wi-Fi provision features
// ACTION: Share a Wi-Fi network by generating a QR code ACTION_SETTINGS_SHARE_WIFI_QR_CODE // ACTION: Connect to a Wi-Fi network by scanning a QR code ACTION_SETTINGS_ENROLL_WIFI_QR_CODE // ACTION: Share Wi-Fi hotspot by generating a QR code ACTION_SETTINGS_SHARE_WIFI_HOTSPOT_QR_CODE Bug: 130521826 Test: manual Change-Id: I4204307dd5318eb7c47e4136dc7d8700d43e4da1
This commit is contained in:
@@ -889,13 +889,19 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
|||||||
/**
|
/**
|
||||||
* Show QR code to share the network represented by this preference.
|
* Show QR code to share the network represented by this preference.
|
||||||
*/
|
*/
|
||||||
public void launchWifiDppConfiguratorActivity() {
|
private void launchWifiDppConfiguratorActivity() {
|
||||||
final Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntentOrNull(mContext,
|
final Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntentOrNull(mContext,
|
||||||
mWifiManager, mAccessPoint);
|
mWifiManager, mAccessPoint);
|
||||||
|
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
Log.e(TAG, "Launch Wi-Fi DPP QR code generator with a wrong Wi-Fi network!");
|
Log.e(TAG, "Launch Wi-Fi DPP QR code generator with a wrong Wi-Fi network!");
|
||||||
} else {
|
} else {
|
||||||
|
mMetricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
|
||||||
|
SettingsEnums.ACTION_SETTINGS_SHARE_WIFI_QR_CODE,
|
||||||
|
SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR,
|
||||||
|
/* key */ null,
|
||||||
|
/* value */ Integer.MIN_VALUE);
|
||||||
|
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -193,6 +193,13 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMetricsFeatureProvider.action(
|
||||||
|
mMetricsFeatureProvider.getAttribution(getActivity()),
|
||||||
|
SettingsEnums.ACTION_SETTINGS_ENROLL_WIFI_QR_CODE,
|
||||||
|
SettingsEnums.SETTINGS_WIFI_DPP_ENROLLEE,
|
||||||
|
/* key */ null,
|
||||||
|
/* value */ Integer.MIN_VALUE);
|
||||||
|
|
||||||
notifyUserForQrCodeRecognition();
|
notifyUserForQrCodeRecognition();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.tether;
|
package com.android.settings.wifi.tether;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.wifi.WifiConfiguration;
|
import android.net.wifi.WifiConfiguration;
|
||||||
@@ -27,9 +28,12 @@ import androidx.preference.EditTextPreference;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.widget.ValidatedEditTextPreference;
|
import com.android.settings.widget.ValidatedEditTextPreference;
|
||||||
import com.android.settings.wifi.dpp.WifiDppUtils;
|
import com.android.settings.wifi.dpp.WifiDppUtils;
|
||||||
|
|
||||||
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
|
|
||||||
public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreferenceController
|
public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreferenceController
|
||||||
implements ValidatedEditTextPreference.Validator {
|
implements ValidatedEditTextPreference.Validator {
|
||||||
|
|
||||||
@@ -41,10 +45,14 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
|
|||||||
private String mSSID;
|
private String mSSID;
|
||||||
private WifiDeviceNameTextValidator mWifiDeviceNameTextValidator;
|
private WifiDeviceNameTextValidator mWifiDeviceNameTextValidator;
|
||||||
|
|
||||||
|
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||||
|
|
||||||
public WifiTetherSSIDPreferenceController(Context context,
|
public WifiTetherSSIDPreferenceController(Context context,
|
||||||
OnTetherConfigUpdateListener listener) {
|
OnTetherConfigUpdateListener listener) {
|
||||||
super(context, listener);
|
super(context, listener);
|
||||||
|
|
||||||
mWifiDeviceNameTextValidator = new WifiDeviceNameTextValidator();
|
mWifiDeviceNameTextValidator = new WifiDeviceNameTextValidator();
|
||||||
|
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -104,7 +112,15 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void shareHotspotNetwork(Intent intent) {
|
private void shareHotspotNetwork(Intent intent) {
|
||||||
WifiDppUtils.showLockScreen(mContext, () -> mContext.startActivity(intent));
|
WifiDppUtils.showLockScreen(mContext, () -> {
|
||||||
|
mMetricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
|
||||||
|
SettingsEnums.ACTION_SETTINGS_SHARE_WIFI_HOTSPOT_QR_CODE,
|
||||||
|
SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR,
|
||||||
|
/* key */ null,
|
||||||
|
/* value */ Integer.MIN_VALUE);
|
||||||
|
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
Reference in New Issue
Block a user