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

Commit d4eb7ecb authored by Bruno Martins's avatar Bruno Martins
Browse files

trust: Respect filtered components when showing apps list

Launcher3 nativelly supports filtering certain components via the
overlay config "filtered_components", making it not visible in some
places such as the apps drawer. Respect this config as well in the
custom "Hidden & Protected apps" feature.

Change-Id: Ie4e9b35c616b0f242c6c971b6bbb5280b1f4480f
parent cbacd425
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The LineageOS Project
 * Copyright (C) 2019-2024 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import android.os.Build;

import androidx.annotation.NonNull;

import com.android.launcher3.AppFilter;
import com.android.launcher3.lineage.trust.db.TrustComponent;
import com.android.launcher3.lineage.trust.db.TrustDatabaseHelper;

@@ -38,14 +39,19 @@ public class LoadTrustComponentsTask extends AsyncTask<Void, Integer, List<Trust
    @NonNull
    private PackageManager mPackageManager;

    @NonNull
    private AppFilter mAppFilter;

    @NonNull
    private Callback mCallback;

    LoadTrustComponentsTask(@NonNull TrustDatabaseHelper dbHelper,
            @NonNull PackageManager packageManager,
            @NonNull AppFilter appFilter,
            @NonNull Callback callback) {
        mDbHelper = dbHelper;
        mPackageManager = packageManager;
        mAppFilter = appFilter;
        mCallback = callback;
    }

@@ -62,6 +68,11 @@ public class LoadTrustComponentsTask extends AsyncTask<Void, Integer, List<Trust
        int numPackages = apps.size();
        for (int i = 0; i < numPackages; i++) {
            ResolveInfo app = apps.get(i);

            if (!mAppFilter.shouldShowApp(app.activityInfo.getComponentName())) {
                continue;
            }

            try {
                String pkgName = app.activityInfo.packageName;
                String label = mPackageManager.getApplicationLabel(
+3 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.android.launcher3.AppFilter;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
@@ -85,7 +86,8 @@ public class TrustAppsActivity extends Activity implements

        showOnBoarding(false);

        new LoadTrustComponentsTask(mDbHelper, getPackageManager(), this).execute();
        final AppFilter appFilter = new AppFilter(this);
        new LoadTrustComponentsTask(mDbHelper, getPackageManager(), appFilter, this).execute();
    }

    @Override