add possibility to completly disable outcall call brodcast receiver
This commit is contained in:
parent
db1b07b363
commit
5ad011c380
7 changed files with 26 additions and 11 deletions
|
@ -106,10 +106,10 @@
|
|||
<intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name="OutgoingCallReceiver" >
|
||||
<!-- receiver android:name="OutgoingCallReceiver" >
|
||||
<intent-filter android:priority="0"><action android:name="android.intent.action.NEW_OUTGOING_CALL"></action>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</receiver-->
|
||||
<receiver android:name="BootReceiver" >
|
||||
<intent-filter><action android:name="android.intent.action.BOOT_COMPLETED"></action>
|
||||
</intent-filter>
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -37,7 +37,7 @@
|
|||
<string name="pref_ilbc_summary">iLBC might be unavailable depending on ARM processor and Android OS version.</string>
|
||||
<string name="pref_echo_cancellation">Echo cancellation</string>
|
||||
<string name="pref_echo_cancellation_key">pref_echo_cancellation_key</string>
|
||||
<string name="pref_handle_outcall_summarry">If set cellular calls are redirected to voip when possible</string>
|
||||
<string name="pref_handle_outcall_summarry">Configure how cellular calls are redirected to voip when possible</string>
|
||||
<string name="pref_handle_outcall">Redirect cellular calls</string>
|
||||
<string name="pref_handle_outcall_key">pref_handle_outcall_key</string>
|
||||
<string name="pref_autostart">Start at boot time</string>
|
||||
|
@ -109,4 +109,10 @@
|
|||
<string name="ec_calibrating">Calibrating...</string>
|
||||
<string name="ec_calibrated">Calibrated [%s ms]</string>
|
||||
<string name="failed">failed</string>
|
||||
|
||||
<string-array name="pref_handle_outcall_values">
|
||||
<item>Off</item>
|
||||
<item>On demand</item>
|
||||
<item>Always</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
<CheckBoxPreference android:defaultValue="true"
|
||||
android:title="@string/pref_video_enable_title" android:key="@string/pref_video_enable_key" />
|
||||
|
||||
<CheckBoxPreference android:title="@string/pref_handle_outcall"
|
||||
android:key="@string/pref_handle_outcall_key" android:summary="@string/pref_handle_outcall_summarry"></CheckBoxPreference>
|
||||
|
||||
|
||||
<EditTextPreference android:title="@string/pref_stun_server"
|
||||
android:key="@string/pref_stun_server_key"></EditTextPreference>
|
||||
</PreferenceCategory>
|
||||
<ListPreference android:key="@string/pref_handle_outcall_key" android:title="@string/pref_handle_outcall" android:summary="@string/pref_handle_outcall_summarry" android:entryValues="@array/pref_handle_outcall_keys" android:entries="@array/pref_handle_outcall_values" android:defaultValue="ask_for_outcall_interception"></ListPreference>
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -91,7 +91,8 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
LinphoneCall.State mCurrentCallState;
|
||||
Vibrator mVibrator;
|
||||
private AudioManager mAudioManager;
|
||||
private BroadcastReceiver mReceiver = new KeepAliveManager();
|
||||
private BroadcastReceiver mKeepAliveMgrReceiver = new KeepAliveManager();
|
||||
private BroadcastReceiver mOutgoingCallReceiver = new OutgoingCallReceiver();
|
||||
|
||||
private Handler mHandler = new Handler() ;
|
||||
static boolean isready() {
|
||||
|
@ -153,8 +154,13 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
mTimer.scheduleAtFixedRate(lTask, 0, 100);
|
||||
IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
registerReceiver(mReceiver, lFilter);
|
||||
|
||||
registerReceiver(mKeepAliveMgrReceiver, lFilter);
|
||||
if (!mPref.getString(getString(R.string.pref_handle_outcall_key), OutgoingCallReceiver.key_on_demand).equalsIgnoreCase(OutgoingCallReceiver.key_off)){
|
||||
lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||
lFilter.setPriority(0);
|
||||
lFilter.addAction(Intent.ACTION_NEW_OUTGOING_CALL);
|
||||
registerReceiver(mOutgoingCallReceiver,lFilter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -459,7 +465,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
mLinphoneCore.destroy();
|
||||
theLinphone=null;
|
||||
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||
unregisterReceiver(mReceiver);
|
||||
unregisterReceiver(mKeepAliveMgrReceiver);
|
||||
}
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
|
||||
String url) {
|
||||
|
|
|
@ -27,6 +27,9 @@ import android.preference.PreferenceManager;
|
|||
|
||||
public class OutgoingCallReceiver extends BroadcastReceiver {
|
||||
public static String TAG = ";0000000";
|
||||
public static String key_off="off";
|
||||
public static String key_on_demand="ask_for_outcall_interception";
|
||||
public static String key_always="alway_intercept_out_call";
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String to = intent.getStringExtra("android.intent.extra.PHONE_NUMBER");
|
||||
|
@ -41,7 +44,7 @@ public class OutgoingCallReceiver extends BroadcastReceiver {
|
|||
setResult(Activity.RESULT_OK,null, null);
|
||||
Intent lIntent = new Intent();
|
||||
// 1 check config
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.pref_handle_outcall_key), false)) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context).getString(context.getString(R.string.pref_handle_outcall_key),key_on_demand).equals(key_always)) {
|
||||
//start linphone directly
|
||||
lIntent.setClass(context, LinphoneActivity.class);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue