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

Commit a4985a79 authored by Vinit Deshpande's avatar Vinit Deshpande
Browse files

am "Hide calllog entries for unregistered phone accounts"

merged from goog/mirror-m-wireless-internal-release
2d2bc16f Hide calllog entries for unregistered phone accounts

Change-Id: I39b60b86fca9c1b74d750ab251cc26b3ce5f5650
parents a166fa09 2d2bc16f
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -379,6 +379,15 @@ public class CallLog {
         */
        public static final String PHONE_ACCOUNT_ADDRESS = "phone_account_address";

        /**
         * Indicates that the entry will be hidden from all queries until the associated
         * {@link android.telecom.PhoneAccount} is registered with the system.
         * <P>Type: INTEGER</P>
         *
         * @hide
         */
        public static final String PHONE_ACCOUNT_HIDDEN = "phone_account_hidden";

        /**
         * The subscription ID used to place this call.  This is no longer used and has been
         * replaced with PHONE_ACCOUNT_COMPONENT_NAME/PHONE_ACCOUNT_ID.
@@ -455,6 +464,7 @@ public class CallLog {
                long start, int duration, Long dataUsage, boolean addForAllUsers) {
            final ContentResolver resolver = context.getContentResolver();
            int numberPresentation = PRESENTATION_ALLOWED;
            boolean isHidden = false;

            TelecomManager tm = null;
            try {
@@ -465,7 +475,16 @@ public class CallLog {
            if (tm != null && accountHandle != null) {
                PhoneAccount account = tm.getPhoneAccount(accountHandle);
                if (account != null) {
                    accountAddress = account.getSubscriptionAddress().getSchemeSpecificPart();
                    Uri address = account.getSubscriptionAddress();
                    if (address != null) {
                        accountAddress = address.getSchemeSpecificPart();
                    }
                } else {
                    // We could not find the account through telecom. For call log entries that
                    // are added with a phone account which is not registered, we automatically
                    // mark them as hidden. They are unhidden once the account is registered.
                    Log.i(LOG_TAG, "Marking call log entry as hidden.");
                    isHidden = true;
                }
            }

@@ -511,6 +530,7 @@ public class CallLog {
            values.put(PHONE_ACCOUNT_COMPONENT_NAME, accountComponentString);
            values.put(PHONE_ACCOUNT_ID, accountId);
            values.put(PHONE_ACCOUNT_ADDRESS, accountAddress);
            values.put(PHONE_ACCOUNT_HIDDEN, Integer.valueOf(isHidden ? 1 : 0));
            values.put(NEW, Integer.valueOf(1));

            if (callType == MISSED_TYPE) {