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.ims.internal.uce;
18 
19 import com.android.ims.internal.uce.uceservice.IUceService;
20 import com.android.ims.internal.uce.uceservice.IUceListener;
21 import com.android.ims.internal.uce.common.StatusCode;
22 import com.android.ims.internal.uce.common.UceLong;
23 import com.android.ims.internal.uce.options.IOptionsListener;
24 import com.android.ims.internal.uce.options.IOptionsService;
25 import com.android.ims.internal.uce.presence.IPresenceService;
26 import com.android.ims.internal.uce.presence.IPresenceListener;
27 
28 /**
29  * Sub IUceService interface. To enable forward compatability
30  * during developlemt
31  * @hide
32  */
33 public abstract class UceServiceBase {
34     /**
35      * IUceService Stub Implementation
36      */
37     private final class UceServiceBinder extends IUceService.Stub {
38         @Override
startService(IUceListener uceListener)39         public boolean startService(IUceListener uceListener) {
40             return onServiceStart(uceListener);
41         }
42 
43         @Override
stopService()44         public boolean stopService() {
45             return onStopService();
46         }
47 
48         @Override
isServiceStarted()49         public boolean isServiceStarted() {
50             return onIsServiceStarted();
51         }
52 
53         @Override
createOptionsService(IOptionsListener optionsListener, UceLong optionsServiceListenerHdl)54         public int createOptionsService(IOptionsListener optionsListener,
55                                         UceLong optionsServiceListenerHdl) {
56             return onCreateOptionsService(optionsListener, optionsServiceListenerHdl);
57         }
58 
59         @Override
createOptionsServiceForSubscription(IOptionsListener optionsListener, UceLong optionsServiceListenerHdl, String iccId)60         public int createOptionsServiceForSubscription(IOptionsListener optionsListener,
61                                       UceLong optionsServiceListenerHdl,
62                                       String iccId) {
63             return onCreateOptionsService(optionsListener, optionsServiceListenerHdl,
64                                           iccId);
65         }
66 
67 
68         @Override
destroyOptionsService(int optionsServiceHandle)69         public void destroyOptionsService(int optionsServiceHandle) {
70             onDestroyOptionsService(optionsServiceHandle);
71         }
72 
73         @Override
createPresenceService( IPresenceListener presServiceListener, UceLong presServiceListenerHdl)74         public int createPresenceService(
75             IPresenceListener presServiceListener,
76             UceLong presServiceListenerHdl) {
77             return onCreatePresService(presServiceListener, presServiceListenerHdl);
78         }
79 
80         @Override
createPresenceServiceForSubscription(IPresenceListener presServiceListener, UceLong presServiceListenerHdl, String iccId)81         public int createPresenceServiceForSubscription(IPresenceListener presServiceListener,
82                                          UceLong presServiceListenerHdl,
83                                          String iccId) {
84             return onCreatePresService(presServiceListener, presServiceListenerHdl,
85                                        iccId);
86         }
87 
88         @Override
destroyPresenceService(int presServiceHdl)89         public void destroyPresenceService(int presServiceHdl) {
90             onDestroyPresService(presServiceHdl);
91         }
92 
93         @Override
getServiceStatus()94         public boolean getServiceStatus() {
95             return onGetServiceStatus();
96         }
97 
98         @Override
getPresenceService()99         public IPresenceService getPresenceService() {
100             return onGetPresenceService();
101         }
102 
103         @Override
getPresenceServiceForSubscription(String iccId)104         public IPresenceService getPresenceServiceForSubscription(String iccId) {
105             return onGetPresenceService(iccId);
106         }
107 
108         @Override
getOptionsService()109         public IOptionsService getOptionsService() {
110             return onGetOptionsService();
111         }
112 
113         @Override
getOptionsServiceForSubscription(String iccId)114         public IOptionsService getOptionsServiceForSubscription(String iccId) {
115             return onGetOptionsService(iccId);
116         }
117     }
118 
119     private UceServiceBinder mBinder;
120 
getBinder()121     public UceServiceBinder getBinder() {
122         if (mBinder == null) {
123             mBinder = new UceServiceBinder();
124         }
125         return mBinder;
126     }
127 
onServiceStart(IUceListener uceListener)128     protected boolean onServiceStart(IUceListener uceListener) {
129         //no-op
130         return false;
131     }
132 
onStopService()133     protected boolean onStopService() {
134         //no-op
135         return false;
136     }
137 
onIsServiceStarted()138     protected boolean onIsServiceStarted() {
139         //no-op
140         return false;
141     }
142 
onCreateOptionsService(IOptionsListener optionsListener, UceLong optionsServiceListenerHdl)143     protected int onCreateOptionsService(IOptionsListener optionsListener,
144                                                 UceLong optionsServiceListenerHdl) {
145         //no-op
146         return 0;
147     }
148 
onCreateOptionsService(IOptionsListener optionsListener, UceLong optionsServiceListenerHdl, String iccId)149     protected int onCreateOptionsService(IOptionsListener optionsListener,
150                                          UceLong optionsServiceListenerHdl,
151                                          String iccId) {
152         //no-op
153         return 0;
154     }
155 
onDestroyOptionsService(int cdServiceHandle)156     protected void onDestroyOptionsService(int cdServiceHandle) {
157         //no-op
158         return;
159     }
160 
onCreatePresService(IPresenceListener presServiceListener, UceLong presServiceListenerHdl)161     protected int onCreatePresService(IPresenceListener presServiceListener,
162             UceLong presServiceListenerHdl) {
163         //no-op
164         return 0;
165     }
166 
onCreatePresService(IPresenceListener presServiceListener, UceLong presServiceListenerHdl, String iccId)167     protected int onCreatePresService(IPresenceListener presServiceListener,
168                                       UceLong presServiceListenerHdl,
169                                       String iccId) {
170         //no-op
171         return 0;
172     }
173 
onDestroyPresService(int presServiceHdl)174     protected void onDestroyPresService(int presServiceHdl) {
175         //no-op
176         return;
177     }
178 
onGetServiceStatus()179     protected boolean onGetServiceStatus() {
180         //no-op
181         return false;
182     }
183 
onGetPresenceService()184     protected IPresenceService onGetPresenceService() {
185         //no-op
186         return null;
187     }
188 
onGetPresenceService(String iccId)189     protected IPresenceService onGetPresenceService(String iccId) {
190         //no-op
191         return null;
192     }
193 
onGetOptionsService()194     protected IOptionsService onGetOptionsService () {
195         //no-op
196         return null;
197     }
198 
onGetOptionsService(String iccId)199     protected IOptionsService onGetOptionsService (String iccId) {
200         //no-op
201         return null;
202     }
203 }
204