[General Questions and Answers] v8dave:
This is related to custom build of Android 5.1 and I have exhausted time on this and posted on a few Google groups but there is no activity on them.

I have a FriendlyArm NanoPC T3 Plus board and I wanted to add GSM to this as the stock image does not support it. I can build the image and done a few tweaks to get landscape mode etc. All that works.

No I added a SIM5320E modem and the SIMCOM RIL in binary format. After a bit of work with SELinux policies, I can get this to dial up PPP and make the connection and I can see this in the logcat. BUT, right after this com.android.phone crashes and pops up a message on the LCD. I click OK and it then repeats the process and crashes again. Below is the logcat capture of the connection and crash. It appears to be a file exception but I can't find digging through the code which file it might be.

I have disable SELinux in the kernel build to remove any issues with policies but get the same result.

java.lang.SecurityException: Package android does not belong to 1001 in the log output seems to be something to look into but all I can find is that 1001 belongs to the phone process.

Stuck on this for a few weeks now and getting nowhere so appreciate any pointers or if you have had a similar issue?

I//system/bin/pppd( 2924): pppd 2.4.3 started by root, uid 0
I/chat ( 2926): abort on (BUSY)
I/chat ( 2926): abort on (NO CARRIER)
I/chat ( 2926): abort on (ERROR)
I/chat ( 2926): abort on (+CME ERROR: 100)
I/chat ( 2926): timeout set to 8 seconds
I/chat ( 2926): send (ATE0Q0V1^M)
I/chat ( 2926): expect (OK)
I/chat ( 2926): ^M
I/chat ( 2926): OK
I/chat ( 2926): -- got it
I/chat ( 2926): send (ATD*99***1#^M)
I/chat ( 2926): expect (CONNECT)
I/chat ( 2926): ^M
I/chat ( 2926): ^M
I/chat ( 2926): CONNECT
I/chat ( 2926): -- got it
I/pppd ( 2924): Serial connection established.
D/pppd ( 2924): using channel 9
I/pppd ( 2924): Using interface ppp0
I/pppd ( 2924): Connect: ppp0 <--> /dev/ttyUSB3
D/pppd ( 2924): sent [LCP ConfReq id=0x1 <mru 1280> <asyncmap 0x0> <magic 0x59f9be6b> <pcomp> <accomp>]
D/pppd ( 2924): rcvd [LCP ConfReq id=0x10 <asyncmap 0x0> <auth chap MD5> <magic 0x332fad98> <pcomp> <accomp>]
D/pppd ( 2924): sent [LCP ConfAck id=0x10 <asyncmap 0x0> <auth chap MD5> <magic 0x332fad98> <pcomp> <accomp>]
D/pppd ( 2924): rcvd [LCP ConfAck id=0x1 <mru 1280> <asyncmap 0x0> <magic 0x59f9be6b> <pcomp> <accomp>]
D/pppd ( 2924): rcvd [LCP DiscReq id=0x11 magic=0x332fad98]
D/pppd ( 2924): rcvd [CHAP Challenge id=0x1 <c81669cbcc0c57607c5609f38a630dea>, name = "UMTS_CHAP_SRVR"]
D/pppd ( 2924): sent [CHAP Response id=0x1 <7b4baf8d89cc6dc0bac854ee8c6e86a0>, name = "wap"]
D/pppd ( 2924): rcvd [CHAP Success id=0x1 ""]
I/pppd ( 2924): CHAP authentication succeeded
D/pppd ( 2924): sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
D/pppd ( 2924): sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
D/pppd ( 2924): rcvd [LCP ProtRej id=0x12 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
D/pppd ( 2924): rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
D/pppd ( 2924): sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
D/pppd ( 2924): rcvd [IPCP ConfNak id=0x2 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
D/pppd ( 2924): sent [IPCP ConfReq id=0x3 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
D/pppd ( 2924): rcvd [IPCP ConfNak id=0x3 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
D/pppd ( 2924): sent [IPCP ConfReq id=0x4 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
D/pppd ( 2924): rcvd [IPCP ConfNak id=0x4 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
D/pppd ( 2924): sent [IPCP ConfReq id=0x5 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
D/pppd ( 2924): rcvd [IPCP ConfReq id=0x8]
D/pppd ( 2924): sent [IPCP ConfNak id=0x8 <addr 0.0.0.0>]
D/pppd ( 2924): rcvd [IPCP ConfRej id=0x5 <ms-dns3 10.11.12.14>]
D/pppd ( 2924): sent [IPCP ConfReq id=0x6 <addr 0.0.0.0> <ms-dns1 10.11.12.13>]
D/pppd ( 2924): rcvd [IPCP ConfReq id=0x9]
D/pppd ( 2924): sent [IPCP ConfAck id=0x9]
D/pppd ( 2924): rcvd [IPCP ConfNak id=0x6 <addr 10.11.240.107> <ms-dns1 192.168.39.28>]
D/pppd ( 2924): sent [IPCP ConfReq id=0x7 <addr 10.11.240.107> <ms-dns1 192.168.39.28>]
D/pppd ( 2924): rcvd [IPCP ConfAck id=0x7 <addr 10.11.240.107> <ms-dns1 192.168.39.28>]
W/pppd ( 2924): Could not determine remote IP address: defaulting to 10.64.64.64
I/pppd ( 2924): local IP address 10.11.240.107
I/pppd ( 2924): remote IP address 10.64.64.64
I/pppd ( 2924): primary DNS address 192.168.39.28
I/pppd ( 2924): secondary DNS address 10.11.12.14
D/TelephonyProvider( 2868): subIdString = 1 subId = 1
W/AppOps ( 416): Bad call: specified package android under uid 1001 but it is really 1000
D/TelephonyProvider( 2868): subIdString = 1 subId = 1
D/ConnectivityService( 416): setProvNotificationVisible: E visible=false networkType=0 action=com.android.internal.telephony.PROVISION0
E/AndroidRuntime( 2868): FATAL EXCEPTION: DcHandlerThread
E/AndroidRuntime( 2868): Process: com.android.phone, PID: 2868
E/AndroidRuntime( 2868): java.lang.SecurityException: Package android does not belong to 1001
E/AndroidRuntime( 2868):	at android.os.Parcel.readException(Parcel.java:1546)
E/AndroidRuntime( 2868):	at android.os.Parcel.readException(Parcel.java:1499)
E/AndroidRuntime( 2868):	at android.net.IConnectivityManager$Stub$Proxy.registerNetworkAgent(IConnectivityManager.java:2030)
E/AndroidRuntime( 2868):	at android.net.ConnectivityManager.registerNetworkAgent(ConnectivityManager.java:2001)
E/AndroidRuntime( 2868):	at android.net.NetworkAgent.<init>(NetworkAgent.java:145)
E/AndroidRuntime( 2868):	at com.android.internal.telephony.dataconnection.DataConnection$DcNetworkAgent.<init>(DataConnection.java:1958)
E/AndroidRuntime( 2868):	at com.android.internal.telephony.dataconnection.DataConnection$DcActiveState.enter(DataConnection.java:1735)
E/AndroidRuntime( 2868):	at com.android.internal.util.StateMachine$SmHandler.invokeEnterMethods(StateMachine.java:1008)
E/AndroidRuntime( 2868):	at com.android.internal.util.StateMachine$SmHandler.performTransitions(StateMachine.java:854)
E/AndroidRuntime( 2868):	at com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:800)
E/AndroidRuntime( 2868):	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 2868):	at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 2868):	at android.os.HandlerThread.run(HandlerThread.java:61)
D/ConnectivityService( 416): setProvNotificationVisibleIntent: E visible=false networkType=0 extraInfo=null
W/ActivityManager( 416): Process com.android.phone has crashed too many times: killing!
I/OpenGLRenderer( 416): Initialized EGL, version 1.4
E/[EGL-ERROR]( 416): EGLBoolean __egl_platform_create_surface_window(egl_surface*, mali_base_ctx_handle):933: =========> usage 0x900