List of usage examples for android.telecom Connection setOnHold
public final void setOnHold()
From source file:com.android.server.telecom.testapps.TestConnectionService.java
@Override public Connection onCreateOutgoingConnection(PhoneAccountHandle connectionManagerAccount, final ConnectionRequest originalRequest) { final Uri handle = originalRequest.getAddress(); String number = originalRequest.getAddress().getSchemeSpecificPart(); log("call, number: " + number); // Crash on 555-DEAD to test call service crashing. if ("5550340".equals(number)) { throw new RuntimeException("Goodbye, cruel world."); }/* ww w.j a va2 s . co m*/ Bundle extras = originalRequest.getExtras(); String gatewayPackage = extras.getString(TelecomManager.GATEWAY_PROVIDER_PACKAGE); Uri originalHandle = extras.getParcelable(TelecomManager.GATEWAY_ORIGINAL_ADDRESS); log("gateway package [" + gatewayPackage + "], original handle [" + originalHandle + "]"); final TestConnection connection = new TestConnection(false /* isIncoming */); setAddress(connection, handle); // If the number starts with 555, then we handle it ourselves. If not, then we // use a remote connection service. // TODO: Have a special phone number to test the account-picker dialog flow. if (number != null && number.startsWith("555")) { // Normally we would use the original request as is, but for testing purposes, we are // adding ".." to the end of the number to follow its path more easily through the logs. final ConnectionRequest request = new ConnectionRequest(originalRequest.getAccountHandle(), Uri.fromParts(handle.getScheme(), handle.getSchemeSpecificPart() + "..", ""), originalRequest.getExtras(), originalRequest.getVideoState()); connection.setVideoState(originalRequest.getVideoState()); /// M: only VideoCall addVideoProvider @{ if (originalRequest.getVideoState() == VideoProfile.STATE_BIDIRECTIONAL) { addVideoProvider(connection); } /// @} addCall(connection); connection.startOutgoing(); for (Connection c : getAllConnections()) { c.setOnHold(); } } else { log("Not a test number"); } return connection; }