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

Skip to content
Commit 1ce603c3 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 3daf8e93
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment