{"action":"opened","issue":{"url":"https://api.github.com/repos/mobile-insight/mobileinsight-mobile/issues/10","repository_url":"https://api.github.com/repos/mobile-insight/mobileinsight-mobile","labels_url":"https://api.github.com/repos/mobile-insight/mobileinsight-mobile/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/mobile-insight/mobileinsight-mobile/issues/10/comments","events_url":"https://api.github.com/repos/mobile-insight/mobileinsight-mobile/issues/10/events","html_url":"https://github.com/mobile-insight/mobileinsight-mobile/issues/10","id":267847311,"number":10,"title":"Cannot cast Android Java API in plugin","user":{"login":"zwyuan","id":7631396,"avatar_url":"https://avatars1.githubusercontent.com/u/7631396?v=4","gravatar_id":"","url":"https://api.github.com/users/zwyuan","html_url":"https://github.com/zwyuan","followers_url":"https://api.github.com/users/zwyuan/followers","following_url":"https://api.github.com/users/zwyuan/following{/other_user}","gists_url":"https://api.github.com/users/zwyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/zwyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zwyuan/subscriptions","organizations_url":"https://api.github.com/users/zwyuan/orgs","repos_url":"https://api.github.com/users/zwyuan/repos","events_url":"https://api.github.com/users/zwyuan/events{/privacy}","received_events_url":"https://api.github.com/users/zwyuan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-23T23:17:59Z","updated_at":"2017-10-23T23:17:59Z","closed_at":null,"author_association":"OWNER","body":"The below demo code will lead to crash if saved as a plugin (`main.mi2app`):\r\n\r\n```\r\n#!/usr/bin/python\r\n\r\nimport os\r\nimport sys\r\nimport kivy\r\nimport jnius\r\nfrom jnius import autoclass, cast\r\n\r\nprint \"Start\"\r\n\r\nactivity = cast(\"android.app.Activity\", autoclass(\"org.kivy.android.PythonActivity\").mActivity)\r\nprint activity.getFilesDir().getAbsolutePath()\r\n\r\nprint \"End\"\r\n```\r\n\r\nThe crash log is attached here:\r\n\r\n```\r\n10-23 16:10:00.769 24857 24872 I python2.7: Phone model: Nexus 6P\r\n10-23 16:10:00.769 24857 24872 I python2.7: Running app: /storage/emulated/0/mobileinsight/plugins/WiFi/main.mi2app\r\n10-23 16:10:00.791 24857 24872 I python2.7: Start\r\n10-23 16:10:00.877   646  1206 I slim_daemon: [QMILOC] requestTimeData: Sending Time Data to LocApi\r\n10-23 16:10:00.916 24857 24872 F libc    : Fatal signal 11 (SIGSEGV), code 2, fault addr 0xd61e7d00 in tid 24872 (Thread-2)\r\n10-23 16:10:00.916   361   361 W         : debuggerd: handling request: pid=24857 uid=10226 gid=10226 tid=24872\r\n10-23 16:10:00.919 24875 24875 I debuggerd: type=1400 audit(0.0:426): avc: denied { read } for name=\"libpymodules.so\" dev=\"dm-0\" ino=426736 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file permissive=1\r\n10-23 16:10:00.919 24875 24875 I debuggerd: type=1400 audit(0.0:427): avc: denied { open } for path=\"/data/data/net.mobileinsight.app/files/app/libpymodules.so\" dev=\"dm-0\" ino=426736 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file permissive=1\r\n10-23 16:10:00.919 24875 24875 I debuggerd: type=1400 audit(0.0:428): avc: denied { getattr } for path=\"/data/data/net.mobileinsight.app/files/app/libpymodules.so\" dev=\"dm-0\" ino=426736 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file permissive=1\r\n10-23 16:10:00.988 24875 24875 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\r\n10-23 16:10:00.988 24875 24875 F DEBUG   : Build fingerprint: 'google/angler/angler:7.1.2/N2G47H/3783593:user/release-keys'\r\n10-23 16:10:00.989 24875 24875 F DEBUG   : Revision: '0'\r\n10-23 16:10:00.989 24875 24875 F DEBUG   : ABI: 'arm'\r\n10-23 16:10:00.989 24875 24875 F DEBUG   : pid: 24857, tid: 24872, name: Thread-2  >>> net.mobileinsight.app:pythonservice <<<\r\n10-23 16:10:00.989 24875 24875 F DEBUG   : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xd61e7d00\r\n10-23 16:10:00.989 24875 24875 F DEBUG   :     r0 d5425d50  r1 d61e7d00  r2 d5be5145  r3 656e6f4f\r\n10-23 16:10:00.989 24875 24875 F DEBUG   :     r4 d5db1ef0  r5 d5425d50  r6 d5d7c4b0  r7 d61e7d00\r\n10-23 16:10:00.989 24875 24875 F DEBUG   :     r8 d5d44b04  r9 d621f90c  sl d55904b8  fp d6254fe4\r\n10-23 16:10:00.989 24875 24875 F DEBUG   :     ip d5d44bb4  sp ee3eca80  lr d5bf3d23  pc d5c04fd6  cpsr 00010030\r\n10-23 16:10:00.990 24875 24875 F DEBUG   :\r\n10-23 16:10:00.990 24875 24875 F DEBUG   : backtrace:\r\n10-23 16:10:00.990 24875 24875 F DEBUG   :     #00 pc 00224fd6  /data/data/net.mobileinsight.app/files/app/libpymodules.so\r\n10-23 16:10:00.990 24875 24875 F DEBUG   :     #01 pc 00213d1f  /data/data/net.mobileinsight.app/files/app/libpymodules.so\r\n10-23 16:10:01.804   361   361 W         : debuggerd: resuming target 24857\r\n10-23 16:10:01.805  1001  1023 I BootReceiver: Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)\r\n10-23 16:10:01.833  1001  4160 I ActivityManager: Process net.mobileinsight.app:pythonservice (pid 24857) has died\r\n10-23 16:10:01.834  1001  4160 D ActivityManager: cleanUpApplicationRecord -- 24857\r\n10-23 16:10:01.834  1001  4160 W ActivityManager: Scheduling restart of crashed service net.mobileinsight.app/org.kivy.android.PythonService in 1000ms\r\n10-23 16:10:01.837   610   610 I Zygote  : Process 24857 exited due to signal (11)\r\n```"}}
{"actor":{"display_login":"zwyuan"}}