Merge "[Satellite] Add satellite string for KDDI if no entitlement" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
1b1fa4810f
@@ -19,7 +19,9 @@ package com.android.settings.network.telephony;
|
||||
import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC;
|
||||
import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL;
|
||||
import static android.telephony.CarrierConfigManager.KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT;
|
||||
import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL;
|
||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL;
|
||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL;
|
||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -165,8 +167,14 @@ public class SatelliteSetting extends RestrictedDashboardFragment {
|
||||
}
|
||||
|
||||
private void updateMobilePlan(boolean isSatelliteEligible) {
|
||||
// Your mobile plan
|
||||
PreferenceCategory prefCategory = findPreference(PREF_KEY_CATEGORY_YOUR_SATELLITE_PLAN);
|
||||
if (prefCategory == null || !mConfigBundle.getBoolean(
|
||||
KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL)) {
|
||||
prefCategory.setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Your mobile plan
|
||||
prefCategory.setTitle(getResources().getString(R.string.category_title_your_satellite_plan,
|
||||
mSimOperatorName));
|
||||
Preference messagingPreference = findPreference(PREF_KEY_YOUR_SATELLITE_PLAN);
|
||||
@@ -227,9 +235,11 @@ public class SatelliteSetting extends RestrictedDashboardFragment {
|
||||
// More about satellite messaging
|
||||
FooterPreference footerPreference = findPreference(KEY_FOOTER_PREFERENCE);
|
||||
if (footerPreference != null) {
|
||||
footerPreference.setSummary(
|
||||
getResources().getString(R.string.satellite_setting_summary_more_information,
|
||||
getSubjectString(), mSimOperatorName));
|
||||
int summary = mConfigBundle.getBoolean(KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL)
|
||||
? R.string.satellite_setting_summary_more_information
|
||||
: R.string.satellite_setting_summary_more_information_no_emergency_messaging;
|
||||
footerPreference.setSummary(getResources().getString(summary,
|
||||
getSubjectString(), mSimOperatorName));
|
||||
|
||||
final String[] link = new String[1];
|
||||
link[0] = readSatelliteMoreInfoString();
|
||||
@@ -273,7 +283,9 @@ public class SatelliteSetting extends RestrictedDashboardFragment {
|
||||
bundle = carrierConfigManager.getConfigForSubId(subId,
|
||||
KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
|
||||
KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING,
|
||||
KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT);
|
||||
KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT,
|
||||
KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL,
|
||||
KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL);
|
||||
if (bundle.isEmpty()) {
|
||||
Log.d(TAG, "SatelliteSettings: getDefaultConfig");
|
||||
bundle = CarrierConfigManager.getDefaultConfig();
|
||||
|
@@ -17,9 +17,9 @@
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC;
|
||||
import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL;
|
||||
import static android.telephony.CarrierConfigManager.KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT;
|
||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL;
|
||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL;
|
||||
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
|
||||
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
|
||||
|
||||
@@ -65,9 +65,9 @@ public class SatelliteSettingPreferenceController extends
|
||||
@Nullable
|
||||
private Boolean mIsSatelliteEligible = null;
|
||||
private boolean mIsServiceDataType = false;
|
||||
private boolean mIsSatelliteSmsAvailableForManualType = false;
|
||||
private boolean mIsCarrierSatelliteAttachSupported = false;
|
||||
private boolean mIsCarrierRoamingNtnConnectedTypeManual = false;
|
||||
@VisibleForTesting
|
||||
boolean mIsSatelliteSmsAvailableForManualType = false;
|
||||
private PersistableBundle mCarrierConfigs = new PersistableBundle();
|
||||
|
||||
public SatelliteSettingPreferenceController(@NonNull Context context, @NonNull String key) {
|
||||
super(context, key);
|
||||
@@ -95,13 +95,15 @@ public class SatelliteSettingPreferenceController extends
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
int availabilityStatus = mIsCarrierSatelliteAttachSupported
|
||||
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
if (availabilityStatus == AVAILABLE && mIsCarrierRoamingNtnConnectedTypeManual
|
||||
&& !mIsSatelliteSmsAvailableForManualType) {
|
||||
availabilityStatus = CONDITIONALLY_UNAVAILABLE;
|
||||
boolean isSatelliteAttachSupport = mCarrierConfigs.getBoolean(
|
||||
KEY_SATELLITE_ATTACH_SUPPORTED_BOOL);
|
||||
|
||||
if (isSatelliteAttachSupport && isCarrierRoamingNtnConnectedTypeAuto()
|
||||
&& mIsSatelliteSmsAvailableForManualType) {
|
||||
return AVAILABLE;
|
||||
}
|
||||
return availabilityStatus;
|
||||
|
||||
return CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,7 +130,7 @@ public class SatelliteSettingPreferenceController extends
|
||||
@Override
|
||||
public void updateState(@Nullable Preference preference) {
|
||||
super.updateState(preference);
|
||||
if (preference != null) {
|
||||
if (preference != null && preference.getKey().equals(getPreferenceKey())) {
|
||||
mCarrierRoamingNtnModeCallback.mPref = preference;
|
||||
updateSummary(preference);
|
||||
}
|
||||
@@ -162,18 +164,7 @@ public class SatelliteSettingPreferenceController extends
|
||||
logd("init(), subId=" + subId);
|
||||
mSubId = subId;
|
||||
mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
|
||||
|
||||
final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(subId);
|
||||
if (carrierConfig == null) {
|
||||
logd("init(), no carrier config data");
|
||||
return;
|
||||
}
|
||||
mIsCarrierSatelliteAttachSupported = carrierConfig.getBoolean(
|
||||
KEY_SATELLITE_ATTACH_SUPPORTED_BOOL);
|
||||
mIsCarrierRoamingNtnConnectedTypeManual =
|
||||
CARRIER_ROAMING_NTN_CONNECT_MANUAL == carrierConfig.getInt(
|
||||
KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT,
|
||||
CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC);
|
||||
mCarrierConfigs = mCarrierConfigCache.getConfigForSubId(subId);
|
||||
}
|
||||
|
||||
private void updateSummary(Preference preference) {
|
||||
@@ -186,11 +177,12 @@ public class SatelliteSettingPreferenceController extends
|
||||
return;
|
||||
}
|
||||
|
||||
if (mIsCarrierRoamingNtnConnectedTypeManual) {
|
||||
preference.setSummary(mIsSatelliteSmsAvailableForManualType
|
||||
? R.string.satellite_setting_enabled_summary
|
||||
: R.string.satellite_setting_disabled_summary);
|
||||
} else {
|
||||
if (!mCarrierConfigs.getBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL)) {
|
||||
preference.setSummary(R.string.satellite_setting_summary_without_entitlement);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCarrierRoamingNtnConnectedTypeAuto()) {
|
||||
try {
|
||||
Set<Integer> restrictionReason =
|
||||
mSatelliteManager.getAttachRestrictionReasonsForCarrier(mSubId);
|
||||
@@ -207,9 +199,19 @@ public class SatelliteSettingPreferenceController extends
|
||||
loge(ex.toString());
|
||||
preference.setSummary(R.string.satellite_setting_disabled_summary);
|
||||
}
|
||||
} else {
|
||||
preference.setSummary(mIsSatelliteSmsAvailableForManualType
|
||||
? R.string.satellite_setting_enabled_summary
|
||||
: R.string.satellite_setting_disabled_summary);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCarrierRoamingNtnConnectedTypeAuto() {
|
||||
return CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC == mCarrierConfigs.getInt(
|
||||
KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT,
|
||||
CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
class CarrierRoamingNtnModeCallback extends TelephonyCallback implements
|
||||
TelephonyCallback.CarrierRoamingNtnListener {
|
||||
|
Reference in New Issue
Block a user