android-binder

How to Create a android native service and use binder to communicate with it?

可紊 提交于 2019-12-29 18:00:31
问题 My basic task is to create a native service in android and then write a simple native program to test it. lets say I want to write a simple service which return me sum of two integers. I have to use binders to talk to it from the program, I have tried to google around but I can't find a precise example. I need to know how to create a native service and find it in the program and if needed in Java also. 回答1: If you're creating a normal Android application using the NDK, you can't use Binder

Recommended approach for handling errors across process using AIDL (Android)

僤鯓⒐⒋嵵緔 提交于 2019-12-22 17:09:04
问题 I have a binder service and a client that live in different processes. Using AIDL, when the client calls into my remote binder service, there are times that I need to relay an error (exception) back to the client. However, from my understanding, this is not possible. I tried throwing a "RemoteException" from my binder service to see what will happen, and I get Uncaught remote exception! (Exceptions are not yet supported across processes.) in my logcat. Since it looks like this is not possible

How to listen to dev/binder?

大憨熊 提交于 2019-12-21 04:25:38
问题 In Android is dev/binder also for layers communication responsible. Is it possible to listen to messages? I know that they must be decoded than, but how can I get this messages. For example if an app send a message to became an Geolocation. I have also root on my android device. 回答1: Short: Nope, it shouldn't be possible, even with root. There isn't that much informations about Binder in detail on the net but there are some, especially about the security. Refer to this or to point 3.8 here.

Android Local Service Sample, bindservice(), and ServiceConnection()

本秂侑毒 提交于 2019-12-19 04:18:29
问题 I have a question which is related to this question that was asked by @mnish about a year ago. Please have a look at his question and code. He implements a ServiceConnection() and passes it to bindService(). This follows the Local Service Sample in the Service documentation near the top. I want to implement the Local Service Sample, so I am trying to add some details from @mnish question/answer. In ServiceConnection() @mnish has this line that confuses me: mService = ILocService.Stub

failed binder transaction on widget update

北城以北 提交于 2019-12-17 19:55:24
问题 i am updating one bitmap in widget (the whole widget is only one ImageView) like this remoteViews.setImageViewBitmap(...) and in some rare situations (it happend 3 times in 6 months of every day use) i get "!!! FAILED BINDER TRANSACTION !!!". then, only phone reboot solves this problem. uninstaling and installing again, does not help, only reboot. i checked the icon's size and it is only 56 kilobytes, so it fits within the IPC memory limit. when i remove setImageViewBitmap(...) the widget

Android java binder FAILED BINDER TRANSACTION?

邮差的信 提交于 2019-12-17 16:32:57
问题 I am trying to download an image from service and display it in activity but I keep getting java binder FAILED BINDER TRANSACTION This is my service Code public class DownloadImageService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { new LoadImageAsync().execute(intent.getStringExtra("type")); return Service.START_NOT_STICKY; } @Override public IBinder onBind(Intent intent) { return null; } private class LoadImageAsync extends AsyncTask<String,

Bundle inside Intent from Native cpp application using Binder

旧巷老猫 提交于 2019-12-12 09:36:19
问题 I'm trying to call an intent from native cpp code. Basically, from what i've understand, i have to compose a Parcel to match the exact deserialization sequence from frameworks/base/core/java/android/app/ActivityManagerNative.java ; case BROADCAST_INTENT_TRANSACTION. The progress so far is that i've received the intent in a Java app, but i have some problem with the bundle payload. I've debugged the Java app and it seems that it reads garbage as an int instead of reading the int which holds

Android instrumentation.execStartActivity parameters

一笑奈何 提交于 2019-12-11 04:24:57
问题 Having a bit of trouble. I'm trying to start an activity using another activity and need to get the 7 parameters of the execStartActivity method in the instrumentation.java class. From what I can tell the method is as follows: execStartActivity( Context who, IBinder contextThread, IBinder token, Activity target, Intent intent, int requestCode, Bundle options) { Suppose my starting activity is called MainActivity. Obviously the who parameter, as stated in documentation, is my base activity so

C++ Binder without addService()

拜拜、爱过 提交于 2019-12-11 03:47:38
问题 Is it possible to use C++ Binder API to communicate between two non-privileged processes? All examples I found (e.g. https://github.com/mcr/Android-HelloWorldService) rely on registering service via ServiceManager->addService() which throws following error when executing on a non-rooted phone: E/ServiceManager﹕ add_service('my.test.service',0x48) uid=2000 - PERMISSION DENIED 回答1: Inside the AOSP (Android Open Source Project) in the file frameworks/native/cmds/servicemanager/service_manager.c

How to properly upgrade AIDL interfaces in Android?

不打扰是莪最后的温柔 提交于 2019-12-08 04:37:47
问题 I have two apps: One is called my-app.apk , the other my-service.apk . The service app just defines a single Android Service, which can be bound by the primary app to execute some methods. This is done using Androids AIDL interface, and it works great - so far. Now I want to change the interface of the service, and I am wondering what I have to watch out for. I changed the file IRemote.aidl of my-service.apk to the following: package com.example.myservice; interface IRemote { void printHello(