Add requestProvisionSubscriberIds , requestIsSatelliteProvisioned and provisionSatellite for test
Bug: 351278182
Test: atest SatelliteManagerTestOnMockService
Test: manual test with SatelliteTestApp b/351278182#comment2
verify requestProvisionSubscriberIds, requestIsSatelliteProvisioned and provisionSatellite
Flag: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
Change-Id: Ifbe45875a77178f1307371949cca147b2e5fffe0
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 9aed910..7d40a1f 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -14298,7 +14298,8 @@
* @throws SecurityException if the caller doesn't have the required permission.
*/
@Override
- public void requestIsProvisioned(String satelliteSubscriberId, @NonNull ResultReceiver result) {
+ public void requestIsProvisioned(@NonNull String satelliteSubscriberId,
+ @NonNull ResultReceiver result) {
enforceSatelliteCommunicationPermission("requestIsProvisioned");
mSatelliteController.requestIsProvisioned(satelliteSubscriberId, result);
}
@@ -14312,7 +14313,7 @@
* @throws SecurityException if the caller doesn't have the required permission.
*/
@Override
- public void provisionSatellite(List<ProvisionSubscriberId> list,
+ public void provisionSatellite(@NonNull List<ProvisionSubscriberId> list,
@NonNull ResultReceiver result) {
enforceSatelliteCommunicationPermission("provisionSatellite");
mSatelliteController.provisionSatellite(list, result);
diff --git a/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml b/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml
index 6aec1da..b1b2ccf 100644
--- a/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml
+++ b/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml
@@ -125,6 +125,24 @@
android:layout_height="wrap_content"
android:paddingRight="4dp"
android:text="@string/getIsEmergency"/>
+ <Button
+ android:id="@+id/requestProvisionSubscriberIds"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/requestProvisionSubscriberIds"/>
+ <Button
+ android:id="@+id/requestIsProvisioned"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/requestIsProvisioned"/>
+ <Button
+ android:id="@+id/provisionSatellite"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/provisionSatellite"/>
<Button
android:id="@+id/Back"
android:onClick="Back"
diff --git a/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml b/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
index e7fbb97..1f2a3ca 100644
--- a/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
+++ b/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
@@ -91,6 +91,10 @@
<string name="reportSatelliteNotSupportedFromModem">reportSatelliteNotSupportedFromModem</string>
<string name="showCurrentSatelliteSupportedStated">showCurrentSatelliteSupportedStated</string>
+ <string name="requestProvisionSubscriberIds">requestProvisionSubscriberIds</string>
+ <string name="requestIsProvisioned">requestIsProvisioned</string>
+ <string name="provisionSatellite">provisionSatellite</string>
+
<string name="Back">Back</string>
<string name="ClearLog">Clear Log</string>
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
index a03f04e..4b09a56 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
@@ -23,6 +23,7 @@
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.satellite.EnableRequestAttributes;
+import android.telephony.satellite.ProvisionSubscriberId;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteManager;
import android.telephony.satellite.stub.SatelliteResult;
@@ -31,6 +32,7 @@
import android.widget.TextView;
import java.time.Duration;
+import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
@@ -45,6 +47,7 @@
private SatelliteManager mSatelliteManager;
private SubscriptionManager mSubscriptionManager;
+ private List<ProvisionSubscriberId> mProvisionSubscriberIdList = new ArrayList<>();
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -83,6 +86,12 @@
.setOnClickListener(this::isRequestIsSatelliteEnabledForCarrierApp);
findViewById(R.id.getIsEmergency)
.setOnClickListener(this::getIsEmergencyApp);
+ findViewById(R.id.requestProvisionSubscriberIds)
+ .setOnClickListener(this::requestProvisionSubscriberIdsApp);
+ findViewById(R.id.requestIsProvisioned)
+ .setOnClickListener(this::requestIsProvisionedApp);
+ findViewById(R.id.provisionSatellite)
+ .setOnClickListener(this::provisionSatelliteApp);
findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
@@ -383,4 +392,94 @@
+ SatelliteTestApp.getTestSatelliteService()
.getIsEmergency());
}
+
+ private void requestProvisionSubscriberIdsApp(View view) {
+ final AtomicReference<List<ProvisionSubscriberId>> list = new AtomicReference<>();
+ final AtomicReference<Integer> errorCode = new AtomicReference<>();
+ OutcomeReceiver<List<ProvisionSubscriberId>, SatelliteManager.SatelliteException> receiver =
+ new OutcomeReceiver<>() {
+ @Override
+ public void onResult(List<ProvisionSubscriberId> result) {
+ mProvisionSubscriberIdList = result;
+ list.set(result);
+ TextView textView = findViewById(R.id.text_id);
+ String text = "";
+ for (ProvisionSubscriberId psi : result) {
+ text += "" + psi + " , ";
+ }
+ textView.setText("requestProvisionSubscriberIds: result=" + text);
+ }
+
+ @Override
+ public void onError(SatelliteManager.SatelliteException exception) {
+ errorCode.set(exception.getErrorCode());
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("Status for requestProvisionSubscriberIds error : "
+ + SatelliteErrorUtils.mapError(errorCode.get()));
+ }
+ };
+ mSatelliteManager.requestProvisionSubscriberIds(Runnable::run, receiver);
+ }
+
+ private void requestIsProvisionedApp(View view) {
+ final AtomicReference<Boolean> enabled = new AtomicReference<>();
+ final AtomicReference<Integer> errorCode = new AtomicReference<>();
+ OutcomeReceiver<Boolean, SatelliteManager.SatelliteException> receiver =
+ new OutcomeReceiver<>() {
+ @Override
+ public void onResult(Boolean result) {
+ enabled.set(result);
+ TextView textView = findViewById(R.id.text_id);
+ if (enabled.get()) {
+ textView.setText("requestIsProvisioned is true");
+ } else {
+ textView.setText("Status for requestIsProvisioned result : "
+ + enabled.get());
+ }
+ }
+
+ @Override
+ public void onError(SatelliteManager.SatelliteException exception) {
+ errorCode.set(exception.getErrorCode());
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("Status for requestIsProvisioned error : "
+ + SatelliteErrorUtils.mapError(errorCode.get()));
+ }
+ };
+ if (mProvisionSubscriberIdList == null || mProvisionSubscriberIdList.get(0) == null) {
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("No ProvisionSubscriberIdList");
+ return;
+ }
+ mSatelliteManager.requestIsProvisioned(mProvisionSubscriberIdList.get(0).getSubscriberId(),
+ Runnable::run, receiver);
+ }
+
+ private void provisionSatelliteApp(View view) {
+ final AtomicReference<Boolean> enabled = new AtomicReference<>();
+ final AtomicReference<Integer> errorCode = new AtomicReference<>();
+ OutcomeReceiver<Boolean, SatelliteManager.SatelliteException> receiver =
+ new OutcomeReceiver<>() {
+ @Override
+ public void onResult(Boolean result) {
+ enabled.set(result);
+ TextView textView = findViewById(R.id.text_id);
+ if (enabled.get()) {
+ textView.setText("provisionSatellite is true");
+ } else {
+ textView.setText("Status for provisionSatellite result : "
+ + enabled.get());
+ }
+ }
+
+ @Override
+ public void onError(SatelliteManager.SatelliteException exception) {
+ errorCode.set(exception.getErrorCode());
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("Status for provisionSatellite error : "
+ + SatelliteErrorUtils.mapError(errorCode.get()));
+ }
+ };
+ mSatelliteManager.provisionSatellite(mProvisionSubscriberIdList, Runnable::run, receiver);
+ }
}