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

Commit f87fab8a authored by Julia Tuttle's avatar Julia Tuttle
Browse files

FakeDeviceProvisionedController: allow un-setting-up user

In VisualInterruptionDecisionProviderTestBase, I'm using a single
FakeDeviceProvisionedController with a single user ID across multiple
test cases, and I need to be able to change what isCurrentUserSetup on a
per-case basis.

Therefore, add an "isSetup" parameter to setUserSetup that lets callers
un-set-up a user.

Also, add a convenience method to 'set' isCurrentUserSetup directly.

Bug: 326356165
Flag: NA
Test: NA
Change-Id: I8dbe09cacb6bfc8ea4e2ad66924deece22930a6e
parent 75296bb1
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -39,8 +39,16 @@ class FakeDeviceProvisionedController : DeviceProvisionedController {
        callbacks.toSet().forEach { it.onUserSwitched() }
    }

    fun setUserSetup(userId: Int) {
    fun setUserSetup(userId: Int, isSetup: Boolean = true) {
        if (isSetup) {
            usersSetup.add(userId)
        } else {
            usersSetup.remove(userId)
        }
        callbacks.toSet().forEach { it.onUserSetupChanged() }
    }

    fun setCurrentUserSetup(isSetup: Boolean) {
        setUserSetup(currentUser, isSetup)
    }
}