开发者

How safe is a "private" aidl to a system process

开发者 https://www.devze.com 2023-04-12 04:19 出处:网络
In my app, which uses a proprietary bluetooth device, I\'m working on self-correcting some problems that may come up with the device.One of those problems is when the phone thinks it\'s paired, and th

In my app, which uses a proprietary bluetooth device, I'm working on self-correcting some problems that may come up with the device. One of those problems is when the phone thinks it's paired, and the 开发者_如何学Cdevice does not, so it refuses connections until the phone unpairs and re-pairs. Using the answer found here, I got this working in code quite nicely, but I'm a bit concerned over how "safe" this is, since I now have an aidl under android.bluetooth in my own source tree. This seems to work fine in my testing with several 2.2 and 2.3 phones, but am I open to having to rewrite in future versions, or does creating this local aidl actually insulate me from future changes? Pointers to further reading are welcome.


It looks like the answer you linked to is calling private APIs. Be careful doing this as they could change at any time in future versions of Android.

To answer you questions:

but am I open to having to rewrite in future versions?

Yes, because those private APIs could change at anytime without any notice because they are private.

does creating this local aidl actually insulate me from future changes?

No, it won't insulate you. They could change anything in android.os.ServiceManager or android.bluetooth.IBluetooth without notice and it would break your code in newer versions of Android.

I sound a bit repetitive, but becareful with private APIs, they might bite you in the future. However, it also sounds like this might be the only way you can do this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号