[Feature][T106-task-1355][Network]  report attach reject cause 15 to
upper layer

       Only Configure:no
       Affected branch:unknown
       Affected module:unknown
       Is it affected on both ZXIC and MTK:ZXIC only
       Self-test:yes
       Doc Update:No

Change-Id: Ide18c1e736995e71cc76b1d41f5f94536d86a36e
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
index 2d45d7d..233faf4 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
@@ -214,11 +214,12 @@
 

                 if(ind->registration_valid)

                 {

-                    printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", 

+                    printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d, deny_reason is %d\n", 

                             tech_domain[ind->registration.tech_domain], 

                             radio_tech[ind->registration.radio_tech],

                             ind->registration.roaming,

-                            ind->registration.registration_state);

+                            ind->registration.registration_state,

+                            ind->registration.deny_reason);

                 }

                 if(ind->registration_details_3gpp_valid)

                 {

@@ -382,19 +383,21 @@
                  printf("qser_nw_get_reg_status ret = %d, detail info:\n", ret);

                  if(t_info.voice_registration_valid)

                  {

-                     printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", 

+                     printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d, deny_reason is %d\n", 

                          tech_domain[t_info.voice_registration.tech_domain], 

                          radio_tech[t_info.voice_registration.radio_tech],

                          t_info.voice_registration.roaming,

-                         t_info.voice_registration.registration_state);

+                         t_info.voice_registration.registration_state,

+                         t_info.voice_registration.deny_reason);

                  }

                  if(t_info.data_registration_valid)

                  {

-                     printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", 

+                     printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d, deny_reason is %d\n", 

                          tech_domain[t_info.data_registration.tech_domain], 

                          radio_tech[t_info.data_registration.radio_tech],

                          t_info.data_registration.roaming,

-                         t_info.data_registration.registration_state);

+                         t_info.data_registration.registration_state,

+                         t_info.data_registration.deny_reason);

                  }

                  if(t_info.voice_registration_details_3gpp_valid)

                  {

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index f0c0bba..fb231b9 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -763,7 +763,7 @@
             LYERRLOG("%s data resp[3] %s is NULL",__func__);

         }

     }

-    else if((*regState)==3 || (*regState)==13)

+    else //if((*regState)==3 || (*regState)==13) //LYNQ_HUANG_QING_AT_20250421_ZXW_TASK_1355_CR_202504112CA2ADB1_MODIFY

     {    

         if(resp[reject_index]==NULL)

         {    

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
index 9ad0b0c..d9cd05a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
@@ -597,6 +597,300 @@
     return state;  
 }
 
+int switch_nw_deny_reason_data(int net_reject_reason)
+{
+#if 0
+below is from <SC-VV601-3A ZX297520V3Vƽ̨ATÃüÁîÊÖ²á >  ¸½Â¼ C +CEER ·µ»Ø´íÎóÔ­ÒòÁбí 
+GPRS/EPS Mobility Management ÀàÐÍ´íÎóÔ­Òò£º
+¼õÈ¥ 100µÃµ½ net_reject_reason
+    103 Illegal Ms
+    106 Illegal Me
+    107 Gprs Services Not Allowed
+    108 Gprs and Non-Gprs Services Not Allowed
+    109 UE identity cannot be derived by the network
+    110 UE implicitly detached
+    111 Plmn Not Allowed
+    112 Location area not allowed
+    113 Roaming not allowed in this location area
+    114 GPRS services not allowed in the PLMN
+    115 No suitable cells in routing area
+    116 Authentication Reject
+    117 Authentication Failure
+    118 IMEI Not Accepted
+    119 Imsi Paging
+    120 MT detach, Reattach Required
+    121 User Deactived
+    122 Congestion
+    123 ESM failure
+    124 No PDP context activated
+    125 Not Authorized For This Csg
+    126 Attach Lower Layer Failure Or Release
+    127 T3410 Time Out
+    128 Requested service option not authorized in this PLMN
+    129 Active Default Eps Bear Reject
+    130 Authentication Mac Failure
+    131 Authentication Sync Failure
+    132 Authentication None Eps parameter
+    133 Reattach not required and no cause
+    134 Get Ue Information Failure
+    135 T3310 Time Out
+    136 Authentication Unacceptable
+    137 Attach Establish Reject
+    148 Unspecified GPRS error
+    149 Normal Fail Continuously Five Times
+    172 Semantically incorrect message
+    173 Invalid mandatory information
+    174 Message type non-existent or not implemented
+    175 Information element non-existent or not implemented
+    176 Protocol error, unspecified
+    177 Message type not compatible with the protocol state
+    178 Conditional IE error
+    179 Message not compatible with the protocol state
+    180 retry upon entry into a new cell
+    181 UE security capabilities mismatch
+    182 Security mode rejected, unspecified
+#endif
+
+    int reason = 0;
+    switch (net_reject_reason)
+    {
+        case 3://3 - Illegal MS
+            reason=E_QSER_NW_ILLEGAL_MS_DENY_REASON;/*2*/
+            break;
+        case 6:// 6 - Illegal ME
+            reason=E_QSER_NW_ILLEGAL_ME_DENY_REASON;/*5*/
+            break;     
+        case 7://7 == GPRS services not allowed
+        case 8://8 == GPRS services and non-GPRS services not allowed
+        case 14://14 == GPRS services not allowed in this PLMN
+            reason = E_QSER_NW_SERVICE_OPTION_NOT_SUPPORTED_DENY_REASON;  /*=16*/
+            break;
+        case 9://9 == MS identity cannot be derived by the network
+            reason = E_QSER_NW_CALL_CANNOT_BE_IDENTIFIED_DENY_REASON;/*=18*/
+            break;
+        case 15://15 - No Suitable Cells in this Location Area
+            reason = E_QSER_NW_NO_SUITABLE_CELLS_LA_DENY_REASON;/*=9*/
+            break;   
+        case 16://16  Authentication Reject
+        case 17://17  Authentication Failure
+        case 30://30  Authentication Mac Failure
+        case 31://31  Authentication Sync Failure
+        case 32://32  Authentication None Eps parameter
+        case 36://36  Authentication Unacceptable
+        case 81://UE security capabilities mismatch
+        case 82://Security mode rejected, unspecified
+            reason=E_QSER_NW_GSM_AUTHENTICATION_UNACCEPTABLE_DENY_REASON;/*14*/
+            break; 
+        case 18://18  IMEI Not Accepted
+            reason=E_QSER_NW_IMEI_NOT_ACCEPTED_DENY_REASON;/*4*/
+            break;           
+        case 22://22 - Congestion
+            reason=E_QSER_NW_CONGESTION_DENY_REASON;/*13*/
+            break;     
+        case 25://25 - Not Authorized for this CSG
+           reason=E_QSER_NW_NOT_AUTHORIZED_CSG_DENY_REASON;/*15*/
+           break; 
+        case 21://21 - User Deactived
+        case 28://28 - Requested service option not authorized in this PLMN
+            reason=E_QSER_NW_REQ_SERVICE_OPTION_NOT_SUBSCRIBED_DENY_REASON;/*17*/
+            break;              
+        case 72://72 - Semantically incorrect message
+           reason=E_QSER_NW_SEMANTICALLY_INCORRECT_MSG_DENY_REASON;/*19*/
+           break; 
+        case 73://73 - Invalid mandatory information
+           reason=E_QSER_NW_INVALID_MANDATORY_INFO_DENY_REASON;/*20*/
+           break;  
+        case 74://74 - Message type non-existent or not implemented
+           reason=E_QSER_NW_MSG_TYPE_NON_EXISTENT_DENY_REASON;/*21*/
+           break;
+        case 75:// 75 -  Information element non-existent or not implemented
+           reason=E_QSER_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON;/*22*/ /**<  Message type not compatible with the protocol state. */
+        case 76: //76  Protocol error, unspecified
+           reason=E_QSER_NW_PROTOCOL_ERROR_DENY_REASON;/*25*/
+           break;
+        case 77:// 77 -  Message type not compatible with protocol state.
+           reason=E_QSER_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON;/*22*/ /**<  Message type not compatible with the protocol state. */
+           break; 
+        case 78://100 - Conditional IE error
+           reason=E_QSER_NW_CONDITIONAL_IE_ERR_DENY_REASON;/*23*/
+           break; 
+        case 79://101 - Message not compatible with protocol state
+           reason=E_QSER_NW_MSG_INCOMPATIBLE_PROTOCOL_STATE_DENY_REASON;/*24*/
+           break;       
+    }
+    return reason;  
+}
+
+int switch_nw_deny_reason_voice(int net_reject_reason)
+{
+#if 0
+    below is from <SC-VV601-3A ZX297520V3Vƽ̨ATÃüÁîÊÖ²á >  ¸½Â¼ C +CEER ·µ»Ø´íÎóÔ­ÒòÁбí 
+    CS Mobility Management ÀàÐÍ´íÎóÔ­Òò£º
+    
+    2 IMSI unknown in HLR
+    3 Illegal MS
+    4 IMSI unknown in VLR
+    5 IMEI not accepted
+    6 Illegal ME
+    11 PLMN not allowed
+    12 Location Area not allowed
+    13 Roaming not allowed in this location area
+    15 No Suitable Cells In Location Area
+    16 MSC temporarily not reachable
+    17 Network Failure
+    18 Retry InTo New Cell
+    19 Default Reject Cause
+    20 MAC failure
+    21 Synch failure
+    22 Congestion
+    23 GSM authentication unacceptable
+    24 Authentication Reject
+    25 Not authorized for this CSG
+    30 Cm Service Abortion
+    32 Service option not supported
+    33 Requested service option not subscribed
+    34 Service option temporarily out of order
+    38 Call cannot be identified
+    39 Extended service request procedure, CS service temporarily not
+    available
+    40 RRC Connection Establish Cell Reselection
+    41 RRC Connection Establish Failure
+    42 Random Acess Failure
+    43 LowLayer Failure
+    44 GRR Abort Indication
+    45 Paging Pending
+    46 RRC Connection Release Preemptive
+    47 RRC Connection Release Congestion
+    48 RRC Connection Release Reestablish Reject
+    49 RRC Connection Release Direct Signal Reestablish
+    50 RRC Connection Release User Inactive
+    51 Combined EPS attach or TAU successful for EPS only, CS domain
+    not available
+    52 MM normal fail or network fail continuously 4 times, need search
+    PLMN
+    53 MT detach, and the detach type is IMSI detach
+    95 Semantically incorrect message
+    96 Invalid mandatory information
+    97 Message type non-existent or not implemented
+    98 Message type not compatible with protocol state
+    99 Information element non-existent or not implemented
+    100 Conditional IE error
+    101 Message not compatible with protocol state
+    111 Protocol error, Unspecified
+    120 Unspecified Failure
+
+below is E_QSER_NW_ macro definition
+    E_QSER_NW_IMSI_UNKNOWN_HLR_DENY_REASON                    = 1, /**<  IMSI unknown in HLR. */
+    E_QSER_NW_ILLEGAL_MS_DENY_REASON                          = 2, /**<  Illegal MS. */
+    E_QSER_NW_IMSI_UNKNOWN_VLR_DENY_REASON                    = 3, /**<  IMSI unknown in VLR. */
+    E_QSER_NW_IMEI_NOT_ACCEPTED_DENY_REASON                   = 4, /**<  IMEI not accepted. */
+    E_QSER_NW_ILLEGAL_ME_DENY_REASON                          = 5, /**<  Illegal ME. */
+    E_QSER_NW_PLMN_NOT_ALLOWED_DENY_REASON                    = 6, /**<  PLMN not allowed. */
+    E_QSER_NW_LA_NOT_ALLOWED_DENY_REASON                      = 7, /**<  Location area not allowed. */
+    E_QSER_NW_ROAMING_NOT_ALLOWED_LA_DENY_REASON              = 8, /**<  Roaming not allowed in this location area. */
+    E_QSER_NW_NO_SUITABLE_CELLS_LA_DENY_REASON                = 9, /**<  No suitable cells in location area. */
+    E_QSER_NW_NETWORK_FAILURE_DENY_REASON                     = 10, /**<  Network failure. */
+    E_QSER_NW_MAC_FAILURE_DENY_REASON                         = 11, /**<  MAC failure. */
+    E_QSER_NW_SYNCH_FAILURE_DENY_REASON                       = 12, /**<  Sync failure. */
+    E_QSER_NW_CONGESTION_DENY_REASON                          = 13, /**<  Congestion. */
+    E_QSER_NW_GSM_AUTHENTICATION_UNACCEPTABLE_DENY_REASON     = 14, /**<  GSM authentication unacceptable. */
+    E_QSER_NW_NOT_AUTHORIZED_CSG_DENY_REASON                  = 15, /**<  Not authorized in this CSG. */
+    E_QSER_NW_SERVICE_OPTION_NOT_SUPPORTED_DENY_REASON        = 16, /**<  Service option not supported. */
+    E_QSER_NW_REQ_SERVICE_OPTION_NOT_SUBSCRIBED_DENY_REASON   = 17, /**<  Requested service option not subscribed. */
+    E_QSER_NW_CALL_CANNOT_BE_IDENTIFIED_DENY_REASON           = 18, /**<  Call cannot be identified. */
+    E_QSER_NW_SEMANTICALLY_INCORRECT_MSG_DENY_REASON          = 19, /**<  Semantically incorrect message. */
+    E_QSER_NW_INVALID_MANDATORY_INFO_DENY_REASON              = 20, /**<  Invalid mandatory information. */
+    E_QSER_NW_MSG_TYPE_NON_EXISTENT_DENY_REASON               = 21, /**<  Message type non-existent or not implemented. */
+    E_QSER_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON           = 22, /**<  Message type not compatible with the protocol state. */
+    E_QSER_NW_CONDITIONAL_IE_ERR_DENY_REASON                  = 23, /**<  Conditional IE error. */
+    E_QSER_NW_MSG_INCOMPATIBLE_PROTOCOL_STATE_DENY_REASON     = 24, /**<  Message not compatible with the protocol state. */
+    E_QSER_NW_PROTOCOL_ERROR_DENY_REASON                      = 25, /**<  Unspecified protocol error. */
+#endif
+    int reason = 0;
+    switch (net_reject_reason)
+    {
+    case 2://2 - IMSI unknown in HLR
+       reason=E_QSER_NW_IMSI_UNKNOWN_HLR_DENY_REASON;/*1*/
+       break;
+    case 3://3 - Illegal MS
+       reason=E_QSER_NW_ILLEGAL_MS_DENY_REASON;/*2*/
+       break;
+    case 4://4 IMSI unknown in VLR
+       reason=E_QSER_NW_IMSI_UNKNOWN_VLR_DENY_REASON;/*3*/
+       break;
+    case 5://" 5 - IMEI not accepted
+       reason=E_QSER_NW_IMEI_NOT_ACCEPTED_DENY_REASON;/*4*/
+       break;
+    case 6:// 6 - Illegal ME
+       reason=E_QSER_NW_ILLEGAL_ME_DENY_REASON;/*5*/
+       break;   
+    case 7://" 7 - Roaming not allowed
+    case 11://11 - PLMN not allowed"
+       reason=E_QSER_NW_PLMN_NOT_ALLOWED_DENY_REASON;/*6*/
+       break;
+    case 12://12 - Location area not allowed"
+       reason=E_QSER_NW_LA_NOT_ALLOWED_DENY_REASON;/*7*/
+       break;
+    case 13://13 - Roaming not allowed in this Location Area"
+       reason=E_QSER_NW_ROAMING_NOT_ALLOWED_LA_DENY_REASON;/*8*/
+       break;
+    case 8://" 8 - No Suitable Cells in this Location Area
+    case 15://15 - No Suitable Cells in this Location Area"
+       reason=E_QSER_NW_NO_SUITABLE_CELLS_LA_DENY_REASON;/*9*/
+       break;
+    case 9://" 9 - Network failure
+    case 17://17 - Network Failure"
+       reason=E_QSER_NW_NETWORK_FAILURE_DENY_REASON;/*10*/
+       break;
+    case 20://20 - MAC Failure
+       reason=E_QSER_NW_MAC_FAILURE_DENY_REASON;/*11*/
+       break;
+    case 21://21 - Sync Failure
+       reason=E_QSER_NW_SYNCH_FAILURE_DENY_REASON;/*12*/
+       break;  
+     case 22://22 - Congestion
+       reason=E_QSER_NW_CONGESTION_DENY_REASON;/*13*/
+       break; 
+     case 23:// 23 - GSM Authentication unacceptable
+        reason=E_QSER_NW_GSM_AUTHENTICATION_UNACCEPTABLE_DENY_REASON;/*14*/
+       break; 
+     case 25://25 - Not Authorized for this CSG
+       reason=E_QSER_NW_NOT_AUTHORIZED_CSG_DENY_REASON;/*15*/
+       break; 
+     case 32://32 - Service option not supported
+       reason=E_QSER_NW_SERVICE_OPTION_NOT_SUPPORTED_DENY_REASON;/*16*/
+       break;      
+     case 33://33 - Requested service option not subscribed
+       reason=E_QSER_NW_REQ_SERVICE_OPTION_NOT_SUBSCRIBED_DENY_REASON;/*17*/
+       break; 
+     case 38://38 - Call cannot be identified
+       reason=E_QSER_NW_CALL_CANNOT_BE_IDENTIFIED_DENY_REASON;/*18*/
+       break; 
+     case 95://95 - Semantically incorrect message
+       reason=E_QSER_NW_SEMANTICALLY_INCORRECT_MSG_DENY_REASON;/*19*/
+       break; 
+     case 96://96 - Invalid mandatory information
+       reason=E_QSER_NW_INVALID_MANDATORY_INFO_DENY_REASON;/*20*/
+       break;  
+     case 97://97 - Message type non-existent or not implemented
+       reason=E_QSER_NW_MSG_TYPE_NON_EXISTENT_DENY_REASON;/*21*/
+       break;
+     case 98:// 98 -  Message type not compatible with protocol state.
+       reason=E_QSER_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON;/*22*/ /**<  Message type not compatible with the protocol state. */
+       break; 
+     case 100://100 - Conditional IE error
+       reason=E_QSER_NW_CONDITIONAL_IE_ERR_DENY_REASON;/*23*/
+       break; 
+     case 101://101 - Message not compatible with protocol state
+       reason=E_QSER_NW_MSG_INCOMPATIBLE_PROTOCOL_STATE_DENY_REASON;/*24*/
+       break; 
+     case 111:
+       reason=E_QSER_NW_PROTOCOL_ERROR_DENY_REASON;/*25*/
+       break; 
+    }
+    return reason;  
+}
+
 int qser_romaing_state_qurey(int regState)
 {
     if (regState == 5)
@@ -699,6 +993,7 @@
         pt_info->voice_registration.radio_tech = qser_radio_tech_qurey(netType);       
         pt_info->voice_registration.roaming = qser_romaing_state_qurey(regState);       
         pt_info->voice_registration.registration_state = switch_nw_regstate(regState);
+        pt_info->voice_registration.deny_reason = switch_nw_deny_reason_voice(netreject);
         
         if(is_have_serve_cell(pt_info->voice_registration.registration_state))
         {  
@@ -723,6 +1018,7 @@
         pt_info->data_registration.radio_tech = qser_radio_tech_qurey(netType);      
         pt_info->data_registration.roaming = qser_romaing_state_qurey(regState);         
         pt_info->data_registration.registration_state = switch_nw_regstate(regState);
+        pt_info->data_registration.deny_reason = switch_nw_deny_reason_data(netreject);
 
         if(is_have_serve_cell(pt_info->data_registration.registration_state))
         {  
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
index b7a262d..ecbd0ec 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
@@ -1293,7 +1293,20 @@
 			  5 - 5GS Session Management

 			  */

 			if (3 == type[count]) {

-				switch (info[count]) {

+				//LYNQ_HUANG_QING_AT_20250421_ZXW_TASK_1355_CR_202504112CA2ADB1_MODIFY_BEGIN

+				if(info[count]==124)

+				{

+					info[count] = 40;

+					asprintf(&responseStr[4], "%d", info[count]);

+				}

+				else if(info[count]>100)

+				{

+					info[count] -= 100;

+					asprintf(&responseStr[4], "%d", info[count]);

+				}

+             }                        

+			/*

+				switch (info[count]) {                

 				case 107:

 				case 108:

 				case 109:

@@ -1308,10 +1321,12 @@
 					break;

 				default:

 					break;

-				}

-			} else if (4 == type[count] && 16 == info[count]) {

+				} 					

+			} 

+			else if (4 == type[count] && 16 == info[count]) {

 				asprintf(&responseStr[4], "%d", info[count]);

-			}

+			}*/

+			//LYNQ_HUANG_QING_AT_20250421_ZXW_TASK_1355_CR_202504112CA2ADB1_MODIFY_END

 		}

 	}