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

Commit bbaf7db9 authored by Yash Garg's avatar Yash Garg 💬 Committed by Mohammed Althaf T
Browse files

feat: hide some apps from placing on homescreen

parent b7635e90
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <array name="blacklisted_apps">
        <item>org.sufficientlysecure.keychain</item>
        <item>com.google.android.gms</item>
        <item>foundation.e.pdfviewer</item>
        <item>com.android.stk</item>
        <item>foundation.e.blissweather</item>
    </array>
</resources>
+10 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.util.Pair;
import androidx.annotation.WorkerThread;

import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.model.ItemInstallQueue;
import com.android.launcher3.model.data.AppInfo;
@@ -36,17 +37,21 @@ import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ItemInfoMatcher;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Predicate;

@WorkerThread
public class VerifyIdleAppTask implements Runnable {
    private static final String TAG = "VerifyIdleAppTask";

    private final List<String> mBlacklistedApps;

    private final Context mContext;
    private final Collection<AppInfo> mApps;
    private final String mPackageNames;
@@ -64,6 +69,7 @@ public class VerifyIdleAppTask implements Runnable {
        mUser = user;
        mIsAddPackage = isAdd;
        mBgdataModel = bgDataModel;
        mBlacklistedApps = Arrays.asList(context.getResources().getStringArray(R.array.blacklisted_apps));
    }

    private static void verifyShortcutHighRes(Context context, AppInfo appInfo) {
@@ -85,8 +91,11 @@ public class VerifyIdleAppTask implements Runnable {
            // All apps loading, we ignore loaded.
            mIgnoreLoaded = true;
            for (AppInfo app : mApps) {
                if (mBlacklistedApps.stream().noneMatch(
                        pkg -> pkg.equals(Objects.requireNonNull(app.getTargetPackage()).trim().toLowerCase()))) {
                    map.put(new ComponentKey(app.componentName, app.user), app);
                }
            }
        } else if (mPackageNames != null && mUser != null) {
            // App add or update, should not ignore loaded.
            mIgnoreLoaded = false;