Makes Caption Language searchable only if captions are enabled.
Fix: 354785578
Flag: com.android.settings.accessibility.fix_a11y_settings_search
Test: atest CaptioningMoreOptionsFragmentTest
Test: adb shell pm clear com.google.android.settings.intelligence;
disable captioning;
search Settings for 'language', observe caption language missing
enable captioning;
search Settings for 'language', observe caption language present
Change-Id: I015d2c77fbd3f7b8fe713bafb3a49a86160ca958
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user