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 
17 package com.android.phone;
18 
19 import android.content.Context;
20 import android.provider.VoicemailContract;
21 import android.provider.VoicemailContract.Status;
22 import android.telecom.PhoneAccountHandle;
23 
24 public class VoicemailUtils {
25 
setConfigurationState(Context context, PhoneAccountHandle accountHandle, int configurationState)26     public static void setConfigurationState(Context context, PhoneAccountHandle accountHandle,
27             int configurationState) {
28         VoicemailContract.Status.setStatus(context, accountHandle,
29                 configurationState,
30                 Status.DATA_CHANNEL_STATE_IGNORE,
31                 Status.NOTIFICATION_CHANNEL_STATE_IGNORE);
32     }
33 
setDataChannelState(Context context, PhoneAccountHandle accountHandle, int dataChannelState)34     public static void setDataChannelState(Context context, PhoneAccountHandle accountHandle,
35             int dataChannelState) {
36         VoicemailContract.Status.setStatus(context, accountHandle,
37                 Status.CONFIGURATION_STATE_IGNORE,
38                 dataChannelState,
39                 Status.NOTIFICATION_CHANNEL_STATE_IGNORE);
40     }
41 
setNotificationChannelState(Context context, PhoneAccountHandle accountHandle, int notificationChannelState)42     public static void setNotificationChannelState(Context context,
43             PhoneAccountHandle accountHandle, int notificationChannelState) {
44         VoicemailContract.Status.setStatus(context, accountHandle,
45                 Status.CONFIGURATION_STATE_IGNORE,
46                 Status.DATA_CHANNEL_STATE_IGNORE,
47                 notificationChannelState);
48     }
49 }
50