Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
940 views
in Technique[技术] by (71.8m points)

android studio - Access denied finding property "persist.vendor.log.tel_dbg"

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As show in screenshot:

logcat avd deined

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...