Merge 25Q1 (ab/BP1A.250305.020) to aosp-main-future

Bug: 385190204
Merged-In: I1ef46e98629c9aa7ea364e83153b55779e7486ea
Change-Id: Idf89b322395a1c8ca110825f741738c32908d012
diff --git a/src/com/android/settings/intelligence/search/query/InstalledAppResultTask.java b/src/com/android/settings/intelligence/search/query/InstalledAppResultTask.java
index 6d9060e..7a14748 100644
--- a/src/com/android/settings/intelligence/search/query/InstalledAppResultTask.java
+++ b/src/com/android/settings/intelligence/search/query/InstalledAppResultTask.java
@@ -21,6 +21,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.ModuleInfo;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.provider.Settings;
@@ -82,6 +83,17 @@
                 // Disabled by something other than user, skip.
                 continue;
             }
+            try {
+                ModuleInfo moduleInfo = mPackageManager.getModuleInfo(info.packageName, 0);
+                if(moduleInfo.isHidden()) {
+                    // The app is hidden, skip
+                    continue;
+                }
+            } catch (PackageManager.NameNotFoundException e) {
+                // this should not happen here
+                continue;
+            }
+
             final CharSequence label = info.loadLabel(mPackageManager);
             final int wordDiff = SearchQueryUtils.getWordDifference(label.toString(), mQuery);
             if (wordDiff == SearchQueryUtils.NAME_NO_MATCH) {