Add requestSatelliteAccessConfigurationForCurrentLocation for TestSatelliteApp
Bug: 380112693i
Test: Manually verified if the api is working well with TestSatelliteApp.
Flag: EXEMPT 'Test Code'
Change-Id: Ib00f8c10137651362ec4f3fd587797056defb962
diff --git a/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml b/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml
index d046f03..b4df40a 100644
--- a/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml
+++ b/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml
@@ -203,6 +203,12 @@
android:layout_height="wrap_content"
android:paddingRight="4dp"
android:text="@string/setNtnSmsSupportedFalse"/>
+ <Button
+ android:id="@+id/requestSatelliteAccessConfigurationForCurrentLocation"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/requestSatelliteAccessConfigurationForCurrentLocation"/>
<LinearLayout
android:layout_width="match_parent"
diff --git a/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml b/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
index 4b5ea5b..5c3a72d 100644
--- a/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
+++ b/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
@@ -109,4 +109,6 @@
<string name="registerForModemStateChanged">registerForModemStateChanged</string>
<string name="unregisterForModemStateChanged">unregisterForModemStateChanged</string>
+
+ <string name="requestSatelliteAccessConfigurationForCurrentLocation">requestSatelliteAccessConfigurationForCurrentLocation</string>
</resources>
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
index 7d5e9af..5092d03 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
@@ -26,6 +26,7 @@
import android.telephony.satellite.wrapper.CarrierRoamingNtnModeListenerWrapper2;
import android.telephony.satellite.wrapper.NtnSignalStrengthCallbackWrapper;
import android.telephony.satellite.wrapper.NtnSignalStrengthWrapper;
+import android.telephony.satellite.wrapper.SatelliteAccessConfigurationWrapper;
import android.telephony.satellite.wrapper.SatelliteCapabilitiesCallbackWrapper;
import android.telephony.satellite.wrapper.SatelliteCommunicationAllowedStateCallbackWrapper;
import android.telephony.satellite.wrapper.SatelliteManagerWrapper;
@@ -131,6 +132,9 @@
.setOnClickListener(this::setNtnSmsSupportedTrue);
findViewById(R.id.setNtnSmsSupportedFalse)
.setOnClickListener(this::setNtnSmsSupportedFalse);
+ findViewById(R.id.requestSatelliteAccessConfigurationForCurrentLocation)
+ .setOnClickListener(this::requestSatelliteAccessConfigurationForCurrentLocation);
+
findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
@@ -703,6 +707,47 @@
}
}
+ private void requestSatelliteAccessConfigurationForCurrentLocation(View view) {
+ addLogMessage("requestSatelliteAccessConfigurationForCurrentLocation");
+ logd("requestSatelliteAccessConfigurationForCurrentLocation");
+ OutcomeReceiver<SatelliteAccessConfigurationWrapper,
+ SatelliteManagerWrapper.SatelliteExceptionWrapper> receiver =
+ new OutcomeReceiver<>() {
+ @Override
+ public void onResult(SatelliteAccessConfigurationWrapper result) {
+ if (result != null) {
+ addLogMessage("requestSatelliteAccessConfigurationForCurrentLocation: "
+ + result.getSatelliteInfos());
+ } else {
+ addLogMessage("requestSatelliteAccessConfigurationForCurrentLocation: "
+ + "null");
+ }
+ }
+
+ @Override
+ public void onError(
+ SatelliteManagerWrapper.SatelliteExceptionWrapper exception) {
+ if (exception != null) {
+ String onError = "requestSatelliteAccessConfigurationForCurrentLocation"
+ + " exception: "
+ + translateResultCodeToString(exception.getErrorCode());
+ logd(onError);
+ addLogMessage(onError);
+ }
+ }
+ };
+
+ try {
+ mSatelliteManagerWrapper
+ .requestSatelliteAccessConfigurationForCurrentLocation(mExecutor, receiver);
+ } catch (SecurityException ex) {
+ String errorMessage = "requestSatelliteAccessConfigurationForCurrentLocation: "
+ + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
private void addAttachRestrictionForCarrier(View view) {
addLogMessage("addAttachRestrictionForCarrier");
logd("addAttachRestrictionForCarrier");