Merge "Show the footer when global switch is off."
This commit is contained in:
committed by
Android (Google) Code Review
commit
1e7ecc1ad5
@@ -26,6 +26,7 @@ import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
@@ -79,6 +80,12 @@ public class GraphicsDriverFooterPreferenceController extends BasePreferenceCont
|
||||
mGraphicsDriverContentObserver.unregister(mContentResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final FooterPreference footerPref = (FooterPreference) preference;
|
||||
footerPref.setVisible(isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGraphicsDriverContentChanged() {
|
||||
updateState(mPreference);
|
||||
|
@@ -105,4 +105,20 @@ public class GraphicsDriverFooterPreferenceControllerTest {
|
||||
|
||||
verify(mGraphicsDriverContentObserver).unregister(mResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_available_visible() {
|
||||
when(mController.getAvailabilityStatus()).thenReturn(AVAILABLE_UNSEARCHABLE);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setVisible(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_unavailable_invisible() {
|
||||
when(mController.getAvailabilityStatus()).thenReturn(CONDITIONALLY_UNAVAILABLE);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setVisible(false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user