• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015, Motorola Mobility LLC
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *     - Redistributions of source code must retain the above copyright
8  *       notice, this list of conditions and the following disclaimer.
9  *     - Redistributions in binary form must reproduce the above copyright
10  *       notice, this list of conditions and the following disclaimer in the
11  *       documentation and/or other materials provided with the distribution.
12  *     - Neither the name of Motorola Mobility nor the
13  *       names of its contributors may be used to endorse or promote products
14  *       derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26  * DAMAGE.
27  */
28 
29 package com.android.service.ims.presence;
30 
31 import java.util.Set;
32 import java.util.HashMap;
33 import java.util.List;
34 import java.util.ArrayList;
35 import android.content.Context;
36 import android.content.Intent;
37 import android.app.PendingIntent;
38 import android.content.IntentFilter;
39 import android.os.RemoteException;
40 import android.app.AlarmManager;
41 import android.os.SystemClock;
42 
43 import com.android.ims.internal.uce.presence.PresCmdStatus;
44 
45 import com.android.ims.internal.Logger;
46 import com.android.ims.RcsManager.ResultCode;
47 import com.android.ims.RcsPresenceInfo;
48 import com.android.ims.IRcsPresenceListener;
49 
50 import com.android.service.ims.TaskManager;
51 
52 /**
53  * PresenceAvailabilityTask
54  */
55 public class PresenceAvailabilityTask extends PresenceTask{
56     /*
57      * The logger
58      */
59     private Logger logger = Logger.getLogger(this.getClass().getName());
60 
61     private long mCreateTimestamp = 0;
62 
63     // Time when get the notify. Used to check the 60s expires.
64     private long mNotifyTimeStamp = 0;
65 
PresenceAvailabilityTask(int taskId, int cmdId, IRcsPresenceListener listener, String[] contacts)66     public PresenceAvailabilityTask(int taskId, int cmdId, IRcsPresenceListener listener,
67             String[] contacts){
68         super(taskId, cmdId, listener, contacts);
69 
70         mCreateTimestamp = System.currentTimeMillis();
71         mNotifyTimeStamp = 0;
72     }
73 
updateNotifyTimestamp()74     public void updateNotifyTimestamp() {
75         mNotifyTimeStamp = System.currentTimeMillis();
76         logger.debug("updateNotifyTimestamp mNotifyTimeStamp=" + mNotifyTimeStamp);
77     }
78 
getNotifyTimestamp()79     public long getNotifyTimestamp() {
80         return mNotifyTimeStamp;
81     }
82 
getCreateTimestamp()83     public long getCreateTimestamp() {
84         return mCreateTimestamp;
85     }
86 
toString()87     public String toString(){
88         return super.toString() +
89                 " mNotifyTimeStamp=" + mNotifyTimeStamp;
90     }
91 };
92 
93