Merge "Make satellite more info url carrier configurable" into 24D1-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1894469..9e1ab8a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11553,8 +11553,6 @@
<string name="satellite_setting_summary_more_information">Satellite messaging may take longer and is available only in some areas. Weather and certain structures may affect your satellite connection. Calling by satellite isn\u2019t available. Emergency calls may still connect.\n\nIt may take some time for account changes to show in Settings. Contact your carrier for details.</string>
<!-- more about satellite messaging [CHAR_LIMIT=NONE] -->
<string name="more_about_satellite_messaging">More about satellite messaging</string>
- <!-- URL for more info about satellite messaging [CHAR LIMIT=60] -->
- <string name="more_info_satellite_messaging_link" translatable="false"></string>
<!-- Title for Apn settings in mobile network settings [CHAR LIMIT=60] -->
<string name="mobile_network_apn_title">Access Point Names</string>
diff --git a/src/com/android/settings/network/telephony/SatelliteSetting.java b/src/com/android/settings/network/telephony/SatelliteSetting.java
index b6d018a..ad10e03 100644
--- a/src/com/android/settings/network/telephony/SatelliteSetting.java
+++ b/src/com/android/settings/network/telephony/SatelliteSetting.java
@@ -16,6 +16,8 @@
package com.android.settings.network.telephony;
+import static android.telephony.CarrierConfigManager.KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING;
+
import android.app.Activity;
import android.app.settings.SettingsEnums;
import android.content.Intent;
@@ -23,7 +25,9 @@
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.os.PersistableBundle;
import android.os.UserManager;
+import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.satellite.SatelliteManager;
@@ -60,7 +64,9 @@
private Activity mActivity;
private TelephonyManager mTelephonymanager;
+ private CarrierConfigManager mCarrierConfigManager;
private SatelliteManager mSatelliteManager;
+ private PersistableBundle mConfigBundle;
private int mSubId;
public SatelliteSetting() {
@@ -78,6 +84,7 @@
mActivity = getActivity();
mTelephonymanager = mActivity.getSystemService(TelephonyManager.class);
+ mCarrierConfigManager = mActivity.getSystemService(CarrierConfigManager.class);
mSatelliteManager = mActivity.getSystemService(SatelliteManager.class);
mSubId = mActivity.getIntent().getIntExtra(SUB_ID,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -134,7 +141,7 @@
preference.setSummary(spannable);
/* The link will lead users to a guide page */
preference.setOnPreferenceClickListener(pref -> {
- String url = getResources().getString(R.string.more_info_satellite_messaging_link);
+ String url = readSatelliteMoreInfoString(mSubId);
if (!url.isEmpty()) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -163,7 +170,7 @@
operatorName));
final String[] link = new String[1];
- link[0] = getResources().getString(R.string.more_info_satellite_messaging_link);
+ link[0] = readSatelliteMoreInfoString(mSubId);
footerPreference.setLearnMoreAction(view -> {
if (!link[0].isEmpty()) {
Intent helpIntent = HelpUtils.getHelpIntent(mActivity, link[0],
@@ -192,6 +199,18 @@
}
}
+ private String readSatelliteMoreInfoString(int subId) {
+ if (mConfigBundle == null) {
+ mConfigBundle = mCarrierConfigManager.getConfigForSubId(subId,
+ KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING);
+ if (mConfigBundle.isEmpty()) {
+ Log.d(TAG, "SatelliteSettings: getDefaultConfig");
+ mConfigBundle = CarrierConfigManager.getDefaultConfig();
+ }
+ }
+ return mConfigBundle.getString(KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING, "");
+ }
+
private static void loge(String message) {
Log.e(TAG, message);
}