Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to get phone account if self managed when creating a connection #685

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/src/main/java/io/wazo/callkeep/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class Constants {
public static final String EXTRA_CALL_UUID = "EXTRA_CALL_UUID";
public static final String EXTRA_CALLER_NAME = "EXTRA_CALLER_NAME";
public static final String EXTRA_HAS_VIDEO = "EXTRA_HAS_VIDEO";
public static final String EXTRA_SELF_MANAGED = "EXTRA_SELF_MANAGED";
// Can't use telecom.EXTRA_DISABLE_ADD_CALL ...
public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL";

Expand Down
2 changes: 2 additions & 0 deletions android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import static io.wazo.callkeep.Constants.EXTRA_CALL_UUID;
import static io.wazo.callkeep.Constants.EXTRA_CALL_NUMBER;
import static io.wazo.callkeep.Constants.EXTRA_HAS_VIDEO;
import static io.wazo.callkeep.Constants.EXTRA_SELF_MANAGED;
import static io.wazo.callkeep.Constants.ACTION_END_CALL;
import static io.wazo.callkeep.Constants.ACTION_ANSWER_CALL;
import static io.wazo.callkeep.Constants.ACTION_MUTE_CALL;
Expand Down Expand Up @@ -370,6 +371,7 @@ public void startCall(String uuid, String number, String callerName, boolean has
callExtras.putString(EXTRA_CALL_UUID, uuid);
callExtras.putString(EXTRA_CALL_NUMBER, number);
callExtras.putString(EXTRA_HAS_VIDEO, String.valueOf(hasVideo));
callExtras.putString(EXTRA_SELF_MANAGED, String.valueOf(isSelfManaged()));

extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, handle);
extras.putParcelable(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, callExtras);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import static io.wazo.callkeep.Constants.EXTRA_CALL_NUMBER;
import static io.wazo.callkeep.Constants.EXTRA_CALL_NUMBER_SCHEMA;
import static io.wazo.callkeep.Constants.EXTRA_CALL_UUID;
import static io.wazo.callkeep.Constants.EXTRA_SELF_MANAGED;
import static io.wazo.callkeep.Constants.EXTRA_DISABLE_ADD_CALL;
import static io.wazo.callkeep.Constants.FOREGROUND_SERVICE_TYPE_MICROPHONE;
import static io.wazo.callkeep.Constants.ACTION_ON_CREATE_CONNECTION_FAILED;
Expand Down Expand Up @@ -448,7 +449,10 @@ private Connection createConnection(ConnectionRequest request) {
VoiceConnection connection = new VoiceConnection(this, extrasMap);
connection.setConnectionCapabilities(Connection.CAPABILITY_MUTE | Connection.CAPABILITY_SUPPORT_HOLD);

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Boolean.parseBoolean(extras.getString(EXTRA_SELF_MANAGED))) {
Log.d(TAG, "[VoiceConnectionService] self managed is enabled in setup, so connection will be too");
connection.setConnectionProperties(Connection.PROPERTY_SELF_MANAGED);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Context context = getApplicationContext();
TelecomManager telecomManager = (TelecomManager) context.getSystemService(context.TELECOM_SERVICE);
PhoneAccount phoneAccount = telecomManager.getPhoneAccount(request.getAccountHandle());
Expand Down