@qusaieilouti99/call-manager 0.1.91 → 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,29 +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
|
-
|
|
947
|
-
// First, wake up the screen using PowerManager
|
|
948
|
-
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
|
|
949
|
-
val wakeLock = powerManager.newWakeLock(
|
|
950
|
-
PowerManager.SCREEN_BRIGHT_WAKE_LOCK or PowerManager.ACQUIRE_CAUSES_WAKEUP,
|
|
951
|
-
"CallEngine:IncomingCallWake"
|
|
952
|
-
)
|
|
953
|
-
wakeLock.acquire(5000) // 5 sec
|
|
954
|
-
val fullScreenIntent = Intent(context, CallActivity::class.java).apply {
|
|
955
|
-
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
956
|
-
putExtra("callId", callId)
|
|
957
|
-
putExtra("callerName", callerName)
|
|
958
|
-
putExtra("callType", callType)
|
|
959
|
-
// **SAMSUNG SPECIFIC**: Add Samsung lock screen bypass flag
|
|
960
|
-
putExtra("SAMSUNG_LOCK_SCREEN_BYPASS", true)
|
|
961
|
-
}
|
|
962
|
-
val fullScreenPendingIntent = PendingIntent.getActivity(
|
|
963
|
-
context, 2, fullScreenIntent,
|
|
964
|
-
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
965
|
-
)
|
|
966
|
-
|
|
967
|
-
// **SAMSUNG FIX**: Enhanced notification
|
|
968
981
|
val notification = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
969
982
|
val person = android.app.Person.Builder()
|
|
970
983
|
.setName(callerName)
|
|
@@ -984,23 +997,20 @@ object CallEngine {
|
|
|
984
997
|
.setAutoCancel(false)
|
|
985
998
|
.setCategory(Notification.CATEGORY_CALL)
|
|
986
999
|
.setPriority(Notification.PRIORITY_MAX)
|
|
987
|
-
// **SAMSUNG SPECIFIC**: Add lock screen visibility
|
|
988
1000
|
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
|
989
|
-
.setPublicVersion(null)
|
|
990
1001
|
.build()
|
|
991
1002
|
} else {
|
|
992
1003
|
Notification.Builder(context, NOTIF_CHANNEL_ID)
|
|
993
1004
|
.setSmallIcon(android.R.drawable.sym_call_incoming)
|
|
994
1005
|
.setContentTitle("Incoming Call")
|
|
995
1006
|
.setContentText(callerName)
|
|
996
|
-
.setPriority(Notification.
|
|
1007
|
+
.setPriority(Notification.PRIORITY_MAX)
|
|
997
1008
|
.setCategory(Notification.CATEGORY_CALL)
|
|
998
1009
|
.setFullScreenIntent(fullScreenPendingIntent, true)
|
|
999
1010
|
.addAction(android.R.drawable.sym_action_call, "Answer", answerPendingIntent)
|
|
1000
1011
|
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Decline", declinePendingIntent)
|
|
1001
1012
|
.setOngoing(true)
|
|
1002
1013
|
.setAutoCancel(false)
|
|
1003
|
-
// **SAMSUNG SPECIFIC**: Add lock screen visibility
|
|
1004
1014
|
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
|
1005
1015
|
.build()
|
|
1006
1016
|
}
|