访问被拒绝,发现属性“persist.vendor.log.tel_dbg" [英] Access denied finding property "persist.vendor.log.tel_dbg"

查看:49
本文介绍了访问被拒绝,发现属性“persist.vendor.log.tel_dbg"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图显示从开放天气地图 api 中提取的 Json 数据并在 logcat 中找到它.成功构建和安装应用程序后.我收到此错误.错误是访问被拒绝,无法找到属性persist.vendor.log.tel_dbg"

公共类 MainActivity 扩展 AppCompatActivity {EditText mEditText;文本视图 mTextView;String api="http://api.openweathermap.org/data/2.5/weather?q=kolkata&appid=e8cd0e5f8d3ba1e87d108da87d9c0a94";@覆盖protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);下载任务任务=新的下载任务();任务.执行(API);}公共类 DownloadTask 扩展了 AsyncTask{@覆盖受保护的字符串 doInBackground(String... urls) {字符串结果="";网址网址;HttpURLConnection urlConnection=null;尝试 {网址=新网址(网址[0]);urlConnection=(HttpURLConnection)url.openConnection();InputStream in=urlConnection.getInputStream();InputStreamReader reader=new InputStreamReader(in);int data=reader.read();而(数据!=-1){字符当前=(字符)数据;结果+=当前;数据=reader.read();}} catch (MalformedURLException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}返回结果;}@覆盖protected void onPostExecute(String result) {super.onPostExecute(result);Log.i("结果",result);}}}

使用 audit2allow 也许可以解决它.

I am trying to display Json data extracted from open weather map api and find it in the logcat.After successful build and installation of the app.I am getting this error.The error is Access denied finding property "persist.vendor.log.tel_dbg"

public class MainActivity extends AppCompatActivity {

EditText mEditText;
TextView mTextView;
String api="http://api.openweathermap.org/data/2.5/weather? 
q=kolkata&appid=e8cd0e5f8d3ba1e87d108da87d9c0a94";
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    DownloadTask task=new DownloadTask();
    task.execute(api);
}
public class DownloadTask extends AsyncTask<String,Void,String>
{
    @Override
    protected String doInBackground(String... urls) {
        String result="";
        URL url;
        HttpURLConnection urlConnection=null;
        try {
            url=new URL(urls[0]);
            urlConnection=(HttpURLConnection)url.openConnection();
            InputStream in=urlConnection.getInputStream();
            InputStreamReader reader=new InputStreamReader(in);
            int data=reader.read();
            while (data!=-1)
            {
                char current=(char)data;
                result+=current;
                data=reader.read();
            }

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    }
    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);
        Log.i("Result",result);
      }
   }

}

Image of Logcat

解决方案

As show in screenshot:

before error log

Access denied finding property "persist.vendor.log.tel_dbg"

there is another warning:

type=1400 audit(xxx): avc: denied { read } for xxx

which is the reason for above error Access denied finding property

Example to show the root cause of Access denied finding property

I encount similar error:

com.gsma.rcs W/com.gsma.rcs: type=1400 audit(0.0:526384): avc: denied { read } for name="u:object_r:vendor_displayfeature_prop:s0" dev="tmpfs" ino=16384 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:vendor_displayfeature_prop:s0 tclass=file permissive=0

Exapnation:

  • Actionread
  • Actor=scontext=source contextuntrusted_app_25
  • Object=tcontext=target contextvendor_displayfeature_prop
    • Note:
      • corresponding later: ro.vendor.df.effect.conflict
      • object_r=object read
  • Result=tclass=target classfile
  • permissive=permissive mode0
    • 0 permissive:not allow = denied
    • background:
      • selinux has two mode:
        • permissive mode
        • enforcing mode
      • during Android device booting, you can use kernel parameter to config mode:
        • androidboot.selinux=permissive
        • or
        • androidboot.selinux=enforcing

Translate to human readable words:

the untrusted_app_25 want to read the vendor_displayfeature_prop, which type is file but due to NOT permissive mode, Android SELinux denied (according to OEM built-in configuration of SELinux)

which cause the following output error log:

com.gsma.rcs E/libc: Access denied finding property "ro.vendor.df.effect.conflict"

How to fix avc: denied error ?

refer official doc:

Validating SELinux | Android Open Source Project

use audit2allow maybe can fix it.

这篇关于访问被拒绝,发现属性“persist.vendor.log.tel_dbg"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆