Merge "Clean up satellite provision APIS" into main
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 33ea71a..97d3727 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -13770,17 +13770,22 @@
* This API can be used by only CTS to update satellite vendor service package name.
*
* @param servicePackageName The package name of the satellite vendor service.
+ * @param provisioned Whether satellite should be provisioned or not.
+ *
* @return {@code true} if the satellite vendor service is set successfully,
* {@code false} otherwise.
*/
- public boolean setSatelliteServicePackageName(String servicePackageName) {
- Log.d(LOG_TAG, "setSatelliteServicePackageName - " + servicePackageName);
+ public boolean setSatelliteServicePackageName(String servicePackageName,
+ String provisioned) {
+ Log.d(LOG_TAG, "setSatelliteServicePackageName - " + servicePackageName
+ + ", provisioned=" + provisioned);
TelephonyPermissions.enforceShellOnly(
Binder.getCallingUid(), "setSatelliteServicePackageName");
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
SubscriptionManager.INVALID_SUBSCRIPTION_ID,
"setSatelliteServicePackageName");
- return mSatelliteController.setSatelliteServicePackageName(servicePackageName);
+ return mSatelliteController.setSatelliteServicePackageName(servicePackageName,
+ provisioned);
}
/**
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 6969275..7a424cb 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -3203,6 +3203,7 @@
private int handleSetSatelliteServicePackageNameCommand() {
PrintWriter errPw = getErrPrintWriter();
String serviceName = null;
+ String provisioned = null;
String opt;
while ((opt = getNextOption()) != null) {
@@ -3211,24 +3212,31 @@
serviceName = getNextArgRequired();
break;
}
+
+ case "-p": {
+ provisioned = getNextArgRequired();
+ break;
+ }
}
}
Log.d(LOG_TAG, "handleSetSatelliteServicePackageNameCommand: serviceName="
- + serviceName);
+ + serviceName + ", provisioned=" + provisioned);
try {
- boolean result = mInterface.setSatelliteServicePackageName(serviceName);
+ boolean result = mInterface.setSatelliteServicePackageName(serviceName, provisioned);
if (VDBG) {
- Log.v(LOG_TAG, "SetSatelliteServicePackageName " + serviceName
- + ", result = " + result);
+ Log.v(LOG_TAG,
+ "SetSatelliteServicePackageName " + serviceName + ", provisioned="
+ + provisioned + ", result = " + result);
}
getOutPrintWriter().println(result);
} catch (RemoteException e) {
- Log.w(LOG_TAG, "SetSatelliteServicePackageName: " + serviceName
- + ", error = " + e.getMessage());
+ Log.w(LOG_TAG, "SetSatelliteServicePackageName: " + serviceName + ", provisioned="
+ + provisioned + ", error = " + e.getMessage());
errPw.println("Exception: " + e.getMessage());
return -1;
}
+
return 0;
}
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java
index 20c5ef5..15c8fd8 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java
@@ -39,7 +39,7 @@
*/
public class Provisioning extends Activity {
- private static final String TAG = "Provisioning";
+ private static final String TAG = "SatelliteProvisioning";
private boolean mProvisioned = false;
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java
index b5b781c..54bb16d 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java
@@ -93,7 +93,6 @@
private boolean mIsCommunicationAllowedInLocation;
private boolean mIsEnabled;
- private boolean mIsProvisioned;
private boolean mIsSupported;
private int mModemState;
private boolean mIsCellularModemEnabledMode;
@@ -113,7 +112,6 @@
super(executor);
mIsCommunicationAllowedInLocation = true;
mIsEnabled = false;
- mIsProvisioned = false;
mIsSupported = true;
mModemState = SatelliteModemState.SATELLITE_MODEM_STATE_OFF;
mIsCellularModemEnabledMode = false;
@@ -297,41 +295,6 @@
}
@Override
- public void provisionSatelliteService(@NonNull String token, @NonNull byte[] provisionData,
- @NonNull IIntegerConsumer errorCallback) {
- logd("provisionSatelliteService: mErrorCode=" + mErrorCode);
- if (mErrorCode != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
- runWithExecutor(() -> errorCallback.accept(mErrorCode));
- return;
- }
- runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS));
- updateSatelliteProvisionState(true);
- }
-
- @Override
- public void deprovisionSatelliteService(@NonNull String token,
- @NonNull IIntegerConsumer errorCallback) {
- logd("deprovisionSatelliteService: mErrorCode=" + mErrorCode);
- if (mErrorCode != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
- runWithExecutor(() -> errorCallback.accept(mErrorCode));
- return;
- }
- runWithExecutor(() -> errorCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS));
- updateSatelliteProvisionState(false);
- }
-
- @Override
- public void requestIsSatelliteProvisioned(@NonNull IIntegerConsumer errorCallback,
- @NonNull IBooleanConsumer callback) {
- logd("requestIsSatelliteProvisioned: mErrorCode=" + mErrorCode);
- if (mErrorCode != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
- runWithExecutor(() -> errorCallback.accept(mErrorCode));
- return;
- }
- runWithExecutor(() -> callback.accept(mIsProvisioned));
- }
-
- @Override
public void pollPendingSatelliteDatagrams(@NonNull IIntegerConsumer errorCallback) {
logd("pollPendingSatelliteDatagrams: mErrorCode=" + mErrorCode);
if (mErrorCode != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
@@ -512,11 +475,6 @@
SatelliteResult.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED));
return false;
}
- if (!mIsProvisioned) {
- runWithExecutor(() -> errorCallback.accept(
- SatelliteResult.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED));
- return false;
- }
if (!mIsEnabled) {
runWithExecutor(() -> errorCallback.accept(
SatelliteResult.SATELLITE_RESULT_INVALID_MODEM_STATE));
@@ -545,24 +503,6 @@
}
/**
- * Update the satellite provision state and notify listeners if it changed.
- *
- * @param isProvisioned {@code true} if the satellite is currently provisioned and
- * {@code false} if it is not.
- */
- private void updateSatelliteProvisionState(boolean isProvisioned) {
- logd("updateSatelliteProvisionState: isProvisioned=" + isProvisioned
- + ", mIsProvisioned=" + mIsProvisioned);
- if (isProvisioned == mIsProvisioned) {
- return;
- }
- mIsProvisioned = isProvisioned;
- logd("updateSatelliteProvisionState: mRemoteListeners.size=" + mRemoteListeners.size());
- mRemoteListeners.values().forEach(listener -> runWithExecutor(() ->
- listener.onSatelliteProvisionStateChanged(mIsProvisioned)));
- }
-
- /**
* Execute the given runnable using the executor that this service was created with.
*
* @param r A runnable that can throw an exception.