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
This commit is contained in:
Menghan Li
2024-12-31 02:18:38 +00:00
parent 99c5bf8b2c
commit f4dfdda4b7

View File

@@ -19,7 +19,10 @@ import android.app.Activity;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.util.Consumer;
import androidx.lifecycle.LifecycleOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; 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. * @param simpleKey The simple name of the key to get the surveyId for.
*/ */
void sendActivityIfAvailable(String simpleKey); 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<Boolean> listener);
} }