hidl_test_java interfaces: use generic interfaces

In places where we are passing interfaces, pass around
android.hidl.base.IBase to give flexibility to the test implementation,
specifically in order to avoid passing local binders to Java process,
which is a disabled feature.

Bug: 169369810
Test: atest hidl_test hidl_test_java
Change-Id: I7721a6ec7e72b96915a0dc66aa8e75c327032d1f
This commit is contained in:
Steven Moreland 2020-10-01 23:19:01 +00:00
parent 897f0d48bb
commit c0236f06e7
6 changed files with 9 additions and 29 deletions

View file

@ -94,7 +94,7 @@ interface IBaz extends IBase {
int8_t[7] array;
string oneString;
vec<string> vectorOfStrings;
IBase dummy;
interface iface;
};
oneway doThis(float param);

View file

@ -4,7 +4,6 @@ hidl_interface {
name: "android.hardware.tests.safeunion@1.0",
root: "android.hardware",
srcs: [
"IOtherInterface.hal",
"ISafeUnion.hal",
],
interfaces: [

View file

@ -1,21 +0,0 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.tests.safeunion@1.0;
interface IOtherInterface {
concatTwoStrings(string a, string b) generates (string result);
};

View file

@ -16,8 +16,6 @@
package android.hardware.tests.safeunion@1.0;
import IOtherInterface;
import android.hidl.safe_union@1.0::Monostate;
interface ISafeUnion {
@ -73,7 +71,7 @@ interface ISafeUnion {
uint32_t a;
int8_t[7] b;
IOtherInterface c;
interface c;
string d;
vec<string> e;
handle f;
@ -107,7 +105,7 @@ interface ISafeUnion {
newInterfaceTypeSafeUnion() generates (InterfaceTypeSafeUnion myUnion);
setInterfaceA(InterfaceTypeSafeUnion myUnion, uint32_t a) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceB(InterfaceTypeSafeUnion myUnion, int8_t[7] b) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceC(InterfaceTypeSafeUnion myUnion, IOtherInterface c) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceC(InterfaceTypeSafeUnion myUnion, interface c) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceD(InterfaceTypeSafeUnion myUnion, string d) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceE(InterfaceTypeSafeUnion myUnion, vec<string> e) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceF(InterfaceTypeSafeUnion myUnion, handle f) generates (InterfaceTypeSafeUnion myUnion);

View file

@ -202,7 +202,9 @@ Return<void> SafeUnion::setInterfaceB(const InterfaceTypeSafeUnion& myUnion, con
return Void();
}
Return<void> SafeUnion::setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hardware::tests::safeunion::V1_0::IOtherInterface>& c, setInterfaceC_cb _hidl_cb) {
Return<void> SafeUnion::setInterfaceC(const InterfaceTypeSafeUnion& myUnion,
const sp<::android::hidl::base::V1_0::IBase>& c,
setInterfaceC_cb _hidl_cb) {
LOG(INFO) << "SERVER(SafeUnion) setInterfaceC(myUnion, " << toString(c) << ")";
InterfaceTypeSafeUnion myNewUnion = myUnion;

View file

@ -54,7 +54,9 @@ struct SafeUnion : public ISafeUnion {
Return<void> newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) override;
Return<void> setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) override;
Return<void> setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& b, setInterfaceB_cb _hidl_cb) override;
Return<void> setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hardware::tests::safeunion::V1_0::IOtherInterface>& c, setInterfaceC_cb _hidl_cb) override;
Return<void> setInterfaceC(const InterfaceTypeSafeUnion& myUnion,
const sp<::android::hidl::base::V1_0::IBase>& c,
setInterfaceC_cb _hidl_cb) override;
Return<void> setInterfaceD(const InterfaceTypeSafeUnion& myUnion, const hidl_string& d, setInterfaceD_cb _hidl_cb) override;
Return<void> setInterfaceE(const InterfaceTypeSafeUnion& myUnion, const hidl_vec<hidl_string>& e, setInterfaceE_cb _hidl_cb) override;
Return<void> setInterfaceF(const InterfaceTypeSafeUnion& myUnion, const hidl_handle& f,