Merge "Add Telecom debug menu." am: 0b67276913
am: 0cabc15257
Change-Id: I840631eb8138141b77d07723cf7b5a869c714f0f
diff --git a/Android.mk b/Android.mk
index 5b483c4..4e5eeff 100644
--- a/Android.mk
+++ b/Android.mk
@@ -7,6 +7,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-proto-files-under, proto)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_USE_AAPT2 := true
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/proto/
diff --git a/proguard.flags b/proguard.flags
index 7c71a15..7ecfc3f 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -9,3 +9,21 @@
-keep class android.telecom.Log {
*;
}
+
+# Keep classes, annotations and members used by Lifecycle. Remove this once aapt2 is enabled
+-keepattributes *Annotation*
+
+-keepclassmembers enum android.arch.lifecycle.Lifecycle$Event {
+ <fields>;
+}
+
+-keep class * implements android.arch.lifecycle.LifecycleObserver {
+}
+
+-keep class * implements android.arch.lifecycle.GeneratedAdapter {
+ <init>(...);
+}
+
+-keepclassmembers class ** {
+ @android.arch.lifecycle.OnLifecycleEvent *;
+}
diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml
index ab49bfb..9684b94 100644
--- a/res/values-ar/strings.xml
+++ b/res/values-ar/strings.xml
@@ -50,7 +50,7 @@
<string name="change_default_dialer_dialog_negative" msgid="9078144617060173845">"إلغاء"</string>
<string name="change_default_dialer_warning_message" msgid="1417671460801684999">"سيتمكن <xliff:g id="NEW_APP">%s</xliff:g> من إجراء المكالمات والتحكم في كل جوانبها. يمكن فقط تعيين التطبيقات التي تثق بها باعتبارها تطبيق الهاتف الافتراضي."</string>
<string name="blocked_numbers" msgid="2751843139572970579">"الأرقام المحظورة"</string>
- <string name="blocked_numbers_msg" msgid="1045015186124965643">"لن تتلقى المكالمات أو المراسلات النصية من الأرقام المحظورة."</string>
+ <string name="blocked_numbers_msg" msgid="1045015186124965643">"لن تتلقى أي مكالمات أو مراسلات نصية من الأرقام المحظورة."</string>
<string name="block_number" msgid="1101252256321306179">"إضافة رقم"</string>
<string name="unblock_dialog_body" msgid="1614238499771862793">"هل تريد إلغاء حظر <xliff:g id="NUMBER_TO_BLOCK">%1$s</xliff:g>؟"</string>
<string name="unblock_button" msgid="3078048901972674170">"إلغاء الحظر"</string>
diff --git a/res/values-bs/strings.xml b/res/values-bs/strings.xml
index 63bccaa..569e738 100644
--- a/res/values-bs/strings.xml
+++ b/res/values-bs/strings.xml
@@ -39,7 +39,7 @@
<string name="respond_via_sms_confirmation_format" msgid="7229149977515784269">"Poruka poslana na <xliff:g id="PHONE_NUMBER">%s</xliff:g>."</string>
<string name="enable_account_preference_title" msgid="2021848090086481720">"Računi za pozivanje"</string>
<string name="outgoing_call_not_allowed_user_restriction" msgid="6872406278300131364">"Dozvoljeni su samo hitni pozivi."</string>
- <string name="outgoing_call_not_allowed_no_permission" msgid="1996571596464271228">"Ova aplikacija ne može upućivati odlazne pozive bez dozvole za Telefon."</string>
+ <string name="outgoing_call_not_allowed_no_permission" msgid="1996571596464271228">"Ova aplikacija ne može upućivati odlazne pozive bez odobrenja za Telefon."</string>
<string name="outgoing_call_error_no_phone_number_supplied" msgid="1940125199802007505">"Da uputite poziv, upišite važeći broj."</string>
<string name="duplicate_video_call_not_allowed" msgid="3749211605014548386">"Trenutno nije moguće dodati poziv."</string>
<string name="no_vm_number" msgid="4164780423805688336">"Nedostaje broj govorne pošte"</string>
@@ -68,13 +68,13 @@
<string name="blocked_numbers_number_already_blocked_message" msgid="4392247814500811798">"<xliff:g id="BLOCKED_NUMBER">%1$s</xliff:g> je već blokiran."</string>
<string name="toast_personal_call_msg" msgid="5115361633476779723">"Za upućivanje poziva koristi se lična brojčana tastatura"</string>
<string name="notification_incoming_call" msgid="7713197997773986670">"<xliff:g id="CALL_VIA">%1$s</xliff:g> poziv od osobe <xliff:g id="CALL_FROM">%2$s</xliff:g>"</string>
- <string name="notification_incoming_video_call" msgid="6638486071698373893">"<xliff:g id="CALL_VIA">%1$s</xliff:g> videopoziv od osobe <xliff:g id="CALL_FROM">%2$s</xliff:g>"</string>
+ <string name="notification_incoming_video_call" msgid="6638486071698373893">"<xliff:g id="CALL_VIA">%1$s</xliff:g> video poziv od osobe <xliff:g id="CALL_FROM">%2$s</xliff:g>"</string>
<string name="answering_ends_other_call" msgid="8282145910153766401">"Odgovaranje će prekinuti poziv: <xliff:g id="CALL_VIA">%1$s</xliff:g>"</string>
<string name="answering_ends_other_calls" msgid="1198589551399049197">"Odgovaranje će prekinuti pozive: <xliff:g id="CALL_VIA">%1$s</xliff:g>"</string>
- <string name="answering_ends_other_video_call" msgid="8510410917384186360">"Odgovaranje će prekinuti videopoziv: <xliff:g id="CALL_VIA">%1$s</xliff:g>"</string>
+ <string name="answering_ends_other_video_call" msgid="8510410917384186360">"Odgovaranje će prekinuti video poziv: <xliff:g id="CALL_VIA">%1$s</xliff:g>"</string>
<string name="answering_ends_other_managed_call" msgid="5186137550267947785">"Odgovaranje će prekinuti poziv koji je u toku"</string>
<string name="answering_ends_other_managed_calls" msgid="6429838309560397988">"Odgovaranje će prekinuti pozive koji su u toku"</string>
- <string name="answering_ends_other_managed_video_call" msgid="1585423762458248435">"Odgovaranje će prekinuti videopoziv koji je u toku"</string>
+ <string name="answering_ends_other_managed_video_call" msgid="1585423762458248435">"Odgovaranje će prekinuti video poziv koji je u toku"</string>
<string name="answer_incoming_call" msgid="4140530013111794587">"Odgovori"</string>
<string name="decline_incoming_call" msgid="806026168661598368">"Odbij"</string>
<string name="cant_call_due_to_ongoing_call" msgid="4952615196237854748">"Pozivanje nije moguće zbog poziva: <xliff:g id="OTHER_CALL">%1$s</xliff:g>."</string>
diff --git a/res/values-en-rCA/strings.xml b/res/values-en-rCA/strings.xml
new file mode 100644
index 0000000..7d344f1
--- /dev/null
+++ b/res/values-en-rCA/strings.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2013 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.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="telecommAppLabel" product="default" msgid="382363169988504520">"Call Management"</string>
+ <string name="userCallActivityLabel" product="default" msgid="5415173590855187131">"Phone"</string>
+ <string name="unknown" msgid="6878797917991465859">"Unknown"</string>
+ <string name="notification_missedCallTitle" msgid="7554385905572364535">"Missed call"</string>
+ <string name="notification_missedWorkCallTitle" msgid="6242489980390803090">"Missed work call"</string>
+ <string name="notification_missedCallsTitle" msgid="1361677948941502522">"Missed calls"</string>
+ <string name="notification_missedCallsMsg" msgid="4575787816055205600">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> missed calls"</string>
+ <string name="notification_missedCallTicker" msgid="504686252427747209">"Missed call from <xliff:g id="MISSED_CALL_FROM">%s</xliff:g>"</string>
+ <string name="notification_missedCall_call_back" msgid="2684890353590890187">"Call back"</string>
+ <string name="notification_missedCall_message" msgid="3049928912736917988">"Message"</string>
+ <string name="accessibility_call_muted" msgid="2776111226185342220">"Call muted."</string>
+ <string name="accessibility_speakerphone_enabled" msgid="1988512040421036359">"Speakerphone enabled."</string>
+ <string name="respond_via_sms_canned_response_1" msgid="2461606462788380215">"Can\'t talk now. What\'s up?"</string>
+ <string name="respond_via_sms_canned_response_2" msgid="4074450431532859214">"I\'ll call you right back."</string>
+ <string name="respond_via_sms_canned_response_3" msgid="3496079065723960450">"I\'ll call you later."</string>
+ <string name="respond_via_sms_canned_response_4" msgid="1698989243040062190">"Can\'t talk now. Call me later?"</string>
+ <string name="respond_via_sms_setting_title" msgid="3754000371039709383">"Quick responses"</string>
+ <string name="respond_via_sms_setting_title_2" msgid="6104662227299493906">"Edit quick responses"</string>
+ <string name="respond_via_sms_setting_summary" msgid="9150281183930613065"></string>
+ <string name="respond_via_sms_edittext_dialog_title" msgid="20379890418289778">"Quick response"</string>
+ <string name="respond_via_sms_confirmation_format" msgid="7229149977515784269">"Message sent to <xliff:g id="PHONE_NUMBER">%s</xliff:g>."</string>
+ <string name="enable_account_preference_title" msgid="2021848090086481720">"Calling accounts"</string>
+ <string name="outgoing_call_not_allowed_user_restriction" msgid="6872406278300131364">"Only emergency calls are allowed."</string>
+ <string name="outgoing_call_not_allowed_no_permission" msgid="1996571596464271228">"This application cannot make outgoing calls without Phone permission."</string>
+ <string name="outgoing_call_error_no_phone_number_supplied" msgid="1940125199802007505">"To place a call, enter a valid number."</string>
+ <string name="duplicate_video_call_not_allowed" msgid="3749211605014548386">"Call cannot be added at this time."</string>
+ <string name="no_vm_number" msgid="4164780423805688336">"Missing voicemail number"</string>
+ <string name="no_vm_number_msg" msgid="1300729501030053828">"No voicemail number is stored on the SIM card."</string>
+ <string name="add_vm_number_str" msgid="4676479471644687453">"Add number"</string>
+ <string name="change_default_dialer_dialog_title" msgid="9101655962941740507">"Make <xliff:g id="NEW_APP">%s</xliff:g> your default Phone app?"</string>
+ <string name="change_default_dialer_dialog_affirmative" msgid="8606546663509166276">"Set Default"</string>
+ <string name="change_default_dialer_dialog_negative" msgid="9078144617060173845">"Cancel"</string>
+ <string name="change_default_dialer_warning_message" msgid="1417671460801684999">"<xliff:g id="NEW_APP">%s</xliff:g> will be able to place and control all aspects of calls. Only apps that you trust should be set as the default Phone app."</string>
+ <string name="blocked_numbers" msgid="2751843139572970579">"Blocked numbers"</string>
+ <string name="blocked_numbers_msg" msgid="1045015186124965643">"You won\'t receive calls or texts from blocked numbers."</string>
+ <string name="block_number" msgid="1101252256321306179">"Add a number"</string>
+ <string name="unblock_dialog_body" msgid="1614238499771862793">"Unblock <xliff:g id="NUMBER_TO_BLOCK">%1$s</xliff:g>?"</string>
+ <string name="unblock_button" msgid="3078048901972674170">"Unblock"</string>
+ <string name="add_blocked_dialog_body" msgid="9030243212265516828">"Block calls and texts from"</string>
+ <string name="add_blocked_number_hint" msgid="6847675097085433553">"Phone number"</string>
+ <string name="block_button" msgid="8822290682524373357">"Block"</string>
+ <string name="non_primary_user" msgid="5180129233352533459">"Only the device owner can view and manage blocked numbers."</string>
+ <string name="delete_icon_description" msgid="8903995728252556724">"Unblock"</string>
+ <string name="blocked_numbers_butter_bar_title" msgid="438170866438793182">"Blocking temporarily off"</string>
+ <string name="blocked_numbers_butter_bar_body" msgid="2223244484319442431">"When you dial or text an emergency number, blocking is turned off to ensure that emergency services can contact you."</string>
+ <string name="blocked_numbers_butter_bar_button" msgid="2197943354922010696">"Re-enable now"</string>
+ <string name="blocked_numbers_number_blocked_message" msgid="7678509606805029540">"<xliff:g id="BLOCKED_NUMBER">%1$s</xliff:g> blocked"</string>
+ <string name="blocked_numbers_number_unblocked_message" msgid="977894647366750418">"<xliff:g id="UNBLOCKED_NUMBER">%1$s</xliff:g> unblocked"</string>
+ <string name="blocked_numbers_block_emergency_number_message" msgid="917851876780698387">"Unable to block emergency number."</string>
+ <string name="blocked_numbers_number_already_blocked_message" msgid="4392247814500811798">"<xliff:g id="BLOCKED_NUMBER">%1$s</xliff:g> is already blocked."</string>
+ <string name="toast_personal_call_msg" msgid="5115361633476779723">"Using the personal dialler to make the call"</string>
+ <string name="notification_incoming_call" msgid="7713197997773986670">"<xliff:g id="CALL_VIA">%1$s</xliff:g> call from <xliff:g id="CALL_FROM">%2$s</xliff:g>"</string>
+ <string name="notification_incoming_video_call" msgid="6638486071698373893">"<xliff:g id="CALL_VIA">%1$s</xliff:g> video call from <xliff:g id="CALL_FROM">%2$s</xliff:g>"</string>
+ <string name="answering_ends_other_call" msgid="8282145910153766401">"Answering will end your <xliff:g id="CALL_VIA">%1$s</xliff:g> call"</string>
+ <string name="answering_ends_other_calls" msgid="1198589551399049197">"Answering will end your <xliff:g id="CALL_VIA">%1$s</xliff:g> calls"</string>
+ <string name="answering_ends_other_video_call" msgid="8510410917384186360">"Answering will end your <xliff:g id="CALL_VIA">%1$s</xliff:g> video call"</string>
+ <string name="answering_ends_other_managed_call" msgid="5186137550267947785">"Answering will end your ongoing call"</string>
+ <string name="answering_ends_other_managed_calls" msgid="6429838309560397988">"Answering will end your ongoing calls"</string>
+ <string name="answering_ends_other_managed_video_call" msgid="1585423762458248435">"Answering will end your ongoing video call"</string>
+ <string name="answer_incoming_call" msgid="4140530013111794587">"Answer"</string>
+ <string name="decline_incoming_call" msgid="806026168661598368">"Decline"</string>
+ <string name="cant_call_due_to_ongoing_call" msgid="4952615196237854748">"Call cannot be placed due to your <xliff:g id="OTHER_CALL">%1$s</xliff:g> call."</string>
+ <string name="cant_call_due_to_ongoing_calls" msgid="1380804892363503856">"Call cannot be placed due to your <xliff:g id="OTHER_CALL">%1$s</xliff:g> calls."</string>
+ <string name="cant_call_due_to_ongoing_unknown_call" msgid="149091978697302211">"Call cannot be placed due to a call in another app."</string>
+ <string name="notification_channel_incoming_call" msgid="3513761697082968084">"Incoming calls"</string>
+ <string name="notification_channel_missed_call" msgid="8727062678632713146">"Missed calls"</string>
+ <string name="alert_outgoing_call" msgid="982908156825958001">"Placing this call will end your <xliff:g id="OTHER_APP">%1$s</xliff:g> call."</string>
+</resources>
diff --git a/res/values-en-rXC/strings.xml b/res/values-en-rXC/strings.xml
new file mode 100644
index 0000000..26daa02
--- /dev/null
+++ b/res/values-en-rXC/strings.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2013 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.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="telecommAppLabel" product="default" msgid="382363169988504520">"Call Management"</string>
+ <string name="userCallActivityLabel" product="default" msgid="5415173590855187131">"Phone"</string>
+ <string name="unknown" msgid="6878797917991465859">"Unknown"</string>
+ <string name="notification_missedCallTitle" msgid="7554385905572364535">"Missed call"</string>
+ <string name="notification_missedWorkCallTitle" msgid="6242489980390803090">"Missed work call"</string>
+ <string name="notification_missedCallsTitle" msgid="1361677948941502522">"Missed calls"</string>
+ <string name="notification_missedCallsMsg" msgid="4575787816055205600">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> missed calls"</string>
+ <string name="notification_missedCallTicker" msgid="504686252427747209">"Missed call from <xliff:g id="MISSED_CALL_FROM">%s</xliff:g>"</string>
+ <string name="notification_missedCall_call_back" msgid="2684890353590890187">"Call back"</string>
+ <string name="notification_missedCall_message" msgid="3049928912736917988">"Message"</string>
+ <string name="accessibility_call_muted" msgid="2776111226185342220">"Call muted."</string>
+ <string name="accessibility_speakerphone_enabled" msgid="1988512040421036359">"Speakerphone enabled."</string>
+ <string name="respond_via_sms_canned_response_1" msgid="2461606462788380215">"Can\'t talk now. What\'s up?"</string>
+ <string name="respond_via_sms_canned_response_2" msgid="4074450431532859214">"I\'ll call you right back."</string>
+ <string name="respond_via_sms_canned_response_3" msgid="3496079065723960450">"I\'ll call you later."</string>
+ <string name="respond_via_sms_canned_response_4" msgid="1698989243040062190">"Can\'t talk now. Call me later?"</string>
+ <string name="respond_via_sms_setting_title" msgid="3754000371039709383">"Quick responses"</string>
+ <string name="respond_via_sms_setting_title_2" msgid="6104662227299493906">"Edit quick responses"</string>
+ <string name="respond_via_sms_setting_summary" msgid="9150281183930613065"></string>
+ <string name="respond_via_sms_edittext_dialog_title" msgid="20379890418289778">"Quick response"</string>
+ <string name="respond_via_sms_confirmation_format" msgid="7229149977515784269">"Message sent to <xliff:g id="PHONE_NUMBER">%s</xliff:g>."</string>
+ <string name="enable_account_preference_title" msgid="2021848090086481720">"Calling accounts"</string>
+ <string name="outgoing_call_not_allowed_user_restriction" msgid="6872406278300131364">"Only emergency calls are allowed."</string>
+ <string name="outgoing_call_not_allowed_no_permission" msgid="1996571596464271228">"This application cannot make outgoing calls without the Phone permission."</string>
+ <string name="outgoing_call_error_no_phone_number_supplied" msgid="1940125199802007505">"To place a call, enter a valid number."</string>
+ <string name="duplicate_video_call_not_allowed" msgid="3749211605014548386">"Call cannot be added at this time."</string>
+ <string name="no_vm_number" msgid="4164780423805688336">"Missing voicemail number"</string>
+ <string name="no_vm_number_msg" msgid="1300729501030053828">"No voicemail number is stored on the SIM card."</string>
+ <string name="add_vm_number_str" msgid="4676479471644687453">"Add number"</string>
+ <string name="change_default_dialer_dialog_title" msgid="9101655962941740507">"Make <xliff:g id="NEW_APP">%s</xliff:g> your default Phone app?"</string>
+ <string name="change_default_dialer_dialog_affirmative" msgid="8606546663509166276">"Set Default"</string>
+ <string name="change_default_dialer_dialog_negative" msgid="9078144617060173845">"Cancel"</string>
+ <string name="change_default_dialer_warning_message" msgid="1417671460801684999">"<xliff:g id="NEW_APP">%s</xliff:g> will be able to place and control all aspects of calls. Only apps you trust should be set as the default Phone app."</string>
+ <string name="blocked_numbers" msgid="2751843139572970579">"Blocked numbers"</string>
+ <string name="blocked_numbers_msg" msgid="1045015186124965643">"You won\'t receive calls or texts from blocked numbers."</string>
+ <string name="block_number" msgid="1101252256321306179">"Add a number"</string>
+ <string name="unblock_dialog_body" msgid="1614238499771862793">"Unblock <xliff:g id="NUMBER_TO_BLOCK">%1$s</xliff:g>?"</string>
+ <string name="unblock_button" msgid="3078048901972674170">"Unblock"</string>
+ <string name="add_blocked_dialog_body" msgid="9030243212265516828">"Block calls and texts from"</string>
+ <string name="add_blocked_number_hint" msgid="6847675097085433553">"Phone number"</string>
+ <string name="block_button" msgid="8822290682524373357">"Block"</string>
+ <string name="non_primary_user" msgid="5180129233352533459">"Only the device owner can view and manage blocked numbers."</string>
+ <string name="delete_icon_description" msgid="8903995728252556724">"Unblock"</string>
+ <string name="blocked_numbers_butter_bar_title" msgid="438170866438793182">"Blocking temporarily off"</string>
+ <string name="blocked_numbers_butter_bar_body" msgid="2223244484319442431">"After you dial or text an emergency number, blocking is turned off to ensure that emergency services can contact you."</string>
+ <string name="blocked_numbers_butter_bar_button" msgid="2197943354922010696">"Re-enable now"</string>
+ <string name="blocked_numbers_number_blocked_message" msgid="7678509606805029540">"<xliff:g id="BLOCKED_NUMBER">%1$s</xliff:g> blocked"</string>
+ <string name="blocked_numbers_number_unblocked_message" msgid="977894647366750418">"<xliff:g id="UNBLOCKED_NUMBER">%1$s</xliff:g> unblocked"</string>
+ <string name="blocked_numbers_block_emergency_number_message" msgid="917851876780698387">"Unable to block emergency number."</string>
+ <string name="blocked_numbers_number_already_blocked_message" msgid="4392247814500811798">"<xliff:g id="BLOCKED_NUMBER">%1$s</xliff:g> is already blocked."</string>
+ <string name="toast_personal_call_msg" msgid="5115361633476779723">"Using the personal dialer to make the call"</string>
+ <string name="notification_incoming_call" msgid="7713197997773986670">"<xliff:g id="CALL_VIA">%1$s</xliff:g> call from <xliff:g id="CALL_FROM">%2$s</xliff:g>"</string>
+ <string name="notification_incoming_video_call" msgid="6638486071698373893">"<xliff:g id="CALL_VIA">%1$s</xliff:g> video call from <xliff:g id="CALL_FROM">%2$s</xliff:g>"</string>
+ <string name="answering_ends_other_call" msgid="8282145910153766401">"Answering will end your <xliff:g id="CALL_VIA">%1$s</xliff:g> call"</string>
+ <string name="answering_ends_other_calls" msgid="1198589551399049197">"Answering will end your <xliff:g id="CALL_VIA">%1$s</xliff:g> calls"</string>
+ <string name="answering_ends_other_video_call" msgid="8510410917384186360">"Answering will end your <xliff:g id="CALL_VIA">%1$s</xliff:g> video call"</string>
+ <string name="answering_ends_other_managed_call" msgid="5186137550267947785">"Answering will end your ongoing call"</string>
+ <string name="answering_ends_other_managed_calls" msgid="6429838309560397988">"Answering will end your ongoing calls"</string>
+ <string name="answering_ends_other_managed_video_call" msgid="1585423762458248435">"Answering will end your ongoing video call"</string>
+ <string name="answer_incoming_call" msgid="4140530013111794587">"Answer"</string>
+ <string name="decline_incoming_call" msgid="806026168661598368">"Decline"</string>
+ <string name="cant_call_due_to_ongoing_call" msgid="4952615196237854748">"Call cannot be placed due to your <xliff:g id="OTHER_CALL">%1$s</xliff:g> call."</string>
+ <string name="cant_call_due_to_ongoing_calls" msgid="1380804892363503856">"Call cannot be placed due to your <xliff:g id="OTHER_CALL">%1$s</xliff:g> calls."</string>
+ <string name="cant_call_due_to_ongoing_unknown_call" msgid="149091978697302211">"Call cannot be placed due to a call in another app."</string>
+ <string name="notification_channel_incoming_call" msgid="3513761697082968084">"Incoming calls"</string>
+ <string name="notification_channel_missed_call" msgid="8727062678632713146">"Missed calls"</string>
+ <string name="alert_outgoing_call" msgid="982908156825958001">"Placing this call will end your <xliff:g id="OTHER_APP">%1$s</xliff:g> call."</string>
+</resources>
diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml
index eb97fe5..529c845 100644
--- a/res/values-eu/strings.xml
+++ b/res/values-eu/strings.xml
@@ -19,7 +19,7 @@
<string name="telecommAppLabel" product="default" msgid="382363169988504520">"Deien kudeaketa"</string>
<string name="userCallActivityLabel" product="default" msgid="5415173590855187131">"Telefonoa"</string>
<string name="unknown" msgid="6878797917991465859">"Ezezaguna"</string>
- <string name="notification_missedCallTitle" msgid="7554385905572364535">"Galdutako deia"</string>
+ <string name="notification_missedCallTitle" msgid="7554385905572364535">"Dei galdua"</string>
<string name="notification_missedWorkCallTitle" msgid="6242489980390803090">"Laneko dei bat galdu duzu"</string>
<string name="notification_missedCallsTitle" msgid="1361677948941502522">"Dei galduak"</string>
<string name="notification_missedCallsMsg" msgid="4575787816055205600">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> dei galdu"</string>
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index 7b50130..a7fcb0e 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -50,7 +50,7 @@
<string name="change_default_dialer_dialog_negative" msgid="9078144617060173845">"キャンセル"</string>
<string name="change_default_dialer_warning_message" msgid="1417671460801684999">"<xliff:g id="NEW_APP">%s</xliff:g> はすべての通話の発信や制御を行えるようになります。デフォルトの電話アプリに設定するのは信頼できるアプリだけにしてください。"</string>
<string name="blocked_numbers" msgid="2751843139572970579">"ブロックした番号"</string>
- <string name="blocked_numbers_msg" msgid="1045015186124965643">"ブロックした電話番号からの通話やテキスト メッセージを受け取ることはありません。"</string>
+ <string name="blocked_numbers_msg" msgid="1045015186124965643">"ブロックした電話番号から通話やテキスト メッセージを受け取ることはありません。"</string>
<string name="block_number" msgid="1101252256321306179">"番号を追加"</string>
<string name="unblock_dialog_body" msgid="1614238499771862793">"<xliff:g id="NUMBER_TO_BLOCK">%1$s</xliff:g> のブロックを解除しますか?"</string>
<string name="unblock_button" msgid="3078048901972674170">"ブロックを解除"</string>
diff --git a/res/values-tl/strings.xml b/res/values-tl/strings.xml
index 7a8b28b..8f56cb2 100644
--- a/res/values-tl/strings.xml
+++ b/res/values-tl/strings.xml
@@ -52,18 +52,18 @@
<string name="blocked_numbers" msgid="2751843139572970579">"Mga naka-block na numero"</string>
<string name="blocked_numbers_msg" msgid="1045015186124965643">"Hindi ka makakatanggap ng mga tawag o mga text mula sa mga naka-block na numero."</string>
<string name="block_number" msgid="1101252256321306179">"Magdagdag ng numero"</string>
- <string name="unblock_dialog_body" msgid="1614238499771862793">"Aalisin ba sa pagkaka-block ang <xliff:g id="NUMBER_TO_BLOCK">%1$s</xliff:g>?"</string>
- <string name="unblock_button" msgid="3078048901972674170">"Alisin sa pagkaka-block"</string>
+ <string name="unblock_dialog_body" msgid="1614238499771862793">"Ia-unblock ba ang <xliff:g id="NUMBER_TO_BLOCK">%1$s</xliff:g>?"</string>
+ <string name="unblock_button" msgid="3078048901972674170">"I-unblock"</string>
<string name="add_blocked_dialog_body" msgid="9030243212265516828">"I-block ang mga tawag at text mula sa"</string>
<string name="add_blocked_number_hint" msgid="6847675097085433553">"Numero ng telepono"</string>
<string name="block_button" msgid="8822290682524373357">"I-block"</string>
<string name="non_primary_user" msgid="5180129233352533459">"Ang may-ari ng device lang ang makakakita at makakapamahala sa mga naka-block na numero."</string>
- <string name="delete_icon_description" msgid="8903995728252556724">"Inaalis sa pagkaka-block"</string>
+ <string name="delete_icon_description" msgid="8903995728252556724">"Na-unblock"</string>
<string name="blocked_numbers_butter_bar_title" msgid="438170866438793182">"Pansamantalang naka-off ang pag-block"</string>
<string name="blocked_numbers_butter_bar_body" msgid="2223244484319442431">"Pagkatapos mong i-dial o i-text ang isang pang-emergency na numero, ino-off ang pag-block upang matiyak na maaaring makipag-ugnayan sa iyo ang mga serbisyong pang-emergency."</string>
<string name="blocked_numbers_butter_bar_button" msgid="2197943354922010696">"I-enable muli ngayon"</string>
<string name="blocked_numbers_number_blocked_message" msgid="7678509606805029540">"Naka-block ang <xliff:g id="BLOCKED_NUMBER">%1$s</xliff:g>"</string>
- <string name="blocked_numbers_number_unblocked_message" msgid="977894647366750418">"Naka-unblock ang <xliff:g id="UNBLOCKED_NUMBER">%1$s</xliff:g>"</string>
+ <string name="blocked_numbers_number_unblocked_message" msgid="977894647366750418">"Na-unblock ang <xliff:g id="UNBLOCKED_NUMBER">%1$s</xliff:g>"</string>
<string name="blocked_numbers_block_emergency_number_message" msgid="917851876780698387">"Hindi ma-block ang numerong pang-emergency."</string>
<string name="blocked_numbers_number_already_blocked_message" msgid="4392247814500811798">"Naka-block na ang <xliff:g id="BLOCKED_NUMBER">%1$s</xliff:g>."</string>
<string name="toast_personal_call_msg" msgid="5115361633476779723">"Ginagamit ang personal na dialer upang tumawag"</string>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 5c043ea..8a9ca00 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -32,8 +32,8 @@
<string name="respond_via_sms_canned_response_2" msgid="4074450431532859214">"我待會就回電。"</string>
<string name="respond_via_sms_canned_response_3" msgid="3496079065723960450">"我晚點回電。"</string>
<string name="respond_via_sms_canned_response_4" msgid="1698989243040062190">"我現在不方便講話,晚點再打來好嗎?"</string>
- <string name="respond_via_sms_setting_title" msgid="3754000371039709383">"快速回應"</string>
- <string name="respond_via_sms_setting_title_2" msgid="6104662227299493906">"編輯快速回應"</string>
+ <string name="respond_via_sms_setting_title" msgid="3754000371039709383">"應答短訊"</string>
+ <string name="respond_via_sms_setting_title_2" msgid="6104662227299493906">"編輯應答短訊"</string>
<string name="respond_via_sms_setting_summary" msgid="9150281183930613065"></string>
<string name="respond_via_sms_edittext_dialog_title" msgid="20379890418289778">"快速回應"</string>
<string name="respond_via_sms_confirmation_format" msgid="7229149977515784269">"訊息已傳送至 <xliff:g id="PHONE_NUMBER">%s</xliff:g>。"</string>
diff --git a/res/values/config.xml b/res/values/config.xml
index 3e02505..7db3315 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -47,8 +47,8 @@
maximum ringing calls. -->
<bool name="silence_incoming_when_different_service_and_maximum_ringing">false</bool>
- <!-- Determines if the granting temporary location permission to the default dialer
- during an emergency call should be allowed. The default is false. -->
+ <!-- Determines if the granting of temporary location permission to the default dialer
+ during an emergency call should be allowed. -->
<bool name="grant_location_permission_enabled">false</bool>
<!-- When true, a simple full intensity on/off vibration pattern will be used when calls ring.
diff --git a/src/com/android/server/telecom/AsyncRingtonePlayer.java b/src/com/android/server/telecom/AsyncRingtonePlayer.java
index 7ed1c85..8a7be4d 100644
--- a/src/com/android/server/telecom/AsyncRingtonePlayer.java
+++ b/src/com/android/server/telecom/AsyncRingtonePlayer.java
@@ -92,7 +92,7 @@
HandlerThread thread = new HandlerThread("ringtone-player");
thread.start();
- return new Handler(thread.getLooper()) {
+ return new Handler(thread.getLooper(), null /*callback*/, true /*async*/) {
@Override
public void handleMessage(Message msg) {
switch(msg.what) {
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 79b57b9..d8f3fbc 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -48,6 +48,7 @@
import android.telecom.VideoProfile;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
+import android.util.StatsLog;
import android.os.UserHandle;
import com.android.internal.annotations.VisibleForTesting;
@@ -935,6 +936,10 @@
}
Log.addEvent(this, event, stringData);
}
+ int statsdDisconnectCause = (newState == CallState.DISCONNECTED) ?
+ getDisconnectCause().getCode() : DisconnectCause.UNKNOWN;
+ StatsLog.write(StatsLog.CALL_STATE_CHANGED, newState, statsdDisconnectCause,
+ isSelfManaged(), isExternalCall());
}
}
diff --git a/src/com/android/server/telecom/CallRecordingTonePlayer.java b/src/com/android/server/telecom/CallRecordingTonePlayer.java
index ffa1b04..9b1c4a5 100644
--- a/src/com/android/server/telecom/CallRecordingTonePlayer.java
+++ b/src/com/android/server/telecom/CallRecordingTonePlayer.java
@@ -239,14 +239,11 @@
AudioDeviceInfo telephonyDevice = getTelephonyDevice(mAudioManager);
if (telephonyDevice != null) {
Log.i(this ,"startCallRecordingTone: playing call recording tone to remote end.");
- /**
- TODO: uncomment this in P release; API dependencies exist which are not met in AOSP.
mRecordingTonePlayer = MediaPlayer.create(context, R.raw.record);
mRecordingTonePlayer.setLooping(true);
mRecordingTonePlayer.setPreferredDevice(telephonyDevice);
mRecordingTonePlayer.setVolume(0.1f);
mRecordingTonePlayer.start();
- */
} else {
Log.w(this ,"startCallRecordingTone: can't find telephony audio device.");
}
diff --git a/src/com/android/server/telecom/CallState.java b/src/com/android/server/telecom/CallState.java
index 0aa928f..05ac38e 100644
--- a/src/com/android/server/telecom/CallState.java
+++ b/src/com/android/server/telecom/CallState.java
@@ -16,6 +16,8 @@
package com.android.server.telecom;
+import android.telecom.TelecomProtoEnums;
+
/**
* Defines call-state constants of the different states in which a call can exist. Although states
* have the notion of normal transitions, due to the volatile nature of telephony systems, code
@@ -32,20 +34,20 @@
* not expected to ever interact with NEW calls, but {@link android.telecom.InCallService}s will
* see calls in this state.
*/
- public static final int NEW = 0;
+ public static final int NEW = TelecomProtoEnums.NEW; // = 0
/**
* The initial state of an outgoing {@code Call}.
* Common transitions are to {@link #DIALING} state for a successful call or
* {@link #DISCONNECTED} if it failed.
*/
- public static final int CONNECTING = 1;
+ public static final int CONNECTING = TelecomProtoEnums.CONNECTING; // = 1
/**
* The state of an outgoing {@code Call} when waiting on user to select a
* {@link android.telecom.PhoneAccount} through which to place the call.
*/
- public static final int SELECT_PHONE_ACCOUNT = 2;
+ public static final int SELECT_PHONE_ACCOUNT = TelecomProtoEnums.SELECT_PHONE_ACCOUNT; // = 2
/**
* Indicates that a call is outgoing and in the dialing state. A call transitions to this state
@@ -53,7 +55,7 @@
* state usually transition to {@link #ACTIVE} if the call was answered or {@link #DISCONNECTED}
* if the call was disconnected somehow (e.g., failure or cancellation of the call by the user).
*/
- public static final int DIALING = 3;
+ public static final int DIALING = TelecomProtoEnums.DIALING; // = 3
/**
* Indicates that a call is incoming and the user still has the option of answering, rejecting,
@@ -61,14 +63,14 @@
* ringtone. Normal transitions are to {@link #ACTIVE} if answered or {@link #DISCONNECTED}
* otherwise.
*/
- public static final int RINGING = 4;
+ public static final int RINGING = TelecomProtoEnums.RINGING; // = 4
/**
* Indicates that a call is currently connected to another party and a communication channel is
* open between them. The normal transition to this state is by the user answering a
* {@link #DIALING} call or a {@link #RINGING} call being answered by the other party.
*/
- public static final int ACTIVE = 5;
+ public static final int ACTIVE = TelecomProtoEnums.ACTIVE; // = 5
/**
* Indicates that the call is currently on hold. In this state, the call is not terminated
@@ -76,7 +78,7 @@
* to this state is by the user putting an {@link #ACTIVE} call on hold by explicitly performing
* an action, such as clicking the hold button.
*/
- public static final int ON_HOLD = 6;
+ public static final int ON_HOLD = TelecomProtoEnums.ON_HOLD; // = 6
/**
* Indicates that a call is currently disconnected. All states can transition to this state
@@ -85,13 +87,13 @@
* the disconnection or communication was lost to the call service currently responsible for
* this call (e.g., call service crashes).
*/
- public static final int DISCONNECTED = 7;
+ public static final int DISCONNECTED = TelecomProtoEnums.DISCONNECTED; // = 7
/**
* Indicates that the call was attempted (mostly in the context of outgoing, at least at the
* time of writing) but cancelled before it was successfully connected.
*/
- public static final int ABORTED = 8;
+ public static final int ABORTED = TelecomProtoEnums.ABORTED; // = 8
/**
* Indicates that the call is in the process of being disconnected and will transition next
@@ -101,7 +103,7 @@
* to the InCall UI for calls where disconnection has been initiated by the user but the
* ConnectionService has confirmed the call as disconnected.
*/
- public static final int DISCONNECTING = 9;
+ public static final int DISCONNECTING = TelecomProtoEnums.DISCONNECTING; // = 9
/**
* Indicates that the call is in the process of being pulled to the local device.
@@ -110,7 +112,7 @@
* {@link android.telecom.Connection#PROPERTY_IS_EXTERNAL_CALL} and
* {@link android.telecom.Connection#CAPABILITY_CAN_PULL_CALL}.
*/
- public static final int PULLING = 10;
+ public static final int PULLING = TelecomProtoEnums.PULLING; // = 10
public static String toString(int callState) {
switch (callState) {
diff --git a/src/com/android/server/telecom/ConnectionServiceFocusManager.java b/src/com/android/server/telecom/ConnectionServiceFocusManager.java
index 06d892a..f296502 100644
--- a/src/com/android/server/telecom/ConnectionServiceFocusManager.java
+++ b/src/com/android/server/telecom/ConnectionServiceFocusManager.java
@@ -370,7 +370,7 @@
// The ConnectionService can call onConnectionServiceFocusReleased even if it's not the
// current focus connection service, nothing will be changed in this case.
if (Objects.equals(mCurrentFocus, connectionServiceFocus)) {
- mEventHandler.removeMessages(MSG_RELEASE_FOCUS_TIMEOUT, mCurrentFocusRequest);
+ mEventHandler.removeMessages(MSG_RELEASE_FOCUS_TIMEOUT);
ConnectionServiceFocus newCSF = null;
if (mCurrentFocusRequest != null) {
newCSF = mCurrentFocusRequest.call.getConnectionServiceWrapper();
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index b827202..c4f9b63 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -24,18 +24,22 @@
import android.telecom.TelecomManager;
import android.media.AudioAttributes;
import android.media.AudioManager;
+import android.media.Ringtone;
import android.net.Uri;
import android.os.Bundle;
import android.os.Vibrator;
import com.android.internal.annotations.VisibleForTesting;
+import java.util.ArrayList;
+
/**
* Controls the ringtone player.
*/
@VisibleForTesting
public class Ringer {
- VibrationEffect mVibrationEffect;
+ @VisibleForTesting
+ public VibrationEffect mDefaultVibrationEffect;
private static final long[] PULSE_PATTERN = {0,12,250,12,500, // priming + interval
50,50,50,50,50,50,50,50,50,50,50,50,50,50, // ease-in
@@ -123,11 +127,11 @@
mInCallController = inCallController;
if (mContext.getResources().getBoolean(R.bool.use_simple_vibration_pattern)) {
- mVibrationEffect = VibrationEffect.createWaveform(SIMPLE_VIBRATION_PATTERN,
+ mDefaultVibrationEffect = VibrationEffect.createWaveform(SIMPLE_VIBRATION_PATTERN,
SIMPLE_VIBRATION_AMPLITUDE, REPEAT_SIMPLE_VIBRATION_AT);
} else {
- mVibrationEffect = VibrationEffect.createWaveform(PULSE_PATTERN, PULSE_AMPLITUDE,
- REPEAT_VIBRATION_AT);
+ mDefaultVibrationEffect = VibrationEffect.createWaveform(PULSE_PATTERN,
+ PULSE_AMPLITUDE, REPEAT_VIBRATION_AT);
}
}
@@ -172,6 +176,7 @@
stopCallWaiting();
+ VibrationEffect effect;
if (isRingerAudible) {
mRingingCall = foregroundCall;
Log.addEvent(foregroundCall, LogUtils.Events.START_RINGER);
@@ -180,15 +185,16 @@
// ringtones should be available by the time this code executes. We can safely
// request the custom ringtone from the call and expect it to be current.
mRingtonePlayer.play(mRingtoneFactory, foregroundCall);
+ effect = getVibrationEffectForCall(mRingtoneFactory, foregroundCall);
} else {
Log.i(this, "startRinging: skipping because ringer would not be audible. " +
"isVolumeOverZero=%s, shouldRingForContact=%s, isRingtonePresent=%s",
isVolumeOverZero, shouldRingForContact, isRingtonePresent);
+ effect = mDefaultVibrationEffect;
}
if (shouldVibrate(mContext, foregroundCall) && !mIsVibrating && shouldRingForContact) {
- mVibratingCall = foregroundCall;
- mVibrator.vibrate(mVibrationEffect, VIBRATION_ATTRIBUTES);
+ mVibrator.vibrate(effect, VIBRATION_ATTRIBUTES);
mIsVibrating = true;
} else if (mIsVibrating) {
Log.addEvent(foregroundCall, LogUtils.Events.SKIP_VIBRATION, "already vibrating");
@@ -197,6 +203,20 @@
return shouldAcquireAudioFocus;
}
+ private VibrationEffect getVibrationEffectForCall(RingtoneFactory factory, Call call) {
+ VibrationEffect effect = null;
+ Ringtone ringtone = factory.getRingtone(call);
+ Uri ringtoneUri = ringtone != null ? ringtone.getUri() : null;
+ if (ringtoneUri != null) {
+ effect = VibrationEffect.get(ringtoneUri, mContext);
+ }
+
+ if (effect == null) {
+ effect = mDefaultVibrationEffect;
+ }
+ return effect;
+ }
+
public void startCallWaiting(Call call) {
if (mSystemSettingsUtil.isTheaterModeOn(mContext)) {
return;
@@ -257,11 +277,13 @@
private boolean shouldRingForContact(Uri contactUri) {
final NotificationManager manager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- final Bundle extras = new Bundle();
+ final Bundle peopleExtras = new Bundle();
if (contactUri != null) {
- extras.putStringArray(Notification.EXTRA_PEOPLE, new String[] {contactUri.toString()});
+ ArrayList<Notification.Person> personList = new ArrayList<>();
+ personList.add(new Notification.Person().setUri(contactUri.toString()));
+ peopleExtras.putParcelableArrayList(Notification.EXTRA_PEOPLE_LIST, personList);
}
- return manager.matchesCallFilter(extras);
+ return manager.matchesCallFilter(peopleExtras);
}
private boolean hasExternalRinger(Call foregroundCall) {
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index e45cf30..a72e5b6 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -980,15 +980,9 @@
public boolean isTtySupported(String callingPackage) {
try {
Log.startSession("TSI.iTS");
- if (!isPrivilegedDialerCalling(callingPackage)) {
- try {
- enforceModifyPermission(
- "isTtySupported requires MODIFY_PHONE_STATE permission.");
- } catch (SecurityException e) {
- EventLog.writeEvent(0x534e4554, "62347125", "isTtySupported: " +
- callingPackage);
- throw e;
- }
+ if (!canReadPhoneState(callingPackage, "isTtySupported")) {
+ throw new SecurityException("Only default dialer or an app with" +
+ "READ_PRIVILEGED_PHONE_STATE or READ_PHONE_STATE can call this api");
}
synchronized (mLock) {
diff --git a/tests/Android.mk b/tests/Android.mk
index c2db42a..1892357 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -37,14 +37,15 @@
LOCAL_RESOURCE_DIR := \
$(LOCAL_PATH)/res \
$(LOCAL_PATH)/../res \
- $(SUPPORT_LIBRARY_ROOT)/compat/res
LOCAL_JAVA_LIBRARIES := \
android.test.mock \
- legacy-android-test \
+ android.test.base \
android.test.runner \
telephony-common
+LOCAL_USE_AAPT2 := true
+
LOCAL_AAPT_FLAGS := \
--auto-add-overlay \
--extra-packages com.android.server.telecom:android.support.compat
diff --git a/tests/src/com/android/server/telecom/tests/RingerTest.java b/tests/src/com/android/server/telecom/tests/RingerTest.java
index 2a45649..25460de 100644
--- a/tests/src/com/android/server/telecom/tests/RingerTest.java
+++ b/tests/src/com/android/server/telecom/tests/RingerTest.java
@@ -18,9 +18,11 @@
import android.app.NotificationManager;
import android.content.Context;
+import android.content.res.Resources;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.Ringtone;
+import android.net.Uri;
import android.os.Bundle;
import android.os.VibrationEffect;
import android.os.Vibrator;
@@ -45,6 +47,7 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -52,6 +55,8 @@
@RunWith(JUnit4.class)
public class RingerTest extends TelecomTestCase {
+ private static final Uri FAKE_RINGTONE_URI = Uri.parse("content://media/fake/audio/1729");
+
@Mock InCallTonePlayer.Factory mockPlayerFactory;
@Mock SystemSettingsUtil mockSystemSettingsUtil;
@Mock AsyncRingtonePlayer mockRingtonePlayer;
@@ -179,7 +184,8 @@
assertFalse(mRingerUnderTest.startRinging(mockCall2, false));
verify(mockTonePlayer).stopTone();
verify(mockRingtonePlayer, never()).play(any(RingtoneFactory.class), any(Call.class));
- verify(mockVibrator).vibrate(any(VibrationEffect.class), any(AudioAttributes.class));
+ verify(mockVibrator).vibrate(eq(mRingerUnderTest.mDefaultVibrationEffect),
+ any(AudioAttributes.class));
}
@SmallTest
@@ -194,7 +200,26 @@
assertFalse(mRingerUnderTest.startRinging(mockCall2, false));
verify(mockTonePlayer).stopTone();
verify(mockRingtonePlayer, never()).play(any(RingtoneFactory.class), any(Call.class));
- verify(mockVibrator).vibrate(any(VibrationEffect.class), any(AudioAttributes.class));
+ verify(mockVibrator).vibrate(eq(mRingerUnderTest.mDefaultVibrationEffect),
+ any(AudioAttributes.class));
+ }
+
+ @SmallTest
+ @Test
+ public void testCustomVibrationForRingtone() {
+ Resources resources = mContext.getResources();
+ when(resources.getStringArray(com.android.internal.R.array.config_ringtoneEffectUris))
+ .thenReturn(new String[] { FAKE_RINGTONE_URI.toString() });
+ mRingerUnderTest.startCallWaiting(mockCall1);
+ Ringtone mockRingtone = mock(Ringtone.class);
+ when(mockRingtoneFactory.getRingtone(any(Call.class))).thenReturn(mockRingtone);
+ when(mockRingtone.getUri()).thenReturn(FAKE_RINGTONE_URI);
+ enableVibrationWhenRinging();
+ assertTrue(mRingerUnderTest.startRinging(mockCall2, false));
+ verify(mockTonePlayer).stopTone();
+ verify(mockRingtonePlayer).play(any(RingtoneFactory.class), any(Call.class));
+ verify(mockVibrator).vibrate(eq(VibrationEffect.get(FAKE_RINGTONE_URI, mContext)),
+ any(AudioAttributes.class));
}
@SmallTest