Makes all custom caption settings unsearchable when custom captions are not active.
Unifies all custom caption controllers under a base controller, whose searchability is directly determined by CaptionHelper#getCustomCaptionAvailability(). Test: atest CaptionHelperTest Bug: 353757664 Flag: com.android.settings.accessibility.fix_a11y_settings_search Change-Id: If44e6eca4c72aa4413cd0a6e8735dbb22c7abe62
This commit is contained in:
@@ -28,7 +28,6 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||
@@ -37,12 +36,11 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/** Preference controller for captioning custom visibility. */
|
||||
public class CaptioningCustomController extends BasePreferenceController
|
||||
public class CaptioningCustomController extends BaseCaptioningCustomController
|
||||
implements LifecycleObserver, OnStart, OnStop {
|
||||
|
||||
@Nullable
|
||||
private Preference mCustom;
|
||||
private final CaptionHelper mCaptionHelper;
|
||||
private final ContentResolver mContentResolver;
|
||||
@VisibleForTesting
|
||||
AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||
@@ -52,16 +50,15 @@ public class CaptioningCustomController extends BasePreferenceController
|
||||
);
|
||||
|
||||
public CaptioningCustomController(Context context, String preferenceKey) {
|
||||
this(context, preferenceKey, new CaptionHelper(context),
|
||||
this(context, preferenceKey,
|
||||
new AccessibilitySettingsContentObserver(new Handler(Looper.getMainLooper())));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
CaptioningCustomController(
|
||||
Context context, String preferenceKey, CaptionHelper captionHelper,
|
||||
Context context, String preferenceKey,
|
||||
AccessibilitySettingsContentObserver contentObserver) {
|
||||
super(context, preferenceKey);
|
||||
mCaptionHelper = new CaptionHelper(context);
|
||||
mContentResolver = context.getContentResolver();
|
||||
mSettingsContentObserver = contentObserver;
|
||||
mSettingsContentObserver.registerKeysToObserverCallback(CAPTIONING_FEATURE_KEYS, key -> {
|
||||
@@ -71,15 +68,6 @@ public class CaptioningCustomController extends BasePreferenceController
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (com.android.settings.accessibility.Flags.fixA11ySettingsSearch()) {
|
||||
return (shouldShowPreference()) ? AVAILABLE : AVAILABLE_UNSEARCHABLE;
|
||||
} else {
|
||||
return AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
|
||||
Reference in New Issue
Block a user