Return empty list when SatelliteManager is not created

TelephonyFrameworkInitializer returns null for SatelliteManager when the feature PackageManager.FEATURE_TELEPHONY_SATELLITE is not enabled.
Therefore it is needed to add a exception handling for the case SatelliteManager is null.

Bug: 331182758
Test: manually select choose network in Settings menu from CuttleFish to reproduce
Change-Id: I5faf4f10585b78aada00d0a925d005de1dd71de1
This commit is contained in:
Hakjun Choi
2024-04-17 16:25:20 +00:00
parent e24b145d48
commit 65cb3dfee7

View File

@@ -167,6 +167,7 @@ public class NetworkSelectSettings extends DashboardFragment {
@Keep
@VisibleForTesting
@Nullable
protected SatelliteManager getSatelliteManager(Context context) {
return context.getSystemService(SatelliteManager.class);
}
@@ -359,7 +360,13 @@ public class NetworkSelectSettings extends DashboardFragment {
if (!Flags.carrierEnabledSatelliteFlag()) {
return new ArrayList<>();
}
return mSatelliteManager.getSatellitePlmnsForCarrier(mSubId);
if (mSatelliteManager != null) {
return mSatelliteManager.getSatellitePlmnsForCarrier(mSubId);
} else {
Log.e(TAG, "mSatelliteManager is null, return empty list");
return new ArrayList<>();
}
}
private void handleCarrierConfigChanged(int subId) {