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 29package com.android.service.ims.presence; 30 31import android.content.Context; 32import android.content.Intent; 33 34import com.android.ims.internal.Logger; 35 36/** 37 * Launcher utility functions 38 * 39 */ 40public class LauncherUtils { 41 private static Logger logger = Logger.getLogger(LauncherUtils.class.getName()); 42 43 /** 44 * Launch the Presence service. 45 * 46 * @param context application context 47 * @param boot Boot flag 48 */ 49 public static boolean launchPollingService(Context context) { 50 logger.debug("Launch polling service"); 51 52 Intent intent = new Intent(context, PollingService.class); 53 return (context.startService(intent) != null); 54 } 55 56 /** 57 * Stop the Presence service. 58 * 59 * @param context application context 60 */ 61 public static boolean stopPollingService(Context context) { 62 logger.debug("Stop polling service"); 63 64 Intent intent = new Intent(context, PollingService.class); 65 return context.stopService(intent); 66 } 67 68 public static boolean launchEabService(Context context) { 69 logger.debug("Launch Eab Service"); 70 71 Intent intent = new Intent(context, EABService.class); 72 return (context.startService(intent) != null); 73 } 74 75 public static boolean stopEabService(Context context) { 76 logger.debug("Stop EAB service"); 77 78 Intent intent = new Intent(context, EABService.class); 79 return context.stopService(intent); 80 } 81} 82 83