[Provider Model] Fix the NetworkDashboardFragmentTest failed issue
Since the getPreferenceScreenResId() is modified to return different resource ID when provider model enabled. So we need to update SEARCH_INDEX_DATA_PROVIDER class to match the same behavior. Bug: 175290124 Test: - Set Settings/System/Developer options/Feature flags/settings_provider_model to true. - atest -c NetworkDashboardFragmentTest Change-Id: I05b0f830158429ddbbfba414cdb33a6df6a7465e
This commit is contained in:
@@ -21,6 +21,7 @@ import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
@@ -38,6 +39,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@SearchIndexable
|
||||
@@ -185,6 +187,18 @@ public class NetworkDashboardFragment extends DashboardFragment implements
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.network_and_internet) {
|
||||
|
||||
@Override
|
||||
// TODO(b/167474581): Should remove this method when Provider Model finished.
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
if (Utils.isProviderModelEnabled(context)) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.network_provider_internet;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
return super.getXmlResourcesToIndex(context, enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(Context
|
||||
context) {
|
||||
|
Reference in New Issue
Block a user