From f4dfdda4b78a75056c7feba2e411c8a029a667f2 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Tue, 31 Dec 2024 02:18:38 +0000 Subject: [PATCH] Add a new API: checkSurveyAvailable This change introduces a new API within SettingsIntelligence to enable SettingsGoogle to identify available surveys for Pixel device users. This API will be used by SettingsGoogle to determine if there are any surveys available for a user to take. Bug: 380346685 Flag: com.android.server.accessibility.enable_low_vision_hats Test: atest SurveyFeatureProviderImplTest Change-Id: Ia4e694b6c8a240af4422baff61386d9ee5ffc346 --- .../settings/overlay/SurveyFeatureProvider.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/com/android/settings/overlay/SurveyFeatureProvider.java b/src/com/android/settings/overlay/SurveyFeatureProvider.java index ce5be981282..85d123d5958 100644 --- a/src/com/android/settings/overlay/SurveyFeatureProvider.java +++ b/src/com/android/settings/overlay/SurveyFeatureProvider.java @@ -19,7 +19,10 @@ import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.util.Consumer; +import androidx.lifecycle.LifecycleOwner; import androidx.localbroadcastmanager.content.LocalBroadcastManager; /** @@ -109,4 +112,14 @@ public interface SurveyFeatureProvider { * @param simpleKey The simple name of the key to get the surveyId for. */ void sendActivityIfAvailable(String simpleKey); + + /** + * Checks if a survey is available for the given key by binding to the survey service. + * + * @param lifecycleOwner The lifecycle owner to manage the service connection. + * @param simpleKey The simple name of the key to get the surveyId for. + * @param listener The callback to be invoked when the survey availability is checked. + */ + void checkSurveyAvailable(@NonNull LifecycleOwner lifecycleOwner, @NonNull String simpleKey, + @NonNull Consumer listener); }