Implement getVisualVoicemailSettings()
This CL allow the system dialer to migrate voicemail settings from
telephony. The following values are provided:
"is_enabled": whether VVM is enabled before. The key will be
missing if the user never modified this setting and the default
should be used.
"default_old_pin": the voicemail PIN scrambled by the
provisioning process. For certain carriers the PIN must be set before
the voicemail feature can be used. Telephony had a automatic process
that will set a random PIN for the user and then prompt them to change
it. This must be migrated to the system dialer so the PIN will not be
lost after an upgrade.
Bug: 34093562
Test: N/A - pending dialer side changes to be implemented.
Change-Id: I037d1e7ec48eda7a0db282449b1c492e545e8930
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 0e772ab..6b75ab5 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -19,7 +19,6 @@
import static com.android.internal.telephony.PhoneConstants.SUBSCRIPTION_KEY;
import android.Manifest.permission;
-import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.app.PendingIntent;
@@ -95,7 +94,10 @@
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.util.HexDump;
import com.android.phone.settings.VoicemailNotificationSettingsUtil;
+import com.android.phone.vvm.PhoneAccountHandleConverter;
import com.android.phone.vvm.RemoteVvmTaskManager;
+import com.android.phone.vvm.VisualVoicemailPreferences;
+import com.android.phone.vvm.VisualVoicemailSettingsUtil;
import com.android.phone.vvm.VisualVoicemailSmsFilterConfig;
import java.io.FileDescriptor;
@@ -2017,6 +2019,20 @@
}
@Override
+ public Bundle getVisualVoicemailSettings(String callingPackage, int subId) {
+ mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
+ String systemDialer = TelecomManager.from(mPhone.getContext()).getSystemDialerPackage();
+ if (!TextUtils.equals(callingPackage, systemDialer)) {
+ throw new SecurityException("caller must be system dialer");
+ }
+ PhoneAccountHandle phoneAccountHandle = PhoneAccountHandleConverter.fromSubId(subId);
+ if (phoneAccountHandle == null){
+ return null;
+ }
+ return VisualVoicemailSettingsUtil.dump(mPhone.getContext(), phoneAccountHandle);
+ }
+
+ @Override
public String getVisualVoicemailPackageName(String callingPackage, int subId) {
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
if (!canReadPhoneState(callingPackage, "getVisualVoicemailPackageName")) {