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

Commit b856f438 authored by Roman Birg's avatar Roman Birg Committed by Matt Garnes
Browse files

frameworks: add blacklist call logging (1/3)



Change-Id: Id3413a298ba1bdf2ecdcc256d02fda85c3221bb6
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 73346918
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -159,6 +159,10 @@ public class CallLog {
        public static final int MISSED_TYPE = 3;
        /** Call log type for voicemails. */
        public static final int VOICEMAIL_TYPE = 4;
        /** Call log type for blacklisted calls
         * @hide
         */
        public static final int BLACKLIST_TYPE = 173;

        /**
         * Bit-mask describing features of the call (e.g. video).
+23 −0
Original line number Diff line number Diff line
@@ -148,11 +148,13 @@ public class CallerInfo {

    private boolean mIsEmergency;
    private boolean mIsVoiceMail;
    private boolean mIsBlacklisted;

    public CallerInfo() {
        // TODO: Move all the basic initialization here?
        mIsEmergency = false;
        mIsVoiceMail = false;
        mIsBlacklisted = false;
    }

    /**
@@ -386,6 +388,10 @@ public class CallerInfo {
        return mIsVoiceMail;
    }

    public boolean isBlacklistedNumber() {
        return mIsBlacklisted;
    }

    /**
     * Mark this CallerInfo as an emergency call.
     * @param context To lookup the localized 'Emergency Number' string.
@@ -444,6 +450,23 @@ public class CallerInfo {
        return this;
    }

    /**
     * Mark this CallerInfo as a blacklist call
     * @return this instance.
     */
    public CallerInfo markAsBlacklist() {
        mIsBlacklisted = true;

        try {
            String blacklistLabel = "Blacklist";

            phoneNumber = blacklistLabel;
        } catch (SecurityException se) {
            Rlog.e(TAG, "Cannot access Blacklist.", se);
        }
        return this;
    }

    private static String normalize(String s) {
        if (s == null || s.length() > 0) {
            return s;