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 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 
23 public class Vvm3MessageSender extends OmtpMessageSender {
24 
25   /**
26    * Creates a new instance of Vvm3MessageSender.
27    *
28    * @param applicationPort If set to a value > 0 then a binary sms is sent to this port number.
29    *     Otherwise, a standard text SMS is sent.
30    */
Vvm3MessageSender( Context context, PhoneAccountHandle phoneAccountHandle, short applicationPort, String destinationNumber)31   public Vvm3MessageSender(
32       Context context,
33       PhoneAccountHandle phoneAccountHandle,
34       short applicationPort,
35       String destinationNumber) {
36     super(context, phoneAccountHandle, applicationPort, destinationNumber);
37   }
38 
39   @Override
requestVvmActivation(@ullable PendingIntent sentIntent)40   public void requestVvmActivation(@Nullable PendingIntent sentIntent) {
41     // Activation not supported for VVM3, send a status request instead.
42     requestVvmStatus(sentIntent);
43   }
44 
45   @Override
requestVvmDeactivation(@ullable PendingIntent sentIntent)46   public void requestVvmDeactivation(@Nullable PendingIntent sentIntent) {
47     // Deactivation not supported for VVM3, do nothing
48   }
49 
50   @Override
requestVvmStatus(@ullable PendingIntent sentIntent)51   public void requestVvmStatus(@Nullable PendingIntent sentIntent) {
52     // Status message:
53     // STATUS
54     StringBuilder sb = new StringBuilder().append("STATUS");
55     sendSms(sb.toString(), sentIntent);
56   }
57 }
58