@qusaieilouti99/call-manager 0.1.74 → 0.1.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -92,14 +92,21 @@ class CallActivity : Activity() {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// NEW: Register broadcast receiver
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
val filter = IntentFilter("com.qusaieilouti99.callmanager.CLOSE_CALL_ACTIVITY")
|
|
96
|
+
try {
|
|
97
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
98
|
+
registerReceiver(closeReceiver, filter, Context.RECEIVER_NOT_EXPORTED)
|
|
99
|
+
Log.d(TAG, "Broadcast receiver registered successfully (API 33+)")
|
|
100
|
+
} else {
|
|
101
|
+
registerReceiver(closeReceiver, filter)
|
|
102
|
+
Log.d(TAG, "Broadcast receiver registered successfully (API < 33)")
|
|
103
|
+
}
|
|
104
|
+
} catch (e: Exception) {
|
|
105
|
+
Log.e(TAG, "Failed to register broadcast receiver: ${e.message}", e)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
timeoutHandler.postDelayed(timeoutRunnable, 60_000)
|
|
109
|
+
Log.d(TAG, "CallActivity onCreate - END")
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
override fun onDestroy() {
|
|
@@ -602,6 +602,17 @@ object CallEngine {
|
|
|
602
602
|
currentCallId = activeCalls.filter { it.value.state != CallState.ENDED }.keys.firstOrNull()
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
+
// NEW: Send broadcast to close CallActivity
|
|
606
|
+
val context = requireContext()
|
|
607
|
+
val closeActivityIntent = Intent("com.qusaieilouti99.callmanager.CLOSE_CALL_ACTIVITY")
|
|
608
|
+
closeActivityIntent.putExtra("callId", callId)
|
|
609
|
+
try {
|
|
610
|
+
context.sendBroadcast(closeActivityIntent)
|
|
611
|
+
Log.d(TAG, "Sent close broadcast for CallActivity: $callId")
|
|
612
|
+
} catch (e: Exception) {
|
|
613
|
+
Log.w(TAG, "Failed to send close broadcast: ${e.message}")
|
|
614
|
+
}
|
|
615
|
+
|
|
605
616
|
val connection = telecomConnections[callId]
|
|
606
617
|
if (connection != null) {
|
|
607
618
|
connection.setDisconnected(DisconnectCause(DisconnectCause.LOCAL))
|
|
@@ -1083,16 +1094,21 @@ object CallEngine {
|
|
|
1083
1094
|
// --- Media Management ---
|
|
1084
1095
|
private fun playRingtone() {
|
|
1085
1096
|
val context = requireContext()
|
|
1086
|
-
|
|
1087
|
-
return // System handles it
|
|
1088
|
-
}
|
|
1097
|
+
Log.d(TAG, "playRingtone() called")
|
|
1089
1098
|
|
|
1090
1099
|
try {
|
|
1091
1100
|
val uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE)
|
|
1101
|
+
Log.d(TAG, "Ringtone URI: $uri")
|
|
1102
|
+
|
|
1092
1103
|
ringtone = RingtoneManager.getRingtone(context, uri)
|
|
1093
|
-
ringtone
|
|
1104
|
+
if (ringtone != null) {
|
|
1105
|
+
ringtone?.play()
|
|
1106
|
+
Log.d(TAG, "Ringtone started playing successfully")
|
|
1107
|
+
} else {
|
|
1108
|
+
Log.w(TAG, "Ringtone is null, cannot play")
|
|
1109
|
+
}
|
|
1094
1110
|
} catch (e: Exception) {
|
|
1095
|
-
Log.e(TAG, "Failed to play ringtone: ${e.message}")
|
|
1111
|
+
Log.e(TAG, "Failed to play ringtone: ${e.message}", e)
|
|
1096
1112
|
}
|
|
1097
1113
|
}
|
|
1098
1114
|
|