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

Commit f422fa1c authored by Mattias Nilsson's avatar Mattias Nilsson Committed by Automerger Merge Worker
Browse files

Filter out hidden modules from search result am: 62e5ce9c am: 25751d7e

parents 295f9f74 25751d7e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.settings.intelligence.search.sitemap.HighlightableMenu
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 @@ public class InstalledAppResultTask extends SearchQueryTask.QueryWorker {
                // 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) {