diff options
| author | Xin Li <delphij@google.com> | 2021-10-07 23:50:24 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-10-07 23:50:24 +0000 |
| commit | 4dffc62f2b5462ddcd01051c9b479e8e91055376 (patch) | |
| tree | 80afdab2635af0425aca44dc2df05dd652ebcaa7 /testapps/src/com/android | |
| parent | 66273f82ba3a6097a4189d453df35aac4b1407b5 (diff) | |
| parent | a920c1b1ca4e2a7d34ea0a08fb06b7cca0a3e8fd (diff) | |
| download | platform_packages_services_Telecomm-master.tar.gz platform_packages_services_Telecomm-master.tar.bz2 platform_packages_services_Telecomm-master.zip | |
Diffstat (limited to 'testapps/src/com/android')
3 files changed, 68 insertions, 8 deletions
diff --git a/testapps/src/com/android/server/telecom/testapps/TestCallDiagnosticService.java b/testapps/src/com/android/server/telecom/testapps/TestCallDiagnosticService.java index 73bf43825..e1511e762 100644 --- a/testapps/src/com/android/server/telecom/testapps/TestCallDiagnosticService.java +++ b/testapps/src/com/android/server/telecom/testapps/TestCallDiagnosticService.java @@ -20,7 +20,7 @@ import android.telecom.BluetoothCallQualityReport; import android.telecom.Call; import android.telecom.CallAudioState; import android.telecom.CallDiagnosticService; -import android.telecom.DiagnosticCall; +import android.telecom.CallDiagnostics; import android.telecom.Log; import android.telephony.CallQuality; import android.telephony.ims.ImsReasonInfo; @@ -30,10 +30,10 @@ import androidx.annotation.Nullable; public class TestCallDiagnosticService extends CallDiagnosticService { - public static final class TestDiagnosticCall extends DiagnosticCall { + public static final class TestCallDiagnostics extends CallDiagnostics { public Call.Details details; - TestDiagnosticCall(Call.Details details) { + TestCallDiagnostics(Call.Details details) { this.details = details; } @@ -51,14 +51,14 @@ public class TestCallDiagnosticService extends CallDiagnosticService { @Override public CharSequence onCallDisconnected(int disconnectCause, int preciseDisconnectCause) { Log.i(this, "onCallDisconnected"); - return null; + return "GSM/CDMA call dropped because " + disconnectCause; } @Nullable @Override public CharSequence onCallDisconnected(@NonNull ImsReasonInfo disconnectReason) { Log.i(this, "onCallDisconnected"); - return null; + return "ImsCall dropped because something happened " + disconnectReason.mExtraMessage; } @Override @@ -69,13 +69,13 @@ public class TestCallDiagnosticService extends CallDiagnosticService { @NonNull @Override - public DiagnosticCall onInitializeDiagnosticCall(@NonNull Call.Details call) { + public CallDiagnostics onInitializeCallDiagnostics(@NonNull Call.Details call) { Log.i(this, "onInitiatlizeDiagnosticCall %s", call); - return new TestDiagnosticCall(call); + return new TestCallDiagnostics(call); } @Override - public void onRemoveDiagnosticCall(@NonNull DiagnosticCall call) { + public void onRemoveCallDiagnostics(@NonNull CallDiagnostics call) { Log.i(this, "onRemoveDiagnosticCall %s", call); } diff --git a/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java b/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java index 1e0638733..010d6eeb1 100644 --- a/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java +++ b/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java @@ -9,6 +9,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.location.Location; import android.net.Uri; import android.os.Bundle; import android.os.PersistableBundle; @@ -32,8 +33,18 @@ public class TestDialerActivity extends Activity { private EditText mNumberView; private CheckBox mRttCheckbox; + private CheckBox mComposerCheckbox; private EditText mPriorityView; + private static final String COMPOSER_SUBJECT = "Sample call composer subject"; + private static final Location COMPOSER_LOCATION; + static { + // Area 51 + COMPOSER_LOCATION = new Location(""); + COMPOSER_LOCATION.setLongitude(-115.806407); + COMPOSER_LOCATION.setLatitude(37.236214); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -68,6 +79,7 @@ public class TestDialerActivity extends Activity { mNumberView = (EditText) findViewById(R.id.number); mRttCheckbox = (CheckBox) findViewById(R.id.call_with_rtt_checkbox); + mComposerCheckbox = (CheckBox) findViewById(R.id.add_composer_attachments_checkbox); findViewById(R.id.enable_car_mode).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { @@ -169,6 +181,11 @@ public class TestDialerActivity extends Activity { if (mRttCheckbox.isChecked()) { extras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, true); } + if (mComposerCheckbox.isChecked()) { + extras.putInt(TelecomManager.EXTRA_PRIORITY, TelecomManager.PRIORITY_URGENT); + extras.putParcelable(TelecomManager.EXTRA_LOCATION, COMPOSER_LOCATION); + extras.putString(TelecomManager.EXTRA_CALL_SUBJECT, COMPOSER_SUBJECT); + } Bundle intentExtras = new Bundle(); intentExtras.putBundle(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, extras); diff --git a/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java b/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java index 3f3a2c8f3..bdd4c1a7b 100644 --- a/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java +++ b/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java @@ -21,6 +21,7 @@ import android.bluetooth.BluetoothDevice; import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; +import android.location.Location; import android.os.Bundle; import android.telecom.Call; import android.telecom.CallAudioState; @@ -28,6 +29,7 @@ import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telecom.VideoProfile; +import android.telephony.ims.ImsCallProfile; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; @@ -248,6 +250,47 @@ public class TestInCallUI extends Activity { enableInCallService(); } }); + + // Find the ringing call and populate the composer extras + for (int i = 0; i < TestCallList.getInstance().size(); i++) { + Call call = TestCallList.getInstance().getCall(i); + if (call.getState() == Call.STATE_RINGING) { + int priority = call.getDetails() + .getIntentExtras().getInt(TelecomManager.EXTRA_PRIORITY, -1); + Location location = call.getDetails() + .getIntentExtras().getParcelable(TelecomManager.EXTRA_LOCATION); + String subject = call.getDetails() + .getIntentExtras().getString(TelecomManager.EXTRA_CALL_SUBJECT); + boolean isBusiness = call.getDetails() + .getExtras().getBoolean(ImsCallProfile.EXTRA_IS_BUSINESS_CALL); + + StringBuilder display = new StringBuilder(); + display.append("priority="); + switch (priority) { + case TelecomManager.PRIORITY_NORMAL: + display.append("normal"); + break; + case TelecomManager.PRIORITY_URGENT: + display.append("urgent"); + break; + default: + display.append("unset"); + } + display.append(";"); + if (location != null) { + display.append("lat=" + location.getLatitude()); + display.append("lon=" + location.getLongitude()); + } else { + display.append("loc=null"); + } + + display.append(" subject=" + subject); + display.append(" isBusiness=" + isBusiness); + TextView attachmentsTextView = findViewById(R.id.incoming_composer_attachments); + attachmentsTextView.setText(display.toString()); + break; + } + } } public void updateCallAudioState(CallAudioState cas) { |
