Add a test mode to SecureSettingsWrapper
This is a preparation before moving InputMethodManagerService#mHardwareKeyboardShortcutController to UserData so that each user can keep maintaining its own instance. The issue is that currently UserDataRepositoryTest does not mock anything around secure settings and UserManagerInternal, which means that when it triggers logic that internally accesses to SecureSettingsWrapper, it ends up throwing NullPointerException as LocalServices.getService(UserManagerInternal.class) returns null, and even if we mocked UserManagerInternal, we still face a problem on how SecureSettingsWrapper should be have when the unit test passes a nonexistent user (e.g. 1). As an intermediate solution, this CL introduces an official fake implementation of SecureSettingsWrapper, which basically forwards all the read/write operations to an on memory dictionary rather than exposing the real data. This should be sufficient for now. Bug: 305849394 Test: presubmit Flag: TEST_ONLY Change-Id: I7cdef44c32871d65d9d2ce2bcdf321cc912d9992
Loading
Please register or sign in to comment