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

Commit 5e1d5d65 authored by Guliz Tuncay's avatar Guliz Tuncay
Browse files

Remove direct boot awareness support for TSMS

Remove onCopyWrite hashmap from TSMS to stop support for direct boot
aware spell checkers, as there is currently no apparent use case for
spell checker use before the device is unlocked. Additionally, we also
remove mCurrentId and mCurrentProfileId out of TextServicesSettings
(TSS) as these are not specific to TSS class itself. The aim here is to
simply TSMS code by removing support for unused cases.
This is a preparation CL for Bug 63041121.

Fixes: 64127156
Test: Manually tested as follows
Test precondition:
      1. Have two users: User Owner (userId 0), User A (userId 10)
      2. Set up a password "aaaa" for both users.
      3. Build SampleSpellCheckerService, which is by default
         direct-boot unaware.
          package name: com.example.android.samplespellcheckerservice
          APK name: SampleSpellCheckerService_DBUnaware.apk
      4. Also build a custom SampleSpellCheckerService by explicitly
         making '.SampleSpellCheckerService' direct-boot aware.
          package name: com.example.android.samplespellcheckerservice2
          APK name: SampleSpellCheckerService_DBAware.apk
      5. adb install --user 0 -r SampleSpellCheckerService_DBUnaware.apk
      6. adb install --user 10 -r SampleSpellCheckerService_DBUnaware.apk
      7. adb install --user 0 -r SampleSpellCheckerService_DBAware.apk
      8. adb install --user 10 -r SampleSpellCheckerService_DBAware.apk
      9. make -j ApiDemos
     10. adb install --user 0 -r $ANDROID_PRODUCT_OUT/data/app/ApiDemos/ApiDemos.apk
     11. adb install --user 10 -r $ANDROID_PRODUCT_OUT/data/app/ApiDemos/ApiDemos.apk
Test: Test direct boot unaware spell checker services on a direct boot
      enabled device as follows.
      1. On a direct-boot enabled device, complete the above steps to
         set up the device.
      2. adb shell settings put --user 0 secure selected_spell_checker 'com.example.android.samplespellcheckerservice/.SampleSpellCheckerService'
      3. adb shell settings put --user 10 secure selected_spell_checker 'com.example.android.samplespellcheckerservice/.SampleSpellCheckerService'
      4. adb reboot
      5. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is false.
         -> make sure no spell checker service appears.
      6. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
      7. Enter password to unlock the user
      8. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 0 appear.
      9. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
     10. Open "Api Demos" app
     11. Go to Views/Text/EditText
     12. Focus into the first EditText then type "aaa"
     13. Focus into the second EditText then type "aaa"
     14. adb shell dumpsys textservices
         -> make sure 'com.example.android.samplespellcheckerservice'
            is serving spell checker sessions.
     15. Switch to User A (userId 10)
     16. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is false.
         -> make sure no spell checker service appears.
     17. adb shell settings get --user 10 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
     18. Enter password to unlock the user
     19. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 10 appear.
     20. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
     21. Open "Api Demos" app
     22. Go to Views/Text/EditText
     23. Focus into the first EditText then type "aaa"
     24. Focus into the second EditText then type "aaa"
     25. adb shell dumpsys textservices
         -> make sure 'com.example.android.samplespellcheckerservice'
            is serving spell checker sessions.
     26. Switch back to Owner (userId 0)
     27. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 0 appear.
     28. Switch to User A (userId 10)
     29. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 10 appear.
Test: Test direct boot aware spell checker services on a direct boot
      enabled device as follows.
      1. On a direct-boot enabled device, complete the above steps to
         set up the device.
      2. adb shell settings put --user 0 secure selected_spell_checker 'com.example.android.samplespellcheckerservice2/.SampleSpellCheckerService'
      3. adb shell settings put --user 10 secure selected_spell_checker 'com.example.android.samplespellcheckerservice2/.SampleSpellCheckerService'
      4. adb reboot
      5. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is false.
         -> make sure no spell checker service appears.
      6. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice2/.SampleSpellCheckerService
      7. Enter password to unlock the user
      8. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 0 appear.
      9. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice2/.SampleSpellCheckerService
     10. Open "Api Demos" app
     11. Go to Views/Text/EditText
     12. Focus into the first EditText then type "aaa"
     13. Focus into the second EditText then type "aaa"
     14. adb shell dumpsys textservices
         -> make sure 'com.example.android.samplespellcheckerservice2'
            is serving spell checker sessions.
     15. Switch to User A (userId 10)
     16. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is false.
         -> make sure no spell checker service appears.
     17. adb shell settings get --user 10 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice2/.SampleSpellCheckerService
     18. Enter password to unlock the user
     19. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 10 appear.
     20. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice2/.SampleSpellCheckerService
     21. Open "Api Demos" app
     22. Go to Views/Text/EditText
     23. Focus into the first EditText then type "aaa"
     24. Focus into the second EditText then type "aaa"
     25. adb shell dumpsys textservices
         -> make sure 'com.example.android.samplespellcheckerservice2'
            is serving spell checker sessions.
     26. Switch back to Owner (userId 0)
     27. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 0 appear.
     28. Switch to User A (userId 10)
     29. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 10 appear.
Test: Test direct boot unaware spell checker services on a direct boot
      disabled device as follows.
      1. On a direct-boot disabled device, complete the above steps to
         set up the device.
      2. adb shell settings put --user 0 secure selected_spell_checker 'com.example.android.samplespellcheckerservice/.SampleSpellCheckerService'
      3. adb shell settings put --user 10 secure selected_spell_checker 'com.example.android.samplespellcheckerservice/.SampleSpellCheckerService'
      4. adb reboot
      5. adb shell dumpsys textservices
         -> make sure isCurrentUserUnlockingOrUnlocked is true.
            Enabling spell checker services in CryptKeeperBounce mode is
            currently working as intended but does not make much sense.
            Bug 64178633 aims to address this.
      6. Enter password to finish CryptKeeperBounce.
      7. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 0 appear.
      8. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
      9. Open "Api Demos" app
     10. Go to Views/Text/EditText
     11. Focus into the first EditText then type "aaa"
     12. Focus into the second EditText then type "aaa"
     13. adb shell dumpsys textservices
         -> make sure 'com.example.android.samplespellcheckerservice'
            is serving spell checker sessions.
     14. Switch to User A (userId 10)
     15. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 10 appear.
     16. adb shell settings get --user 10 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
     17. Enter password to unlock the lock screen
     18. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 10 appear.
     19. adb shell settings get --user 0 secure selected_spell_checker
         -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
     20. Open "Api Demos" app
     21. Go to Views/Text/EditText
     22. Focus into the first EditText then type "aaa"
     23. Focus into the second EditText then type "aaa"
     24. adb shell dumpsys textservices
         -> make sure 'com.example.android.samplespellcheckerservice'
            is serving spell checker sessions.
     25. Switch back to Owner (userId 0)
     26. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 0 appear.
     27. Switch to User A (userId 10)
     28. adb shell dumpsys textservices
         -> make sure 'isCurrentUserUnlockingOrUnlocked' is true.
         -> make sure all spell checker services for user 10 appear.
Change-Id: Ied29a47b6e32e83a9893111c9df291bee355077c
parent 737553c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment