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

Commit 9c1af6a9 authored by Grace Jia's avatar Grace Jia
Browse files

Added support for writing Calls.FEATURES_WIFI and Calls.FEATURES_HD_CALL to the Call Log.

Test: cts Test.
Bug: 141264545
Change-Id: I12e5785c669c615e3e53016dde06caea5c0ea38e
parent 5db01929
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,

    private boolean mWasConferencePreviouslyMerged = false;
    private boolean mWasHighDefAudio = false;
    private boolean mWasWifi = false;

    // For conferences which support merge/swap at their level, we retain a notion of an active
    // call. This is used for BluetoothPhoneService.  In order to support hold/merge, it must have
@@ -1570,6 +1571,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
            }
            mWasHighDefAudio = (connectionProperties & Connection.PROPERTY_HIGH_DEF_AUDIO) ==
                    Connection.PROPERTY_HIGH_DEF_AUDIO;
            mWasWifi = (connectionProperties & Connection.PROPERTY_WIFI) > 0;
            for (Listener l : mListeners) {
                l.onConnectionPropertiesChanged(this, didRttChange);
            }
@@ -3200,6 +3202,15 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
        return mWasHighDefAudio;
    }

    /**
     * Returns wether or not Wifi call was used.
     *
     * @return true if wifi call was used during this call.
     */
    boolean wasWifi() {
        return mWasWifi;
    }

    public void setIsUsingCallFiltering(boolean isUsingCallFiltering) {
        mIsUsingCallFiltering = isUsingCallFiltering;
    }
+6 −18
Original line number Diff line number Diff line
@@ -324,7 +324,7 @@ public final class CallLogManager extends CallsManagerListenerBase {

        int callFeatures = getCallFeatures(call.getVideoStateHistory(),
                call.getDisconnectCause().getCode() == DisconnectCause.CALL_PULLED,
                shouldSaveHdInfo(call, accountHandle),
                call.wasHighDefAudio(), call.wasWifi(),
                (call.getConnectionProperties() & Connection.PROPERTY_ASSISTED_DIALING_USED) ==
                        Connection.PROPERTY_ASSISTED_DIALING_USED,
                call.wasEverRttCall());
@@ -447,11 +447,12 @@ public final class CallLogManager extends CallsManagerListenerBase {
     * @param videoState The video state.
     * @param isPulledCall {@code true} if this call was pulled to another device.
     * @param isStoreHd {@code true} if this call was used HD.
     * @param isWifi {@code true} if this call was used wifi.
     * @param isUsingAssistedDialing {@code true} if this call used assisted dialing.
     * @return The call features.
     */
    private static int getCallFeatures(int videoState, boolean isPulledCall, boolean isStoreHd,
            boolean isUsingAssistedDialing, boolean isRtt) {
            boolean isWifi, boolean isUsingAssistedDialing, boolean isRtt) {
        int features = 0;
        if (VideoProfile.isVideo(videoState)) {
            features |= Calls.FEATURES_VIDEO;
@@ -462,6 +463,9 @@ public final class CallLogManager extends CallsManagerListenerBase {
        if (isStoreHd) {
            features |= Calls.FEATURES_HD_CALL;
        }
        if (isWifi) {
            features |= Calls.FEATURES_WIFI;
        }
        if (isUsingAssistedDialing) {
            features |= Calls.FEATURES_ASSISTED_DIALING_USED;
        }
@@ -471,22 +475,6 @@ public final class CallLogManager extends CallsManagerListenerBase {
        return features;
    }

    private boolean shouldSaveHdInfo(Call call, PhoneAccountHandle accountHandle) {
        CarrierConfigManager configManager = (CarrierConfigManager) mContext.getSystemService(
                Context.CARRIER_CONFIG_SERVICE);
        PersistableBundle configBundle = null;
        if (configManager != null) {
            configBundle = configManager.getConfigForSubId(
                    mPhoneAccountRegistrar.getSubscriptionIdForPhoneAccount(accountHandle));
        }
        if (configBundle != null && configBundle.getBoolean(
                CarrierConfigManager.KEY_IDENTIFY_HIGH_DEFINITION_CALLS_IN_CALL_LOG_BOOL)
                && call.wasHighDefAudio()) {
            return true;
        }
        return false;
    }

    /**
     * Retrieve the phone number from the call, and then process it before returning the
     * actual number that is to be logged.