简体   繁体   English

如何在Android上获取指定文件的SELinux上下文?

[英]How to get the SELinux context of a specified file on Android?

I'm developing a SU-aware app for Android, and found that SELinux context configuration and policies on some devices are slightly different than others. 我正在为Android开发一个可识别SU的应用程序,发现某些设备上的SELinux上下文配置和策略与其他设备略有不同。

Is there any public or hidden API of Android SDK to query SELinux context of a specified file, like what "ls -Z" provides in shell? Android SDK是否有任何公共或隐藏的API来查询指定文件的SELinux上下文,例如shell中的“ ls -Z”提供了什么?

Look at this. 看这个。

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/SELinux.java https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/SELinux.java

And maybe You know how to set SELinux scontext for Android Application from store. 也许您知道如何从商店为Android应用程序设置SELinux上下文。 I want change utrusted_app for my custom domain. 我想为我的自定义域更改utrusted_app。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM