@@ -53,12 +53,16 @@ public class VoiceConnection extends Connection {
53
53
if (name != null && !name .equals ("" )) {
54
54
setCallerDisplayName (name , TelecomManager .PRESENTATION_ALLOWED );
55
55
}
56
+ Log .e (TAG , "Constructor" );
56
57
}
57
58
58
59
@ Override
59
60
public void onExtrasChanged (Bundle extras ) {
60
61
super .onExtrasChanged (extras );
61
- handle = (HashMap <String , String >)extras .getSerializable ("attributeMap" );
62
+ HashMap attributeMap = (HashMap <String , String >)extras .getSerializable ("attributeMap" );
63
+ if (attributeMap != null ) {
64
+ handle = attributeMap ;
65
+ }
62
66
}
63
67
64
68
@ Override
@@ -86,7 +90,11 @@ public void onAnswer() {
86
90
87
91
@ Override
88
92
public void onPlayDtmfTone (char dtmf ) {
89
- handle .put ("DTMF" , Character .toString (dtmf ));
93
+ try {
94
+ handle .put ("DTMF" , Character .toString (dtmf ));
95
+ } catch (Throwable exception ) {
96
+ Log .e (TAG , "Handle map error" , exception );
97
+ }
90
98
sendCallRequestToActivity (ACTION_DTMF_TONE , handle );
91
99
}
92
100
@@ -96,7 +104,11 @@ public void onDisconnect() {
96
104
setDisconnected (new DisconnectCause (DisconnectCause .LOCAL ));
97
105
sendCallRequestToActivity (ACTION_END_CALL , handle );
98
106
Log .d (TAG , "onDisconnect executed" );
99
- ((VoiceConnectionService )context ).deinitConnection (handle .get (EXTRA_CALL_UUID ));
107
+ try {
108
+ ((VoiceConnectionService ) context ).deinitConnection (handle .get (EXTRA_CALL_UUID ));
109
+ } catch (Throwable exception ) {
110
+ Log .e (TAG , "Handle map error" , exception );
111
+ }
100
112
destroy ();
101
113
}
102
114
@@ -125,7 +137,11 @@ public void onAbort() {
125
137
setDisconnected (new DisconnectCause (DisconnectCause .REJECTED ));
126
138
sendCallRequestToActivity (ACTION_END_CALL , handle );
127
139
Log .d (TAG , "onAbort executed" );
128
- ((VoiceConnectionService )context ).deinitConnection (handle .get (EXTRA_CALL_UUID ));
140
+ try {
141
+ ((VoiceConnectionService ) context ).deinitConnection (handle .get (EXTRA_CALL_UUID ));
142
+ } catch (Throwable exception ) {
143
+ Log .e (TAG , "Handle map error" , exception );
144
+ }
129
145
destroy ();
130
146
}
131
147
@@ -149,7 +165,11 @@ public void onReject() {
149
165
setDisconnected (new DisconnectCause (DisconnectCause .REJECTED ));
150
166
sendCallRequestToActivity (ACTION_END_CALL , handle );
151
167
Log .d (TAG , "onReject executed" );
152
- ((VoiceConnectionService )context ).deinitConnection (handle .get (EXTRA_CALL_UUID ));
168
+ try {
169
+ ((VoiceConnectionService ) context ).deinitConnection (handle .get (EXTRA_CALL_UUID ));
170
+ } catch (Throwable exception ) {
171
+ Log .e (TAG , "Handle map error" , exception );
172
+ }
153
173
destroy ();
154
174
}
155
175
@@ -168,9 +188,8 @@ public void run() {
168
188
Bundle extras = new Bundle ();
169
189
extras .putSerializable ("attributeMap" , attributeMap );
170
190
intent .putExtras (extras );
191
+ LocalBroadcastManager .getInstance (context ).sendBroadcast (intent );
171
192
}
172
-
173
- LocalBroadcastManager .getInstance (context ).sendBroadcast (intent );
174
193
}
175
194
});
176
195
}
0 commit comments