1 package com.android.phone.vvm;
2 
3 import android.content.Context;
4 import android.telecom.PhoneAccountHandle;
5 import android.telecom.TelecomManager;
6 import android.telephony.TelephonyManager;
7 
8 import com.android.internal.util.IndentingPrintWriter;
9 
10 import java.io.FileDescriptor;
11 import java.io.PrintWriter;
12 
13 public class VvmDumpHandler {
14 
dump(Context context, FileDescriptor fd, PrintWriter writer, String[] args)15     public static void dump(Context context, FileDescriptor fd, PrintWriter writer,
16             String[] args) {
17         TelephonyManager telephonyManager = TelephonyManager.from(context);
18         IndentingPrintWriter indentedWriter = new IndentingPrintWriter(writer, "  ");
19         indentedWriter.println("******* OmtpVvm *******");
20         indentedWriter.println("======= Configs =======");
21         indentedWriter.increaseIndent();
22         for (PhoneAccountHandle handle : context.getSystemService(TelecomManager.class)
23                 .getCallCapablePhoneAccounts()) {
24             int subId = PhoneAccountHandleConverter.toSubId(handle);
25             indentedWriter.println(
26                     "VisualVoicemailPackageName:" + telephonyManager.createForSubscriptionId(subId)
27                             .getVisualVoicemailPackageName());
28             indentedWriter.println(
29                     "VisualVoicemailSmsFilterSettings(" + subId + "):" + telephonyManager
30                             .getActiveVisualVoicemailSmsFilterSettings(subId));
31         }
32         indentedWriter.decreaseIndent();
33         indentedWriter.println("======== Logs =========");
34         VvmLog.dump(fd, indentedWriter, args);
35     }
36 }
37