Make generic of get/setMobileDataPolicyEnabled()
Replace the specified valid policies "data during call" and "mms always allowed" with any mobile data policy. After this change, any mobile data policies will be stored in dataSettingsManager.
Bug: 244064524
Test: atest TelephonyManagerTest + manually set/remove and review bugreport
Merged-In: Ia53a740e0490a473dfcfdf23a8e9cb8870cfec1f
Change-Id: Ia53a740e0490a473dfcfdf23a8e9cb8870cfec1f
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index ba8b330..06d6849 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -9800,14 +9800,7 @@
Phone phone = getPhone(subscriptionId);
if (phone == null) return false;
- switch (policy) {
- case TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL:
- return phone.getDataSettingsManager().isDataAllowedInVoiceCall();
- case TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED:
- return phone.getDataSettingsManager().isMmsAlwaysAllowed();
- default:
- throw new IllegalArgumentException(policy + " is not a valid policy");
- }
+ return phone.getDataSettingsManager().isMobileDataPolicyEnabled(policy);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -9823,16 +9816,7 @@
Phone phone = getPhone(subscriptionId);
if (phone == null) return;
- switch (policy) {
- case TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL:
- phone.getDataSettingsManager().setAllowDataDuringVoiceCall(enabled);
- break;
- case TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED:
- phone.getDataSettingsManager().setAlwaysAllowMmsData(enabled);
- break;
- default:
- throw new IllegalArgumentException(policy + " is not a valid policy");
- }
+ phone.getDataSettingsManager().setMobileDataPolicy(policy, enabled);
} finally {
Binder.restoreCallingIdentity(identity);
}