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

Commit 712c7979 authored by emancebo's avatar emancebo
Browse files

Disable CM blacklist feature (1/5)

Change-Id: I51e79c3d7b21824b31baf2352e4d991ec6f2b6f7
parent 28614449
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.UserHandle;
import android.os.SystemProperties;
import android.provider.Settings;
import android.provider.Telephony.Blacklist;
import android.text.TextUtils;
@@ -39,6 +40,9 @@ public class BlacklistUtils {
    private static final String TAG = "BlacklistUtils";
    private static final boolean DEBUG = false;

    private static final String CM_BLACKLIST_FEATURE_PRESENT =
            "ro.telphony.cm_blklst_on";

    // Blacklist matching type
    public final static int MATCH_NONE = 0;
    public final static int MATCH_PRIVATE = 1;
@@ -152,12 +156,26 @@ public class BlacklistUtils {
        return result;
    }

    /**
     * Flag that can be set by the user in blacklist settings.  When disabled
     * we do not show blacklist menu items or check the blacklist for calls
     * or messages.
     */
    public static boolean isBlacklistEnabled(Context context) {
        return Settings.System.getIntForUser(context.getContentResolver(),
        return isBlacklistFeaturePresent(context) &&
                Settings.System.getIntForUser(context.getContentResolver(),
                Settings.System.PHONE_BLACKLIST_ENABLED, 1,
                UserHandle.USER_CURRENT_OR_SELF) != 0;
    }

    /**
     * Build time flag that can be used to disable blacklist and remove all
     * access to blacklist settings.
     */
    public static boolean isBlacklistFeaturePresent(Context context) {
        return SystemProperties.getInt(CM_BLACKLIST_FEATURE_PRESENT, 1) != 0;
    }

    public static boolean isBlacklistNotifyEnabled(Context context) {
        return Settings.System.getIntForUser(context.getContentResolver(),
                Settings.System.PHONE_BLACKLIST_NOTIFY_ENABLED, 1,