Home | History | Annotate | Download | only in uceservice
      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
     39         public boolean startService(IUceListener uceListener) {
     40             return onServiceStart(uceListener);
     41         }
     42 
     43         @Override
     44         public boolean stopService() {
     45             return onStopService();
     46         }
     47 
     48         @Override
     49         public boolean isServiceStarted() {
     50             return onIsServiceStarted();
     51         }
     52 
     53         @Override
     54         public int createOptionsService(IOptionsListener optionsListener,
     55                                         UceLong optionsServiceListenerHdl) {
     56             return onCreateOptionsService(optionsListener, optionsServiceListenerHdl);
     57         }
     58 
     59 
     60         @Override
     61         public void destroyOptionsService(int optionsServiceHandle) {
     62             onDestroyOptionsService(optionsServiceHandle);
     63         }
     64 
     65         @Override
     66         public int createPresenceService(
     67             IPresenceListener presServiceListener,
     68             UceLong presServiceListenerHdl) {
     69             return onCreatePresService(presServiceListener, presServiceListenerHdl);
     70         }
     71 
     72         @Override
     73         public void destroyPresenceService(int presServiceHdl) {
     74             onDestroyPresService(presServiceHdl);
     75         }
     76 
     77         @Override
     78         public boolean getServiceStatus() {
     79             return onGetServiceStatus();
     80         }
     81 
     82         @Override
     83         public IPresenceService getPresenceService() {
     84             return onGetPresenceService();
     85         }
     86 
     87         @Override
     88         public IOptionsService getOptionsService() {
     89             return onGetOptionsService();
     90         }
     91     }
     92 
     93     private UceServiceBinder mBinder;
     94 
     95     public UceServiceBinder getBinder() {
     96         if (mBinder == null) {
     97             mBinder = new UceServiceBinder();
     98         }
     99         return mBinder;
    100     }
    101 
    102     protected boolean onServiceStart(IUceListener uceListener) {
    103         //no-op
    104         return false;
    105     }
    106 
    107     protected boolean onStopService() {
    108         //no-op
    109         return false;
    110     }
    111 
    112     protected boolean onIsServiceStarted() {
    113         //no-op
    114         return false;
    115     }
    116 
    117     protected int onCreateOptionsService(IOptionsListener optionsListener,
    118                                                 UceLong optionsServiceListenerHdl) {
    119         //no-op
    120         return 0;
    121     }
    122 
    123     protected void onDestroyOptionsService(int cdServiceHandle) {
    124         //no-op
    125         return;
    126     }
    127 
    128     protected int onCreatePresService(IPresenceListener presServiceListener,
    129             UceLong presServiceListenerHdl) {
    130         //no-op
    131         return 0;
    132     }
    133 
    134     protected void onDestroyPresService(int presServiceHdl) {
    135         //no-op
    136         return;
    137     }
    138 
    139     protected boolean onGetServiceStatus() {
    140         //no-op
    141         return false;
    142     }
    143 
    144     protected IPresenceService onGetPresenceService() {
    145         //no-op
    146         return null;
    147     }
    148 
    149     protected IOptionsService onGetOptionsService () {
    150         //no-op
    151         return null;
    152     }
    153 }
    154