Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 617458b0 authored by Yi-Ling Chuang's avatar Yi-Ling Chuang
Browse files

Make all TogglePreferenceController slice-able.

All the descendants of TogglePreferenceController are now slice-able by
default, where every controller can still disable it by overriding this
value. Though all of them are now slice-able, doesn't necessarily means
they are exposed publicly as we set the default value of isPublicSlice()
to false. For those that want to be public ones will have to override
this value.

Bug: 141088937
Test: robotests
Change-Id: I2ea529c11f0177cd6c55754b632cd1fea1dcc48f
parent e7ff0891
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -70,4 +70,13 @@ public abstract class TogglePreferenceController extends BasePreferenceControlle
        return SliceData.SliceType.SWITCH;
    }

    @Override
    public boolean isSliceable() {
        return true;
    }

    @Override
    public boolean isPublicSlice() {
        return false;
    }
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -90,6 +90,16 @@ public class TogglePreferenceControllerTest {
                SliceData.SliceType.SWITCH);
    }

    @Test
    public void isSliceable_returnTrue() {
        assertThat(mToggleController.isSliceable()).isTrue();
    }

    @Test
    public void isPublicSlice_returnFalse() {
        assertThat(mToggleController.isPublicSlice()).isFalse();
    }

    private static class FakeToggle extends TogglePreferenceController {

        private boolean checkedFlag;