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

Commit 18bfe89e authored by Qi Wang's avatar Qi Wang Committed by Gerrit Code Review
Browse files

Merge "Display the HD icon in the Call Log"

parents 29644dc4 0063a198
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -405,6 +405,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable {
    private Analytics.CallInfo mAnalytics;

    private boolean mWasConferencePreviouslyMerged = false;
    private boolean mWasHighDefAudio = 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
@@ -1328,6 +1329,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable {
            mConnectionProperties = connectionProperties;
            setRttStreams((mConnectionProperties & Connection.PROPERTY_IS_RTT) ==
                    Connection.PROPERTY_IS_RTT);
            mWasHighDefAudio = (connectionProperties & Connection.PROPERTY_HIGH_DEF_AUDIO) ==
                    Connection.PROPERTY_HIGH_DEF_AUDIO;
            boolean didRttChange =
                    (changedProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT;
            for (Listener l : mListeners) {
@@ -2780,4 +2783,12 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable {
        mVideoStateHistory |= mVideoState;
    }

    /**
     * Returns whether or not high definition audio was used.
     *
     * @return true if high definition audio was used during this call.
     */
    boolean wasHighDefAudio() {
        return mWasHighDefAudio;
    }
}
+23 −2
Original line number Diff line number Diff line
@@ -226,7 +226,8 @@ public final class CallLogManager extends CallsManagerListenerBase {
                call.getCallDataUsage();

        int callFeatures = getCallFeatures(call.getVideoStateHistory(),
                call.getDisconnectCause().getCode() == DisconnectCause.CALL_PULLED);
                call.getDisconnectCause().getCode() == DisconnectCause.CALL_PULLED,
                shouldSaveHdInfo(call, accountHandle));
        logCall(call.getCallerInfo(), logNumber, call.getPostDialDigits(), formattedViaNumber,
                call.getHandlePresentation(), callLogType, callFeatures, accountHandle,
                creationTime, age, callDataUsage, call.isEmergencyCall(), call.getInitiatingUser(),
@@ -301,9 +302,10 @@ 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.
     * @return The call features.
     */
    private static int getCallFeatures(int videoState, boolean isPulledCall) {
    private static int getCallFeatures(int videoState, boolean isPulledCall, boolean isStoreHd) {
        int features = 0;
        if (VideoProfile.isVideo(videoState)) {
            features |= Calls.FEATURES_VIDEO;
@@ -311,9 +313,28 @@ public final class CallLogManager extends CallsManagerListenerBase {
        if (isPulledCall) {
            features |= Calls.FEATURES_PULLED_EXTERNALLY;
        }
        if (isStoreHd) {
            features |= Calls.FEATURES_HD_CALL;
        }
        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.