Merge "Add subId extra to CARRIER_CONFIG broadcast only when relevant."
diff --git a/Android.mk b/Android.mk
index be929f1..4846ea1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -46,6 +46,7 @@
--extra-packages android.support.v14.preference
LOCAL_PACKAGE_NAME := TeleService
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ae4ed14..f86cdef 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -79,10 +79,10 @@
<protected-broadcast android:name= "com.android.phone.vvm.ACTION_VISUAL_VOICEMAIL_SERVICE_EVENT" />
<protected-broadcast android:name= "com.android.internal.telephony.CARRIER_VVM_PACKAGE_INSTALLED" />
<protected-broadcast android:name= "com.android.cellbroadcastreceiver.GET_LATEST_CB_AREA_INFO" />
- <protected-broadcast android:name= "android.intent.action.CURRENT_CARRIER_IDENTITY_CHANGED" />
<protected-broadcast android:name= "android.telephony.action.SIM_CARD_STATE_CHANGED" />
<protected-broadcast android:name= "android.telephony.action.SIM_APPLICATION_STATE_CHANGED" />
<protected-broadcast android:name= "android.telephony.action.SIM_SLOT_STATUS_CHANGED" />
+ <protected-broadcast android:name= "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.CALL_PHONE" />
@@ -181,6 +181,7 @@
<uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
<uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
<uses-permission android:name="android.permission.BIND_TELEPHONY_DATA_SERVICE" />
+ <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<application android:name="PhoneApp"
android:persistent="true"
diff --git a/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml b/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
new file mode 100644
index 0000000..905dc55
--- /dev/null
+++ b/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+
+<!-- Variant of progress_indeterminate_horizontal_material in frameworks/base/core/res, which
+ draws the whole height of the progress bar instead having blank space above and below the
+ bar. -->
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@drawable/vector_drawable_progress_indeterminate_horizontal_trimmed" >
+ <target
+ android:name="rect2_grp"
+ android:animation="@*android:anim/progress_indeterminate_horizontal_rect2" />
+ <target
+ android:name="rect1_grp"
+ android:animation="@*android:anim/progress_indeterminate_horizontal_rect1" />
+</animated-vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_1x.xml b/res/drawable/signal_strength_1x.xml
new file mode 100644
index 0000000..d1d2229
--- /dev/null
+++ b/res/drawable/signal_strength_1x.xml
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2018 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="8.5dp"
+ android:height="17dp"
+ android:viewportWidth="12.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M3.500000,11.000000L1.800000,11.000000L1.800000,4.400000L0.200000,5.100000L0.200000,3.700000l3.100000,-1.300000l0.200000,0.000000L3.500000,11.000000z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M8.600000,5.500000l1.200000,-3.000000l1.900000,0.000000L9.700000,6.700000l2.200000,4.300000L9.900000,11.000000L8.700000,7.900000L7.400000,11.000000L5.500000,11.000000l2.100000,-4.300000L5.600000,2.500000l1.900000,0.000000L8.600000,5.500000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_3g.xml b/res/drawable/signal_strength_3g.xml
new file mode 100644
index 0000000..49f52a9
--- /dev/null
+++ b/res/drawable/signal_strength_3g.xml
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2018 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="9.208dp"
+ android:height="17dp"
+ android:viewportWidth="13.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M2.000000,6.000000l0.800000,0.000000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000s0.200000,-0.500000 0.200000,-0.900000c0.000000,-0.300000 -0.100000,-0.600000 -0.200000,-0.800000S3.200000,3.700000 2.900000,3.700000C2.700000,3.700000 2.500000,3.800000 2.300000,4.000000S2.100000,4.400000 2.100000,4.700000L0.500000,4.700000C0.500000,4.000000 0.700000,3.400000 1.100000,3.000000s1.000000,-0.600000 1.700000,-0.600000c0.800000,0.000000 1.400000,0.200000 1.900000,0.600000s0.700000,1.000000 0.700000,1.800000c0.000000,0.400000 -0.100000,0.700000 -0.300000,1.100000S4.600000,6.500000 4.300000,6.600000C4.700000,6.800000 5.000000,7.100000 5.200000,7.400000s0.300000,0.700000 0.300000,1.200000c0.000000,0.800000 -0.200000,1.400000 -0.700000,1.800000s-1.100000,0.700000 -1.900000,0.700000c-0.700000,0.000000 -1.300000,-0.200000 -1.800000,-0.600000s-0.700000,-1.000000 -0.700000,-1.800000L2.000000,8.700000C2.000000,9.000000 2.100000,9.300000 2.300000,9.500000s0.400000,0.300000 0.600000,0.300000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000S3.900000,9.000000 3.900000,8.600000c0.000000,-0.500000 -0.100000,-0.800000 -0.300000,-1.000000S3.200000,7.300000 2.800000,7.300000L2.000000,7.300000L2.000000,6.000000z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.700000,9.000000 6.700000,7.900000L6.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000s-0.500000,-0.300000 -0.900000,-0.300000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S8.400000,5.000000 8.400000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.799999,7.800000L9.600000,7.800000L9.600000,6.600000l2.900000,0.000000L12.500000,9.900000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_g.xml b/res/drawable/signal_strength_g.xml
new file mode 100644
index 0000000..7258c94
--- /dev/null
+++ b/res/drawable/signal_strength_g.xml
@@ -0,0 +1,25 @@
+<!--
+Copyright (C) 2018 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="4.958dp"
+ android:height="17dp"
+ android:viewportWidth="7.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M6.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S0.700000,9.000000 0.700000,7.900000L0.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000L4.700000,5.200000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S4.000000,3.700000 3.600000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S2.300000,5.000000 2.300000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L4.700000,7.800000L3.500000,7.800000L3.500000,6.600000l2.900000,0.000000L6.400000,9.900000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_lte.xml b/res/drawable/signal_strength_lte.xml
new file mode 100644
index 0000000..e6edd24
--- /dev/null
+++ b/res/drawable/signal_strength_lte.xml
@@ -0,0 +1,31 @@
+<!--
+Copyright (C) 2018 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="9.208dp"
+ android:height="17dp"
+ android:viewportWidth="13.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M2.000000,9.700000l2.000000,0.000000L4.000000,11.000000L0.300000,11.000000L0.300000,2.500000L2.000000,2.500000L2.000000,9.700000z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M8.300000,3.800000L7.000000,3.800000L7.000000,11.000000L5.300000,11.000000L5.300000,3.800000L4.000000,3.800000L4.000000,2.500000l4.300000,0.000000L8.300000,3.800000z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12.400000,7.300000l-1.700000,0.000000l0.000000,2.400000l2.100000,0.000000L12.799999,11.000000L9.000000,11.000000L9.000000,2.500000l3.700000,0.000000l0.000000,1.300000l-2.100000,0.000000l0.000000,2.100000l1.700000,0.000000L12.300000,7.300000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/vector_drawable_progress_indeterminate_horizontal_trimmed.xml b/res/drawable/vector_drawable_progress_indeterminate_horizontal_trimmed.xml
new file mode 100644
index 0000000..dc0352a
--- /dev/null
+++ b/res/drawable/vector_drawable_progress_indeterminate_horizontal_trimmed.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+
+<!-- Variant of vector_drawable_progress_indeterminate_horizontal in frameworks/base/core/res, which
+ draws the whole height of the progress bar instead having blank space above and below the
+ bar. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="10dp"
+ android:width="360dp"
+ android:viewportHeight="10"
+ android:viewportWidth="360" >
+ <group
+ android:name="progress_group"
+ android:translateX="180"
+ android:translateY="5" >
+ <path
+ android:name="background_track"
+ android:pathData="M -180.0,-5.0 l 360.0,0 l 0,10.0 l -360.0,0 Z"
+ android:fillColor="?android:attr/colorControlActivated"
+ android:fillAlpha="?android:attr/disabledAlpha"/>
+ <group
+ android:name="rect2_grp"
+ android:translateX="-197.60001"
+ android:scaleX="0.1" >
+ <path
+ android:name="rect2"
+ android:pathData="M -144.0,-5.0 l 288.0,0 l 0,10.0 l -288.0,0 Z"
+ android:fillColor="?android:attr/colorControlActivated" />
+ </group>
+ <group
+ android:name="rect1_grp"
+ android:translateX="-522.59998"
+ android:scaleX="0.1" >
+ <path
+ android:name="rect1"
+ android:pathData="M -144.0,-5.0 l 288.0,0 l 0,10.0 l -288.0,0 Z"
+ android:fillColor="?android:attr/colorControlActivated" />
+ </group>
+ </group>
+</vector>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5dc7279..f6d1b79 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -108,4 +108,6 @@
<dimen name="floating_action_button_width">67dp</dimen>
<dimen name="floating_action_button_height">67dp</dimen>
<dimen name="floating_action_button_margin_bottom">32dp</dimen>
+
+ <dimen name="signal_strength_icon_size">24dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8c450a0..add9ac4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -387,6 +387,16 @@
<string name="preferred_network_mode_summary">Change the network operating mode</string>
<string name="preferred_network_mode_dialogtitle">Preferred network type</string>
<string name="forbidden_network">(forbidden)</string>
+ <!-- Available networks screen, name of button when user wants to select network manually -->
+ <string name="choose_network_title">Choose network</string>
+ <!-- Available networks screen, text when no networks connected -->
+ <string name="network_disconnected">Disconnected</string>
+ <!-- Available networks screen, text when network connected -->
+ <string name="network_connected">Connected</string>
+ <!-- Available networks screen, text when a network is connecting -->
+ <string name="network_connecting">Connecting...</string>
+ <!-- Available networks screen, text when a network cannot be connected -->
+ <string name="network_could_not_connect">Couldn’t connect</string>
<!-- The preferred network modes in Mobile network settings -->
<string-array name="preferred_network_mode_choices">
@@ -1165,6 +1175,11 @@
<string name="hac_mode_title">Hearing aids</string>
<string name="hac_mode_summary">Turn on hearing aid compatibility</string>
+ <!-- RTT settings: used to turn on/off Real-Time Text, an accessibility feature similar to
+ TTY that allows users to send text over a phone call. -->
+ <string name="rtt_mode_title">RTT</string>
+ <string name="rtt_mode_summary">Turn RTT on or off</string>
+
<!-- Service option entries. -->
<string-array name="tty_mode_entries">
<item>TTY Off</item>
@@ -1494,111 +1509,111 @@
<!-- In-call screen: status label displayed briefly after a call ends -->
<string name="clh_card_title_call_ended_txt">Call ended</string>
<!-- In-call screen: call failure reason (radio is off) -->
- <string name="clh_callFailed_powerOff_txt">Radio off</string>
+ <string name="clh_callFailed_powerOff_txt">Airplane mode is on</string>
<!-- In-call screen: call failure reason (SIM error) -->
- <string name="clh_callFailed_simError_txt">No SIM card or SIM card error</string>
+ <string name="clh_callFailed_simError_txt">Can\'t access SIM card</string>
<!-- In-call screen: call failure message displayed in an error dialog -->
<string name="clh_incall_error_out_of_service_txt">Mobile network not available</string>
<!-- See CallFailCause for details on what causes each message -->
<!-- In-call screen: call failure reason (Cause Number 1) -->
- <string name="clh_callFailed_unassigned_number_txt">Unassigned (unallocated) number</string>
+ <string name="clh_callFailed_unassigned_number_txt">Issue with phone number you are trying to dial. Error code 1.</string>
<!-- In-call screen: call failure reason (Cause Number 3) -->
- <string name="clh_callFailed_no_route_to_destination_txt">No route to destination</string>
+ <string name="clh_callFailed_no_route_to_destination_txt">Couldn\'t complete call. Error code 3.</string>
<!-- In-call screen: call failure reason (Cause Number 6) -->
- <string name="clh_callFailed_channel_unacceptable_txt">Channel unacceptable</string>
+ <string name="clh_callFailed_channel_unacceptable_txt">Couldn\'t complete call. Error code 6.</string>
<!-- In-call screen: call failure reason (Cause Number 8) -->
- <string name="clh_callFailed_operator_determined_barring_txt">Operator determined barring</string>
+ <string name="clh_callFailed_operator_determined_barring_txt">Couldn\'t complete call. Error code 8.</string>
<!-- In-call screen: call failure reason (Cause Number 16) -->
- <string name="clh_callFailed_normal_call_clearing_txt">Normal call clearing</string>
+ <string name="clh_callFailed_normal_call_clearing_txt">Couldn\'t complete call. Error code 16.</string>
<!-- In-call screen: call failure reason (Cause Number 17) -->
<string name="clh_callFailed_user_busy_txt">User busy</string>
<!-- In-call screen: call failure reason (Cause Number 18) -->
- <string name="clh_callFailed_no_user_responding_txt">No user responding</string>
+ <string name="clh_callFailed_no_user_responding_txt">User not responding</string>
<!-- In-call screen: call failure reason (Cause Number 19) -->
- <string name="clh_callFailed_user_alerting_txt">User alerting, no answer</string>
+ <string name="clh_callFailed_user_alerting_txt">Couldn\'t complete call. Error code 19.</string>
<!-- In-call screen: call failure reason (Cause Number 21) -->
<string name="clh_callFailed_call_rejected_txt">Call rejected</string>
<!-- In-call screen: call failure reason (Cause Number 22) -->
<string name="clh_callFailed_number_changed_txt">Number changed</string>
<!-- In-call screen: call failure reason (Cause Number 25) -->
- <string name="clh_callFailed_pre_emption_txt">Pre-emption</string>
+ <string name="clh_callFailed_pre_emption_txt">Couldn\'t complete call. Error code 25.</string>
<!-- In-call screen: call failure reason (Cause Number 26) -->
- <string name="clh_callFailed_non_selected_user_clearing_txt">Non selected user clearing</string>
+ <string name="clh_callFailed_non_selected_user_clearing_txt">Couldn\'t complete call. Error code 26.</string>
<!-- In-call screen: call failure reason (Cause Number 27) -->
- <string name="clh_callFailed_destination_out_of_order_txt">Destination out of order</string>
+ <string name="clh_callFailed_destination_out_of_order_txt">Couldn\'t complete call. Error code 27.</string>
<!-- In-call screen: call failure reason (Cause Number 28) -->
<string name="clh_callFailed_invalid_number_format_txt">Invalid number format (incomplete number)</string>
<!-- In-call screen: call failure reason (Cause Number 29) -->
- <string name="clh_callFailed_facility_rejected_txt">Facility rejected</string>
+ <string name="clh_callFailed_facility_rejected_txt">Couldn\'t complete call. Error code 29.</string>
<!-- In-call screen: call failure reason (Cause Number 30) -->
- <string name="clh_callFailed_response_to_STATUS_ENQUIRY_txt">Response to STATUS ENQUIRY</string>
+ <string name="clh_callFailed_response_to_STATUS_ENQUIRY_txt">Couldn\'t complete call. Error code 30.</string>
<!-- In-call screen: call failure reason (Cause Number 31) -->
- <string name="clh_callFailed_normal_unspecified_txt">Normal, unspecified</string>
+ <string name="clh_callFailed_normal_unspecified_txt">Couldn\'t complete call. Error code 31.</string>
<!-- In-call screen: call failure reason (Cause Number 34) -->
- <string name="clh_callFailed_no_circuit_available_txt">No circuit/channel available</string>
+ <string name="clh_callFailed_no_circuit_available_txt">Couldn\'t complete call. Error code 34.</string>
<!-- In-call screen: call failure reason (Cause Number 38) -->
- <string name="clh_callFailed_network_out_of_order_txt">Network out of order</string>
+ <string name="clh_callFailed_network_out_of_order_txt">Couldn\'t complete call. Error code 38.</string>
<!-- In-call screen: call failure reason (Cause Number 41) -->
- <string name="clh_callFailed_temporary_failure_txt">Temporary failure</string>
+ <string name="clh_callFailed_temporary_failure_txt">Couldn\'t complete call. Error code 41.</string>
<!-- In-call screen: call failure reason (Cause Number 42) -->
- <string name="clh_callFailed_switching_equipment_congestion_txt">Switching equipment congestion</string>
+ <string name="clh_callFailed_switching_equipment_congestion_txt">Couldn\'t complete call. Error code 42.</string>
<!-- In-call screen: call failure reason (Cause Number 43) -->
- <string name="clh_callFailed_access_information_discarded_txt">Access information discarded</string>
+ <string name="clh_callFailed_access_information_discarded_txt">Couldn\'t complete call. Error code 43.</string>
<!-- In-call screen: call failure reason (Cause Number 44) -->
- <string name="clh_callFailed_requested_circuit_txt">Requested circuit/channel not available</string>
+ <string name="clh_callFailed_requested_circuit_txt">Couldn\'t complete call. Error code 44.</string>
<!-- In-call screen: call failure reason (Cause Number 47) -->
- <string name="clh_callFailed_resources_unavailable_unspecified_txt">Resources unavailable, unspecified</string>
+ <string name="clh_callFailed_resources_unavailable_unspecified_txt">Couldn\'t complete call. Error code 47.</string>
<!-- In-call screen: call failure reason (Cause Number 49) -->
- <string name="clh_callFailed_quality_of_service_unavailable_txt">Quality of service unavailable</string>
+ <string name="clh_callFailed_quality_of_service_unavailable_txt">Couldn\'t complete call. Error code 49.</string>
<!-- In-call screen: call failure reason (Cause Number 50) -->
- <string name="clh_callFailed_requested_facility_not_subscribed_txt">Requested facility not subscribed</string>
+ <string name="clh_callFailed_requested_facility_not_subscribed_txt">Couldn\'t complete call. Error code 50.</string>
<!-- In-call screen: call failure reason (Cause Number 55) -->
- <string name="clh_callFailed_incoming_calls_barred_within_the_CUG_txt">Incoming calls barred within the CUG</string>
+ <string name="clh_callFailed_incoming_calls_barred_within_the_CUG_txt">Couldn\'t complete call. Error code 55.</string>
<!-- In-call screen: call failure reason (Cause Number 57) -->
- <string name="clh_callFailed_bearer_capability_not_authorized_txt">Bearer capability not authorized</string>
+ <string name="clh_callFailed_bearer_capability_not_authorized_txt">Couldn\'t complete call. Error code 57.</string>
<!-- In-call screen: call failure reason (Cause Number 58) -->
- <string name="clh_callFailed_bearer_capability_not_presently_available_txt">Bearer capability not presently available</string>
+ <string name="clh_callFailed_bearer_capability_not_presently_available_txt">Couldn\'t complete call. Error code 58.</string>
<!-- In-call screen: call failure reason (Cause Number 63) -->
- <string name="clh_callFailed_service_or_option_not_available_unspecified_txt">Service or option not available, unspecified</string>
+ <string name="clh_callFailed_service_or_option_not_available_unspecified_txt">Couldn\'t complete call. Error code 63.</string>
<!-- In-call screen: call failure reason (Cause Number 65) -->
- <string name="clh_callFailed_bearer_service_not_implemented_txt">Bearer service not implemented</string>
+ <string name="clh_callFailed_bearer_service_not_implemented_txt">Couldn\'t complete call. Error code 65.</string>
<!-- In-call screen: call failure reason (Cause Number 68) -->
- <string name="clh_callFailed_ACM_equal_to_or_greater_than_ACMmax_txt">ACM equal to or greater than ACMmax</string>
+ <string name="clh_callFailed_ACM_equal_to_or_greater_than_ACMmax_txt">Couldn\'t complete call. Error code 68.</string>
<!-- In-call screen: call failure reason (Cause Number 69) -->
- <string name="clh_callFailed_requested_facility_not_implemented_txt">Requested facility not implemented</string>
+ <string name="clh_callFailed_requested_facility_not_implemented_txt">Couldn\'t complete call. Error code 69.</string>
<!-- In-call screen: call failure reason (Cause Number 70) -->
- <string name="clh_callFailed_only_restricted_digital_information_bearer_capability_is_available_txt">Only restricted digital information bearer capability is available</string>
+ <string name="clh_callFailed_only_restricted_digital_information_bearer_capability_is_available_txt">Couldn\'t complete call. Error code 70.</string>
<!-- In-call screen: call failure reason (Cause Number 79) -->
- <string name="clh_callFailed_service_or_option_not_implemented_unspecified_txt">Service or option not implemented, unspecified</string>
+ <string name="clh_callFailed_service_or_option_not_implemented_unspecified_txt">Couldn\'t complete call. Error code 79.</string>
<!-- In-call screen: call failure reason (Cause Number 81) -->
- <string name="clh_callFailed_invalid_transaction_identifier_value_txt">Invalid transaction identifier value</string>
+ <string name="clh_callFailed_invalid_transaction_identifier_value_txt">Couldn\'t complete call. Error code 81.</string>
<!-- In-call screen: call failure reason (Cause Number 87) -->
- <string name="clh_callFailed_user_not_member_of_CUG_txt">User not member of CUG</string>
+ <string name="clh_callFailed_user_not_member_of_CUG_txt">Couldn\'t complete call. Error code 87.</string>
<!-- In-call screen: call failure reason (Cause Number 88) -->
- <string name="clh_callFailed_incompatible_destination_txt">Incompatible destination</string>
+ <string name="clh_callFailed_incompatible_destination_txt">Couldn\'t complete call. Error code 88.</string>
<!-- In-call screen: call failure reason (Cause Number 91) -->
- <string name="clh_callFailed_invalid_transit_network_selection_txt">Invalid transit network selection</string>
+ <string name="clh_callFailed_invalid_transit_network_selection_txt">Couldn\'t complete call. Error code 91.</string>
<!-- In-call screen: call failure reason (Cause Number 95) -->
- <string name="clh_callFailed_semantically_incorrect_message_txt">Semantically incorrect message</string>
+ <string name="clh_callFailed_semantically_incorrect_message_txt">Couldn\'t complete call. Error code 95.</string>
<!-- In-call screen: call failure reason (Cause Number 96) -->
- <string name="clh_callFailed_invalid_mandatory_information_txt">Invalid mandatory information</string>
+ <string name="clh_callFailed_invalid_mandatory_information_txt">Couldn\'t complete call. Error code 96.</string>
<!-- In-call screen: call failure reason (Cause Number 97) -->
- <string name="clh_callFailed_message_type_non_existent_or_not_implemented_txt">Message type non-existent or not implemented</string>
+ <string name="clh_callFailed_message_type_non_existent_or_not_implemented_txt">Couldn\'t complete call. Error code 97.</string>
<!-- In-call screen: call failure reason (Cause Number 98) -->
- <string name="clh_callFailed_message_type_not_compatible_with_protocol_state_txt">Message type not compatible with protocol state</string>
+ <string name="clh_callFailed_message_type_not_compatible_with_protocol_state_txt">Couldn\'t complete call. Error code 98.</string>
<!-- In-call screen: call failure reason (Cause Number 99) -->
- <string name="clh_callFailed_information_element_non_existent_or_not_implemented_txt">Information element non-existent or not implemented</string>
+ <string name="clh_callFailed_information_element_non_existent_or_not_implemented_txt">Couldn\'t complete call. Error code 99.</string>
<!-- In-call screen: call failure reason (Cause Number 100) -->
- <string name="clh_callFailed_conditional_IE_error_txt">Conditional IE error</string>
+ <string name="clh_callFailed_conditional_IE_error_txt">Couldn\'t complete call. Error code 00.</string>
<!-- In-call screen: call failure reason (Cause Number 101) -->
- <string name="clh_callFailed_message_not_compatible_with_protocol_state_txt">Message not compatible with protocol state</string>
+ <string name="clh_callFailed_message_not_compatible_with_protocol_state_txt">Couldn\'t complete call. Error code 01.</string>
<!-- In-call screen: call failure reason (Cause Number 102) -->
- <string name="clh_callFailed_recovery_on_timer_expiry_txt">Recovery on timer expiry</string>
+ <string name="clh_callFailed_recovery_on_timer_expiry_txt">Couldn\'t complete call. Error code 02.</string>
<!-- In-call screen: call failure reason (Cause Number 111) -->
- <string name="clh_callFailed_protocol_Error_unspecified_txt">Protocol error, unspecified</string>
+ <string name="clh_callFailed_protocol_Error_unspecified_txt">Couldn\'t complete call. Error code 11.</string>
<!-- In-call screen: call failure reason (Cause Number 127) -->
- <string name="clh_callFailed_interworking_unspecified_txt">Interworking, unspecified</string>
+ <string name="clh_callFailed_interworking_unspecified_txt">Couldn\'t complete call. Error code 27.</string>
<!-- Call settings screen, setting option name -->
<string name="labelCallBarring">Call barring</string>
<!-- Call barring settings screen, setting summary text when a call barring option is activated -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 2b893e5..d003aec 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -187,6 +187,12 @@
<item name="android:preferenceScreenStyle">@style/SettingsPreferenceScreen</item>
</style>
+ <style name="TrimmedHorizontalProgressBar" parent="android:Widget.Material.ProgressBar.Horizontal">
+ <item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_material_trimmed</item>
+ <item name="android:minHeight">3dip</item>
+ <item name="android:maxHeight">3dip</item>
+ </style>
+
<style name="Empty" parent="@android:style/Theme.Material.Light">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 2c007f6..e674e74 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -32,4 +32,10 @@
android:persistent="true"
android:summary="@string/hac_mode_summary"/>
+ <SwitchPreference
+ android:key="button_rtt_key"
+ android:title="@string/rtt_mode_title"
+ android:persistent="true"
+ android:summary="@string/rtt_mode_summary"/>
+
</PreferenceScreen>
diff --git a/sip/src/com/android/services/telephony/sip/SipConnectionService.java b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
index a5f48d3..27be9b4 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnectionService.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
@@ -37,6 +37,7 @@
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.PhoneInternalInterface;
import com.android.internal.telephony.sip.SipPhone;
import com.android.services.telephony.DisconnectCauseUtil;
@@ -258,7 +259,9 @@
try {
com.android.internal.telephony.Connection originalConnection =
- phone.dial(number, request.getVideoState());
+ phone.dial(number, new PhoneInternalInterface.DialArgs.Builder<>()
+ .setVideoState(request.getVideoState())
+ .build());
return originalConnection;
} catch (CallStateException e) {
log("startCallWithPhone, exception: " + e);
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 5a228a8..8da980c 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -101,6 +101,7 @@
private SwitchPreference mButtonAutoRetry;
private PreferenceScreen mVoicemailSettingsScreen;
private SwitchPreference mEnableVideoCalling;
+ private Preference mButtonWifiCalling;
/*
* Click Listeners, handle click based on objects attached to UI.
@@ -194,7 +195,14 @@
public void onCallStateChanged(int state, String incomingNumber) {
if (DBG) log("PhoneStateListener onCallStateChanged: state is " + state);
if (mEnableVideoCalling != null) {
- mEnableVideoCalling.setEnabled(state == TelephonyManager.CALL_STATE_IDLE);
+ // Use TelephonyManager#getCallStete instead of 'state' parameter because it needs
+ // to check the current state of all phone calls.
+ TelephonyManager telephonyManager =
+ (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+ mEnableVideoCalling.setEnabled(
+ telephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE);
+ mButtonWifiCalling.setEnabled(
+ telephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE);
}
}
};
@@ -234,6 +242,8 @@
mButtonAutoRetry = (SwitchPreference) findPreference(BUTTON_RETRY_KEY);
mEnableVideoCalling = (SwitchPreference) findPreference(ENABLE_VIDEO_CALLING_KEY);
+ mButtonWifiCalling = findPreference(getResources().getString(
+ R.string.wifi_calling_settings_key));
PersistableBundle carrierConfig =
PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
@@ -304,9 +314,6 @@
/* tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); */
}
- Preference wifiCallingSettings = findPreference(
- getResources().getString(R.string.wifi_calling_settings_key));
-
final PhoneAccountHandle simCallManager = mTelecomManager.getSimCallManager();
if (simCallManager != null) {
Intent intent = PhoneAccountSettingsFragment.buildPhoneAccountConfigureIntent(
@@ -315,17 +322,17 @@
PackageManager pm = mPhone.getContext().getPackageManager();
List<ResolveInfo> resolutions = pm.queryIntentActivities(intent, 0);
if (!resolutions.isEmpty()) {
- wifiCallingSettings.setTitle(resolutions.get(0).loadLabel(pm));
- wifiCallingSettings.setSummary(null);
- wifiCallingSettings.setIntent(intent);
+ mButtonWifiCalling.setTitle(resolutions.get(0).loadLabel(pm));
+ mButtonWifiCalling.setSummary(null);
+ mButtonWifiCalling.setIntent(intent);
} else {
- prefSet.removePreference(wifiCallingSettings);
+ prefSet.removePreference(mButtonWifiCalling);
}
} else {
- prefSet.removePreference(wifiCallingSettings);
+ prefSet.removePreference(mButtonWifiCalling);
}
} else if (!mImsMgr.isWfcEnabledByPlatform() || !mImsMgr.isWfcProvisionedOnDevice()) {
- prefSet.removePreference(wifiCallingSettings);
+ prefSet.removePreference(mButtonWifiCalling);
} else {
int resId = com.android.internal.R.string.wifi_calling_off_summary;
if (mImsMgr.isWfcEnabledByUser()) {
@@ -345,19 +352,19 @@
if (DBG) log("Unexpected WFC mode value: " + wfcMode);
}
}
- wifiCallingSettings.setSummary(resId);
+ mButtonWifiCalling.setSummary(resId);
}
try {
if (mImsMgr.getImsServiceState() != ImsFeature.STATE_READY) {
log("Feature state not ready so remove vt and wfc settings for "
+ " phone =" + mPhone.getPhoneId());
- prefSet.removePreference(wifiCallingSettings);
+ prefSet.removePreference(mButtonWifiCalling);
prefSet.removePreference(mEnableVideoCalling);
}
} catch (ImsException ex) {
log("Exception when trying to get ImsServiceStatus: " + ex);
- prefSet.removePreference(wifiCallingSettings);
+ prefSet.removePreference(mButtonWifiCalling);
prefSet.removePreference(mEnableVideoCalling);
}
}
diff --git a/src/com/android/phone/IccNetworkDepersonalizationPanel.java b/src/com/android/phone/IccNetworkDepersonalizationPanel.java
index 9dff461..8bd10a2 100644
--- a/src/com/android/phone/IccNetworkDepersonalizationPanel.java
+++ b/src/com/android/phone/IccNetworkDepersonalizationPanel.java
@@ -74,7 +74,7 @@
/**
* Shows the network depersonalization dialog, but only if it is not already visible.
*/
- public static void showDialog() {
+ public static void showDialog(Phone phone) {
if (sShowingDialog) {
Log.i(TAG, "[IccNetworkDepersonalizationPanel] - showDialog; skipped already shown.");
return;
@@ -82,7 +82,7 @@
Log.i(TAG, "[IccNetworkDepersonalizationPanel] - showDialog; showing dialog.");
sShowingDialog = true;
IccNetworkDepersonalizationPanel ndpPanel =
- new IccNetworkDepersonalizationPanel(PhoneGlobals.getInstance());
+ new IccNetworkDepersonalizationPanel(PhoneGlobals.getInstance(), phone);
ndpPanel.show();
}
@@ -133,6 +133,13 @@
//constructor
public IccNetworkDepersonalizationPanel(Context context) {
super(context);
+ mPhone = PhoneGlobals.getPhone();
+ }
+
+ //constructor
+ public IccNetworkDepersonalizationPanel(Context context, Phone phone) {
+ super(context);
+ mPhone = phone == null ? PhoneGlobals.getPhone() : phone;
}
@Override
@@ -172,8 +179,6 @@
//status panel is used since we're having problems with the alert dialog.
mStatusPanel = (LinearLayout) findViewById(R.id.status_panel);
mStatusText = (TextView) findViewById(R.id.status_text);
-
- mPhone = PhoneGlobals.getPhone();
}
@Override
diff --git a/src/com/android/phone/LocationAccessPolicy.java b/src/com/android/phone/LocationAccessPolicy.java
deleted file mode 100644
index 6f2a5ec..0000000
--- a/src/com/android/phone/LocationAccessPolicy.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2017 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.phone;
-
-import android.Manifest;
-import android.annotation.NonNull;
-import android.annotation.UserIdInt;
-import android.app.ActivityManager;
-import android.app.AppOpsManager;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.pm.UserInfo;
-import android.os.Build;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.provider.Settings;
-
-import java.util.List;
-
-/**
- * Helper for performing location access checks.
- */
-final class LocationAccessPolicy {
-
- private LocationAccessPolicy() {
- /* do nothing - hide ctor */
- }
-
- /**
- * API to determine if the caller has permissions to get cell location.
- *
- * @param pkgName Package name of the application requesting access
- * @param uid The uid of the package
- * @param message Message to add to the exception if no location permission
- * @return boolean true or false if permissions is granted
- */
- static boolean canAccessCellLocation(@NonNull Context context, @NonNull String pkgName,
- int uid, String message) throws SecurityException {
- context.getSystemService(AppOpsManager.class).checkPackage(uid, pkgName);
- // We always require the location permission and also require the
- // location mode to be on for non-legacy apps. Legacy apps are
- // required to be in the foreground to at least mitigate the case
- // where a legacy app the user is not using tracks their location.
-
- // Grating ACCESS_FINE_LOCATION to an app automatically grants it ACCESS_COARSE_LOCATION.
- context.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION, message);
- final int opCode = AppOpsManager.permissionToOpCode(
- Manifest.permission.ACCESS_COARSE_LOCATION);
- if (opCode != AppOpsManager.OP_NONE && context.getSystemService(AppOpsManager.class)
- .noteOp(opCode, uid, pkgName) != AppOpsManager.MODE_ALLOWED) {
- return false;
- }
- if (!isLocationModeEnabled(context, UserHandle.getUserId(uid))
- && !isLegacyForeground(context, pkgName)) {
- return false;
- }
- // If the user or profile is current, permission is granted.
- // Otherwise, uid must have INTERACT_ACROSS_USERS_FULL permission.
- return isCurrentProfile(context, uid) || checkInteractAcrossUsersFull(context);
- }
-
- private static boolean isLocationModeEnabled(@NonNull Context context, @UserIdInt int userId) {
- return Settings.Secure.getIntForUser(context.getContentResolver(),
- Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF, userId)
- != Settings.Secure.LOCATION_MODE_OFF;
- }
-
- private static boolean isLegacyForeground(@NonNull Context context, @NonNull String pkgName) {
- return isLegacyVersion(context, pkgName) && isForegroundApp(context, pkgName);
- }
-
- private static boolean isLegacyVersion(@NonNull Context context, @NonNull String pkgName) {
- try {
- if (context.getPackageManager().getApplicationInfo(pkgName, 0)
- .targetSdkVersion <= Build.VERSION_CODES.O) {
- return true;
- }
- } catch (PackageManager.NameNotFoundException e) {
- // In case of exception, assume known app (more strict checking)
- // Note: This case will never happen since checkPackage is
- // called to verify validity before checking app's version.
- }
- return false;
- }
-
- private static boolean isForegroundApp(@NonNull Context context, @NonNull String pkgName) {
- final ActivityManager am = context.getSystemService(ActivityManager.class);
- final List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1);
- if (!tasks.isEmpty()) {
- return pkgName.equals(tasks.get(0).topActivity.getPackageName());
- }
- return false;
- }
-
- private static boolean checkInteractAcrossUsersFull(@NonNull Context context) {
- return context.checkCallingOrSelfPermission(
- android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
- == PackageManager.PERMISSION_GRANTED;
- }
-
- private static boolean isCurrentProfile(@NonNull Context context, int uid) {
- final int currentUser = ActivityManager.getCurrentUser();
- final int callingUserId = UserHandle.getUserId(uid);
- if (callingUserId == currentUser) {
- return true;
- } else {
- List<UserInfo> userProfiles = context.getSystemService(
- UserManager.class).getProfiles(currentUser);
- for (UserInfo user: userProfiles) {
- if (user.id == callingUserId) {
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 96309ad..5dc57dd 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -264,7 +264,7 @@
private boolean mIsGlobalCdma;
private boolean mUnavailable;
- private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
+ private class PhoneCallStateListener extends PhoneStateListener {
/*
* Enable/disable the 'Enhanced 4G LTE Mode' when in/out of a call
* and depending on TTY mode and TTY support over VoLTE.
@@ -275,16 +275,31 @@
public void onCallStateChanged(int state, String incomingNumber) {
if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
- int subId = mPhone != null
- ? mPhone.getSubId() : SubscriptionManager.INVALID_SUBSCRIPTION_ID;
- PersistableBundle carrierConfig =
- PhoneGlobals.getInstance().getCarrierConfigForSubId(subId);
- boolean enabled = is4gLtePrefEnabled(carrierConfig);
- Preference pref = getPreferenceScreen().findPreference(BUTTON_4G_LTE_KEY);
- if (pref != null) pref.setEnabled(enabled && hasActiveSubscriptions());
-
+ updateEnhanced4gLteState();
+ updateWiFiCallState();
+ updateVideoCallState();
}
- };
+
+ /*
+ * Listen to different subId if mPhone is updated.
+ */
+ protected void updatePhone() {
+ int newSubId = (mPhone != null
+ && SubscriptionManager.isValidSubscriptionId(mPhone.getSubId()))
+ ? mPhone.getSubId()
+ : SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+
+ // Now, listen to new subId if it's valid.
+ mTelephonyManager.listen(this, PhoneStateListener.LISTEN_NONE);
+
+ mSubId = newSubId;
+ if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
+ mTelephonyManager.listen(this, PhoneStateListener.LISTEN_CALL_STATE);
+ }
+ }
+ }
+
+ private final PhoneCallStateListener mPhoneStateListener = new PhoneCallStateListener();
/**
* Service connection code for the NetworkQueryService.
@@ -576,7 +591,6 @@
int phoneId = SubscriptionManager.getPhoneId(sir.getSubscriptionId());
if (SubscriptionManager.isValidPhoneId(phoneId)) {
mPhone = PhoneFactory.getPhone(phoneId);
- mImsMgr = ImsManager.getInstance(getContext(), phoneId);
}
}
if (mPhone == null) {
@@ -586,11 +600,14 @@
Log.i(LOG_TAG, "updatePhone:- slotId=" + slotId + " sir=" + sir);
mImsMgr = ImsManager.getInstance(mPhone.getContext(), mPhone.getPhoneId());
+ mTelephonyManager = new TelephonyManager(mPhone.getContext(), mPhone.getSubId());
if (mImsMgr == null) {
log("updatePhone :: Could not get ImsManager instance!");
} else if (DBG) {
log("updatePhone :: mImsMgr=" + mImsMgr);
}
+
+ mPhoneStateListener.updatePhone();
}
private TabHost.TabContentFactory mEmptyTabContent = new TabHost.TabContentFactory() {
@@ -1044,7 +1061,6 @@
* but you do need to remember that this all needs to work when subscriptions
* change dynamically such as when hot swapping sims.
*/
- boolean canChange4glte = is4gLtePrefEnabled(carrierConfig);
boolean useVariant4glteTitle = carrierConfig.getBoolean(
CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_BOOL);
int enhanced4glteModeTitleId = useVariant4glteTitle ?
@@ -1054,7 +1070,6 @@
mButtonPreferredNetworkMode.setEnabled(hasActiveSubscriptions);
mButtonEnabledNetworks.setEnabled(hasActiveSubscriptions);
mButton4glte.setTitle(enhanced4glteModeTitleId);
- mButton4glte.setEnabled(hasActiveSubscriptions && canChange4glte);
mLteDataServicePref.setEnabled(hasActiveSubscriptions);
Preference ps;
ps = findPreference(BUTTON_CELL_BROADCAST_SETTINGS);
@@ -1268,7 +1283,8 @@
}
private boolean is4gLtePrefEnabled(PersistableBundle carrierConfig) {
- return (mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)
+ return (mTelephonyManager.getCallState(mPhone.getSubId())
+ == TelephonyManager.CALL_STATE_IDLE)
&& mImsMgr != null
&& mImsMgr.isNonTtyOrTtyOnVolteEnabled()
&& carrierConfig.getBoolean(
@@ -1658,6 +1674,8 @@
mCallingCategory.removePreference(mWiFiCallingPref);
} else {
mCallingCategory.addPreference(mWiFiCallingPref);
+ mWiFiCallingPref.setEnabled(mTelephonyManager.getCallState(mPhone.getSubId())
+ == TelephonyManager.CALL_STATE_IDLE && hasActiveSubscriptions());
}
}
@@ -1678,7 +1696,8 @@
CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL))) {
getPreferenceScreen().removePreference(mButton4glte);
} else {
- // NOTE: Buttons will be enabled/disabled in mPhoneStateListener
+ mButton4glte.setEnabled(is4gLtePrefEnabled(carrierConfig)
+ && hasActiveSubscriptions());
boolean enh4glteMode = mImsMgr.isEnhanced4gLteModeSettingEnabledByUser()
&& mImsMgr.isNonTtyOrTtyOnVolteEnabled();
mButton4glte.setChecked(enh4glteMode);
@@ -1708,7 +1727,8 @@
mVideoCallingPref.setEnabled(false);
mVideoCallingPref.setChecked(false);
} else {
- mVideoCallingPref.setEnabled(true);
+ mVideoCallingPref.setEnabled(mTelephonyManager.getCallState(mPhone.getSubId())
+ == TelephonyManager.CALL_STATE_IDLE && hasActiveSubscriptions());
mVideoCallingPref.setChecked(mImsMgr.isVtEnabledByUser());
mVideoCallingPref.setOnPreferenceChangeListener(this);
}
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 2d0b99d..3b65f40 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -199,7 +199,8 @@
// The user won't be able to do anything else until
// they enter a valid SIM network PIN.
Log.i(LOG_TAG, "show sim depersonal panel");
- IccNetworkDepersonalizationPanel.showDialog();
+ Phone phone = (Phone) ((AsyncResult) msg.obj).userObj;
+ IccNetworkDepersonalizationPanel.showDialog(phone);
}
break;
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
old mode 100644
new mode 100755
index f10a609..b70f9eb
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -55,6 +55,7 @@
import android.telephony.CellInfo;
import android.telephony.ClientRequestStats;
import android.telephony.IccOpenLogicalChannelResponse;
+import android.telephony.LocationAccessPolicy;
import android.telephony.ModemActivityInfo;
import android.telephony.NeighboringCellInfo;
import android.telephony.NetworkScanRequest;
@@ -74,6 +75,7 @@
import android.telephony.ims.aidl.IImsMmTelFeature;
import android.telephony.ims.aidl.IImsRcsFeature;
import android.telephony.ims.aidl.IImsRegistration;
+import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
@@ -100,6 +102,7 @@
import com.android.internal.telephony.RIL;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.SubscriptionController;
+import com.android.internal.telephony.TelephonyPermissions;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.euicc.EuiccConnector;
import com.android.internal.telephony.uicc.IccIoResult;
@@ -108,6 +111,7 @@
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.uicc.UiccController;
+import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.telephony.uicc.UiccSlot;
import com.android.internal.telephony.util.VoicemailNotificationSettingsUtil;
import com.android.internal.util.HexDump;
@@ -623,7 +627,7 @@
uiccCard = getUiccCardFromRequest(request);
if (uiccCard == null) {
loge("iccCloseLogicalChannel: No UICC");
- request.result = new IccIoResult(0x6F, 0, (byte[])null);
+ request.result = false;
synchronized (request) {
request.notifyAll();
}
@@ -1252,7 +1256,8 @@
@Override
public boolean isOffhookForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "isOffhookForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "isOffhookForSubscriber")) {
return false;
}
@@ -1271,7 +1276,8 @@
@Override
public boolean isRingingForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "isRingingForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "isRingingForSubscriber")) {
return false;
}
@@ -1290,7 +1296,8 @@
@Override
public boolean isIdleForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "isIdleForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "isIdleForSubscriber")) {
return false;
}
@@ -1465,7 +1472,8 @@
@Override
public boolean isRadioOnForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "isRadioOnForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "isRadioOnForSubscriber")) {
return false;
}
return isRadioOnForSubscriber(subId);
@@ -1652,8 +1660,10 @@
@Override
public Bundle getCellLocation(String callingPackage) {
+ mPhone.getContext().getSystemService(AppOpsManager.class)
+ .checkPackage(Binder.getCallingUid(), callingPackage);
if (!LocationAccessPolicy.canAccessCellLocation(mPhone.getContext(),
- callingPackage, Binder.getCallingUid(), "getCellLocation")) {
+ callingPackage, Binder.getCallingUid(),Binder.getCallingPid())) {
return null;
}
@@ -1720,8 +1730,10 @@
@Override
@SuppressWarnings("unchecked")
public List<NeighboringCellInfo> getNeighboringCellInfo(String callingPackage) {
+ mPhone.getContext().getSystemService(AppOpsManager.class)
+ .checkPackage(Binder.getCallingUid(), callingPackage);
if (!LocationAccessPolicy.canAccessCellLocation(mPhone.getContext(),
- callingPackage, Binder.getCallingUid(), "getNeighboringCellInfo")) {
+ callingPackage, Binder.getCallingUid(), Binder.getCallingPid())) {
return null;
}
@@ -1748,8 +1760,10 @@
@Override
public List<CellInfo> getAllCellInfo(String callingPackage) {
+ mPhone.getContext().getSystemService(AppOpsManager.class)
+ .checkPackage(Binder.getCallingUid(), callingPackage);
if (!LocationAccessPolicy.canAccessCellLocation(mPhone.getContext(),
- callingPackage, Binder.getCallingUid(), "getAllCellInfo")) {
+ callingPackage, Binder.getCallingUid(), Binder.getCallingPid())) {
return null;
}
@@ -1772,16 +1786,18 @@
@Override
public String getImeiForSlot(int slotIndex, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getImeiForSlot")) {
- return null;
- }
- Phone phone = PhoneFactory.getPhone(slotIndex);
- return phone == null ? null : phone.getImei();
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getImeiForSlot")) {
+ return null;
+ }
+ Phone phone = PhoneFactory.getPhone(slotIndex);
+ return phone == null ? null : phone.getImei();
}
@Override
public String getMeidForSlot(int slotIndex, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getMeidForSlot")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getMeidForSlot")) {
return null;
}
Phone phone = PhoneFactory.getPhone(slotIndex);
@@ -1790,11 +1806,12 @@
@Override
public String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getDeviceSoftwareVersionForSlot")) {
- return null;
- }
- Phone phone = PhoneFactory.getPhone(slotIndex);
- return phone == null ? null : phone.getDeviceSvn();
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getDeviceSoftwareVersionForSlot")) {
+ return null;
+ }
+ Phone phone = PhoneFactory.getPhone(slotIndex);
+ return phone == null ? null : phone.getDeviceSvn();
}
@Override
@@ -1823,35 +1840,6 @@
}
/**
- * Make sure either system app or the caller has carrier privilege.
- *
- * @throws SecurityException if the caller does not have the required permission/privilege
- */
- private void enforceModifyPermissionOrCarrierPrivilege(int subId) {
- int permission = mApp.checkCallingOrSelfPermission(
- android.Manifest.permission.MODIFY_PHONE_STATE);
- if (permission == PackageManager.PERMISSION_GRANTED) {
- return;
- }
-
- log("No modify permission, check carrier privilege next.");
- enforceCarrierPrivilege(subId);
- }
-
- /**
- * Make sure the caller has carrier privilege.
- *
- * @throws SecurityException if the caller does not have the required permission
- */
- private void enforceCarrierPrivilege(int subId) {
- if (getCarrierPrivilegeStatus(subId) !=
- TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
- loge("No Carrier Privilege.");
- throw new SecurityException("No Carrier Privilege.");
- }
- }
-
- /**
* Make sure the caller has the CALL_PHONE permission.
*
* @throws SecurityException if the caller does not have the required permission
@@ -1911,7 +1899,8 @@
@Override
public int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getCdmaEriIconIndexForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getCdmaEriIconIndexForSubscriber")) {
return -1;
}
final Phone phone = getPhone(subId);
@@ -1934,7 +1923,8 @@
@Override
public int getCdmaEriIconModeForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getCdmaEriIconModeForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getCdmaEriIconModeForSubscriber")) {
return -1;
}
final Phone phone = getPhone(subId);
@@ -1955,7 +1945,8 @@
@Override
public String getCdmaEriTextForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getCdmaEriIconTextForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getCdmaEriIconTextForSubscriber")) {
return null;
}
final Phone phone = getPhone(subId);
@@ -1971,7 +1962,8 @@
*/
@Override
public String getCdmaMdn(int subId) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "getCdmaMdn");
final Phone phone = getPhone(subId);
if (mPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA && phone != null) {
return phone.getLine1Number();
@@ -1985,7 +1977,8 @@
*/
@Override
public String getCdmaMin(int subId) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "getCdmaMin");
final Phone phone = getPhone(subId);
if (phone != null && phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
return phone.getCdmaMin();
@@ -2006,7 +1999,7 @@
*/
@Override
public boolean setVoiceMailNumber(int subId, String alphaTag, String number) {
- enforceCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(subId, "setVoiceMailNumber");
Boolean success = (Boolean) sendRequest(CMD_SET_VOICEMAIL_NUMBER,
new Pair<String, String>(alphaTag, number), new Integer(subId));
return success;
@@ -2029,7 +2022,8 @@
@Override
public String getVisualVoicemailPackageName(String callingPackage, int subId) {
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
- if (!canReadPhoneState(callingPackage, "getVisualVoicemailPackageName")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getVisualVoicemailPackageName")) {
return null;
}
return RemoteVvmTaskManager.getRemotePackage(mPhone.getContext(), subId).getPackageName();
@@ -2093,7 +2087,8 @@
*/
@Override
public void setVoiceActivationState(int subId, int activationState) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setVoiceActivationState");
final Phone phone = getPhone(subId);
if (phone != null) {
phone.setVoiceActivationState(activationState);
@@ -2107,7 +2102,8 @@
*/
@Override
public void setDataActivationState(int subId, int activationState) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setDataActivationState");
final Phone phone = getPhone(subId);
if (phone != null) {
phone.setDataActivationState(activationState);
@@ -2121,7 +2117,8 @@
*/
@Override
public int getVoiceActivationState(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getVoiceActivationStateForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getVoiceActivationStateForSubscriber")) {
return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
}
final Phone phone = getPhone(subId);
@@ -2137,7 +2134,8 @@
*/
@Override
public int getDataActivationState(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getDataActivationStateForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getDataActivationStateForSubscriber")) {
return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
}
final Phone phone = getPhone(subId);
@@ -2188,7 +2186,8 @@
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
String defaultDialer = TelecomManager.from(mPhone.getContext()).getDefaultDialerPackage();
if (!TextUtils.equals(callingPackage, defaultDialer)) {
- enforceCarrierPrivilege(getDefaultSubscription());
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(
+ getDefaultSubscription(), "sendDialerSpecialCode");
}
mPhone.sendDialerSpecialCode(inputCode);
}
@@ -2214,7 +2213,8 @@
*/
@Override
public int getNetworkTypeForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getNetworkTypeForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -2239,7 +2239,8 @@
*/
@Override
public int getDataNetworkTypeForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getDataNetworkTypeForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getDataNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -2256,7 +2257,8 @@
*/
@Override
public int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getDataNetworkTypeForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getDataNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -2306,7 +2308,8 @@
@Override
public int getLteOnCdmaModeForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getLteOnCdmaModeForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getLteOnCdmaModeForSubscriber")) {
return PhoneConstants.LTE_ON_CDMA_UNKNOWN;
}
@@ -2363,7 +2366,8 @@
@Override
public IccOpenLogicalChannelResponse iccOpenLogicalChannel(
int subId, String callingPackage, String aid, int p2) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "iccOpenLogicalChannel");
if (TextUtils.equals(ISDR_AID, aid)) {
// Only allows LPA to open logical channel to ISD-R.
@@ -2386,7 +2390,8 @@
@Override
public boolean iccCloseLogicalChannel(int subId, int channel) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "iccCloseLogicalChannel");
if (DBG) log("iccCloseLogicalChannel: subId=" + subId + " chnl=" + channel);
if (channel < 0) {
@@ -2400,7 +2405,8 @@
@Override
public String iccTransmitApduLogicalChannel(int subId, int channel, int cla,
int command, int p1, int p2, int p3, String data) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "iccTransmitApduLogicalChannel");
if (DBG) {
log("iccTransmitApduLogicalChannel: subId=" + subId + " chnl=" + channel +
@@ -2428,7 +2434,8 @@
@Override
public String iccTransmitApduBasicChannel(int subId, String callingPackage, int cla,
int command, int p1, int p2, int p3, String data) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "iccTransmitApduBasicChannel");
if (command == SELECT_COMMAND && p1 == SELECT_P1 && p2 == SELECT_P2 && p3 == SELECT_P3
&& TextUtils.equals(ISDR_AID, data)) {
@@ -2464,7 +2471,8 @@
@Override
public byte[] iccExchangeSimIO(int subId, int fileID, int command, int p1, int p2, int p3,
String filePath) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "iccExchangeSimIO");
if (DBG) {
log("Exchange SIM_IO " + subId + ":" + fileID + ":" + command + " " +
@@ -2517,7 +2525,8 @@
@Override
public String sendEnvelopeWithStatus(int subId, String content) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "sendEnvelopeWithStatus");
IccIoResult response = (IccIoResult)sendRequest(CMD_SEND_ENVELOPE, content, subId);
if (response.payload == null) {
@@ -2540,7 +2549,8 @@
*/
@Override
public String nvReadItem(int itemID) {
- enforceModifyPermissionOrCarrierPrivilege(getDefaultSubscription());
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, getDefaultSubscription(), "nvReadItem");
if (DBG) log("nvReadItem: item " + itemID);
String value = (String) sendRequest(CMD_NV_READ_ITEM, itemID);
if (DBG) log("nvReadItem: item " + itemID + " is \"" + value + '"');
@@ -2557,7 +2567,8 @@
*/
@Override
public boolean nvWriteItem(int itemID, String itemValue) {
- enforceModifyPermissionOrCarrierPrivilege(getDefaultSubscription());
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, getDefaultSubscription(), "nvWriteItem");
if (DBG) log("nvWriteItem: item " + itemID + " value \"" + itemValue + '"');
Boolean success = (Boolean) sendRequest(CMD_NV_WRITE_ITEM,
new Pair<Integer, String>(itemID, itemValue));
@@ -2574,7 +2585,8 @@
*/
@Override
public boolean nvWriteCdmaPrl(byte[] preferredRoamingList) {
- enforceModifyPermissionOrCarrierPrivilege(getDefaultSubscription());
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, getDefaultSubscription(), "nvWriteCdmaPrl");
if (DBG) log("nvWriteCdmaPrl: value: " + HexDump.toHexString(preferredRoamingList));
Boolean success = (Boolean) sendRequest(CMD_NV_WRITE_CDMA_PRL, preferredRoamingList);
if (DBG) log("nvWriteCdmaPrl: " + (success ? "ok" : "fail"));
@@ -2590,7 +2602,8 @@
*/
@Override
public boolean nvResetConfig(int resetType) {
- enforceModifyPermissionOrCarrierPrivilege(getDefaultSubscription());
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, getDefaultSubscription(), "nvResetConfig");
if (DBG) log("nvResetConfig: type " + resetType);
Boolean success = (Boolean) sendRequest(CMD_NV_RESET_CONFIG, resetType);
if (DBG) log("nvResetConfig: type " + resetType + ' ' + (success ? "ok" : "fail"));
@@ -2607,7 +2620,8 @@
}
public String[] getPcscfAddress(String apnType, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getPcscfAddress")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getPcscfAddress")) {
return new String[0];
}
@@ -2673,6 +2687,14 @@
return PhoneFactory.getImsResolver().getImsConfig(slotId, feature);
}
+ /**
+ * @return true if emergency calling is available on IMS, false if it should fallback to CS.
+ */
+ public boolean isEmergencyMmTelAvailable(int slotId) {
+ enforceModifyPermission();
+ return PhoneFactory.getImsResolver().isEmergencyMmTelAvailable(slotId);
+ }
+
public void setImsRegistrationState(boolean registered) {
enforceModifyPermission();
mPhone.setImsRegistrationState(registered);
@@ -2684,7 +2706,8 @@
*/
@Override
public void setNetworkSelectionModeAutomatic(int subId) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setNetworkSelectionModeAutomatic");
if (DBG) log("setNetworkSelectionModeAutomatic: subId " + subId);
sendRequest(CMD_SET_NETWORK_SELECTION_MODE_AUTOMATIC, null, subId);
}
@@ -2695,7 +2718,8 @@
@Override
public boolean setNetworkSelectionModeManual(int subId, String operatorNumeric,
boolean persistSelection) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setNetworkSelectionModeManual");
OperatorInfo operator = new OperatorInfo(
/* operatorAlphaLong */ "",
/* operatorAlphaShort */ "",
@@ -2711,7 +2735,8 @@
*/
@Override
public CellNetworkScanResult getCellNetworkScanResults(int subId) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "getCellNetworkScanResults");
if (DBG) log("getCellNetworkScanResults: subId " + subId);
CellNetworkScanResult result = (CellNetworkScanResult) sendRequest(
CMD_PERFORM_NETWORK_SCAN, null, subId);
@@ -2730,7 +2755,8 @@
@Override
public int requestNetworkScan(int subId, NetworkScanRequest request, Messenger messenger,
IBinder binder) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "requestNetworkScan");
return mNetworkScanRequestTracker.startNetworkScan(
request, messenger, binder, getPhone(subId));
}
@@ -2743,7 +2769,8 @@
*/
@Override
public void stopNetworkScan(int subId, int scanId) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "stopNetworkScan");
mNetworkScanRequestTracker.stopNetworkScan(scanId);
}
@@ -2755,7 +2782,8 @@
*/
@Override
public int getCalculatedPreferredNetworkType(String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getCalculatedPreferredNetworkType")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getCalculatedPreferredNetworkType")) {
return RILConstants.PREFERRED_NETWORK_MODE;
}
@@ -2770,7 +2798,8 @@
*/
@Override
public int getPreferredNetworkType(int subId) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "getPreferredNetworkType");
if (DBG) log("getPreferredNetworkType");
int[] result = (int[]) sendRequest(CMD_GET_PREFERRED_NETWORK_TYPE, null, subId);
int networkType = (result != null ? result[0] : -1);
@@ -2787,7 +2816,8 @@
*/
@Override
public boolean setPreferredNetworkType(int subId, int networkType) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setPreferredNetworkType");
if (DBG) log("setPreferredNetworkType: subId " + subId + " type " + networkType);
Boolean success = (Boolean) sendRequest(CMD_SET_PREFERRED_NETWORK_TYPE, networkType, subId);
if (DBG) log("setPreferredNetworkType: " + (success ? "ok" : "fail"));
@@ -2827,7 +2857,8 @@
*/
@Override
public void setUserDataEnabled(int subId, boolean enable) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setUserDataEnabled");
int phoneId = mSubscriptionController.getPhoneId(subId);
if (DBG) log("setUserDataEnabled: subId=" + subId + " phoneId=" + phoneId);
Phone phone = PhoneFactory.getPhone(phoneId);
@@ -2870,7 +2901,8 @@
mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
null);
} catch (Exception e) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "isUserDataEnabled");
}
int phoneId = mSubscriptionController.getPhoneId(subId);
if (DBG) log("isUserDataEnabled: subId=" + subId + " phoneId=" + phoneId);
@@ -2901,7 +2933,8 @@
mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
null);
} catch (Exception e) {
- enforceModifyPermissionOrCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "isDataEnabled");
}
int phoneId = mSubscriptionController.getPhoneId(subId);
if (DBG) log("isDataEnabled: subId=" + subId + " phoneId=" + phoneId);
@@ -2933,6 +2966,22 @@
}
@Override
+ public int getCarrierPrivilegeStatusForUid(int subId, int uid) {
+ final Phone phone = getPhone(subId);
+ if (phone == null) {
+ loge("getCarrierPrivilegeStatus: Invalid subId");
+ return TelephonyManager.CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
+ }
+ UiccProfile profile =
+ UiccController.getInstance().getUiccProfileForPhone(phone.getPhoneId());
+ if (profile == null) {
+ loge("getCarrierPrivilegeStatus: No UICC");
+ return TelephonyManager.CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED;
+ }
+ return profile.getCarrierPrivilegeStatusForUid(phone.getContext().getPackageManager(), uid);
+ }
+
+ @Override
public int checkCarrierPrivilegesForPackage(String pkgName) {
if (TextUtils.isEmpty(pkgName))
return TelephonyManager.CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
@@ -3031,7 +3080,8 @@
@Override
public boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag,
String number) {
- enforceCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(
+ subId, "setLine1NumberForDisplayForSubscriber");
final String iccId = getIccId(subId);
final Phone phone = getPhone(subId);
@@ -3077,7 +3127,8 @@
@Override
public String getLine1NumberForDisplay(int subId, String callingPackage) {
// This is open to apps with WRITE_SMS.
- if (!canReadPhoneNumber(callingPackage, "getLine1NumberForDisplay")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneNumber(
+ mApp, callingPackage, "getLine1NumberForDisplay")) {
if (DBG_MERGE) log("getLine1NumberForDisplay returning null due to permission");
return null;
}
@@ -3097,7 +3148,8 @@
@Override
public String getLine1AlphaTagForDisplay(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getLine1AlphaTagForDisplay")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getLine1AlphaTagForDisplay")) {
return null;
}
@@ -3111,7 +3163,8 @@
@Override
public String[] getMergedSubscriberIds(String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getMergedSubscriberIds")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getMergedSubscriberIds")) {
return null;
}
final Context context = mPhone.getContext();
@@ -3184,7 +3237,8 @@
@Override
public boolean setOperatorBrandOverride(int subId, String brand) {
- enforceCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(
+ subId, "setOperatorBrandOverride");
final Phone phone = getPhone(subId);
return phone == null ? false : phone.setOperatorBrandOverride(brand);
}
@@ -3193,7 +3247,7 @@
public boolean setRoamingOverride(int subId, List<String> gsmRoamingList,
List<String> gsmNonRoamingList, List<String> cdmaRoamingList,
List<String> cdmaNonRoamingList) {
- enforceCarrierPrivilege(subId);
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(subId, "setRoamingOverride");
final Phone phone = getPhone(subId);
if (phone == null) {
return false;
@@ -3213,7 +3267,8 @@
@Override
public int getRadioAccessFamily(int phoneId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getRadioAccessFamily")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getRadioAccessFamily")) {
return RadioAccessFamily.RAF_UNKNOWN;
}
@@ -3228,7 +3283,8 @@
@Override
public boolean isVideoCallingEnabled(String callingPackage) {
- if (!canReadPhoneState(callingPackage, "isVideoCallingEnabled")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "isVideoCallingEnabled")) {
return false;
}
@@ -3265,6 +3321,14 @@
return mPhone.getContext().getResources().getBoolean(R.bool.hac_enabled);
}
+ public boolean isRttSupported() {
+ boolean isCarrierSupported =
+ mApp.getCarrierConfig().getBoolean(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL);
+ boolean isDeviceSupported =
+ mPhone.getContext().getResources().getBoolean(R.bool.config_support_rtt);
+ return isCarrierSupported && isDeviceSupported;
+ }
+
/**
* Returns the unique device ID of phone, for example, the IMEI for
* GSM and the MEID for CDMA phones. Return null if device ID is not available.
@@ -3274,7 +3338,8 @@
*/
@Override
public String getDeviceId(String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getDeviceId")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getDeviceId")) {
return null;
}
@@ -3286,22 +3351,13 @@
}
}
- /*
- * {@hide}
- * Returns the IMS Registration Status
- */
- @Override
- public boolean isImsRegistered() {
- return mPhone.isImsRegistered();
- }
-
/**
* {@hide}
* Returns the IMS Registration Status on a particular subid
*
* @param subId
*/
- public boolean isImsRegisteredForSubscriber(int subId) {
+ public boolean isImsRegistered(int subId) {
Phone phone = getPhone(subId);
if (phone != null) {
return phone.isImsRegistered();
@@ -3315,93 +3371,53 @@
return PhoneUtils.getSubIdForPhoneAccount(phoneAccount);
}
- /*
- * {@hide}
- * Returns the IMS Registration Status
+ /**
+ * @return the VoWiFi calling availability.
*/
- public boolean isWifiCallingAvailable() {
- return mPhone.isWifiCallingEnabled();
- }
-
- /*
- * {@hide}
- * Returns the IMS Registration Status
- */
- public boolean isVolteAvailable() {
- return mPhone.isVolteEnabled();
- }
-
- /*
- * {@hide} Returns the IMS Registration Status
- */
- public boolean isVideoTelephonyAvailable() {
- return mPhone.isVideoEnabled();
- }
-
- private boolean canReadPhoneState(String callingPackage, String message) {
- try {
- mApp.enforceCallingOrSelfPermission(
- android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, message);
-
- // SKIP checking for run-time permission since caller or self has PRIVILEDGED permission
- return true;
- } catch (SecurityException e) {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
- message);
- }
-
- if (mAppOps.noteOp(AppOpsManager.OP_READ_PHONE_STATE, Binder.getCallingUid(),
- callingPackage) != AppOpsManager.MODE_ALLOWED) {
+ public boolean isWifiCallingAvailable(int subId) {
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ return phone.isWifiCallingEnabled();
+ } else {
return false;
}
-
- return true;
}
/**
- * Besides READ_PHONE_STATE, WRITE_SMS and READ_SMS also allow apps to get phone numbers.
+ * @return the VoLTE availability.
*/
- private boolean canReadPhoneNumber(String callingPackage, String message) {
- // Default SMS app can always read it.
- if (mAppOps.noteOp(AppOpsManager.OP_WRITE_SMS,
- Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED) {
- return true;
+ public boolean isVolteAvailable(int subId) {
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ return phone.isVolteEnabled();
+ } else {
+ return false;
}
+ }
- try {
- return canReadPhoneState(callingPackage, message);
- } catch (SecurityException readPhoneStateSecurityException) {
+ /**
+ * @return the VT calling availability.
+ */
+ public boolean isVideoTelephonyAvailable(int subId) {
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ return phone.isVideoEnabled();
+ } else {
+ return false;
}
- // Can be read with READ_SMS too.
- try {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_SMS, message);
- int opCode = mAppOps.permissionToOpCode(android.Manifest.permission.READ_SMS);
- if (opCode != AppOpsManager.OP_NONE) {
- return mAppOps.noteOp(opCode, Binder.getCallingUid(), callingPackage)
- == AppOpsManager.MODE_ALLOWED;
- } else {
- return true;
- }
- } catch (SecurityException readSmsSecurityException) {
- }
- // Can be read with READ_PHONE_NUMBERS too.
- try {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_NUMBERS,
- message);
- int opCode = mAppOps.permissionToOpCode(android.Manifest.permission.READ_PHONE_NUMBERS);
- if (opCode != AppOpsManager.OP_NONE) {
- return mAppOps.noteOp(opCode, Binder.getCallingUid(), callingPackage)
- == AppOpsManager.MODE_ALLOWED;
- } else {
- return true;
- }
- } catch (SecurityException readPhoneNumberSecurityException) {
- }
+ }
- throw new SecurityException(message + ": Neither user " + Binder.getCallingUid() +
- " nor current process has" + android.Manifest.permission.READ_PHONE_STATE +
- ", " + android.Manifest.permission.READ_SMS + ", or " +
- android.Manifest.permission.READ_PHONE_NUMBERS);
+ /**
+ * @return the IMS registration technology for the MMTEL feature. Valid return values are
+ * defined in {@link ImsRegistrationImplBase}.
+ */
+ public @ImsRegistrationImplBase.ImsRegistrationTech int getImsRegTechnologyForMmTel(int subId) {
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ return phone.getImsRegistrationTech();
+ } else {
+ return ImsRegistrationImplBase.REGISTRATION_TECH_NONE;
+ }
}
@Override
@@ -3534,7 +3550,8 @@
@Override
public ServiceState getServiceStateForSubscriber(int subId, String callingPackage) {
- if (!canReadPhoneState(callingPackage, "getServiceStateForSubscriber")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getServiceStateForSubscriber")) {
return null;
}
@@ -3581,8 +3598,9 @@
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
if (!TextUtils.equals(callingPackage,
TelecomManager.from(mPhone.getContext()).getDefaultDialerPackage())) {
- enforceModifyPermissionOrCarrierPrivilege(
- PhoneUtils.getSubIdForPhoneAccountHandle(phoneAccountHandle));
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, PhoneUtils.getSubIdForPhoneAccountHandle(phoneAccountHandle),
+ "setVoicemailRingtoneUri");
}
Phone phone = PhoneUtils.getPhoneForPhoneAccountHandle(phoneAccountHandle);
if (phone == null){
@@ -3625,8 +3643,9 @@
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
if (!TextUtils.equals(callingPackage,
TelecomManager.from(mPhone.getContext()).getDefaultDialerPackage())) {
- enforceModifyPermissionOrCarrierPrivilege(
- PhoneUtils.getSubIdForPhoneAccountHandle(phoneAccountHandle));
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, PhoneUtils.getSubIdForPhoneAccountHandle(phoneAccountHandle),
+ "setVoicemailVibrationEnabled");
}
Phone phone = PhoneUtils.getPhoneForPhoneAccountHandle(phoneAccountHandle);
@@ -3749,7 +3768,8 @@
*/
@Override
public List<TelephonyHistogram> getTelephonyHistograms() {
- enforceModifyPermissionOrCarrierPrivilege(getDefaultSubscription());
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, getDefaultSubscription(), "getTelephonyHistograms");
return RIL.getTelephonyRILTimingHistograms();
}
@@ -3916,7 +3936,8 @@
*/
@Override
public List<ClientRequestStats> getClientRequestStats(String callingPackage, int subId) {
- if (!canReadPhoneState(callingPackage, "getClientRequestStats")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, callingPackage, "getClientRequestStats")) {
return null;
}
@@ -4046,4 +4067,16 @@
enforceModifyPermission();
return (Boolean) sendRequest(CMD_SWITCH_SLOTS, physicalSlots);
}
+
+ @Override
+ public void setRadioIndicationUpdateMode(int subId, int filters, int mode) {
+ enforceModifyPermission();
+ final Phone phone = getPhone(subId);
+ if (phone == null) {
+ loge("setRadioIndicationUpdateMode fails with invalid subId: " + subId);
+ return;
+ }
+
+ phone.setRadioIndicationUpdateMode(filters, mode);
+ }
}
diff --git a/src/com/android/phone/settings/AccessibilitySettingsFragment.java b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
index af7d4bf..8ec747c 100644
--- a/src/com/android/phone/settings/AccessibilitySettingsFragment.java
+++ b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
@@ -24,8 +24,10 @@
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -41,6 +43,7 @@
private static final String BUTTON_TTY_KEY = "button_tty_mode_key";
private static final String BUTTON_HAC_KEY = "button_hac_key";
+ private static final String BUTTON_RTT_KEY = "button_rtt_key";
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
/**
@@ -67,6 +70,7 @@
private TtyModeListPreference mButtonTty;
private SwitchPreference mButtonHac;
+ private SwitchPreference mButtonRtt;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -80,6 +84,7 @@
mButtonTty = (TtyModeListPreference) findPreference(
getResources().getString(R.string.tty_mode_key));
mButtonHac = (SwitchPreference) findPreference(BUTTON_HAC_KEY);
+ mButtonRtt = (SwitchPreference) findPreference(BUTTON_RTT_KEY);
if (PhoneGlobals.getInstance().phoneMgr.isTtyModeSupported()) {
mButtonTty.init();
@@ -96,6 +101,17 @@
getPreferenceScreen().removePreference(mButtonHac);
mButtonHac = null;
}
+
+ if (PhoneGlobals.getInstance().phoneMgr.isRttSupported()) {
+ // TODO: this is going to be a on/off switch for now. Ask UX about how to integrate
+ // this settings with TTY
+ boolean rttOn = Settings.System.getInt(
+ mContext.getContentResolver(), Settings.System.RTT_CALLING_MODE, 0) != 0;
+ mButtonRtt.setChecked(rttOn);
+ } else {
+ getPreferenceScreen().removePreference(mButtonRtt);
+ mButtonRtt = null;
+ }
}
@Override
@@ -129,7 +145,18 @@
hac == SettingsConstants.HAC_ENABLED
? SettingsConstants.HAC_VAL_ON : SettingsConstants.HAC_VAL_OFF);
return true;
+ } else if (preference == mButtonRtt) {
+ Log.i(LOG_TAG, "RTT setting changed -- now " + mButtonRtt.isChecked());
+ int rttMode = mButtonRtt.isChecked() ? 1 : 0;
+ Settings.System.putInt(mContext.getContentResolver(), Settings.System.RTT_CALLING_MODE,
+ rttMode);
+ // Update RTT config with IMS Manager
+ ImsManager imsManager = ImsManager.getInstance(getContext(),
+ SubscriptionManager.getDefaultVoicePhoneId());
+ imsManager.setRttEnabled(mButtonRtt.isChecked());
+ return true;
}
+
return false;
}
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 3cf420a..dd74d28 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -758,7 +758,8 @@
participant.removeConnectionListener(mParticipantListener);
synchronized(mUpdateSyncRoot) {
- mConferenceParticipantConnections.remove(participant.getUserEntity());
+ mConferenceParticipantConnections.remove(new Pair<>(participant.getUserEntity(),
+ participant.getEndpoint()));
}
mTelephonyConnectionService.removeConnection(participant);
}
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index e007bb4..4dfaf44 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -36,6 +36,7 @@
import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
import com.android.internal.telephony.imsphone.ImsExternalCallTracker;
import com.android.internal.telephony.imsphone.ImsExternalConnection;
+import com.android.internal.telephony.imsphone.ImsPhoneConnection;
import com.android.phone.PhoneUtils;
import com.google.common.base.Preconditions;
@@ -243,6 +244,11 @@
extras.putLong(TelecomManager.EXTRA_CALL_CREATED_TIME_MILLIS,
SystemClock.elapsedRealtime());
+ if (connection.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
+ if (((ImsPhoneConnection) connection).isRttEnabledForCall()) {
+ extras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, true);
+ }
+ }
PhoneAccountHandle handle = findCorrectPhoneAccountHandle();
if (handle == null) {
try {
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 17c6049..3fb8d32 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -234,9 +234,7 @@
extras.putBoolean(PhoneAccount.EXTRA_PLAY_CALL_RECORDING_TONE, true);
}
- boolean isDeviceRttSupported = mContext.getResources().getBoolean(
- R.bool.config_support_rtt);
- if (isDeviceRttSupported && isCarrierRttSupported()) {
+ if (PhoneGlobals.getInstance().phoneMgr.isRttSupported()) {
capabilities |= PhoneAccount.CAPABILITY_RTT;
}
@@ -405,12 +403,6 @@
b.getBoolean(CarrierConfigManager.KEY_SUPPORT_VIDEO_CONFERENCE_CALL_BOOL);
}
- private boolean isCarrierRttSupported() {
- PersistableBundle b =
- PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
- return b != null && b.getBoolean(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL);
- }
-
/**
* Determines from carrier config whether merging of wifi calls is allowed when VoWIFI is
* turned off.
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 67e9739..0fe6980 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -546,6 +546,7 @@
@Override
public void onRttModifyResponseReceived(int status) {
+ updateConnectionProperties();
if (status == RttModifyStatus.SESSION_MODIFY_REQUEST_SUCCESS) {
sendRttInitiationSuccess();
} else {
@@ -559,6 +560,18 @@
DisconnectCause.toString(cause));
mHandler.obtainMessage(MSG_DISCONNECT).sendToTarget();
}
+
+ @Override
+ public void onRttInitiated() {
+ updateConnectionProperties();
+ sendRttInitiationSuccess();
+ }
+
+ @Override
+ public void onRttTerminated() {
+ updateConnectionProperties();
+ sendRttSessionRemotelyTerminated();
+ }
};
protected com.android.internal.telephony.Connection mOriginalConnection;
@@ -567,6 +580,7 @@
private boolean mIsStateOverridden = false;
private Call.State mOriginalConnectionState = Call.State.IDLE;
private Call.State mConnectionOverriddenState = Call.State.IDLE;
+ private RttTextStream mRttTextStream = null;
private boolean mWasImsConnection;
@@ -834,7 +848,7 @@
@Override
public void onStopRtt() {
- // This is not supported by carriers/vendor yet. No-op for now.
+ Log.i(this, "Stopping RTT currently not supported. Doing nothing.");
}
@Override
@@ -992,6 +1006,7 @@
mIsCdmaVoicePrivacyEnabled);
newProperties = changeBitmask(newProperties, PROPERTY_ASSISTED_DIALING_USED,
mIsUsingAssistedDialing);
+ newProperties = changeBitmask(newProperties, PROPERTY_IS_RTT, isRtt());
if (getConnectionProperties() != newProperties) {
setConnectionProperties(newProperties);
@@ -1678,6 +1693,15 @@
}
/**
+ * Determines if the current connection has RTT enabled.
+ */
+ private boolean isRtt() {
+ return mOriginalConnection != null
+ && mOriginalConnection.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS
+ && ((ImsPhoneConnection) mOriginalConnection).isRttEnabledForCall();
+ }
+
+ /**
* Determines if the current connection is pullable.
*
* A connection is deemed to be pullable if the original connection capabilities state that it
@@ -1811,6 +1835,14 @@
return false;
}
+ public void setRttTextStream(RttTextStream s) {
+ mRttTextStream = s;
+ }
+
+ public RttTextStream getRttTextStream() {
+ return mRttTextStream;
+ }
+
/**
* For video calls, sets whether this connection supports pausing the outgoing video for the
* call using the {@link android.telecom.VideoProfile#STATE_PAUSED} VideoState.
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 8584d42..6fd481b 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -52,6 +52,7 @@
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.imsphone.ImsExternalCallTracker;
import com.android.internal.telephony.imsphone.ImsPhone;
+import com.android.internal.telephony.imsphone.ImsPhoneConnection;
import com.android.phone.MMIDialogActivity;
import com.android.phone.PhoneUtils;
import com.android.phone.R;
@@ -650,6 +651,7 @@
connection.setAddress(handle, PhoneConstants.PRESENTATION_ALLOWED);
connection.setInitializing();
connection.setVideoState(request.getVideoState());
+ connection.setRttTextStream(request.getRttTextStream());
return connection;
}
@@ -699,10 +701,11 @@
int videoState = originalConnection != null ? originalConnection.getVideoState() :
VideoProfile.STATE_AUDIO_ONLY;
- Connection connection =
+ TelephonyConnection connection =
createConnectionFor(phone, originalConnection, false /* isOutgoing */,
request.getAccountHandle(), request.getTelecomCallId(),
request.getAddress(), videoState);
+ handleIncomingRtt(request, originalConnection);
if (connection == null) {
return Connection.createCanceledConnection();
} else {
@@ -710,6 +713,36 @@
}
}
+ private void handleIncomingRtt(ConnectionRequest request,
+ com.android.internal.telephony.Connection originalConnection) {
+ if (originalConnection == null
+ || originalConnection.getPhoneType() != PhoneConstants.PHONE_TYPE_IMS) {
+ if (request.isRequestingRtt()) {
+ Log.w(this, "Requesting RTT on non-IMS call, ignoring");
+ }
+ return;
+ }
+
+ ImsPhoneConnection imsOriginalConnection = (ImsPhoneConnection) originalConnection;
+ if (!request.isRequestingRtt()) {
+ if (imsOriginalConnection.isRttEnabledForCall()) {
+ Log.i(this, "Incoming call requested RTT but was declined");
+ }
+ return;
+ }
+
+ if (!imsOriginalConnection.isRttEnabledForCall()) {
+ if (request.isRequestingRtt()) {
+ Log.w(this, "Incoming call processed as RTT but did not come in as one. Ignoring");
+ }
+ return;
+ }
+
+ Log.i(this, "Setting RTT stream on ImsPhoneConnection");
+ imsOriginalConnection.setCurrentRttTextStream(request.getRttTextStream());
+ imsOriginalConnection.getImsCall().setAnswerWithRtt();
+ }
+
/**
* Called by the {@link ConnectionService} when a newly created {@link Connection} has been
* added to the {@link ConnectionService} and sent to Telecom. Here it is safe to send
@@ -988,7 +1021,11 @@
com.android.internal.telephony.Connection originalConnection = null;
try {
if (phone != null) {
- originalConnection = phone.dial(number, null, videoState, extras);
+ originalConnection = phone.dial(number, new ImsPhone.ImsDialArgs.Builder()
+ .setVideoState(videoState)
+ .setIntentExtras(extras)
+ .setRttTextStream(connection.getRttTextStream())
+ .build());
}
} catch (CallStateException e) {
Log.e(this, e, "placeOutgoingConnection, phone.dial exception: " + e);
diff --git a/testapps/EmbmsServiceTestApp/Android.mk b/testapps/EmbmsServiceTestApp/Android.mk
index d8c4493..29b8112 100644
--- a/testapps/EmbmsServiceTestApp/Android.mk
+++ b/testapps/EmbmsServiceTestApp/Android.mk
@@ -10,6 +10,7 @@
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
LOCAL_PACKAGE_NAME := EmbmsTestService
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
diff --git a/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java b/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java
index 128793f..7bd0f70 100644
--- a/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java
+++ b/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java
@@ -371,11 +371,8 @@
c.onProgressUpdated(request, fileToDownload, 10, 10, 10, 10);
}
// Take a round-trip through the download request serialization to exercise it
- DownloadRequest request1 = new DownloadRequest.Builder(request.getSourceUri())
- .setSubscriptionId(request.getSubscriptionId())
- .setServiceId(request.getFileServiceId())
- .setOpaqueData(request.getOpaqueData())
- .build();
+ DownloadRequest request1 = DownloadRequest.Builder.fromSerializedRequest(
+ request.toByteArray()).build();
Intent downloadResultIntent =
new Intent(VendorUtils.ACTION_DOWNLOAD_RESULT_INTERNAL);
diff --git a/testapps/EmbmsTestDownloadApp/Android.mk b/testapps/EmbmsTestDownloadApp/Android.mk
index 080e5b0..445357c 100644
--- a/testapps/EmbmsTestDownloadApp/Android.mk
+++ b/testapps/EmbmsTestDownloadApp/Android.mk
@@ -14,6 +14,7 @@
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
LOCAL_PACKAGE_NAME := EmbmsTestDownloadApp
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := tests
diff --git a/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/DownloadCompletionReceiver.java b/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/DownloadCompletionReceiver.java
index 3c94b76..736b912 100644
--- a/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/DownloadCompletionReceiver.java
+++ b/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/DownloadCompletionReceiver.java
@@ -21,14 +21,12 @@
import android.content.Intent;
import android.net.Uri;
import android.telephony.MbmsDownloadSession;
-import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.FileInfo;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
public class DownloadCompletionReceiver extends BroadcastReceiver {
@Override
@@ -41,22 +39,8 @@
}
Uri completedFile = intent.getParcelableExtra(
MbmsDownloadSession.EXTRA_MBMS_COMPLETED_FILE_URI);
- FileInfo completedFileInfo = intent.getParcelableExtra(
- MbmsDownloadSession.EXTRA_MBMS_FILE_INFO);
- DownloadRequest request = intent.getParcelableExtra(
- MbmsDownloadSession.EXTRA_MBMS_DOWNLOAD_REQUEST);
- Path destinationFile = getDestinationFile(context,
- request.getFileServiceId(), completedFileInfo);
- Path sourceFile = FileSystems.getDefault().getPath(completedFile.getPath());
- try {
- Files.move(sourceFile, destinationFile, StandardCopyOption.REPLACE_EXISTING);
- } catch (IOException e) {
- return;
- }
-
- EmbmsTestDownloadApp.getInstance().onDownloadDone(
- Uri.fromFile(destinationFile.toFile()));
+ EmbmsTestDownloadApp.getInstance().onDownloadDone(completedFile);
}
}
diff --git a/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java b/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java
index 4083f67..76baf05 100644
--- a/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java
+++ b/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java
@@ -44,6 +44,7 @@
import android.widget.Toast;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -203,7 +204,7 @@
Button bindButton = (Button) findViewById(R.id.bind_button);
bindButton.setOnClickListener((view) -> {
- mDownloadManager = MbmsDownloadSession.create(this, mCallback, mHandler);
+ mDownloadManager = MbmsDownloadSession.create(this, mHandler::post, mCallback);
});
Button setTempFileRootButton = (Button) findViewById(R.id.set_temp_root_button);
@@ -291,26 +292,28 @@
"No DownloadRequest Pending for progress...", Toast.LENGTH_SHORT).show();
return;
}
- mDownloadManager.registerStateCallback(req, new DownloadStateCallback(
- DownloadStateCallback.PROGRESS_UPDATES) {
- @Override
- public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo,
- int currentDownloadSize, int fullDownloadSize, int currentDecodedSize,
- int fullDecodedSize) {
- Toast.makeText(EmbmsTestDownloadApp.this,
- "Progress Updated (" + fileInfo + ") cd: " + currentDecodedSize
- + " fd: " + fullDownloadSize, Toast.LENGTH_SHORT).show();
- }
+ mDownloadManager.registerStateCallback(req, sInstance.getMainThreadHandler()::post,
+ new DownloadStateCallback(DownloadStateCallback.PROGRESS_UPDATES) {
+ @Override
+ public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo,
+ int currentDownloadSize, int fullDownloadSize,
+ int currentDecodedSize, int fullDecodedSize) {
+ Toast.makeText(EmbmsTestDownloadApp.this,
+ "Progress Updated (" + fileInfo + ") cd: " + currentDecodedSize
+ + " fd: " + fullDownloadSize, Toast.LENGTH_SHORT)
+ .show();
+ }
- @Override
- public void onStateUpdated(DownloadRequest request, FileInfo fileInfo,
- @MbmsDownloadSession.DownloadStatus int state) {
- // only registered for state callback, this shouldn't happen!
- Toast.makeText(EmbmsTestDownloadApp.this,
- "State ERROR: received state update for callback that didn't filter it",
- Toast.LENGTH_SHORT).show();
- }
- }, sInstance.getMainThreadHandler());
+ @Override
+ public void onStateUpdated(DownloadRequest request, FileInfo fileInfo,
+ @MbmsDownloadSession.DownloadStatus int state) {
+ // only registered for state callback, this shouldn't happen!
+ Toast.makeText(EmbmsTestDownloadApp.this,
+ "State ERROR: received state update for callback that didn't"
+ + " filter it",
+ Toast.LENGTH_SHORT).show();
+ }
+ });
});
Button registerStateCallback =
@@ -327,26 +330,27 @@
"No DownloadRequest Pending for state...", Toast.LENGTH_SHORT).show();
return;
}
- mDownloadManager.registerStateCallback(req, new DownloadStateCallback(
- DownloadStateCallback.STATE_UPDATES) {
- @Override
- public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo,
- int currentDownloadSize, int fullDownloadSize, int currentDecodedSize,
- int fullDecodedSize) {
- // only registered for state callback, this shouldn't happen!
- Toast.makeText(EmbmsTestDownloadApp.this,
- "Progress ERROR: received progress update for callback that didn't "
- + "filter it", Toast.LENGTH_SHORT).show();
- }
+ mDownloadManager.registerStateCallback(req, sInstance.getMainThreadHandler()::post,
+ new DownloadStateCallback(DownloadStateCallback.STATE_UPDATES) {
+ @Override
+ public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo,
+ int currentDownloadSize, int fullDownloadSize,
+ int currentDecodedSize, int fullDecodedSize) {
+ // only registered for state callback, this shouldn't happen!
+ Toast.makeText(EmbmsTestDownloadApp.this,
+ "Progress ERROR: received progress update for"
+ + " callback that didn't "
+ + "filter it", Toast.LENGTH_SHORT).show();
+ }
- @Override
- public void onStateUpdated(DownloadRequest request, FileInfo fileInfo,
- @MbmsDownloadSession.DownloadStatus int state) {
- Toast.makeText(EmbmsTestDownloadApp.this,
- "State Updated (" + fileInfo + ") state: " + state,
- Toast.LENGTH_SHORT).show();
- }
- }, sInstance.getMainThreadHandler());
+ @Override
+ public void onStateUpdated(DownloadRequest request, FileInfo fileInfo,
+ @MbmsDownloadSession.DownloadStatus int state) {
+ Toast.makeText(EmbmsTestDownloadApp.this,
+ "State Updated (" + fileInfo + ") state: " + state,
+ Toast.LENGTH_SHORT).show();
+ }
+ });
});
Button registerAllCallbacks =
@@ -363,24 +367,26 @@
"No DownloadRequest Pending for state...", Toast.LENGTH_SHORT).show();
return;
}
- mDownloadManager.registerStateCallback(req, new DownloadStateCallback() {
- @Override
- public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo,
- int currentDownloadSize, int fullDownloadSize, int currentDecodedSize,
- int fullDecodedSize) {
- Toast.makeText(EmbmsTestDownloadApp.this,
- "Progress Updated (" + fileInfo + ") cd: " + currentDecodedSize
- + " fd: " + fullDownloadSize, Toast.LENGTH_SHORT).show();
- }
+ mDownloadManager.registerStateCallback(req, sInstance.getMainThreadHandler()::post,
+ new DownloadStateCallback() {
+ @Override
+ public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo,
+ int currentDownloadSize, int fullDownloadSize,
+ int currentDecodedSize, int fullDecodedSize) {
+ Toast.makeText(EmbmsTestDownloadApp.this,
+ "Progress Updated (" + fileInfo + ") cd: " + currentDecodedSize
+ + " fd: " + fullDownloadSize, Toast.LENGTH_SHORT)
+ .show();
+ }
- @Override
- public void onStateUpdated(DownloadRequest request, FileInfo fileInfo,
- @MbmsDownloadSession.DownloadStatus int state) {
- Toast.makeText(EmbmsTestDownloadApp.this,
- "State Updated (" + fileInfo + ") state: " + state,
- Toast.LENGTH_SHORT).show();
- }
- }, sInstance.getMainThreadHandler());
+ @Override
+ public void onStateUpdated(DownloadRequest request, FileInfo fileInfo,
+ @MbmsDownloadSession.DownloadStatus int state) {
+ Toast.makeText(EmbmsTestDownloadApp.this,
+ "State Updated (" + fileInfo + ") state: " + state,
+ Toast.LENGTH_SHORT).show();
+ }
+ });
});
}
@@ -429,7 +435,8 @@
Intent completionIntent = new Intent(DOWNLOAD_DONE_ACTION);
completionIntent.setClass(this, DownloadCompletionReceiver.class);
- DownloadRequest request = new DownloadRequest.Builder(sourceUriBuilder.build())
+ DownloadRequest request = new DownloadRequest.Builder(sourceUriBuilder.build(),
+ getDestination(info.getServiceId()))
.setServiceInfo(info)
.setAppIntent(completionIntent)
.setSubscriptionId(SubscriptionManager.getDefaultSubscriptionId())
@@ -438,4 +445,24 @@
mDownloadManager.download(request);
mDownloadRequestAdapter.add(request);
}
+
+ private Uri getDestination(String serviceId) {
+ File dest;
+ try {
+ if (serviceId.contains("2")) {
+ dest = new File(getFilesDir().getCanonicalFile(), "images/animals/");
+ if (!dest.exists()) {
+ dest.mkdirs();
+ }
+ } else {
+ dest = new File(getFilesDir().getCanonicalFile(), "images/");
+ if (!dest.exists()) {
+ dest.mkdirs();
+ }
+ }
+ return Uri.fromFile(dest);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/testapps/EmbmsTestStreamingApp/Android.mk b/testapps/EmbmsTestStreamingApp/Android.mk
index 45826b9..f574990 100644
--- a/testapps/EmbmsTestStreamingApp/Android.mk
+++ b/testapps/EmbmsTestStreamingApp/Android.mk
@@ -10,6 +10,7 @@
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
LOCAL_PACKAGE_NAME := EmbmsTestStreamingApp
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := tests
diff --git a/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/EmbmsTestStreamingApp.java b/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/EmbmsTestStreamingApp.java
index 0546c9d..75febda 100644
--- a/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/EmbmsTestStreamingApp.java
+++ b/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/EmbmsTestStreamingApp.java
@@ -154,7 +154,7 @@
Button bindButton = (Button) findViewById(R.id.bind_button);
bindButton.setOnClickListener((view) -> {
mStreamingManager = MbmsStreamingSession.create(
- EmbmsTestStreamingApp.this, mStreamingListener, mHandler);
+ EmbmsTestStreamingApp.this, mHandler::post, mStreamingListener);
});
Button getStreamingServicesButton = (Button)
diff --git a/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/StreamingServiceTracker.java b/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/StreamingServiceTracker.java
index 5244d30..d45b5fd 100644
--- a/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/StreamingServiceTracker.java
+++ b/testapps/EmbmsTestStreamingApp/src/com/android/phone/testapps/embmsfrontend/StreamingServiceTracker.java
@@ -60,13 +60,13 @@
* Start streaming using the provided streaming session
*/
public boolean startStreaming(MbmsStreamingSession streamingManager) {
- mStreamingService =
- streamingManager.startStreaming(mStreamingServiceInfo, new Callback(), null);
+ mStreamingService = streamingManager.startStreaming(mStreamingServiceInfo,
+ mActivity.getMainThreadHandler()::post, new Callback());
return true;
}
public void stopStreaming() {
- mStreamingService.stopStreaming();
+ mStreamingService.close();
}
public String getServiceId() {
diff --git a/testapps/ImsTestService/Android.mk b/testapps/ImsTestService/Android.mk
index 6afb3d5..29df224 100644
--- a/testapps/ImsTestService/Android.mk
+++ b/testapps/ImsTestService/Android.mk
@@ -19,6 +19,7 @@
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
LOCAL_PACKAGE_NAME := ImsTestApp
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
diff --git a/testapps/TelephonyRegistryTestApp/Android.mk b/testapps/TelephonyRegistryTestApp/Android.mk
index ed1f2a3..8c0d286 100644
--- a/testapps/TelephonyRegistryTestApp/Android.mk
+++ b/testapps/TelephonyRegistryTestApp/Android.mk
@@ -9,6 +9,7 @@
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
LOCAL_PACKAGE_NAME := TelephonyRegistryTestApp
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := tests
diff --git a/tests/Android.mk b/tests/Android.mk
index b43533f..a6a79fe 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -21,6 +21,7 @@
LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_PACKAGE_NAME := TeleServiceTests
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := tests
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index b4c93ee..3bd2716 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -539,7 +539,7 @@
// was redialed on the same slot
assertEquals(0, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot0Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot0Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -571,7 +571,7 @@
// was never redialed
assertEquals(0, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot0Phone, never()).dial(anyString(), any(), anyInt(), any());
+ verify(slot0Phone, never()).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -611,7 +611,7 @@
// redialed on another slot
assertEquals(1, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot1Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -649,7 +649,7 @@
// redialed on another slot
assertEquals(1, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot1Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -700,8 +700,8 @@
// redialed on another slot
assertEquals(2, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot0Phone).dial(anyString(), any(), anyInt(), any());
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot0Phone).dial(anyString(), any());
+ verify(slot1Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -750,8 +750,8 @@
// redialed on another slot
assertEquals(1, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
- verify(slot0Phone, never()).dial(anyString(), any(), anyInt(), any());
+ verify(slot1Phone).dial(anyString(), any());
+ verify(slot0Phone, never()).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -850,7 +850,7 @@
private void setPhonesDialConnection(Phone phone, Connection c) {
try {
- when(phone.dial(anyString(), anyInt())).thenReturn(c);
+ when(phone.dial(anyString(), any())).thenReturn(c);
} catch (CallStateException e) {
// this shouldn't happen
fail();