Access ro.serialno from native in Android 8?Is there a way to run Python on Android?How to save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?Stop EditText from gaining focus at Activity startupIs there a unique Android device ID?What is 'Context' on Android?Can't start Eclipse - Java was started but returned exit code=13Proper use cases for Android UserManager.isUserAGoat()?Does anyone have benchmarks (code & results) comparing performance of Android apps written in Xamarin C# and Java?

Is it right to use the ideas of non-winning designers in a design contest?

What is the extent of the commands a Cambion can issue through Fiendish Charm?

When does order matter in probability?

How many attacks exactly do I get combining Dual Wielder feat with Two-Weapon Fighting style?

How can I hint that my character isn't real?

Why does 8 bit truecolor use only 2 bits for blue?

Where on Earth is it easiest to survive in the wilderness?

Why is Sojdlg123aljg a common password?

How do you say "to hell with everything" in French?

What quests do you need to stop at before you make an enemy of a faction for each faction?

Should I tip on the Amtrak train?

Can you pop microwave popcorn on a stove?

Relationship between speed and cadence?

At what point does a land become controlled?

Short story: Interstellar inspector senses "off" nature of planet hiding aggressive culture

Constant integers and constant evaluation

Can taking my 1-week-old on a 6-7 hours journey in the car lead to medical complications?

Is every sentence we write or utter either true or false?

Can the Spell Alter Self allow a Kenku to Speak Normally?

Professor refuses to write a recommendation letter to students who haven't written a research paper with him

Template default argument loses its reference type

I won a car in a poker game. How is that taxed in Canada?

Is there some sort of French saying for "a person's signature move"?

Word for something that used to be popular but not anymore



Access ro.serialno from native in Android 8?


Is there a way to run Python on Android?How to save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?Stop EditText from gaining focus at Activity startupIs there a unique Android device ID?What is 'Context' on Android?Can't start Eclipse - Java was started but returned exit code=13Proper use cases for Android UserManager.isUserAGoat()?Does anyone have benchmarks (code & results) comparing performance of Android apps written in Xamarin C# and Java?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5















I need some help. I have an app that is mostly written in native C code. I use the __system_property_get(const char * name, char * value) method to read the serial nr. of the device at various points in my native code. With Android 8 I always get a "Access denied" message now.
libc: Access denied finding property "ro.serialno"

Is there a way for me to still be able to read the serial nr. in Android 8? I tried switching to targetSDKversion < 26 but it still gives me a "Access denied" message. I do get the correct values if I use Java with Build.SERIAL (regardless of SDK version) and Build.getSerial() in SDK version 26 if I grant the READ_PHONE_STATE permission. But I cannot read these values in Java and pass them to the native code without a huge rewrite of the native code.



Any help?










share|improve this question
































    5















    I need some help. I have an app that is mostly written in native C code. I use the __system_property_get(const char * name, char * value) method to read the serial nr. of the device at various points in my native code. With Android 8 I always get a "Access denied" message now.
    libc: Access denied finding property "ro.serialno"

    Is there a way for me to still be able to read the serial nr. in Android 8? I tried switching to targetSDKversion < 26 but it still gives me a "Access denied" message. I do get the correct values if I use Java with Build.SERIAL (regardless of SDK version) and Build.getSerial() in SDK version 26 if I grant the READ_PHONE_STATE permission. But I cannot read these values in Java and pass them to the native code without a huge rewrite of the native code.



    Any help?










    share|improve this question




























      5












      5








      5


      2






      I need some help. I have an app that is mostly written in native C code. I use the __system_property_get(const char * name, char * value) method to read the serial nr. of the device at various points in my native code. With Android 8 I always get a "Access denied" message now.
      libc: Access denied finding property "ro.serialno"

      Is there a way for me to still be able to read the serial nr. in Android 8? I tried switching to targetSDKversion < 26 but it still gives me a "Access denied" message. I do get the correct values if I use Java with Build.SERIAL (regardless of SDK version) and Build.getSerial() in SDK version 26 if I grant the READ_PHONE_STATE permission. But I cannot read these values in Java and pass them to the native code without a huge rewrite of the native code.



      Any help?










      share|improve this question
















      I need some help. I have an app that is mostly written in native C code. I use the __system_property_get(const char * name, char * value) method to read the serial nr. of the device at various points in my native code. With Android 8 I always get a "Access denied" message now.
      libc: Access denied finding property "ro.serialno"

      Is there a way for me to still be able to read the serial nr. in Android 8? I tried switching to targetSDKversion < 26 but it still gives me a "Access denied" message. I do get the correct values if I use Java with Build.SERIAL (regardless of SDK version) and Build.getSerial() in SDK version 26 if I grant the READ_PHONE_STATE permission. But I cannot read these values in Java and pass them to the native code without a huge rewrite of the native code.



      Any help?







      android c permissions native






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 19 '17 at 13:46









      Delimitry

      2,7254 gold badges21 silver badges36 bronze badges




      2,7254 gold badges21 silver badges36 bronze badges










      asked Oct 19 '17 at 8:03









      carlaharriscarlaharris

      261 silver badge3 bronze badges




      261 silver badge3 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          4
















          I met this problem too. Finally I find the root cause of the problem. In Android O, SELinux sets a lot of limitations in system property. In this case, There is a neverallow to limit read serial number except some domain in whitelist.



          For more specific information, you can read code in system/sepolicy/public/domain.te:



          neverallow 
          domain
          -adbd
          -dumpstate
          -hal_drm
          -init
          -mediadrmserver
          -recovery
          -shell
          -system_server
          serialno_prop:file r_file_perms;





          share|improve this answer



























          • Thank you very much!

            – carlaharris
            Dec 15 '17 at 6:56


















          1
















          If you have the hand on AOSP:



          1. Put android:sharedUserId="android.uid.system" to AdnroidMainfest

          2. Run app like system_app.

          3. Change in Android.mk. LOCAL_MODULE_PATH := $(TARGET_OUT)/app.

          Or you can duplicate the property.






          share|improve this answer





























            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/4.0/"u003ecc by-sa 4.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%2f46825230%2faccess-ro-serialno-from-native-in-android-8%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4
















            I met this problem too. Finally I find the root cause of the problem. In Android O, SELinux sets a lot of limitations in system property. In this case, There is a neverallow to limit read serial number except some domain in whitelist.



            For more specific information, you can read code in system/sepolicy/public/domain.te:



            neverallow 
            domain
            -adbd
            -dumpstate
            -hal_drm
            -init
            -mediadrmserver
            -recovery
            -shell
            -system_server
            serialno_prop:file r_file_perms;





            share|improve this answer



























            • Thank you very much!

              – carlaharris
              Dec 15 '17 at 6:56















            4
















            I met this problem too. Finally I find the root cause of the problem. In Android O, SELinux sets a lot of limitations in system property. In this case, There is a neverallow to limit read serial number except some domain in whitelist.



            For more specific information, you can read code in system/sepolicy/public/domain.te:



            neverallow 
            domain
            -adbd
            -dumpstate
            -hal_drm
            -init
            -mediadrmserver
            -recovery
            -shell
            -system_server
            serialno_prop:file r_file_perms;





            share|improve this answer



























            • Thank you very much!

              – carlaharris
              Dec 15 '17 at 6:56













            4














            4










            4









            I met this problem too. Finally I find the root cause of the problem. In Android O, SELinux sets a lot of limitations in system property. In this case, There is a neverallow to limit read serial number except some domain in whitelist.



            For more specific information, you can read code in system/sepolicy/public/domain.te:



            neverallow 
            domain
            -adbd
            -dumpstate
            -hal_drm
            -init
            -mediadrmserver
            -recovery
            -shell
            -system_server
            serialno_prop:file r_file_perms;





            share|improve this answer















            I met this problem too. Finally I find the root cause of the problem. In Android O, SELinux sets a lot of limitations in system property. In this case, There is a neverallow to limit read serial number except some domain in whitelist.



            For more specific information, you can read code in system/sepolicy/public/domain.te:



            neverallow 
            domain
            -adbd
            -dumpstate
            -hal_drm
            -init
            -mediadrmserver
            -recovery
            -shell
            -system_server
            serialno_prop:file r_file_perms;






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 8 '17 at 2:54









            Stephen Rauch

            33.1k15 gold badges44 silver badges69 bronze badges




            33.1k15 gold badges44 silver badges69 bronze badges










            answered Dec 8 '17 at 2:35









            simowcesimowce

            798 bronze badges




            798 bronze badges















            • Thank you very much!

              – carlaharris
              Dec 15 '17 at 6:56

















            • Thank you very much!

              – carlaharris
              Dec 15 '17 at 6:56
















            Thank you very much!

            – carlaharris
            Dec 15 '17 at 6:56





            Thank you very much!

            – carlaharris
            Dec 15 '17 at 6:56













            1
















            If you have the hand on AOSP:



            1. Put android:sharedUserId="android.uid.system" to AdnroidMainfest

            2. Run app like system_app.

            3. Change in Android.mk. LOCAL_MODULE_PATH := $(TARGET_OUT)/app.

            Or you can duplicate the property.






            share|improve this answer































              1
















              If you have the hand on AOSP:



              1. Put android:sharedUserId="android.uid.system" to AdnroidMainfest

              2. Run app like system_app.

              3. Change in Android.mk. LOCAL_MODULE_PATH := $(TARGET_OUT)/app.

              Or you can duplicate the property.






              share|improve this answer





























                1














                1










                1









                If you have the hand on AOSP:



                1. Put android:sharedUserId="android.uid.system" to AdnroidMainfest

                2. Run app like system_app.

                3. Change in Android.mk. LOCAL_MODULE_PATH := $(TARGET_OUT)/app.

                Or you can duplicate the property.






                share|improve this answer















                If you have the hand on AOSP:



                1. Put android:sharedUserId="android.uid.system" to AdnroidMainfest

                2. Run app like system_app.

                3. Change in Android.mk. LOCAL_MODULE_PATH := $(TARGET_OUT)/app.

                Or you can duplicate the property.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 28 at 6:15









                Community

                11 silver badge




                11 silver badge










                answered Mar 21 at 4:07









                Thinh DinhThinh Dinh

                92 bronze badges




                92 bronze badges































                    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%2f46825230%2faccess-ro-serialno-from-native-in-android-8%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현