Run hearing devices survey for qualified users

When the user is categorized as one of our interested group, we'll try
to pop out the survey. The survey is control by remote config:
https://source.corp.google.com/piper///depot/google3/googledata/experiments/mobile/android_platform_settings_intelligence_google/features/hats_config.gcl;l=34
and the rate limit is control by Listnr: https://listnr.corp.google.com

Bug: 294627726
Test: atest ConnectedDeviceDashboardFragmentTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5bf6d4391ec15897d866386278970ff85826da7b)

Change-Id: I8d8c4b7cf166f25a905dc0d874eb4ed655442b22
This commit is contained in:
Angela Wang
2023-08-15 08:40:33 +00:00
parent 12f8f5ac7a
commit f8f43b6f82

View File

@@ -15,8 +15,6 @@
*/
package com.android.settings.connecteddevice;
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.net.Uri;
@@ -31,8 +29,11 @@ import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
import com.android.settings.core.SettingsUIDeviceConfig;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.overlay.SurveyFeatureProvider;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.slices.SlicePreferenceController;
import com.android.settingslib.bluetooth.HearingAidStatsLogUtils;
import com.android.settingslib.search.SearchIndexable;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
@@ -87,6 +88,16 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
: null);
use(DiscoverableFooterPreferenceController.class)
.setAlwaysDiscoverable(isAlwaysDiscoverable(callingAppPackageName, action));
// Show hearing devices survey if user is categorized as one of interested category
final String category = HearingAidStatsLogUtils.getUserCategory(context);
if (category != null && !category.isEmpty()) {
SurveyFeatureProvider provider =
FeatureFactory.getFeatureFactory().getSurveyFeatureProvider(context);
if (provider != null) {
provider.sendActivityIfAvailable(category);
}
}
}
@VisibleForTesting