add new API setActivationState to TelephonyManager
Bug: 31061369
Test: all existing telephony unit tests are passing
Merged-in CHANGE-ID: I01a931b4d953d03a5710d521b0c5a3a9033c1d89
Change-Id: I84433729448f32fc1eea4d93bc9ad6b99252608b
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index b1ad364..7f9a865 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1960,6 +1960,66 @@
.getVisualVoicemailSmsFilterSettings(mPhone.getContext(), packageName, subId);
}
/**
+ * Sets the voice activation state of a given subId.
+ */
+ @Override
+ public void setVoiceActivationState(int subId, int activationState) {
+ enforceModifyPermissionOrCarrierPrivilege(subId);
+ final Phone phone = getPhone(subId);
+ if (phone != null) {
+ phone.setVoiceActivationState(activationState);
+ } else {
+ loge("setVoiceActivationState fails with invalid subId: " + subId);
+ }
+ }
+
+ /**
+ * Sets the data activation state of a given subId.
+ */
+ @Override
+ public void setDataActivationState(int subId, int activationState) {
+ enforceModifyPermissionOrCarrierPrivilege(subId);
+ final Phone phone = getPhone(subId);
+ if (phone != null) {
+ phone.setDataActivationState(activationState);
+ } else {
+ loge("setVoiceActivationState fails with invalid subId: " + subId);
+ }
+ }
+
+ /**
+ * Returns the voice activation state of a given subId.
+ */
+ @Override
+ public int getVoiceActivationState(int subId, String callingPackage) {
+ if (!canReadPhoneState(callingPackage, "getVoiceActivationStateForSubscriber")) {
+ return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
+ }
+ final Phone phone = getPhone(subId);
+ if (phone != null) {
+ return phone.getVoiceActivationState();
+ } else {
+ return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
+ }
+ }
+
+ /**
+ * Returns the data activation state of a given subId.
+ */
+ @Override
+ public int getDataActivationState(int subId, String callingPackage) {
+ if (!canReadPhoneState(callingPackage, "getDataActivationStateForSubscriber")) {
+ return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
+ }
+ final Phone phone = getPhone(subId);
+ if (phone != null) {
+ return phone.getDataActivationState();
+ } else {
+ return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
+ }
+ }
+
+ /**
* Returns the unread count of voicemails
*/
public int getVoiceMessageCount() {