1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.voicemail.impl.utils;
18
19import android.content.Context;
20import android.telecom.PhoneAccountHandle;
21import android.telecom.TelecomManager;
22import com.android.voicemail.impl.OmtpVvmCarrierConfigHelper;
23import com.android.voicemail.impl.VvmLog;
24import java.io.FileDescriptor;
25import java.io.PrintWriter;
26
27public class VvmDumpHandler {
28
29  public static void dump(Context context, FileDescriptor fd, PrintWriter writer, String[] args) {
30    IndentingPrintWriter indentedWriter = new IndentingPrintWriter(writer, "  ");
31    indentedWriter.println("******* OmtpVvm *******");
32    indentedWriter.println("======= Configs =======");
33    indentedWriter.increaseIndent();
34    for (PhoneAccountHandle handle :
35        context.getSystemService(TelecomManager.class).getCallCapablePhoneAccounts()) {
36      OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(context, handle);
37      indentedWriter.println(config.toString());
38    }
39    indentedWriter.decreaseIndent();
40    indentedWriter.println("======== Logs =========");
41    VvmLog.dump(fd, indentedWriter, args);
42  }
43}
44