Merge "Makes Caption Language searchable only if captions are enabled." into main

This commit is contained in:
Daniel Norman
2024-09-09 17:46:01 +00:00
committed by Android (Google) Code Review
2 changed files with 57 additions and 4 deletions

View File

@@ -17,6 +17,8 @@
package com.android.settings.accessibility;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.provider.Settings;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -50,5 +52,16 @@ public class CaptioningMoreOptionsFragment extends DashboardFragment {
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.captioning_more_options);
new BaseSearchIndexProvider(R.xml.captioning_more_options) {
@Override
protected boolean isPageSearchEnabled(Context context) {
if (!Flags.fixA11ySettingsSearch()) {
return super.isPageSearchEnabled(context);
}
// CaptioningMoreOptions is only searchable if captions are enabled, so that we
// don't show search results for settings that will cause no change to the user.
return Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, 0) == 1;
}
};
}