Hi Dave,
Thanks very much for your reply!!
I have the following questions that I hope to get your confirmation:
1, if a method is declared in AIDL file and it is not @hide, then it can be called by third-party application as well as other system services?
From a permissions perspective, yes. But just to be clear, we are talking about being hidden by the manager classes. If the method simply isn’t declared in the manager, even if it’s in AIDL, it isn't discoverable.
2, if a method is declared in AIDL file but it is @hide, then (1) third-party application cannot directly call it, but can use Reflection to call it? (2) other system services can always call it (as the method is removed from SDK but other system services can still see it)?
This statement is correct as written.
Thanks very much!!!
Best,
Lisa
On Monday, March 14, 2016 at 5:28:09 PM UTC-4, Dave Smith wrote:> For example, (public) closeSystemDialog method is declared in IWindowManager. It can be called by ActivityManagerService, but cannot be called by third-party application.Let's examine this statement for a minute. It's true…but not because of anything inherent to AIDL…ActivityManagerService (running in the system_server process) has a direct reference to the WindowManagerService instance where that method happens to be defined (no IPC, and therefore no AIDL, is used). Third-party applications only have access to certain window manager properties through the various API classes (Window, WindowManager, ViewConfiguration, etc.) which wrap access to the underlying service (running in a remote process) exposed via AIDL. If a method is not exposed by one of these wrapper classes, SDK applications won't see it.Sometimes the methods do exist on the client-side manager, but they are removed from the SDK with the @hide annotation. In these cases, the methods are actually there (and can be called with reflection), but they are stripped from the SDK that developers compile against. This is the real reason you can't call that method: you don't have access to the raw AIDL interface (it's abstracted), and the abstraction doesn't expose that method. In order for an application to talk directly through the AIDL interface for a given service, it would have to access it via ServiceManager.getService(), which is also hidden and protected.Hope that helps.Cheers,--Dave Smith, PE@devunwired
On Monday, March 14, 2016 at 2:06:42 PM UTC-6, Lisa wrote:Hi, all,
I have a question about AIDL. For each system service, its AIDL declares several methods that are exposed (i.e., public) and can be called by other system services or third-party applications.
However, I noticed that some methods declared in an AIDL file can be called by other system services, but CANNOT be called by third-party applications.
I wonder why? and in which situations, the methods declared in an AIDL file can be called by third-party application, and in which situations, they cannot be called by third-party application? (but they can always be called by other system services).
For example, (public) closeSystemDialog method is declared in IWindowManager. It can be called by ActivityManagerService, but cannot be called by third-party application.
Thanks a lot!
Lisa
--
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 android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.