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

Commit d8fedb73 authored by Yuichiro Hanada's avatar Yuichiro Hanada
Browse files

Fix NameNotFound exception in loadAppResources

Bug: 404119367
Bug: 409001082
Bug: 409485902
Test: atest --rerun-until-failure 100 DesktopChromeTestCases:com.android.chrome.desktop.integration.ChromeWindowTests#testSingleWindow
Flag: EXEMPT simple fix for crash
Change-Id: Id06c43104ea42b789b58f0d75b2cc0a84d979133
parent 01ecb3fa
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -167,7 +167,11 @@ class WindowDecorTaskResourceLoader(
    private fun loadAppResources(taskInfo: RunningTaskInfo): AppResources {
        Trace.beginSection("$TAG#loadAppResources")
        try {
            val pm = userProfilesContexts.getOrCreate(taskInfo.userId).packageManager
            val pm =
                userProfilesContexts
                .getOrCreate(taskInfo.userId)
                .createPackageContext(taskInfo.component().packageName, /* flags= */ 0)
                .packageManager
            val activityInfo = getActivityInfo(taskInfo, pm)
            val appName = pm.getApplicationLabel(activityInfo.applicationInfo)
            val appIconDrawable = iconProvider.getIcon(activityInfo)
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ class WindowDecorTaskResourceLoaderTest : ShellTestCase() {
        spyContext = spy(mContext)
        spyContext.setMockPackageManager(mockPackageManager)
        doReturn(spyContext).whenever(spyContext).createContextAsUser(any(), anyInt())
        doReturn(spyContext).whenever(spyContext).createPackageContext(any(), anyInt())
        doReturn(spyContext).whenever(mMockUserProfileContexts)[anyInt()]
        doReturn(spyContext).whenever(mMockUserProfileContexts).getOrCreate(anyInt())
        loader =