shill: cellular: Pass operator-specific MDN to online payment portal.
BUG=chrome-os-partner:20887
TEST=Tested the following:
1. Build and run unit tests.
2. Run `connectivity show services` to verify that the 'Cellular.OlpUrl'
property of a LTE cellular service includes a 10-digit MDN.
3. Verify that clicking the 'View account' button on the settings page
of a connected LTE service launches the online account page of the
mobile carrier.
Change-Id: If7a9660082b3b33812d3f1a0c0f99e01c17265f6
Reviewed-on: https://gerrit.chromium.org/gerrit/61823
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/cellular_capability_universal_cdma.cc b/cellular_capability_universal_cdma.cc
index 7b9c7ec..af148bd 100644
--- a/cellular_capability_universal_cdma.cc
+++ b/cellular_capability_universal_cdma.cc
@@ -213,13 +213,21 @@
}
void CellularCapabilityUniversalCDMA::UpdateOLP() {
- SLOG(Cellular,2) << __func__;
- if (!modem_info()->cellular_operator_info())
+ SLOG(Cellular, 2) << __func__;
+
+ const CellularOperatorInfo *cellular_operator_info =
+ modem_info()->cellular_operator_info();
+ if (!cellular_operator_info)
+ return;
+
+ string sid_string = UintToString(sid_);
+ const CellularOperatorInfo::CellularOperator *cellular_operator =
+ cellular_operator_info->GetCellularOperatorBySID(sid_string);
+ if (!cellular_operator)
return;
const CellularService::OLP *result =
- modem_info()->cellular_operator_info()->GetOLPBySID(
- UintToString(sid_));
+ cellular_operator_info->GetOLPBySID(sid_string);
if (!result)
return;
@@ -227,7 +235,8 @@
olp.CopyFrom(*result);
string post_data = olp.GetPostData();
ReplaceSubstringsAfterOffset(&post_data, 0, "${esn}", esn());
- ReplaceSubstringsAfterOffset(&post_data, 0, "${mdn}", mdn());
+ ReplaceSubstringsAfterOffset(&post_data, 0, "${mdn}",
+ GetMdnForOLP(*cellular_operator));
ReplaceSubstringsAfterOffset(&post_data, 0, "${meid}", meid());
olp.SetPostData(post_data);
if (cellular()->service().get())