Loading src/java/com/android/internal/telephony/d2d/MessageTypeAndValueHelper.java 0 → 100644 +97 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony.d2d; import android.telecom.Connection; import android.telecom.DiagnosticCall; import android.telephony.TelephonyManager; import com.android.internal.telephony.BiMap; /** * Helper class to map between the message types and values used in {@link Communicator} and those * defined in the public API in {@link DiagnosticCall}. */ public class MessageTypeAndValueHelper { // Maps between the local message and value types defined here and those defined in the // DiagnosticCall class as part of the actual API. /** * Convert between the local message type (e.g. * {@link Communicator#MESSAGE_CALL_RADIO_ACCESS_TYPE}) * and * the ones referred to in {@link DiagnosticCall}. */ public static final BiMap<Integer, Integer> MSG_TYPE_TO_DC_MSG_TYPE = new BiMap<>(); /** * Convert between the local RAT type (e.g. {@link Communicator#RADIO_ACCESS_TYPE_IWLAN}) and * the ones * referred to by {@link DiagnosticCall#MESSAGE_CALL_NETWORK_TYPE}. */ public static final BiMap<Integer, Integer> RAT_TYPE_TO_DC_NETWORK_TYPE = new BiMap<>(); /** * Convert between the local codec (e.g. {@link Communicator#AUDIO_CODEC_AMR_WB}) and the ones * referred to by {@link DiagnosticCall#MESSAGE_CALL_AUDIO_CODEC}. */ public static final BiMap<Integer, Integer> CODEC_TO_DC_CODEC = new BiMap<>(); /** * Convert between the local battery state (e.g. {@link Communicator#BATTERY_STATE_GOOD}) and * the ones referred to by {@link DiagnosticCall#MESSAGE_DEVICE_BATTERY_STATE}. */ public static final BiMap<Integer, Integer> BATTERY_STATE_TO_DC_BATTERY_STATE = new BiMap(); /** * Convert between the local battery state (e.g. {@link Communicator#COVERAGE_GOOD}) and the * ones referred to by {@link DiagnosticCall#MESSAGE_DEVICE_NETWORK_COVERAGE}. */ public static final BiMap<Integer, Integer> COVERAGE_TO_DC_COVERAGE = new BiMap(); static { MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_CALL_RADIO_ACCESS_TYPE, DiagnosticCall.MESSAGE_CALL_NETWORK_TYPE); MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_CALL_AUDIO_CODEC, DiagnosticCall.MESSAGE_CALL_AUDIO_CODEC); MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_DEVICE_BATTERY_STATE, DiagnosticCall.MESSAGE_DEVICE_BATTERY_STATE); MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_DEVICE_NETWORK_COVERAGE, DiagnosticCall.MESSAGE_DEVICE_NETWORK_COVERAGE); RAT_TYPE_TO_DC_NETWORK_TYPE.put(Communicator.RADIO_ACCESS_TYPE_LTE, TelephonyManager.NETWORK_TYPE_LTE); RAT_TYPE_TO_DC_NETWORK_TYPE.put(Communicator.RADIO_ACCESS_TYPE_IWLAN, TelephonyManager.NETWORK_TYPE_IWLAN); RAT_TYPE_TO_DC_NETWORK_TYPE.put(Communicator.RADIO_ACCESS_TYPE_NR, TelephonyManager.NETWORK_TYPE_NR); CODEC_TO_DC_CODEC.put(Communicator.AUDIO_CODEC_EVS, Connection.AUDIO_CODEC_EVS_WB); CODEC_TO_DC_CODEC.put(Communicator.AUDIO_CODEC_AMR_WB, Connection.AUDIO_CODEC_AMR_WB); CODEC_TO_DC_CODEC.put(Communicator.AUDIO_CODEC_AMR_NB, Connection.AUDIO_CODEC_AMR); BATTERY_STATE_TO_DC_BATTERY_STATE.put(Communicator.BATTERY_STATE_LOW, DiagnosticCall.BATTERY_STATE_LOW); BATTERY_STATE_TO_DC_BATTERY_STATE.put(Communicator.BATTERY_STATE_GOOD, DiagnosticCall.BATTERY_STATE_GOOD); BATTERY_STATE_TO_DC_BATTERY_STATE.put(Communicator.BATTERY_STATE_CHARGING, DiagnosticCall.BATTERY_STATE_CHARGING); COVERAGE_TO_DC_COVERAGE.put(Communicator.COVERAGE_POOR, DiagnosticCall.COVERAGE_POOR); COVERAGE_TO_DC_COVERAGE.put(Communicator.COVERAGE_GOOD, DiagnosticCall.COVERAGE_GOOD); } } src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +9 −0 Original line number Diff line number Diff line Loading @@ -3797,6 +3797,15 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { } cqm.saveCallQuality(callQuality); mCallQualityMetrics.put(callId, cqm); ImsPhoneConnection conn = findConnection(imsCall); if (conn != null) { Bundle report = new Bundle(); report.putParcelable(android.telecom.Connection.EXTRA_CALL_QUALITY_REPORT, callQuality); conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_QUALITY_REPORT, report); } } /** Loading Loading
src/java/com/android/internal/telephony/d2d/MessageTypeAndValueHelper.java 0 → 100644 +97 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony.d2d; import android.telecom.Connection; import android.telecom.DiagnosticCall; import android.telephony.TelephonyManager; import com.android.internal.telephony.BiMap; /** * Helper class to map between the message types and values used in {@link Communicator} and those * defined in the public API in {@link DiagnosticCall}. */ public class MessageTypeAndValueHelper { // Maps between the local message and value types defined here and those defined in the // DiagnosticCall class as part of the actual API. /** * Convert between the local message type (e.g. * {@link Communicator#MESSAGE_CALL_RADIO_ACCESS_TYPE}) * and * the ones referred to in {@link DiagnosticCall}. */ public static final BiMap<Integer, Integer> MSG_TYPE_TO_DC_MSG_TYPE = new BiMap<>(); /** * Convert between the local RAT type (e.g. {@link Communicator#RADIO_ACCESS_TYPE_IWLAN}) and * the ones * referred to by {@link DiagnosticCall#MESSAGE_CALL_NETWORK_TYPE}. */ public static final BiMap<Integer, Integer> RAT_TYPE_TO_DC_NETWORK_TYPE = new BiMap<>(); /** * Convert between the local codec (e.g. {@link Communicator#AUDIO_CODEC_AMR_WB}) and the ones * referred to by {@link DiagnosticCall#MESSAGE_CALL_AUDIO_CODEC}. */ public static final BiMap<Integer, Integer> CODEC_TO_DC_CODEC = new BiMap<>(); /** * Convert between the local battery state (e.g. {@link Communicator#BATTERY_STATE_GOOD}) and * the ones referred to by {@link DiagnosticCall#MESSAGE_DEVICE_BATTERY_STATE}. */ public static final BiMap<Integer, Integer> BATTERY_STATE_TO_DC_BATTERY_STATE = new BiMap(); /** * Convert between the local battery state (e.g. {@link Communicator#COVERAGE_GOOD}) and the * ones referred to by {@link DiagnosticCall#MESSAGE_DEVICE_NETWORK_COVERAGE}. */ public static final BiMap<Integer, Integer> COVERAGE_TO_DC_COVERAGE = new BiMap(); static { MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_CALL_RADIO_ACCESS_TYPE, DiagnosticCall.MESSAGE_CALL_NETWORK_TYPE); MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_CALL_AUDIO_CODEC, DiagnosticCall.MESSAGE_CALL_AUDIO_CODEC); MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_DEVICE_BATTERY_STATE, DiagnosticCall.MESSAGE_DEVICE_BATTERY_STATE); MSG_TYPE_TO_DC_MSG_TYPE.put(Communicator.MESSAGE_DEVICE_NETWORK_COVERAGE, DiagnosticCall.MESSAGE_DEVICE_NETWORK_COVERAGE); RAT_TYPE_TO_DC_NETWORK_TYPE.put(Communicator.RADIO_ACCESS_TYPE_LTE, TelephonyManager.NETWORK_TYPE_LTE); RAT_TYPE_TO_DC_NETWORK_TYPE.put(Communicator.RADIO_ACCESS_TYPE_IWLAN, TelephonyManager.NETWORK_TYPE_IWLAN); RAT_TYPE_TO_DC_NETWORK_TYPE.put(Communicator.RADIO_ACCESS_TYPE_NR, TelephonyManager.NETWORK_TYPE_NR); CODEC_TO_DC_CODEC.put(Communicator.AUDIO_CODEC_EVS, Connection.AUDIO_CODEC_EVS_WB); CODEC_TO_DC_CODEC.put(Communicator.AUDIO_CODEC_AMR_WB, Connection.AUDIO_CODEC_AMR_WB); CODEC_TO_DC_CODEC.put(Communicator.AUDIO_CODEC_AMR_NB, Connection.AUDIO_CODEC_AMR); BATTERY_STATE_TO_DC_BATTERY_STATE.put(Communicator.BATTERY_STATE_LOW, DiagnosticCall.BATTERY_STATE_LOW); BATTERY_STATE_TO_DC_BATTERY_STATE.put(Communicator.BATTERY_STATE_GOOD, DiagnosticCall.BATTERY_STATE_GOOD); BATTERY_STATE_TO_DC_BATTERY_STATE.put(Communicator.BATTERY_STATE_CHARGING, DiagnosticCall.BATTERY_STATE_CHARGING); COVERAGE_TO_DC_COVERAGE.put(Communicator.COVERAGE_POOR, DiagnosticCall.COVERAGE_POOR); COVERAGE_TO_DC_COVERAGE.put(Communicator.COVERAGE_GOOD, DiagnosticCall.COVERAGE_GOOD); } }
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +9 −0 Original line number Diff line number Diff line Loading @@ -3797,6 +3797,15 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { } cqm.saveCallQuality(callQuality); mCallQualityMetrics.put(callId, cqm); ImsPhoneConnection conn = findConnection(imsCall); if (conn != null) { Bundle report = new Bundle(); report.putParcelable(android.telecom.Connection.EXTRA_CALL_QUALITY_REPORT, callQuality); conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_QUALITY_REPORT, report); } } /** Loading