• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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 package com.android.voicemail.impl.sms;
17 
18 import android.app.PendingIntent;
19 import android.content.Context;
20 import android.support.annotation.Nullable;
21 import android.telecom.PhoneAccountHandle;
22 import com.android.voicemail.impl.OmtpConstants;
23 
24 /** An implementation of the OmtpMessageSender for T-Mobile. */
25 public class OmtpCvvmMessageSender extends OmtpMessageSender {
OmtpCvvmMessageSender( Context context, PhoneAccountHandle phoneAccountHandle, short applicationPort, String destinationNumber)26   public OmtpCvvmMessageSender(
27       Context context,
28       PhoneAccountHandle phoneAccountHandle,
29       short applicationPort,
30       String destinationNumber) {
31     super(context, phoneAccountHandle, applicationPort, destinationNumber);
32   }
33 
34   @Override
requestVvmActivation(@ullable PendingIntent sentIntent)35   public void requestVvmActivation(@Nullable PendingIntent sentIntent) {
36     sendCvvmMessage(OmtpConstants.ACTIVATE_REQUEST, sentIntent);
37   }
38 
39   @Override
requestVvmDeactivation(@ullable PendingIntent sentIntent)40   public void requestVvmDeactivation(@Nullable PendingIntent sentIntent) {
41     sendCvvmMessage(OmtpConstants.DEACTIVATE_REQUEST, sentIntent);
42   }
43 
44   @Override
requestVvmStatus(@ullable PendingIntent sentIntent)45   public void requestVvmStatus(@Nullable PendingIntent sentIntent) {
46     sendCvvmMessage(OmtpConstants.STATUS_REQUEST, sentIntent);
47   }
48 
sendCvvmMessage(String request, PendingIntent sentIntent)49   private void sendCvvmMessage(String request, PendingIntent sentIntent) {
50     StringBuilder sb = new StringBuilder().append(request);
51     sb.append(OmtpConstants.SMS_PREFIX_SEPARATOR);
52     appendField(sb, "dt" /* device type */, "6" /* no VTT (transcription) support*/);
53     sendSms(sb.toString(), sentIntent);
54   }
55 }
56