• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Dagger Authors.
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 dagger.android.support.functional;
18 
19 import android.content.Intent;
20 import android.os.IBinder;
21 import android.os.IInterface;
22 import android.os.Parcel;
23 import android.os.RemoteException;
24 import dagger.android.DaggerService;
25 import java.io.FileDescriptor;
26 import java.util.Set;
27 import javax.inject.Inject;
28 
29 public final class TestService extends DaggerService {
30   @Inject Set<Class<?>> componentHierarchy;
31 
32   @Override
onBind(Intent intent)33   public IBinder onBind(Intent intent) {
34     return new MockBinder();
35   }
36 
37   private static class MockBinder implements IBinder {
38     @Override
getInterfaceDescriptor()39     public String getInterfaceDescriptor() throws RemoteException {
40       return null;
41     }
42 
43     @Override
pingBinder()44     public boolean pingBinder() {
45       return false;
46     }
47 
48     @Override
isBinderAlive()49     public boolean isBinderAlive() {
50       return false;
51     }
52 
53     @Override
queryLocalInterface(String descriptor)54     public IInterface queryLocalInterface(String descriptor) {
55       return null;
56     }
57 
58     @Override
dump(FileDescriptor fd, String[] args)59     public void dump(FileDescriptor fd, String[] args) throws RemoteException {}
60 
61     @Override
dumpAsync(FileDescriptor fd, String[] args)62     public void dumpAsync(FileDescriptor fd, String[] args) throws RemoteException {}
63 
64     @Override
transact(int code, Parcel data, Parcel reply, int flags)65     public boolean transact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
66       return false;
67     }
68 
69     @Override
linkToDeath(DeathRecipient recipient, int flags)70     public void linkToDeath(DeathRecipient recipient, int flags) throws RemoteException {}
71 
72     @Override
unlinkToDeath(DeathRecipient recipient, int flags)73     public boolean unlinkToDeath(DeathRecipient recipient, int flags) {
74       return false;
75     }
76   }
77 }
78