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

Reset IMMS when the device is unlocked.

With File-Based Encryption (FBE), now we have yet another runteime event
to reset IMMS state in order to keep the list of available IMEs updated
and make sure one IME is enabled.  Here is the full list of such runtime
events.

   1. Boot phase reaches SystemService.PHASE_ACTIVITY_MANAGER_READY.
   2. One or more packages that contain InputMethodService are updated.
   3. The current user is switched.
   4. The device locale is changed.
   5. The device is unlocked by the current user.

Now we are adding the rule 5 in this CL.

We also apply Copy-On-Write (COW) settings mode, which was added in a
recent commit [1], until the deivice is unlocked.  This allows us to
temporarily update the settings when the device is locked, without
messing up actual SecureSettings.

  [1] I9c6f9bb3d51174198e5f73588637f87ea0d90e11

Here are some examples of what users would see in FBE-enabled devices.
Suppose we have following 5 IMEs installed.

 - IME A: Encryption Aware, pre-installed, ASCII-capable
 - IME B: Encryption Unaware, pre-installed, ASCII-capable
 - IME C: Encryption Unaware, not pre-installed, ASCII-capable
 - IME D: Encryption Aware, not pre-installed, ASCII-capable

 Case 1)
  Before boot:
    Enabled:   IME A
    Selected:  IME A
  Device Locked:
    Available: IME A, IME D
    Enabled:   IME A
    Selected:  IME A
  Device Unolcked:
    Available: IME A, IME B, IME C, IME D
    Enabled:   IME A
    Selected:  IME A

 Case 2)
  Before boot:
    Enabled:   IME A, IME B
    Selected:  IME B
  Device Locked:
    Available: IME A, IME D
    Enabled:   IME A
    Selected:  IME A
  Device Unolcked:
    Available: IME A, IME B, IME C, IME D
    Enabled:   IME A, IME B
    Selected:  IME B

 Case 3)
  Before boot:
    Enabled:   IME B, IME C
    Selected:  IME B
  Device Locked:
    Available: IME A, IME D
    Enabled:   IME A
    Selected:  IME A
  Device Unolcked:
    Available: IME A, IME B, IME C, IME D
    Enabled:   IME B, IME C
    Selected:  IME B

  Note: in this case, IMMS can rely on an existing rule to support
  the situation where enabled/selected IMEs were already uninstalled.

 Case 4)
  Before boot:
    Enabled:   IME B, IME C, IME D
    Selected:  IME B
  Device Locked:
    Available: IME A, IME D
    Enabled:   IME D
    Selected:  IME D
  Device Unolcked:
    Available: IME A, IME B, IME C, IME D
    Enabled:   IME B, IME C, IME D
    Selected:  IME B

Following things should be taken care of subsequent CLs.

 - Add CTS to ensure that at least one encryption-aware IME is
   pre-installed if the device supports FBE.
 - Consider an accidental case where there is no encryption-aware IME.
   This includes the case where all the encryption-aware system IMEs are
   overwritten by encryption-unaware IMEs that have higher versions.

Bug: 26279466
Change-Id: Ifa2225070bf8223f8964cf063c86889e312c5e9a
parent f4910511
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