[Panlingual] Improve performance of displaying app list in Settings.

- Use existed ApplicationInfo to get needed info.
 - Add unittest to AppLocaleUtil.java

Bug: b/238054165
Bug: b/231904717
Test: Maunal test passed
Test: atest passed
Change-Id: I23f354c366b45d4b684184b3366aeab913bcd3c8
This commit is contained in:
tom hsu
2022-10-25 16:26:55 +08:00
parent 862e9b3040
commit 8bd5e2a52f
7 changed files with 97 additions and 82 deletions

View File

@@ -77,7 +77,8 @@ class AppLocalePreferenceTest {
.strictness(Strictness.LENIENT)
.startMocking()
whenever(context.packageManager).thenReturn(packageManager)
whenever(AppLocaleUtil.canDisplayLocaleUi(any(), eq(PACKAGE_NAME), any())).thenReturn(true)
whenever(AppLocaleUtil.canDisplayLocaleUi(any(), ArgumentMatchers.eq(APP), any()))
.thenReturn(true)
whenever(AppLocaleDetails.getSummary(any(), ArgumentMatchers.eq(APP))).thenReturn(SUMMARY)
}
@@ -88,7 +89,8 @@ class AppLocalePreferenceTest {
@Test
fun whenCanNotDisplayLocalUi_notDisplayed() {
whenever(AppLocaleUtil.canDisplayLocaleUi(any(), eq(PACKAGE_NAME), any())).thenReturn(false)
whenever(AppLocaleUtil.canDisplayLocaleUi(any(), ArgumentMatchers.eq(APP), any()))
.thenReturn(false)
setContent()