Merge "[Satellite] Fixed the crash issue with phone hidden menu." into main
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index a3d8baf..0548aa5 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -15017,4 +15017,25 @@
Binder.restoreCallingIdentity(identity);
}
}
+
+ /**
+ * Get list of applications that are optimized for low bandwidth satellite data.
+ *
+ * @return List of Application Name with data optimized network property.
+ * {@link #PROPERTY_SATELLITE_DATA_OPTIMIZED}
+ */
+ @Override
+ public List<String> getSatelliteDataOptimizedApps() {
+ enforceSatelliteCommunicationPermission("getSatelliteDataOptimizedApps");
+ List<String> appNames = new ArrayList<>();
+ int userId = Binder.getCallingUserHandle().getIdentifier();
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ appNames = mSatelliteController.getSatelliteDataOptimizedApps(userId);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+
+ return appNames;
+ }
}
diff --git a/tests/src/com/android/phone/PhoneInterfaceManagerTest.java b/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
index ef6a02a..bbcb52b 100644
--- a/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
+++ b/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
@@ -46,6 +46,7 @@
import android.platform.test.flag.junit.SetFlagsRule;
import android.preference.PreferenceManager;
import android.telephony.RadioAccessFamily;
+import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -74,6 +75,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
+import java.util.List;
import java.util.Locale;
/**
@@ -85,6 +87,8 @@
@Rule
public TestRule compatChangeRule = new PlatformCompatChangeRule();
+ private static final String TAG = "PhoneInterfaceManagerTest";
+
private PhoneInterfaceManager mPhoneInterfaceManager;
private SharedPreferences mSharedPreferences;
@Mock private IIntegerConsumer mIIntegerConsumer;
@@ -322,6 +326,10 @@
mPhoneInterfaceManager).getDefaultPhone();
}
+ private static void loge(String message) {
+ Rlog.e(TAG, message);
+ }
+
@Test
public void setNullCipherNotificationsEnabled_allReqsMet_successfullyEnabled() {
setModemSupportsNullCipherNotification(true);
@@ -550,4 +558,25 @@
String packageName = mPhoneInterfaceManager.getCurrentPackageName();
assertEquals(null, packageName);
}
+
+ @Test
+ public void testGetSatelliteDataOptimizedApps() throws Exception {
+ doReturn(true).when(mFeatureFlags).carrierRoamingNbIotNtn();
+ mPhoneInterfaceManager.setFeatureFlags(mFeatureFlags);
+ loge("FeatureFlagApi is set to return true");
+
+ boolean containsCtsApp = false;
+ String ctsPackageName = "android.telephony.cts";
+ List<String> listSatelliteApplications =
+ mPhoneInterfaceManager.getSatelliteDataOptimizedApps();
+
+ for (String packageName : listSatelliteApplications) {
+ if (ctsPackageName.equals(packageName)) {
+ containsCtsApp = true;
+ }
+ }
+
+ assertFalse(containsCtsApp);
+ }
+
}