Is it possible for an Android application to share UID with a non-android application in C

StackOverflow https://stackoverflow.com/questions/8522157

  •  17-03-2021
  •  | 
  •  

質問

1) Is it possible for an android application to share UID with an non-android application written in C?

2) Is it possible to add an Android application to a group?

Thanks!!

役に立ちましたか?

解決

1) Is it possible for an android application to share UID with an non-android application written in C?

Do you mean native code bundeled with your app (NDK) then yes, to share UID with someting in the platform NO, this is part of the Android security model.

2) Is it possible to add an Android application to a group?

This might be possible maybe asking for some of the permissions will put you in that group, thats one way to easily solve it (like support to read/write the USB massstorage area) But I have not looked at the source code to verify this. (Some permissions do not rely on the group think and are tested on the server/receiver side of some services)

他のヒント

  1. use sharedUserId attribute in android, with NDK, (but doing this will share permissions as well(in the mainfest))

  2. http://android-dls.com/wiki/index.php?title=Android_UIDs_and_GIDs contains what groups each function are in, i don't think so.

You can't share app uid with a non-android application write in c directly;
but you can write a SHELL APK, which can share uid with other APK, the SHELL apk call the functions implements in C, by:
1. make the function written by C as a lib, call the function via JNI;
2. make the function written by C as a native application and call the application in APK by Runtime.getRuntime().exec()

I think method 2 is more convenient :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top