I posted this on stack overflow, but wasn't appearing to have any luck. I think this might be the place to ask this kind of question.I am trying to open a socket in the android source code. Specifically, right now, I am in the DisplayDevice.cpp file, but the location of the socket code may change. Right now after I do:
int fd = socket(AF_INET, SOCK_STREAM, 0);fd gets returned as -1, and when i check the error message it is listed as Permission Denied. I have looked around a lot for this, most answers involve adding the internet permission to the AndroidManifest file. This will not work for me as the code I am adding is inside of the android source code.
I was wondering if there is a way to bypass the permission denied. Or if there is a better way to do this/ a different type of socket to use.
I also was looking at this other post from the google group:
It seemed to be related to what I am trying to do, but I wasn't sure what to follow up with. I see people mentioning modifying init.rc or trying to set the permissions ahead of time, but was confused on how to go forward. Any help at all or a point in the right direction would be great!
Thank you,
Jim
Are you saying that you have recompiled surfaceflinger? Are you running a custom Android or one with just surfaceflinger modified?
This could be some issue related to shell.
To debug how about adding this line to your code in DisplayDevice -
system("printenv > /tmp/env_in_my_code");
And later check the file by cat /tmp/env_in_my_code to see your env var is there or not.
Also, Instead of storing the fd in env variable can you try storing it in some file in /tmp and read the file back in DisplayDevice.
Thanks
Anup
--
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 http://groups.google.com/group/android-platform?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.