Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-android
Commits
47a72044
Commit
47a72044
authored
11 years ago
by
Alexandre Lision
Browse files
Options
Downloads
Patches
Plain Diff
Incoming calls now displayed event if SFLphone is not in the foreground
parent
59daaafd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/org/sflphone/client/CallActivity.java
+30
-48
30 additions, 48 deletions
src/org/sflphone/client/CallActivity.java
src/org/sflphone/receivers/IncomingReceiver.java
+15
-9
15 additions, 9 deletions
src/org/sflphone/receivers/IncomingReceiver.java
with
45 additions
and
57 deletions
src/org/sflphone/client/CallActivity.java
+
30
−
48
View file @
47a72044
...
@@ -78,35 +78,33 @@ import android.view.WindowManager;
...
@@ -78,35 +78,33 @@ import android.view.WindowManager;
public
class
CallActivity
extends
Activity
implements
CallInterface
,
IMFragment
.
Callbacks
,
CallFragment
.
Callbacks
,
ProximityDirector
{
public
class
CallActivity
extends
Activity
implements
CallInterface
,
IMFragment
.
Callbacks
,
CallFragment
.
Callbacks
,
ProximityDirector
{
static
final
String
TAG
=
"CallActivity"
;
static
final
String
TAG
=
"CallActivity"
;
private
ISipService
s
ervice
;
private
ISipService
mS
ervice
;
CallReceiver
r
eceiver
;
CallReceiver
mR
eceiver
;
CallPaneLayout
s
lidingPaneLayout
;
CallPaneLayout
mS
lidingPaneLayout
;
IMFragment
mIMFragment
;
IMFragment
mIMFragment
;
CallFragment
mCurrentCallFragment
;
CallFragment
mCurrentCallFragment
;
// private boolean fragIsChanging;
/* result code sent in case of call failure */
/* result code sent in case of call failure */
public
static
int
RESULT_FAILURE
=
-
10
;
public
static
int
RESULT_FAILURE
=
-
10
;
private
CallProximityManager
mProximityManager
;
private
CallProximityManager
proximityManager
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_call_layout
);
setContentView
(
R
.
layout
.
activity_call_layout
);
r
eceiver
=
new
CallReceiver
(
this
);
mR
eceiver
=
new
CallReceiver
(
this
);
p
roximityManager
=
new
CallProximityManager
(
this
,
this
);
mP
roximityManager
=
new
CallProximityManager
(
this
,
this
);
s
lidingPaneLayout
=
(
CallPaneLayout
)
findViewById
(
R
.
id
.
slidingpanelayout
);
mS
lidingPaneLayout
=
(
CallPaneLayout
)
findViewById
(
R
.
id
.
slidingpanelayout
);
s
lidingPaneLayout
.
setParallaxDistance
(
500
);
mS
lidingPaneLayout
.
setParallaxDistance
(
500
);
s
lidingPaneLayout
.
setSliderFadeColor
(
Color
.
TRANSPARENT
);
mS
lidingPaneLayout
.
setSliderFadeColor
(
Color
.
TRANSPARENT
);
s
lidingPaneLayout
.
setPanelSlideListener
(
new
SlidingPaneLayout
.
PanelSlideListener
()
{
mS
lidingPaneLayout
.
setPanelSlideListener
(
new
SlidingPaneLayout
.
PanelSlideListener
()
{
@Override
@Override
public
void
onPanelSlide
(
View
view
,
float
offSet
)
{
public
void
onPanelSlide
(
View
view
,
float
offSet
)
{
...
@@ -124,7 +122,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -124,7 +122,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
}
}
});
});
p
roximityManager
.
startTracking
();
mP
roximityManager
.
startTracking
();
Intent
intent
=
new
Intent
(
this
,
SipService
.
class
);
Intent
intent
=
new
Intent
(
this
,
SipService
.
class
);
bindService
(
intent
,
mConnection
,
Context
.
BIND_AUTO_CREATE
);
bindService
(
intent
,
mConnection
,
Context
.
BIND_AUTO_CREATE
);
}
}
...
@@ -141,7 +139,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -141,7 +139,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
intentFilter
.
addAction
(
CallManagerCallBack
.
CONF_REMOVED
);
intentFilter
.
addAction
(
CallManagerCallBack
.
CONF_REMOVED
);
intentFilter
.
addAction
(
CallManagerCallBack
.
CONF_CHANGED
);
intentFilter
.
addAction
(
CallManagerCallBack
.
CONF_CHANGED
);
intentFilter
.
addAction
(
CallManagerCallBack
.
RECORD_STATE_CHANGED
);
intentFilter
.
addAction
(
CallManagerCallBack
.
RECORD_STATE_CHANGED
);
registerReceiver
(
r
eceiver
,
intentFilter
);
registerReceiver
(
mR
eceiver
,
intentFilter
);
super
.
onResume
();
super
.
onResume
();
}
}
...
@@ -184,10 +182,10 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -184,10 +182,10 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
unregisterReceiver
(
r
eceiver
);
unregisterReceiver
(
mR
eceiver
);
unbindService
(
mConnection
);
unbindService
(
mConnection
);
p
roximityManager
.
stopTracking
();
mP
roximityManager
.
stopTracking
();
p
roximityManager
.
release
(
0
);
mP
roximityManager
.
release
(
0
);
super
.
onDestroy
();
super
.
onDestroy
();
}
}
...
@@ -195,7 +193,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -195,7 +193,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
private
ServiceConnection
mConnection
=
new
ServiceConnection
()
{
private
ServiceConnection
mConnection
=
new
ServiceConnection
()
{
@Override
@Override
public
void
onServiceConnected
(
ComponentName
className
,
IBinder
binder
)
{
public
void
onServiceConnected
(
ComponentName
className
,
IBinder
binder
)
{
s
ervice
=
ISipService
.
Stub
.
asInterface
(
binder
);
mS
ervice
=
ISipService
.
Stub
.
asInterface
(
binder
);
mCurrentCallFragment
=
new
CallFragment
();
mCurrentCallFragment
=
new
CallFragment
();
mIMFragment
=
new
IMFragment
();
mIMFragment
=
new
IMFragment
();
...
@@ -204,11 +202,11 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -204,11 +202,11 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
if
(
u
!=
null
)
{
if
(
u
!=
null
)
{
CallContact
c
=
CallContact
.
ContactBuilder
.
buildUnknownContact
(
u
.
getSchemeSpecificPart
());
CallContact
c
=
CallContact
.
ContactBuilder
.
buildUnknownContact
(
u
.
getSchemeSpecificPart
());
try
{
try
{
s
ervice
.
destroyNotification
();
mS
ervice
.
destroyNotification
();
String
accountID
=
(
String
)
s
ervice
.
getAccountList
().
get
(
1
);
// We use the first account to place outgoing calls
String
accountID
=
(
String
)
mS
ervice
.
getAccountList
().
get
(
1
);
// We use the first account to place outgoing calls
HashMap
<
String
,
String
>
details
=
(
HashMap
<
String
,
String
>)
s
ervice
.
getAccountDetails
(
accountID
);
HashMap
<
String
,
String
>
details
=
(
HashMap
<
String
,
String
>)
mS
ervice
.
getAccountDetails
(
accountID
);
ArrayList
<
HashMap
<
String
,
String
>>
credentials
=
(
ArrayList
<
HashMap
<
String
,
String
>>)
s
ervice
.
getCredentials
(
accountID
);
ArrayList
<
HashMap
<
String
,
String
>>
credentials
=
(
ArrayList
<
HashMap
<
String
,
String
>>)
mS
ervice
.
getCredentials
(
accountID
);
Account
acc
=
new
Account
(
accountID
,
details
,
credentials
);
Account
acc
=
new
Account
(
accountID
,
details
,
credentials
);
SipCall
call
=
SipCall
.
SipCallBuilder
.
getInstance
().
startCallCreation
().
setContact
(
c
).
setAccount
(
acc
)
SipCall
call
=
SipCall
.
SipCallBuilder
.
getInstance
().
startCallCreation
().
setContact
(
c
).
setAccount
(
acc
)
...
@@ -245,7 +243,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -245,7 +243,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
}
}
s
lidingPaneLayout
.
setCurFragment
(
mCurrentCallFragment
);
mS
lidingPaneLayout
.
setCurFragment
(
mCurrentCallFragment
);
getIntent
().
getExtras
();
getIntent
().
getExtras
();
// mCallsFragment.update();
// mCallsFragment.update();
getFragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
ongoingcall_pane
,
mCurrentCallFragment
).
commit
();
getFragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
ongoingcall_pane
,
mCurrentCallFragment
).
commit
();
...
@@ -267,7 +265,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -267,7 +265,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
mCurrentCallFragment
=
new
CallFragment
();
mCurrentCallFragment
=
new
CallFragment
();
mCurrentCallFragment
.
setArguments
(
b
);
mCurrentCallFragment
.
setArguments
(
b
);
getFragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
ongoingcall_pane
,
mCurrentCallFragment
).
commit
();
getFragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
ongoingcall_pane
,
mCurrentCallFragment
).
commit
();
s
lidingPaneLayout
.
setCurFragment
(
mCurrentCallFragment
);
mS
lidingPaneLayout
.
setCurFragment
(
mCurrentCallFragment
);
}
}
...
@@ -279,27 +277,11 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -279,27 +277,11 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
}
}
@SuppressWarnings
(
"unchecked"
)
// No proper solution with HashMap runtime cast
public
void
processCallStateChangedSignal
(
String
callID
,
String
newState
)
{
public
void
processCallStateChangedSignal
(
String
callID
,
String
newState
)
{
if
(
mCurrentCallFragment
!=
null
)
{
if
(
mCurrentCallFragment
!=
null
)
{
mCurrentCallFragment
.
changeCallState
(
callID
,
newState
);
mCurrentCallFragment
.
changeCallState
(
callID
,
newState
);
}
}
mProximityManager
.
updateProximitySensorMode
();
proximityManager
.
updateProximitySensorMode
();
try
{
HashMap
<
String
,
SipCall
>
callMap
=
(
HashMap
<
String
,
SipCall
>)
service
.
getCallList
();
HashMap
<
String
,
Conference
>
confMap
=
(
HashMap
<
String
,
Conference
>)
service
.
getConferenceList
();
}
catch
(
RemoteException
e
)
{
Log
.
e
(
TAG
,
e
.
toString
());
}
Log
.
w
(
TAG
,
"processCallStateChangedSignal "
+
newState
);
}
}
@Override
@Override
...
@@ -315,7 +297,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -315,7 +297,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
@Override
@Override
public
ISipService
getService
()
{
public
ISipService
getService
()
{
return
s
ervice
;
return
mS
ervice
;
}
}
@Override
@Override
...
@@ -367,7 +349,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -367,7 +349,7 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
public
boolean
sendIM
(
SipMessage
msg
)
{
public
boolean
sendIM
(
SipMessage
msg
)
{
try
{
try
{
s
ervice
.
sendTextMessage
(
mCurrentCallFragment
.
getConference
().
getId
(),
msg
);
mS
ervice
.
sendTextMessage
(
mCurrentCallFragment
.
getConference
().
getId
(),
msg
);
}
catch
(
RemoteException
e
)
{
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
...
@@ -384,9 +366,9 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -384,9 +366,9 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
public
void
onCallSuspended
()
{
public
void
onCallSuspended
()
{
try
{
try
{
if
(
mCurrentCallFragment
.
getConference
().
hasMultipleParticipants
())
{
if
(
mCurrentCallFragment
.
getConference
().
hasMultipleParticipants
())
{
s
ervice
.
holdConference
(
mCurrentCallFragment
.
getConference
().
getId
());
mS
ervice
.
holdConference
(
mCurrentCallFragment
.
getConference
().
getId
());
}
else
{
}
else
{
s
ervice
.
hold
(
mCurrentCallFragment
.
getConference
().
getParticipants
().
get
(
0
).
getCallId
());
mS
ervice
.
hold
(
mCurrentCallFragment
.
getConference
().
getParticipants
().
get
(
0
).
getCallId
());
}
}
}
catch
(
RemoteException
e
)
{
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -396,11 +378,11 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
...
@@ -396,11 +378,11 @@ public class CallActivity extends Activity implements CallInterface, IMFragment.
@Override
@Override
public
void
slideChatScreen
()
{
public
void
slideChatScreen
()
{
if
(
s
lidingPaneLayout
.
isOpen
())
{
if
(
mS
lidingPaneLayout
.
isOpen
())
{
s
lidingPaneLayout
.
closePane
();
mS
lidingPaneLayout
.
closePane
();
}
else
{
}
else
{
mCurrentCallFragment
.
getBubbleView
().
stopThread
();
mCurrentCallFragment
.
getBubbleView
().
stopThread
();
s
lidingPaneLayout
.
openPane
();
mS
lidingPaneLayout
.
openPane
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/org/sflphone/receivers/IncomingReceiver.java
+
15
−
9
View file @
47a72044
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
org.sflphone.client.CallActivity
;
import
org.sflphone.model.Account
;
import
org.sflphone.model.Account
;
import
org.sflphone.model.CallContact
;
import
org.sflphone.model.CallContact
;
import
org.sflphone.model.Conference
;
import
org.sflphone.model.Conference
;
...
@@ -21,7 +22,6 @@ import android.content.Context;
...
@@ -21,7 +22,6 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.RemoteException
;
import
android.os.RemoteException
;
import
android.os.SystemClock
;
import
android.util.Log
;
import
android.util.Log
;
public
class
IncomingReceiver
extends
BroadcastReceiver
{
public
class
IncomingReceiver
extends
BroadcastReceiver
{
...
@@ -80,19 +80,25 @@ public class IncomingReceiver extends BroadcastReceiver {
...
@@ -80,19 +80,25 @@ public class IncomingReceiver extends BroadcastReceiver {
callBuilder
.
setContact
(
CallContact
.
ContactBuilder
.
buildUnknownContact
(
b
.
getString
(
"From"
)));
callBuilder
.
setContact
(
CallContact
.
ContactBuilder
.
buildUnknownContact
(
b
.
getString
(
"From"
)));
Intent
toSend
=
new
Intent
(
CallManagerCallBack
.
INCOMING_CALL
);
Intent
toSend
=
new
Intent
(
CallManagerCallBack
.
INCOMING_CALL
);
toSend
.
setClass
(
callback
,
CallActivity
.
class
);
toSend
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
SipCall
newCall
=
callBuilder
.
build
();
SipCall
newCall
=
callBuilder
.
build
();
toSend
.
putExtra
(
"newcall"
,
newCall
);
toSend
.
putExtra
(
"newcall"
,
newCall
);
HashMap
<
String
,
String
>
callDetails
=
(
HashMap
<
String
,
String
>)
mBinder
.
getCallDetails
(
b
.
getString
(
"CallID"
));
HashMap
<
String
,
String
>
callDetails
=
(
HashMap
<
String
,
String
>)
mBinder
.
getCallDetails
(
b
.
getString
(
"CallID"
));
String
stamp
=
callDetails
.
get
(
ServiceConstants
.
call
.
TIMESTAMP_START
);
newCall
.
setTimestamp_start
(
Long
.
parseLong
(
callDetails
.
get
(
ServiceConstants
.
call
.
TIMESTAMP_START
)));
if
(
stamp
.
length
()
>
0
)
newCall
.
setTimestamp_start
(
Long
.
parseLong
(
stamp
));
else
newCall
.
setTimestamp_start
(
System
.
currentTimeMillis
()
/
1000
);
callback
.
getCurrent_calls
().
put
(
newCall
.
getCallId
(),
newCall
);
callback
.
getCurrent_calls
().
put
(
newCall
.
getCallId
(),
newCall
);
callback
.
sendBroadcast
(
toSend
);
// callback.sendBroadcast(toSend);
Bundle
bundle
=
new
Bundle
();
Conference
tmp
=
new
Conference
(
"-1"
);
tmp
.
getParticipants
().
add
(
newCall
);
bundle
.
putParcelable
(
"conference"
,
tmp
);
toSend
.
putExtra
(
"resuming"
,
false
);
toSend
.
putExtras
(
bundle
);
callback
.
startActivity
(
toSend
);
callback
.
mediaManager
.
obtainAudioFocus
(
true
);
callback
.
mediaManager
.
obtainAudioFocus
(
true
);
}
catch
(
RemoteException
e1
)
{
}
catch
(
RemoteException
e1
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment