From eae07a40aeadf4f0e339c331487c80d3216e3b6e Mon Sep 17 00:00:00 2001 From: Krzysztof Semko Date: Tue, 7 Feb 2017 10:50:40 +0100 Subject: [PATCH] ToneGenerator: fix dual sim ringback tone If dual sim device has two SIM cards inserted, in airplane mode it sets "gsm.operator.iso-country" prop to a single comma, which prevents ToneGenerator to access prop for "gsm.sim.operator.iso-country" - SIM provider country code. When VoWifi is used to make a call, incorrect ringback tone is being played (generic one), instead if one being read from gsm.sim.operator.iso-country. This patch fix this, and allows ToneGenerator to correctly recognize SIM country code. Bug: 65859291 Test: Check ringback tone during SIM2 VoWiFi in flight mode Change-Id: Ibb57d38432f3d99f2eac568aec2a949af5e2a9cd --- media/libaudioclient/ToneGenerator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/media/libaudioclient/ToneGenerator.cpp b/media/libaudioclient/ToneGenerator.cpp index 9bc2594bfb..78e392e601 100644 --- a/media/libaudioclient/ToneGenerator.cpp +++ b/media/libaudioclient/ToneGenerator.cpp @@ -864,6 +864,13 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool if (property_get("gsm.operator.iso-country", value, "") == 0) { property_get("gsm.sim.operator.iso-country", value, ""); } + // If dual sim device has two SIM cards inserted and is not registerd to any network, + // "," is set to "gsm.operator.iso-country" prop. + // In this case, "gsm.sim.operator.iso-country" prop should be used. + if (strlen(value) == 1 && strstr(value, ",") != NULL) { + property_get("gsm.sim.operator.iso-country", value, ""); + } + if (strstr(value, "us") != NULL || strstr(value, "ca") != NULL) { mRegion = ANSI;