Optimize InputMethodSubtypeSwitchingController
This avoids re-computing the list of items in the InputMethodSubtypeSwitchingController every time the IME Switcher Menu is requested, by instead storing the full list of items. These are still updated whenever necessary (e.g. user, context or language change). As this will be a superset of all the enabled IMEs and subtypes we could use, this requires iterating and filtering when creating the list used for switching, and the one used for the menu. However, this avoids repeatedly calling into package manager to resolve the IME and subtype label resources. With these lists being usually small, this should overall improve performance. To enable this, the logic for creating the list suitable for hardware keyboard switching was merged into the main method. This presents a few changes for the hardware keyboard list: * sorted based on the IME label, and IME id * removes duplicates based on the subtype hashcode These two behaviours were already present on the main method, thus combining them will provide more consistency in switching IMEs. Flag: EXEMPT cleanup Bug: 347693610 Test: atest InputMethodSubtypeSwitchingControllerTest Change-Id: I11280dd485faa06676e8292b95cecdb312d92460
Loading
Please register or sign in to comment