blob: 72ec958ca6d6659bc2f2cdb7d326d55fd01d1fe2 [file] [log] [blame]
Andreas Huberdab5fc62016-08-15 09:25:02 -07001/*
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
17package android.os;
18
Andrei Onea24ec3212019-03-15 17:35:05 +000019import android.annotation.UnsupportedAppUsage;
Andreas Huberdab5fc62016-08-15 09:25:02 -070020import libcore.util.NativeAllocationRegistry;
21
22/** @hide */
23public class HwRemoteBinder implements IHwBinder {
24 private static final String TAG = "HwRemoteBinder";
25
26 private static final NativeAllocationRegistry sNativeRegistry;
27
Andrei Onea24ec3212019-03-15 17:35:05 +000028 @UnsupportedAppUsage
Andreas Huberdab5fc62016-08-15 09:25:02 -070029 public HwRemoteBinder() {
30 native_setup_empty();
31
32 sNativeRegistry.registerNativeAllocation(
33 this,
34 mNativeContext);
35 }
36
Steven Moreland27538df2016-12-20 15:55:48 -080037 @Override
Andreas Huberdab5fc62016-08-15 09:25:02 -070038 public IHwInterface queryLocalInterface(String descriptor) {
39 return null;
40 }
41
Steven Moreland27538df2016-12-20 15:55:48 -080042 @Override
Andreas Huberdab5fc62016-08-15 09:25:02 -070043 public native final void transact(
Steven Moreland27538df2016-12-20 15:55:48 -080044 int code, HwParcel request, HwParcel reply, int flags)
45 throws RemoteException;
Andreas Huberdab5fc62016-08-15 09:25:02 -070046
Martijn Coenen727f7bf2016-12-27 14:33:09 +010047 public native boolean linkToDeath(DeathRecipient recipient, long cookie);
48 public native boolean unlinkToDeath(DeathRecipient recipient);
49
Andreas Huberdab5fc62016-08-15 09:25:02 -070050 private static native final long native_init();
51
52 private native final void native_setup_empty();
53
54 static {
55 long freeFunction = native_init();
56
57 sNativeRegistry = new NativeAllocationRegistry(
58 HwRemoteBinder.class.getClassLoader(),
59 freeFunction,
60 128 /* size */);
61 }
62
Martijn Coenen727f7bf2016-12-27 14:33:09 +010063 private static final void sendDeathNotice(DeathRecipient recipient, long cookie) {
64 recipient.serviceDied(cookie);
65 }
66
Andreas Huberdab5fc62016-08-15 09:25:02 -070067 private long mNativeContext;
Yifan Hong73b6c272017-10-31 17:32:15 -070068
69 @Override
70 public final native boolean equals(Object other);
71 @Override
72 public final native int hashCode();
Andreas Huberdab5fc62016-08-15 09:25:02 -070073}