avc: denied read fragment Android










1















I have a modal dialog that I've created with XML. Then, I show it in kotlin (it's not a real dialog view, more than an information popup).



See the XML:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AlertsDialogRemi"
android:id="@+id/alertLayoutRoot"
android:orientation="vertical"
>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UselessParent"
>

<RelativeLayout
android:id="@+id/layoutTopAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:gravity="center"
>

<LinearLayout
android:id="@+id/layoutAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/orange"
>

<TextView
android:id="@+id/alerte_title"
style="@style/titleActu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="66dp"
android:text="@string/alertes"
android:textColor="@color/colorWhite" />


<ViewFlipper
android:id="@+id/viewFlipperAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/orange">
</ViewFlipper>

<LinearLayout
android:id="@+id/dotNavAlert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">

</LinearLayout>

</LinearLayout>
<Button
android:id="@+id/close_modal_alerte"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@android:color/transparent"
android:text="Fermer"
android:layout_below="@id/layoutAlert"/>
</RelativeLayout>
<ImageView
android:id="@+id/alert_logo"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerHorizontal="true"
android:src="@drawable/alertes" />


</RelativeLayout>


</LinearLayout>


This function show the modal in MainActivity.kt (I'm using fragment and navigation drawer) :



lateinit var mydialog : Dialog
lateinit var txt : TextView

override fun onOptionsItemSelected(item: MenuItem): Boolean
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
var fragment: Fragment? = null

when (item.itemId)
R.id.action_alert ->
showDialog()
return true

else -> return super.onOptionsItemSelected(item)



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()



And in AlertsDialogRemi.xml, I have this :



override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val alerts = arrayOf("AlertsDialogRemi 1", "AlertsDialogRemi 2", "AlertsDialogRemi 3")
for(alert in alerts)
Log.i(TAG, "Alert : $alert")



I have this error in my logs when I'm trying to access alerts variable in AlertDialogRemi.kt:




W/RenderThread: type=1400 audit(0.0:6789172): avc: denied read for
name="perf_ioctl" dev="proc" ino=4026533700
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0
tclass=file permissive=0




It's weird because I do the same thing in another Fragment (Accueil.kt) but I have no problem at all.



EDIT :
Apparently, this is due to the dialog, if I call the fragment without the dialog, I have my data. So what should I change ?










share|improve this question
























  • which variable of alerts variable? plz share full code

    – hamid keyhani
    Nov 13 '18 at 8:45











  • It's my only used code, the rest is not useful.

    – Projet Sin
    Nov 16 '18 at 16:17















1















I have a modal dialog that I've created with XML. Then, I show it in kotlin (it's not a real dialog view, more than an information popup).



See the XML:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AlertsDialogRemi"
android:id="@+id/alertLayoutRoot"
android:orientation="vertical"
>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UselessParent"
>

<RelativeLayout
android:id="@+id/layoutTopAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:gravity="center"
>

<LinearLayout
android:id="@+id/layoutAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/orange"
>

<TextView
android:id="@+id/alerte_title"
style="@style/titleActu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="66dp"
android:text="@string/alertes"
android:textColor="@color/colorWhite" />


<ViewFlipper
android:id="@+id/viewFlipperAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/orange">
</ViewFlipper>

<LinearLayout
android:id="@+id/dotNavAlert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">

</LinearLayout>

</LinearLayout>
<Button
android:id="@+id/close_modal_alerte"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@android:color/transparent"
android:text="Fermer"
android:layout_below="@id/layoutAlert"/>
</RelativeLayout>
<ImageView
android:id="@+id/alert_logo"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerHorizontal="true"
android:src="@drawable/alertes" />


</RelativeLayout>


</LinearLayout>


This function show the modal in MainActivity.kt (I'm using fragment and navigation drawer) :



lateinit var mydialog : Dialog
lateinit var txt : TextView

override fun onOptionsItemSelected(item: MenuItem): Boolean
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
var fragment: Fragment? = null

when (item.itemId)
R.id.action_alert ->
showDialog()
return true

else -> return super.onOptionsItemSelected(item)



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()



And in AlertsDialogRemi.xml, I have this :



override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val alerts = arrayOf("AlertsDialogRemi 1", "AlertsDialogRemi 2", "AlertsDialogRemi 3")
for(alert in alerts)
Log.i(TAG, "Alert : $alert")



I have this error in my logs when I'm trying to access alerts variable in AlertDialogRemi.kt:




W/RenderThread: type=1400 audit(0.0:6789172): avc: denied read for
name="perf_ioctl" dev="proc" ino=4026533700
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0
tclass=file permissive=0




It's weird because I do the same thing in another Fragment (Accueil.kt) but I have no problem at all.



EDIT :
Apparently, this is due to the dialog, if I call the fragment without the dialog, I have my data. So what should I change ?










share|improve this question
























  • which variable of alerts variable? plz share full code

    – hamid keyhani
    Nov 13 '18 at 8:45











  • It's my only used code, the rest is not useful.

    – Projet Sin
    Nov 16 '18 at 16:17













1












1








1








I have a modal dialog that I've created with XML. Then, I show it in kotlin (it's not a real dialog view, more than an information popup).



See the XML:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AlertsDialogRemi"
android:id="@+id/alertLayoutRoot"
android:orientation="vertical"
>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UselessParent"
>

<RelativeLayout
android:id="@+id/layoutTopAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:gravity="center"
>

<LinearLayout
android:id="@+id/layoutAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/orange"
>

<TextView
android:id="@+id/alerte_title"
style="@style/titleActu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="66dp"
android:text="@string/alertes"
android:textColor="@color/colorWhite" />


<ViewFlipper
android:id="@+id/viewFlipperAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/orange">
</ViewFlipper>

<LinearLayout
android:id="@+id/dotNavAlert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">

</LinearLayout>

</LinearLayout>
<Button
android:id="@+id/close_modal_alerte"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@android:color/transparent"
android:text="Fermer"
android:layout_below="@id/layoutAlert"/>
</RelativeLayout>
<ImageView
android:id="@+id/alert_logo"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerHorizontal="true"
android:src="@drawable/alertes" />


</RelativeLayout>


</LinearLayout>


This function show the modal in MainActivity.kt (I'm using fragment and navigation drawer) :



lateinit var mydialog : Dialog
lateinit var txt : TextView

override fun onOptionsItemSelected(item: MenuItem): Boolean
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
var fragment: Fragment? = null

when (item.itemId)
R.id.action_alert ->
showDialog()
return true

else -> return super.onOptionsItemSelected(item)



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()



And in AlertsDialogRemi.xml, I have this :



override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val alerts = arrayOf("AlertsDialogRemi 1", "AlertsDialogRemi 2", "AlertsDialogRemi 3")
for(alert in alerts)
Log.i(TAG, "Alert : $alert")



I have this error in my logs when I'm trying to access alerts variable in AlertDialogRemi.kt:




W/RenderThread: type=1400 audit(0.0:6789172): avc: denied read for
name="perf_ioctl" dev="proc" ino=4026533700
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0
tclass=file permissive=0




It's weird because I do the same thing in another Fragment (Accueil.kt) but I have no problem at all.



EDIT :
Apparently, this is due to the dialog, if I call the fragment without the dialog, I have my data. So what should I change ?










share|improve this question
















I have a modal dialog that I've created with XML. Then, I show it in kotlin (it's not a real dialog view, more than an information popup).



See the XML:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AlertsDialogRemi"
android:id="@+id/alertLayoutRoot"
android:orientation="vertical"
>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UselessParent"
>

<RelativeLayout
android:id="@+id/layoutTopAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:gravity="center"
>

<LinearLayout
android:id="@+id/layoutAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/orange"
>

<TextView
android:id="@+id/alerte_title"
style="@style/titleActu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="66dp"
android:text="@string/alertes"
android:textColor="@color/colorWhite" />


<ViewFlipper
android:id="@+id/viewFlipperAlert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/orange">
</ViewFlipper>

<LinearLayout
android:id="@+id/dotNavAlert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">

</LinearLayout>

</LinearLayout>
<Button
android:id="@+id/close_modal_alerte"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@android:color/transparent"
android:text="Fermer"
android:layout_below="@id/layoutAlert"/>
</RelativeLayout>
<ImageView
android:id="@+id/alert_logo"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerHorizontal="true"
android:src="@drawable/alertes" />


</RelativeLayout>


</LinearLayout>


This function show the modal in MainActivity.kt (I'm using fragment and navigation drawer) :



lateinit var mydialog : Dialog
lateinit var txt : TextView

override fun onOptionsItemSelected(item: MenuItem): Boolean
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
var fragment: Fragment? = null

when (item.itemId)
R.id.action_alert ->
showDialog()
return true

else -> return super.onOptionsItemSelected(item)



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()



And in AlertsDialogRemi.xml, I have this :



override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val alerts = arrayOf("AlertsDialogRemi 1", "AlertsDialogRemi 2", "AlertsDialogRemi 3")
for(alert in alerts)
Log.i(TAG, "Alert : $alert")



I have this error in my logs when I'm trying to access alerts variable in AlertDialogRemi.kt:




W/RenderThread: type=1400 audit(0.0:6789172): avc: denied read for
name="perf_ioctl" dev="proc" ino=4026533700
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0
tclass=file permissive=0




It's weird because I do the same thing in another Fragment (Accueil.kt) but I have no problem at all.



EDIT :
Apparently, this is due to the dialog, if I call the fragment without the dialog, I have my data. So what should I change ?







android android-fragments kotlin fragment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 8:13







Projet Sin

















asked Nov 12 '18 at 9:53









Projet SinProjet Sin

417




417












  • which variable of alerts variable? plz share full code

    – hamid keyhani
    Nov 13 '18 at 8:45











  • It's my only used code, the rest is not useful.

    – Projet Sin
    Nov 16 '18 at 16:17

















  • which variable of alerts variable? plz share full code

    – hamid keyhani
    Nov 13 '18 at 8:45











  • It's my only used code, the rest is not useful.

    – Projet Sin
    Nov 16 '18 at 16:17
















which variable of alerts variable? plz share full code

– hamid keyhani
Nov 13 '18 at 8:45





which variable of alerts variable? plz share full code

– hamid keyhani
Nov 13 '18 at 8:45













It's my only used code, the rest is not useful.

– Projet Sin
Nov 16 '18 at 16:17





It's my only used code, the rest is not useful.

– Projet Sin
Nov 16 '18 at 16:17












1 Answer
1






active

oldest

votes


















0














You should call mydialog.create() before calling the mydialog.show() method or trying to access its internal views.



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

mydialog.create()

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()






share|improve this answer























  • Same error message than before unfortunately...

    – Projet Sin
    Nov 12 '18 at 10:22










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259615%2favc-denied-read-fragment-android%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You should call mydialog.create() before calling the mydialog.show() method or trying to access its internal views.



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

mydialog.create()

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()






share|improve this answer























  • Same error message than before unfortunately...

    – Projet Sin
    Nov 12 '18 at 10:22















0














You should call mydialog.create() before calling the mydialog.show() method or trying to access its internal views.



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

mydialog.create()

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()






share|improve this answer























  • Same error message than before unfortunately...

    – Projet Sin
    Nov 12 '18 at 10:22













0












0








0







You should call mydialog.create() before calling the mydialog.show() method or trying to access its internal views.



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

mydialog.create()

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()






share|improve this answer













You should call mydialog.create() before calling the mydialog.show() method or trying to access its internal views.



fun showDialog()
mydialog = Dialog(this, R.style.DialogCustomTheme)
mydialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
mydialog.setContentView(R.layout.alerts_dialog_remi)

mydialog.create()

txt = mydialog.findViewById(R.id.close_modal_alerte)
txt.isEnabled = true
txt.setOnClickListener
mydialog.cancel()

mydialog.show()







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 '18 at 10:18









Eric MartoriEric Martori

729310




729310












  • Same error message than before unfortunately...

    – Projet Sin
    Nov 12 '18 at 10:22

















  • Same error message than before unfortunately...

    – Projet Sin
    Nov 12 '18 at 10:22
















Same error message than before unfortunately...

– Projet Sin
Nov 12 '18 at 10:22





Same error message than before unfortunately...

– Projet Sin
Nov 12 '18 at 10:22

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259615%2favc-denied-read-fragment-android%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo