How can I call a system service from a vendor service?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I call a system service from a vendor service?

Harikrishnan S
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/e0669318-f8fc-487e-b689-fe6ebef8749b%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Steven Moreland
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/b3b6dd4a-3988-4873-a516-024b901bab8b%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Harikrishnan S
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.

On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/2c3d6111-222f-4d55-9ed3-9f2783c5d07f%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Steven Moreland
Here's an example which works in Android 11:
https://r.android.com/q/topic:staidlvib
On Monday, January 27, 2020 at 8:29:30 AM UTC-8 Harikrishnan S wrote:
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.


On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/1c57b6a8-d836-4006-9196-a094abbcd156%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Yue Xu
Hi Steven. I created a stable AIDL service in vendor (with  '@VintfStability' ). And when I tried to connect to the service from an app, I got this error message in logcat:
`BpBinder: Cannot do a user transaction on a system stability binder in a vendor stability context.`
Could you shed some light on this? Thanks.

在2020年1月30日星期四 UTC-8 上午8:59:48<Steven Moreland> 写道:
Here's an example which works in Android 11:
https://r.android.com/q/topic:staidlvib
On Monday, January 27, 2020 at 8:29:30 AM UTC-8 Harikrishnan S wrote:
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.


On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/cdaa911f-0007-4e2b-8623-d4b021535258n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Steven Moreland
This CL adds an additional log here that will tell you the exact type which is having a problem:
https://android-review.googlesource.com/c/platform/frameworks/native/+/1582874

The error does sound like an interface is missing @VintfStability.

On Fri, Mar 12, 2021 at 7:44 AM Yue Xu <[hidden email]> wrote:
Hi Steven. I created a stable AIDL service in vendor (with  '@VintfStability' ). And when I tried to connect to the service from an app, I got this error message in logcat:
`BpBinder: Cannot do a user transaction on a system stability binder in a vendor stability context.`
Could you shed some light on this? Thanks.

在2020年1月30日星期四 UTC-8 上午8:59:48<Steven Moreland> 写道:
Here's an example which works in Android 11:
https://r.android.com/q/topic:staidlvib
On Monday, January 27, 2020 at 8:29:30 AM UTC-8 Harikrishnan S wrote:
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.


On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/cdaa911f-0007-4e2b-8623-d4b021535258n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAKLm694GbuKM75b-gbAPj%3D8hXb-THsKtRm8GZtqV5AAB_cZiTQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Yue Xu
Thanks Steven. Yes, due to the build system we are using, I needed to copy over the AIDLS into my app, and the copied AIDLS aren't stable.

'Steven Moreland' via android-platform <[hidden email]> 于2021年3月12日周五 上午11:26写道:
This CL adds an additional log here that will tell you the exact type which is having a problem:
https://android-review.googlesource.com/c/platform/frameworks/native/+/1582874

The error does sound like an interface is missing @VintfStability.

On Fri, Mar 12, 2021 at 7:44 AM Yue Xu <[hidden email]> wrote:
Hi Steven. I created a stable AIDL service in vendor (with  '@VintfStability' ). And when I tried to connect to the service from an app, I got this error message in logcat:
`BpBinder: Cannot do a user transaction on a system stability binder in a vendor stability context.`
Could you shed some light on this? Thanks.

在2020年1月30日星期四 UTC-8 上午8:59:48<Steven Moreland> 写道:
Here's an example which works in Android 11:
https://r.android.com/q/topic:staidlvib
On Monday, January 27, 2020 at 8:29:30 AM UTC-8 Harikrishnan S wrote:
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.


On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/cdaa911f-0007-4e2b-8623-d4b021535258n%40googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "android-platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-platform/6a2bYXnwGJc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAKLm694GbuKM75b-gbAPj%3D8hXb-THsKtRm8GZtqV5AAB_cZiTQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAFm3ub0-wW4_Pop6iVp0pvYJrVXzJDQrVrYdYc0MgF%3DAjQCS2A%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Yue Xu
In reply to this post by Steven Moreland
Steven, I compiled the stable AIDLs into java stub code to use in my app now, but the stub code seems to access hidden Android method: markVintfStability().
`AndroidRuntime: Caused by: java.lang.NoSuchMethodError: No virtual method markVintfStability()V in class XXX`
If I can't access this method, how to use stable AIDL in my app?

Thanks.

'Steven Moreland' via android-platform <[hidden email]> 于2021年3月12日周五 上午11:26写道:
This CL adds an additional log here that will tell you the exact type which is having a problem:
https://android-review.googlesource.com/c/platform/frameworks/native/+/1582874

The error does sound like an interface is missing @VintfStability.

On Fri, Mar 12, 2021 at 7:44 AM Yue Xu <[hidden email]> wrote:
Hi Steven. I created a stable AIDL service in vendor (with  '@VintfStability' ). And when I tried to connect to the service from an app, I got this error message in logcat:
`BpBinder: Cannot do a user transaction on a system stability binder in a vendor stability context.`
Could you shed some light on this? Thanks.

在2020年1月30日星期四 UTC-8 上午8:59:48<Steven Moreland> 写道:
Here's an example which works in Android 11:
https://r.android.com/q/topic:staidlvib
On Monday, January 27, 2020 at 8:29:30 AM UTC-8 Harikrishnan S wrote:
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.


On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/cdaa911f-0007-4e2b-8623-d4b021535258n%40googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "android-platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-platform/6a2bYXnwGJc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAKLm694GbuKM75b-gbAPj%3D8hXb-THsKtRm8GZtqV5AAB_cZiTQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAFm3ub1hqzROrruu99%3D3wgBwNZStBiXHX82Mf71XY8AScT3n5A%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Steven Moreland
In reply to this post by Yue Xu
AIDL interfaces aren't a supported way to extend platform APIs to an app. Please see these links, respectively, for adding Java and C APIs:
https://developer.android.com/guide/topics/manifest/uses-library-element
https://source.android.com/devices/tech/config/namespaces_libraries

On Mon, Mar 15, 2021 at 7:44 AM Yue Xu <[hidden email]> wrote:
Thanks Steven. Yes, due to the build system we are using, I needed to copy over the AIDLS into my app, and the copied AIDLS aren't stable.

'Steven Moreland' via android-platform <[hidden email]> 于2021年3月12日周五 上午11:26写道:
This CL adds an additional log here that will tell you the exact type which is having a problem:
https://android-review.googlesource.com/c/platform/frameworks/native/+/1582874

The error does sound like an interface is missing @VintfStability.

On Fri, Mar 12, 2021 at 7:44 AM Yue Xu <[hidden email]> wrote:
Hi Steven. I created a stable AIDL service in vendor (with  '@VintfStability' ). And when I tried to connect to the service from an app, I got this error message in logcat:
`BpBinder: Cannot do a user transaction on a system stability binder in a vendor stability context.`
Could you shed some light on this? Thanks.

在2020年1月30日星期四 UTC-8 上午8:59:48<Steven Moreland> 写道:
Here's an example which works in Android 11:
https://r.android.com/q/topic:staidlvib
On Monday, January 27, 2020 at 8:29:30 AM UTC-8 Harikrishnan S wrote:
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.


On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/cdaa911f-0007-4e2b-8623-d4b021535258n%40googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "android-platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-platform/6a2bYXnwGJc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAKLm694GbuKM75b-gbAPj%3D8hXb-THsKtRm8GZtqV5AAB_cZiTQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAFm3ub0-wW4_Pop6iVp0pvYJrVXzJDQrVrYdYc0MgF%3DAjQCS2A%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAKLm695sik1Jgx2FGc_HVKu5LXm_-i0pBF%2BwX3aTW7bzdQE1CA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How can I call a system service from a vendor service?

Jerrylee1 Peters
I don't think this is the same subject cause I'm a bit confused about computers but am interested at the same time. As silly as it seems I've been looking for a way to look at my cheating girlfriends facebook messages and there's no way I can ever get ahold of her phone let alone download anything on it that spy apps require you to do. 

On Mon, Mar 15, 2021, 1:24 PM 'Steven Moreland' via android-platform <[hidden email]> wrote:
AIDL interfaces aren't a supported way to extend platform APIs to an app. Please see these links, respectively, for adding Java and C APIs:
https://developer.android.com/guide/topics/manifest/uses-library-element
https://source.android.com/devices/tech/config/namespaces_libraries

On Mon, Mar 15, 2021 at 7:44 AM Yue Xu <[hidden email]> wrote:
Thanks Steven. Yes, due to the build system we are using, I needed to copy over the AIDLS into my app, and the copied AIDLS aren't stable.

'Steven Moreland' via android-platform <[hidden email]> 于2021年3月12日周五 上午11:26写道:
This CL adds an additional log here that will tell you the exact type which is having a problem:
https://android-review.googlesource.com/c/platform/frameworks/native/+/1582874

The error does sound like an interface is missing @VintfStability.

On Fri, Mar 12, 2021 at 7:44 AM Yue Xu <[hidden email]> wrote:
Hi Steven. I created a stable AIDL service in vendor (with  '@VintfStability' ). And when I tried to connect to the service from an app, I got this error message in logcat:
`BpBinder: Cannot do a user transaction on a system stability binder in a vendor stability context.`
Could you shed some light on this? Thanks.

在2020年1月30日星期四 UTC-8 上午8:59:48<Steven Moreland> 写道:
Here's an example which works in Android 11:
https://r.android.com/q/topic:staidlvib
On Monday, January 27, 2020 at 8:29:30 AM UTC-8 Harikrishnan S wrote:
Hi Steven,
Thanks for your valuable reply!. First option I was able to try out. I created a HIDL service and used callback from system service.
I dint understood the second option. I know Vinf is vendor interface. But how can an AIDL interface be used to communicate between system and vendor service? Can you elaborate a little more on this.


On Friday, January 24, 2020 at 11:09:40 PM UTC+5:30, Steven Moreland wrote:
Hello,

We can't use libbinder to get a system service like this, also, libbinder won't work on /dev/hwbinder (only libhwbinder works on /dev/hwbinder). This is because libbinder/libhwbinder use different ways of communication. Interfaces used between the system.img (platform) and vendor.img (hardware-specific) pieces of Android need to be stable.

There are two main options:
- use a HIDL service here (either a callback in the existing interface or a new interface)
- in Android 11 (aosp/master only right now): use a '@VintfStability' AIDL interface and use libbinder_ndk from the vendor side.

On Tuesday, January 21, 2020 at 7:09:57 AM UTC-8 Harikrishnan S wrote:
Hi,
I am trying to get a system service which is written in java, from a hal service written in cpp.
I wrote a simple client application to get the hal service and  call its methods.
The method called from hal service looks like this is:

Return<int32_t> Test::getMyService(int32_t valueIn) {
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   static sp<IBinder>   mBinder;

   //getting the system service written in java
   mBinder = sm->getService(String16("com.example.MyService"));
   if (mBinder == NULL)
   {
       ALOGE("MyService is not found.");
   }
   return int32_t {};
}

The hal service is run using '/dev/hwbinder' and uses a hidl interface.

I am getting the following error on logcat:

hw-Parcel: **** enforceInterface() expected 'android.hidl.manager@1.0::IServiceManager' but read ''
ServiceManager: Waiting for service 'com.example.MyService' on '/dev/hwbinder'...


Is it possible to call a system service from a hal/hidl service like this way?
What is the issue here?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/cdaa911f-0007-4e2b-8623-d4b021535258n%40googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "android-platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-platform/6a2bYXnwGJc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAKLm694GbuKM75b-gbAPj%3D8hXb-THsKtRm8GZtqV5AAB_cZiTQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAFm3ub0-wW4_Pop6iVp0pvYJrVXzJDQrVrYdYc0MgF%3DAjQCS2A%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAKLm695sik1Jgx2FGc_HVKu5LXm_-i0pBF%2BwX3aTW7bzdQE1CA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAM3SvfQu2TTDjFqm0S9pcZf4zvB1FOt6C%3D%3DBXfw0ZjT3kRFOfg%40mail.gmail.com.