Remove ModuleInfo#isHidden Usage from the source code.

ModuleInfo#isHidden is used for getting hidden module status from
ModuleMetadata package (Mainline). It was set to hide Mainline modules'
Apk to show in the Settings UI and this has caused the issue as it
disallowed the user to toggle permissions where it was needed. Thus, we
decided to deprecate the usage of ModuleInfo#isHidden (see
go/aml-hidden-modules-permissions).

Bug: 379056868
Test: unittest
Test: check behavior before/after enable flags
Flag: android.content.pm.remove_hidden_module_usage
Change-Id: I670c95350e3c21db9f74f37b675aba1b23c67a61
This commit is contained in:
Alyssa Ketpreechasawat
2024-10-04 16:22:43 +00:00
parent 999cf6ec6c
commit f480cdd56f
6 changed files with 92 additions and 3 deletions

View File

@@ -186,7 +186,8 @@ public class RecentAppStatsMixin implements LifecycleObserver, OnStart {
return false;
}
if (AppUtils.isHiddenSystemModule(mContext, pkgName)) {
if (!android.content.pm.Flags.removeHiddenModuleUsage()
&& AppUtils.isHiddenSystemModule(mContext, pkgName)) {
return false;
}

View File

@@ -243,7 +243,7 @@ public class AppInfoDashboardFragment extends DashboardFragment
if (!ensurePackageInfoAvailable(activity)) {
return;
}
if (!ensureDisplayableModule(activity)) {
if (!android.content.pm.Flags.removeHiddenModuleUsage() && !ensureDisplayableModule(activity)) {
return;
}
startListeningToPackageRemove();
@@ -386,6 +386,7 @@ public class AppInfoDashboardFragment extends DashboardFragment
* If it's not, the fragment will finish.
*
* @return true if package is displayable.
* TODO(b/382016780): to be removed after flag cleanup.
*/
@VisibleForTesting
boolean ensureDisplayableModule(Activity activity) {