Loading src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreference.kt +9 −4 Original line number Diff line number Diff line Loading @@ -91,10 +91,15 @@ private class AppInstallerInfoPresenter( } }.sharedFlow() val isAvailableFlow = installerLabelFlow.map { installerLabel -> val isAvailableFlow = installerLabelFlow.map() { installerLabel -> // Do not show the install info for the special case of the Play Store app. if (app.packageName == context.getString(R.string.config_mainline_module_update_package)) { false } else { withContext(Dispatchers.IO) { !AppUtils.isMainlineModule(packageManager, app.packageName) && installerLabel != null val isMainlineModule = AppUtils.isMainlineModule(packageManager, app.packageName) !isMainlineModule && installerLabel != null } } } Loading tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreferenceTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,25 @@ class AppInstallerInfoPreferenceTest { composeTestRule.onRoot().assertIsNotDisplayed() } @Test fun whenIsPlayStoreApp_notDisplayed() { val playStorePackageName = "com.android.vending" whenever( AppStoreUtil.getInstallerPackageNameAndInstallSourceInfo( any(), eq(playStorePackageName) ) ) .thenReturn(Pair(INSTALLER_PACKAGE_NAME, INSTALL_SOURCE_INFO)) val playStoreApp = ApplicationInfo().apply { packageName = playStorePackageName uid = UID } setContent(playStoreApp) composeTestRule.onRoot().assertIsNotDisplayed() } @Test fun whenStoreLinkIsNull_disabled() { whenever(AppStoreUtil.getAppStoreLink(context, INSTALLER_PACKAGE_NAME, PACKAGE_NAME)) Loading Loading
src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreference.kt +9 −4 Original line number Diff line number Diff line Loading @@ -91,10 +91,15 @@ private class AppInstallerInfoPresenter( } }.sharedFlow() val isAvailableFlow = installerLabelFlow.map { installerLabel -> val isAvailableFlow = installerLabelFlow.map() { installerLabel -> // Do not show the install info for the special case of the Play Store app. if (app.packageName == context.getString(R.string.config_mainline_module_update_package)) { false } else { withContext(Dispatchers.IO) { !AppUtils.isMainlineModule(packageManager, app.packageName) && installerLabel != null val isMainlineModule = AppUtils.isMainlineModule(packageManager, app.packageName) !isMainlineModule && installerLabel != null } } } Loading
tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreferenceTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,25 @@ class AppInstallerInfoPreferenceTest { composeTestRule.onRoot().assertIsNotDisplayed() } @Test fun whenIsPlayStoreApp_notDisplayed() { val playStorePackageName = "com.android.vending" whenever( AppStoreUtil.getInstallerPackageNameAndInstallSourceInfo( any(), eq(playStorePackageName) ) ) .thenReturn(Pair(INSTALLER_PACKAGE_NAME, INSTALL_SOURCE_INFO)) val playStoreApp = ApplicationInfo().apply { packageName = playStorePackageName uid = UID } setContent(playStoreApp) composeTestRule.onRoot().assertIsNotDisplayed() } @Test fun whenStoreLinkIsNull_disabled() { whenever(AppStoreUtil.getAppStoreLink(context, INSTALLER_PACKAGE_NAME, PACKAGE_NAME)) Loading