diff options
| author | sqian <shuoq@google.com> | 2018-10-05 18:51:40 -0700 |
|---|---|---|
| committer | Shuo Qian <shuoq@google.com> | 2019-01-17 21:26:46 +0000 |
| commit | e976e68134e125d9876b4fddc0befdfbb75bc19c (patch) | |
| tree | eae6950e6df438bcbb1e611a35a61c2dd0210334 /testapps | |
| parent | dde1c811c806ba1f2e0f63f619f6ffaf6af660f4 (diff) | |
| download | platform_packages_services_Telecomm-e976e68134e125d9876b4fddc0befdfbb75bc19c.tar.gz platform_packages_services_Telecomm-e976e68134e125d9876b4fddc0befdfbb75bc19c.tar.bz2 platform_packages_services_Telecomm-e976e68134e125d9876b4fddc0befdfbb75bc19c.zip | |
User Interaction for Call Redirection service in Telecom
- Show UX if Telecom gets user-defined service's timeout.
When Telecom does not receive a response from user-defined service, Telecom
will cancel the outgoing call.
- Show UX if Telecom gets confirmFirst request from user-defined service's
timeout.
When Telecom's Call Redirection service receives the redirected call
from user's application, it may show an UX to confirm with users if they
want to process with the call.
Design doc: go/telecom-outflow-ux
Bug: 64959558
Test: Treehugger; Manually Telecom test app and see two types of UX
sucessfully show up
Change-Id: Ida0d46967bcaab3e4b621a5e635a0ac04c717033
Diffstat (limited to 'testapps')
3 files changed, 129 insertions, 0 deletions
diff --git a/testapps/AndroidManifest.xml b/testapps/AndroidManifest.xml index 9cb199220..b3ecd2780 100644 --- a/testapps/AndroidManifest.xml +++ b/testapps/AndroidManifest.xml @@ -252,5 +252,19 @@ android:excludeFromRecents="true" android:launchMode="singleInstance"> </activity> + + <service + android:name=".TestCallRedirectionService" + android:permission="android.permission.BIND_CALL_REDIRECTION_SERVICE"> + <intent-filter> + <action android:name="android.telecom.CallRedirectionService"/> + </intent-filter> + </service> + + <activity android:name=".CallRedirectionActivity" + android:configChanges="orientation|screenSize|keyboardHidden" + android:excludeFromRecents="true" + android:launchMode="singleInstance"> + </activity> </application> </manifest> diff --git a/testapps/src/com/android/server/telecom/testapps/CallRedirectionActivity.java b/testapps/src/com/android/server/telecom/testapps/CallRedirectionActivity.java new file mode 100644 index 000000000..044e27141 --- /dev/null +++ b/testapps/src/com/android/server/telecom/testapps/CallRedirectionActivity.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.server.telecom.testapps; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Bundle; +import android.telecom.Log; + +public class CallRedirectionActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Log.i(this, "onCreate: CallRedirectionActivity"); + + AlertDialog alertDialog = new AlertDialog.Builder(this) + .setTitle("Test Call Redirection") + .setMessage("Decision for call redirection?") + .setNegativeButton("Timeout", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // No action is needed for timeout + finish(); + } + }) + .setPositiveButton("Redirect and confirm", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (TestCallRedirectionService.getInstance() != null) { + TestCallRedirectionService.getInstance().tryRedirectCallAndAskToConfirm(); + } + finish(); + } + }).create(); + alertDialog.show(); + } +}
\ No newline at end of file diff --git a/testapps/src/com/android/server/telecom/testapps/TestCallRedirectionService.java b/testapps/src/com/android/server/telecom/testapps/TestCallRedirectionService.java new file mode 100644 index 000000000..b7a033c70 --- /dev/null +++ b/testapps/src/com/android/server/telecom/testapps/TestCallRedirectionService.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.server.telecom.testapps; + +import android.annotation.NonNull; +import android.content.ComponentName; +import android.content.Intent; +import android.net.Uri; +import android.telecom.CallRedirectionService; +import android.telecom.Log; +import android.telecom.PhoneAccount; +import android.telecom.PhoneAccountHandle; + +public class TestCallRedirectionService extends CallRedirectionService { + + public static TestCallRedirectionService getInstance() { + return sTestCallRedirectionService; + } + + private static TestCallRedirectionService sTestCallRedirectionService; + + private static final Uri SAMPLE_HANDLE = Uri.fromParts(PhoneAccount.SCHEME_TEL, "0001112222", + null); + + private static final PhoneAccountHandle SAMPLE_PHONE_ACCOUNT = new PhoneAccountHandle( + new ComponentName("com.android.server.telecom.testapps", + "com.android.server.telecom.testapps.TestCallRedirectionService"), + "TELECOM_TEST_APP_PHONE_ACCOUNT_ID"); + + /** + * Handles request from the system to redirect an outgoing call. + */ + @Override + public void onPlaceCall(@NonNull Uri handle, @NonNull PhoneAccountHandle initialPhoneAccount, + boolean allowInteractiveResponse) { + Log.i(this, "onPlaceCall: received call %s", handle); + sTestCallRedirectionService = this; + + Intent intent = new Intent(this, CallRedirectionActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + + public void tryRedirectCallAndAskToConfirm() { + // Provide call identification + redirectCall(SAMPLE_HANDLE, SAMPLE_PHONE_ACCOUNT, true); + } +} |
