1 /*
2  * Copyright (C) 2015 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.systemui.qs.external;
17 
18 import android.os.IBinder;
19 import android.service.quicksettings.IQSTileService;
20 import android.util.Log;
21 
22 
23 public class QSTileServiceWrapper {
24     private static final String TAG = "IQSTileServiceWrapper";
25 
26     private final IQSTileService mService;
27 
QSTileServiceWrapper(IQSTileService service)28     public QSTileServiceWrapper(IQSTileService service) {
29         mService = service;
30     }
31 
asBinder()32     public IBinder asBinder() {
33         return mService.asBinder();
34     }
35 
onTileAdded()36     public boolean onTileAdded() {
37         try {
38             mService.onTileAdded();
39             return true;
40         } catch (Exception e) {
41             Log.d(TAG, "Caught exception from TileService", e);
42             return false;
43         }
44     }
45 
onTileRemoved()46     public boolean onTileRemoved() {
47         try {
48             mService.onTileRemoved();
49             return true;
50         } catch (Exception e) {
51             Log.d(TAG, "Caught exception from TileService", e);
52             return false;
53         }
54     }
55 
onStartListening()56     public boolean onStartListening() {
57         try {
58             mService.onStartListening();
59             return true;
60         } catch (Exception e) {
61             Log.d(TAG, "Caught exception from TileService", e);
62             return false;
63         }
64     }
65 
onStopListening()66     public boolean onStopListening() {
67         try {
68             mService.onStopListening();
69             return true;
70         } catch (Exception e) {
71             Log.d(TAG, "Caught exception from TileService", e);
72             return false;
73         }
74     }
75 
onClick(IBinder token)76     public boolean onClick(IBinder token) {
77         try {
78             mService.onClick(token);
79             return true;
80         } catch (Exception e) {
81             Log.d(TAG, "Caught exception from TileService", e);
82             return false;
83         }
84     }
85 
onUnlockComplete()86     public boolean onUnlockComplete() {
87         try {
88             mService.onUnlockComplete();
89             return true;
90         } catch (Exception e) {
91             Log.d(TAG, "Caught exception from TileService", e);
92             return false;
93         }
94     }
95 
getService()96     public IQSTileService getService() {
97         return mService;
98     }
99 }
100