OSDN Git Service

Add action metrics for Wi-Fi provision features
authorArc Wang <arcwang@google.com>
Mon, 15 Apr 2019 10:19:30 +0000 (18:19 +0800)
committerArc Wang <arcwang@google.com>
Fri, 19 Apr 2019 07:28:29 +0000 (15:28 +0800)
  // 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

src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java

index 5706e9b..ed9c550 100644 (file)
@@ -889,13 +889,19 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
     /**
      * Show QR code to share the network represented by this preference.
      */
-    public void launchWifiDppConfiguratorActivity() {
+    private void launchWifiDppConfiguratorActivity() {
         final Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntentOrNull(mContext,
                 mWifiManager, mAccessPoint);
 
         if (intent == null) {
             Log.e(TAG, "Launch Wi-Fi DPP QR code generator with a wrong Wi-Fi network!");
         } 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);
         }
     }
index d0322b7..0cd7f09 100644 (file)
@@ -193,6 +193,13 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
                         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();
                     break;
 
index b7ddcae..1197db4 100644 (file)
@@ -16,6 +16,7 @@
 
 package com.android.settings.wifi.tether;
 
+import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.Intent;
 import android.net.wifi.WifiConfiguration;
@@ -27,9 +28,12 @@ import androidx.preference.EditTextPreference;
 import androidx.preference.Preference;
 
 import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.widget.ValidatedEditTextPreference;
 import com.android.settings.wifi.dpp.WifiDppUtils;
 
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+
 public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreferenceController
         implements ValidatedEditTextPreference.Validator {
 
@@ -41,10 +45,14 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
     private String mSSID;
     private WifiDeviceNameTextValidator mWifiDeviceNameTextValidator;
 
+    private final MetricsFeatureProvider mMetricsFeatureProvider;
+
     public WifiTetherSSIDPreferenceController(Context context,
             OnTetherConfigUpdateListener listener) {
         super(context, listener);
+
         mWifiDeviceNameTextValidator = new WifiDeviceNameTextValidator();
+        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
     }
 
     @Override
@@ -104,7 +112,15 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
     }
 
     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