@qusaieilouti99/call-manager 0.1.90 → 0.1.92
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.
|
@@ -921,8 +921,44 @@ object CallEngine {
|
|
|
921
921
|
val context = requireContext()
|
|
922
922
|
Log.d(TAG, "Showing incoming call UI for $callId")
|
|
923
923
|
createNotificationChannel()
|
|
924
|
-
val notificationManager =
|
|
925
|
-
|
|
924
|
+
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
925
|
+
|
|
926
|
+
// **CRITICAL**: Use Android's SYSTEM overlay approach for Samsung
|
|
927
|
+
val overlayIntent = Intent(context, CallActivity::class.java).apply {
|
|
928
|
+
addFlags(
|
|
929
|
+
Intent.FLAG_ACTIVITY_NEW_TASK or
|
|
930
|
+
Intent.FLAG_ACTIVITY_CLEAR_TASK or
|
|
931
|
+
Intent.FLAG_ACTIVITY_NO_ANIMATION or
|
|
932
|
+
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS or
|
|
933
|
+
Intent.FLAG_ACTIVITY_MULTIPLE_TASK
|
|
934
|
+
)
|
|
935
|
+
putExtra("callId", callId)
|
|
936
|
+
putExtra("callerName", callerName)
|
|
937
|
+
putExtra("callType", callType)
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// **SAMSUNG SPECIFIC**: Launch immediately via system overlay
|
|
941
|
+
try {
|
|
942
|
+
// First, wake up the screen using PowerManager
|
|
943
|
+
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
|
|
944
|
+
val wakeLock = powerManager.newWakeLock(
|
|
945
|
+
PowerManager.SCREEN_BRIGHT_WAKE_LOCK or PowerManager.ACQUIRE_CAUSES_WAKEUP,
|
|
946
|
+
"CallEngine:IncomingCallWake"
|
|
947
|
+
)
|
|
948
|
+
wakeLock.acquire(5000) // 5 seconds
|
|
949
|
+
|
|
950
|
+
// Then launch the activity
|
|
951
|
+
context.startActivity(overlayIntent)
|
|
952
|
+
Log.d(TAG, "Successfully launched CallActivity with screen wake")
|
|
953
|
+
} catch (e: Exception) {
|
|
954
|
+
Log.e(TAG, "Failed to launch CallActivity: ${e.message}")
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
// Create notification as backup
|
|
958
|
+
val fullScreenPendingIntent = PendingIntent.getActivity(
|
|
959
|
+
context, callId.hashCode(), overlayIntent,
|
|
960
|
+
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
961
|
+
)
|
|
926
962
|
|
|
927
963
|
val answerIntent = Intent(context, CallNotificationActionReceiver::class.java).apply {
|
|
928
964
|
action = "com.qusaieilouti99.callmanager.ANSWER_CALL"
|
|
@@ -942,21 +978,6 @@ object CallEngine {
|
|
|
942
978
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
943
979
|
)
|
|
944
980
|
|
|
945
|
-
// **SAMSUNG FIX**: Enhanced full-screen intent
|
|
946
|
-
val fullScreenIntent = Intent(context, CallActivity::class.java).apply {
|
|
947
|
-
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
948
|
-
putExtra("callId", callId)
|
|
949
|
-
putExtra("callerName", callerName)
|
|
950
|
-
putExtra("callType", callType)
|
|
951
|
-
// **SAMSUNG SPECIFIC**: Add Samsung lock screen bypass flag
|
|
952
|
-
putExtra("SAMSUNG_LOCK_SCREEN_BYPASS", true)
|
|
953
|
-
}
|
|
954
|
-
val fullScreenPendingIntent = PendingIntent.getActivity(
|
|
955
|
-
context, 2, fullScreenIntent,
|
|
956
|
-
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
957
|
-
)
|
|
958
|
-
|
|
959
|
-
// **SAMSUNG FIX**: Enhanced notification
|
|
960
981
|
val notification = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
961
982
|
val person = android.app.Person.Builder()
|
|
962
983
|
.setName(callerName)
|
|
@@ -976,23 +997,20 @@ object CallEngine {
|
|
|
976
997
|
.setAutoCancel(false)
|
|
977
998
|
.setCategory(Notification.CATEGORY_CALL)
|
|
978
999
|
.setPriority(Notification.PRIORITY_MAX)
|
|
979
|
-
// **SAMSUNG SPECIFIC**: Add lock screen visibility
|
|
980
1000
|
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
|
981
|
-
.setPublicVersion(null)
|
|
982
1001
|
.build()
|
|
983
1002
|
} else {
|
|
984
1003
|
Notification.Builder(context, NOTIF_CHANNEL_ID)
|
|
985
1004
|
.setSmallIcon(android.R.drawable.sym_call_incoming)
|
|
986
1005
|
.setContentTitle("Incoming Call")
|
|
987
1006
|
.setContentText(callerName)
|
|
988
|
-
.setPriority(Notification.
|
|
1007
|
+
.setPriority(Notification.PRIORITY_MAX)
|
|
989
1008
|
.setCategory(Notification.CATEGORY_CALL)
|
|
990
1009
|
.setFullScreenIntent(fullScreenPendingIntent, true)
|
|
991
1010
|
.addAction(android.R.drawable.sym_action_call, "Answer", answerPendingIntent)
|
|
992
1011
|
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Decline", declinePendingIntent)
|
|
993
1012
|
.setOngoing(true)
|
|
994
1013
|
.setAutoCancel(false)
|
|
995
|
-
// **SAMSUNG SPECIFIC**: Add lock screen visibility
|
|
996
1014
|
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
|
997
1015
|
.build()
|
|
998
1016
|
}
|