diff options
63 files changed, 937 insertions, 736 deletions
diff --git a/api/current.txt b/api/current.txt index 125e11311b20..fd5c371e805d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -51763,6 +51763,8 @@ package java.lang.annotation { enum_constant public static final java.lang.annotation.ElementType PACKAGE; enum_constant public static final java.lang.annotation.ElementType PARAMETER; enum_constant public static final java.lang.annotation.ElementType TYPE; + enum_constant public static final java.lang.annotation.ElementType TYPE_PARAMETER; + enum_constant public static final java.lang.annotation.ElementType TYPE_USE; } public class IncompleteAnnotationException extends java.lang.RuntimeException { @@ -51844,7 +51846,7 @@ package java.lang.reflect { method public abstract <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T>); method public abstract java.lang.annotation.Annotation[] getAnnotations(); method public default <T extends java.lang.annotation.Annotation> T[] getAnnotationsByType(java.lang.Class<T>); - method public default <T extends java.lang.annotation.Annotation> java.lang.annotation.Annotation getDeclaredAnnotation(java.lang.Class<T>); + method public default <T extends java.lang.annotation.Annotation> T getDeclaredAnnotation(java.lang.Class<T>); method public abstract java.lang.annotation.Annotation[] getDeclaredAnnotations(); method public default <T extends java.lang.annotation.Annotation> T[] getDeclaredAnnotationsByType(java.lang.Class<T>); method public default boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>); diff --git a/api/system-current.txt b/api/system-current.txt index 6dc2bcf5d9e1..528342fd3ae4 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -55120,6 +55120,8 @@ package java.lang.annotation { enum_constant public static final java.lang.annotation.ElementType PACKAGE; enum_constant public static final java.lang.annotation.ElementType PARAMETER; enum_constant public static final java.lang.annotation.ElementType TYPE; + enum_constant public static final java.lang.annotation.ElementType TYPE_PARAMETER; + enum_constant public static final java.lang.annotation.ElementType TYPE_USE; } public class IncompleteAnnotationException extends java.lang.RuntimeException { @@ -55201,7 +55203,7 @@ package java.lang.reflect { method public abstract <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T>); method public abstract java.lang.annotation.Annotation[] getAnnotations(); method public default <T extends java.lang.annotation.Annotation> T[] getAnnotationsByType(java.lang.Class<T>); - method public default <T extends java.lang.annotation.Annotation> java.lang.annotation.Annotation getDeclaredAnnotation(java.lang.Class<T>); + method public default <T extends java.lang.annotation.Annotation> T getDeclaredAnnotation(java.lang.Class<T>); method public abstract java.lang.annotation.Annotation[] getDeclaredAnnotations(); method public default <T extends java.lang.annotation.Annotation> T[] getDeclaredAnnotationsByType(java.lang.Class<T>); method public default boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>); diff --git a/api/test-current.txt b/api/test-current.txt index 941790e11c01..871617f09ccb 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -51843,6 +51843,8 @@ package java.lang.annotation { enum_constant public static final java.lang.annotation.ElementType PACKAGE; enum_constant public static final java.lang.annotation.ElementType PARAMETER; enum_constant public static final java.lang.annotation.ElementType TYPE; + enum_constant public static final java.lang.annotation.ElementType TYPE_PARAMETER; + enum_constant public static final java.lang.annotation.ElementType TYPE_USE; } public class IncompleteAnnotationException extends java.lang.RuntimeException { @@ -51924,7 +51926,7 @@ package java.lang.reflect { method public abstract <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T>); method public abstract java.lang.annotation.Annotation[] getAnnotations(); method public default <T extends java.lang.annotation.Annotation> T[] getAnnotationsByType(java.lang.Class<T>); - method public default <T extends java.lang.annotation.Annotation> java.lang.annotation.Annotation getDeclaredAnnotation(java.lang.Class<T>); + method public default <T extends java.lang.annotation.Annotation> T getDeclaredAnnotation(java.lang.Class<T>); method public abstract java.lang.annotation.Annotation[] getDeclaredAnnotations(); method public default <T extends java.lang.annotation.Annotation> T[] getDeclaredAnnotationsByType(java.lang.Class<T>); method public default boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>); diff --git a/core/res/res/values-mcc204-mnc04/config.xml b/core/res/res/values-mcc204-mnc04/config.xml index 0f39e42e8b3c..ddf0e9fa9a68 100755 --- a/core/res/res/values-mcc204-mnc04/config.xml +++ b/core/res/res/values-mcc204-mnc04/config.xml @@ -25,13 +25,6 @@ --> <integer name="config_mobile_mtu">1358</integer> - <!-- service number convert map in roaming network. --> - <!-- [dialstring],[replacement][,optional gid] --> - <string-array translatable="false" name="dial_string_replace"> - <item>"*611:+19085594899,BAE0000000000000"</item> - <item>"*86:+1MDN,BAE0000000000000"</item> - </string-array> - <!-- Flag indicating whether strict threshold is used, or lenient threshold is used, when evaluating RSRP for LTE antenna bar display 0. Strict threshold diff --git a/core/res/res/values-mcc310-mnc120/config.xml b/core/res/res/values-mcc310-mnc120/config.xml index 4b616885aab6..413c6980869f 100644 --- a/core/res/res/values-mcc310-mnc120/config.xml +++ b/core/res/res/values-mcc310-mnc120/config.xml @@ -25,9 +25,6 @@ --> <integer name="config_mobile_mtu">1422</integer> - <!-- Sprint need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">70</integer> - <!-- If this value is true, The mms content-disposition field is supported correctly. If false, Content-disposition fragments are ignored --> <bool name="config_mms_content_disposition_support">false</bool> diff --git a/core/res/res/values-mcc310-mnc160/config.xml b/core/res/res/values-mcc310-mnc160/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc160/config.xml +++ b/core/res/res/values-mcc310-mnc160/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc200/config.xml b/core/res/res/values-mcc310-mnc200/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc200/config.xml +++ b/core/res/res/values-mcc310-mnc200/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc210/config.xml b/core/res/res/values-mcc310-mnc210/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc210/config.xml +++ b/core/res/res/values-mcc310-mnc210/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc220/config.xml b/core/res/res/values-mcc310-mnc220/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc220/config.xml +++ b/core/res/res/values-mcc310-mnc220/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc230/config.xml b/core/res/res/values-mcc310-mnc230/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc230/config.xml +++ b/core/res/res/values-mcc310-mnc230/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc240/config.xml b/core/res/res/values-mcc310-mnc240/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc240/config.xml +++ b/core/res/res/values-mcc310-mnc240/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc250/config.xml b/core/res/res/values-mcc310-mnc250/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc250/config.xml +++ b/core/res/res/values-mcc310-mnc250/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc260/config.xml b/core/res/res/values-mcc310-mnc260/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc260/config.xml +++ b/core/res/res/values-mcc310-mnc260/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc270/config.xml b/core/res/res/values-mcc310-mnc270/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc270/config.xml +++ b/core/res/res/values-mcc310-mnc270/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc300/config.xml b/core/res/res/values-mcc310-mnc300/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc300/config.xml +++ b/core/res/res/values-mcc310-mnc300/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc310/config.xml b/core/res/res/values-mcc310-mnc310/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc310/config.xml +++ b/core/res/res/values-mcc310-mnc310/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc490/config.xml b/core/res/res/values-mcc310-mnc490/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc490/config.xml +++ b/core/res/res/values-mcc310-mnc490/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc530/config.xml b/core/res/res/values-mcc310-mnc530/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc530/config.xml +++ b/core/res/res/values-mcc310-mnc530/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc580/config.xml b/core/res/res/values-mcc310-mnc580/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc580/config.xml +++ b/core/res/res/values-mcc310-mnc580/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc590/config.xml b/core/res/res/values-mcc310-mnc590/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc590/config.xml +++ b/core/res/res/values-mcc310-mnc590/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc640/config.xml b/core/res/res/values-mcc310-mnc640/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc640/config.xml +++ b/core/res/res/values-mcc310-mnc640/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc660/config.xml b/core/res/res/values-mcc310-mnc660/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc660/config.xml +++ b/core/res/res/values-mcc310-mnc660/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc310-mnc800/config.xml b/core/res/res/values-mcc310-mnc800/config.xml index 2cae7cc0376b..5a6a84bd06b3 100644 --- a/core/res/res/values-mcc310-mnc800/config.xml +++ b/core/res/res/values-mcc310-mnc800/config.xml @@ -32,9 +32,4 @@ <!-- Flag specifying whether VoLTE TTY is supported --> <bool name="config_carrier_volte_tty_supported">false</bool> - - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">true</bool> </resources> diff --git a/core/res/res/values-mcc311-mnc220/config.xml b/core/res/res/values-mcc311-mnc220/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc220/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc221/config.xml b/core/res/res/values-mcc311-mnc221/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc221/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc222/config.xml b/core/res/res/values-mcc311-mnc222/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc222/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc223/config.xml b/core/res/res/values-mcc311-mnc223/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc223/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc224/config.xml b/core/res/res/values-mcc311-mnc224/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc224/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc225/config.xml b/core/res/res/values-mcc311-mnc225/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc225/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc226/config.xml b/core/res/res/values-mcc311-mnc226/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc226/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc227/config.xml b/core/res/res/values-mcc311-mnc227/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc227/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc228/config.xml b/core/res/res/values-mcc311-mnc228/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc228/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc229/config.xml b/core/res/res/values-mcc311-mnc229/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc229/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc480/config.xml b/core/res/res/values-mcc311-mnc480/config.xml index 39ea2bf1f5aa..8d7fd6177500 100755 --- a/core/res/res/values-mcc311-mnc480/config.xml +++ b/core/res/res/values-mcc311-mnc480/config.xml @@ -52,11 +52,6 @@ <bool name="config_carrier_volte_provisioned">true</bool> <bool name="config_auto_attach_data_on_creation">false</bool> - <!-- service number convert map in roaming network. --> - <string-array translatable="false" name="dial_string_replace"> - <item>"*611:+19085594899,"</item> - <item>"*86:+1MDN,"</item> - </string-array> <!-- Flag indicating whether strict threshold is used, or lenient threshold is used, when evaluating RSRP for LTE antenna bar display diff --git a/core/res/res/values-mcc311-mnc490/config.xml b/core/res/res/values-mcc311-mnc490/config.xml index d481c9717e23..836abdf39ab8 100644 --- a/core/res/res/values-mcc311-mnc490/config.xml +++ b/core/res/res/values-mcc311-mnc490/config.xml @@ -21,9 +21,6 @@ for different hardware and product builds. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <!-- Sprint need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">70</integer> - <!-- An array of CDMA roaming indicators which means international roaming --> <integer-array translatable="false" name="config_cdma_international_roaming_indicators" > <item>2</item> diff --git a/core/res/res/values-mcc311-mnc580/config.xml b/core/res/res/values-mcc311-mnc580/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc580/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc581/config.xml b/core/res/res/values-mcc311-mnc581/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc581/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc582/config.xml b/core/res/res/values-mcc311-mnc582/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc582/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc583/config.xml b/core/res/res/values-mcc311-mnc583/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc583/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc584/config.xml b/core/res/res/values-mcc311-mnc584/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc584/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc585/config.xml b/core/res/res/values-mcc311-mnc585/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc585/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc586/config.xml b/core/res/res/values-mcc311-mnc586/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc586/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc587/config.xml b/core/res/res/values-mcc311-mnc587/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc587/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc588/config.xml b/core/res/res/values-mcc311-mnc588/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc588/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc589/config.xml b/core/res/res/values-mcc311-mnc589/config.xml deleted file mode 100644 index 811e9c73d2e1..000000000000 --- a/core/res/res/values-mcc311-mnc589/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2014, 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 my 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- USC need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">300</integer> -</resources> diff --git a/core/res/res/values-mcc311-mnc870/config.xml b/core/res/res/values-mcc311-mnc870/config.xml index 98cb72ee50f5..f6aed1335d66 100644 --- a/core/res/res/values-mcc311-mnc870/config.xml +++ b/core/res/res/values-mcc311-mnc870/config.xml @@ -25,9 +25,6 @@ --> <integer name="config_mobile_mtu">1422</integer> - <!-- Sprint need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">70</integer> - <!-- An array of CDMA roaming indicators which means international roaming --> <integer-array translatable="false" name="config_cdma_international_roaming_indicators" > <item>2</item> diff --git a/core/res/res/values-mcc312-mnc530/config.xml b/core/res/res/values-mcc312-mnc530/config.xml index 98cb72ee50f5..f6aed1335d66 100644 --- a/core/res/res/values-mcc312-mnc530/config.xml +++ b/core/res/res/values-mcc312-mnc530/config.xml @@ -25,9 +25,6 @@ --> <integer name="config_mobile_mtu">1422</integer> - <!-- Sprint need a 70 ms delay for 3way call --> - <integer name="config_cdma_3waycall_flash_delay">70</integer> - <!-- An array of CDMA roaming indicators which means international roaming --> <integer-array translatable="false" name="config_cdma_international_roaming_indicators" > <item>2</item> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 44cbc0f91527..51a5704c7f0b 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2157,11 +2157,6 @@ <!-- Flag specifying whether WFC over IMS is available on device --> <bool name="config_device_wfc_ims_available">false</bool> - <!-- Flag specifying whether WFC over IMS should be available for carrier: independent of - carrier provisioning. If false: hard disabled. If true: then depends on carrier - provisioning, availability etc --> - <bool name="config_carrier_wfc_ims_available">false</bool> - <bool name="config_networkSamplingWakesDevice">true</bool> <string-array translatable="false" name="config_cdma_home_system" /> @@ -2212,6 +2207,21 @@ <!-- Sprint need a 70 ms delay for 3way call --> <integer name="config_cdma_3waycall_flash_delay">0</integer> + <!-- If there is no preload VM number in the sim card, carriers such as + Verizon require to load a default vm number from the configurantion. + Define config_default_vm_number for this purpose. And there are two + optional formats for this configuration as below: + (1)<item>voicemail number</item> + (2)<item>voicemail number;gid</item> + The logic to pick up the correct voicemail number: + (1) If the config_default_vm_number array has no gid special item, the last one will be + picked + (2) If the config_default_vm_number array has gid special item and it matches the current + sim's gid, it will be picked. + (3) If the config_default_vm_number array has gid special item but it doesn't match the + current sim's gid, the last one without gid will be picked --> + <string-array translatable="false" name="config_default_vm_number" /> + <!--SIM does not save, but the voice mail number to be changed. --> <bool name="editable_voicemailnumber">false</bool> @@ -2220,6 +2230,10 @@ <string-array translatable="false" name="dial_string_replace"> </string-array> + <!-- Flag indicating whether radio is to be restarted on the error of + PDP_FAIL_REGULAR_DEACTIVATION/0x24 --> + <bool name="config_restart_radio_on_pdp_fail_regular_deactivation">false</bool> + <!-- networks that don't want data deactivate when shutdown the phone note this is dependent on the operator of the network we're on, not operator on the SIM --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 206a910e4b7c..72e5078ac55e 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2195,7 +2195,6 @@ <java-symbol type="bool" name="config_device_vt_available" /> <java-symbol type="bool" name="config_carrier_vt_available" /> <java-symbol type="bool" name="config_device_wfc_ims_available" /> - <java-symbol type="bool" name="config_carrier_wfc_ims_available" /> <java-symbol type="attr" name="touchscreenBlocksFocus" /> <java-symbol type="layout" name="resolver_list_with_default" /> <java-symbol type="string" name="whichApplicationNamed" /> @@ -2237,9 +2236,11 @@ <java-symbol type="layout" name="resolver_different_item_header" /> <java-symbol type="array" name="config_default_vm_number" /> <java-symbol type="integer" name="config_cdma_3waycall_flash_delay"/> + <java-symbol type="array" name="config_default_vm_number" /> <java-symbol type="attr" name="windowBackgroundFallback" /> <java-symbol type="id" name="textSpacerNoButtons" /> <java-symbol type="array" name="dial_string_replace" /> + <java-symbol type="bool" name="config_restart_radio_on_pdp_fail_regular_deactivation" /> <java-symbol type="array" name="networks_not_clear_data" /> <java-symbol type="bool" name="config_switch_phone_on_voice_reg_state_change" /> <java-symbol type="string" name="whichHomeApplicationNamed" /> diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 74af37f971b7..eb5bf228b852 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -6098,6 +6098,8 @@ public final class ActivityManagerService extends ActivityManagerNative ProcessList.INVALID_ADJ, callerWillRestart, true, doit, evenPersistent, packageName == null ? ("stop user " + userId) : ("stop " + packageName)); + didSomething |= mActivityStarter.clearPendingActivityLaunchesLocked(packageName); + if (mStackSupervisor.finishDisabledPackageActivitiesLocked( packageName, null, doit, evenPersistent, userId)) { if (!doit) { diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index 7b3f65a728bf..85fa139906dd 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -2006,4 +2006,18 @@ class ActivityStarter { } } } + + boolean clearPendingActivityLaunchesLocked(String packageName) { + boolean didSomething = false; + + for (int palNdx = mPendingActivityLaunches.size() - 1; palNdx >= 0; --palNdx) { + PendingActivityLaunch pal = mPendingActivityLaunches.get(palNdx); + ActivityRecord r = pal.r; + if (r != null && r.packageName.equals(packageName)) { + mPendingActivityLaunches.remove(palNdx); + didSomething = true; + } + } + return didSomething; + } } diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index cc556c7e45b3..a12a92cc7a6a 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -178,6 +178,7 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe public void binderDied() { Slog.v(TAG, "fingerprintd died"); mDaemon = null; + mCurrentUserId = UserHandle.USER_CURRENT; handleError(mHalDeviceId, FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE); } diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java index 72c549f7bec6..2e18b1c417fe 100644 --- a/services/core/java/com/android/server/pm/Installer.java +++ b/services/core/java/com/android/server/pm/Installer.java @@ -230,6 +230,11 @@ public final class Installer extends SystemService { mInstaller.execute("move_ab", apkPath, instructionSet, outputPath); } + public void deleteOdex(String apkPath, String instructionSet, String outputPath) + throws InstallerException { + mInstaller.execute("delete_odex", apkPath, instructionSet, outputPath); + } + private static void assertValidInstructionSet(String instructionSet) throws InstallerException { for (String abi : Build.SUPPORTED_ABIS) { diff --git a/services/core/java/com/android/server/pm/OtaDexoptService.java b/services/core/java/com/android/server/pm/OtaDexoptService.java index bff6d2d4786e..689917cd670a 100644 --- a/services/core/java/com/android/server/pm/OtaDexoptService.java +++ b/services/core/java/com/android/server/pm/OtaDexoptService.java @@ -31,7 +31,7 @@ import android.os.ServiceManager; import android.os.storage.StorageManager; import android.util.Log; import android.util.Slog; - +import com.android.internal.logging.MetricsLogger; import com.android.internal.os.InstallerConnection; import com.android.internal.os.InstallerConnection.InstallerException; @@ -40,6 +40,7 @@ import java.io.FileDescriptor; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.concurrent.TimeUnit; /** * A service for A/B OTA dexopting. @@ -53,6 +54,10 @@ public class OtaDexoptService extends IOtaDexopt.Stub { // The synthetic library dependencies denoting "no checks." private final static String[] NO_LIBRARIES = new String[] { "&" }; + // The amount of "available" (free - low threshold) space necessary at the start of an OTA to + // not bulk-delete unused apps' odex files. + private final static long BULK_DELETE_THRESHOLD = 1024 * 1024 * 1024; // 1GB. + private final Context mContext; private final PackageManagerService mPackageManagerService; @@ -65,6 +70,25 @@ public class OtaDexoptService extends IOtaDexopt.Stub { private int completeSize; + // MetricsLogger properties. + + // Space before and after. + private long availableSpaceBefore; + private long availableSpaceAfterBulkDelete; + private long availableSpaceAfterDexopt; + + // Packages. + private int importantPackageCount; + private int otherPackageCount; + + // Number of dexopt commands. This may be different from the count of packages. + private int dexoptCommandCountTotal; + private int dexoptCommandCountExecuted; + + // For spent time. + private long otaDexoptTimeStart; + + public OtaDexoptService(Context context, PackageManagerService packageManagerService) { this.mContext = context; this.mPackageManagerService = packageManagerService; @@ -128,6 +152,18 @@ public class OtaDexoptService extends IOtaDexopt.Stub { generatePackageDexopts(p, PackageManagerService.REASON_FIRST_BOOT)); } completeSize = mDexoptCommands.size(); + + long spaceAvailable = getAvailableSpace(); + if (spaceAvailable < BULK_DELETE_THRESHOLD) { + Log.i(TAG, "Low on space, deleting oat files in an attempt to free up space: " + + PackageManagerServiceUtils.packagesToString(others)); + for (PackageParser.Package pkg : others) { + deleteOatArtifactsOfPackage(pkg); + } + } + long spaceAvailableNow = getAvailableSpace(); + + prepareMetricsLogging(important.size(), others.size(), spaceAvailable, spaceAvailableNow); } @Override @@ -136,6 +172,9 @@ public class OtaDexoptService extends IOtaDexopt.Stub { Log.i(TAG, "Cleaning up OTA Dexopt state."); } mDexoptCommands = null; + availableSpaceAfterDexopt = getAvailableSpace(); + + performMetricsLogging(); } @Override @@ -169,28 +208,67 @@ public class OtaDexoptService extends IOtaDexopt.Stub { String next = mDexoptCommands.remove(0); - if (IsFreeSpaceAvailable()) { + if (getAvailableSpace() > 0) { + dexoptCommandCountExecuted++; + return next; } else { + if (DEBUG_DEXOPT) { + Log.w(TAG, "Not enough space for OTA dexopt, stopping with " + + (mDexoptCommands.size() + 1) + " commands left."); + } mDexoptCommands.clear(); return "(no free space)"; } } - /** - * Check for low space. Returns true if there's space left. - */ - private boolean IsFreeSpaceAvailable() { - // TODO: If apps are not installed in the internal /data partition, we should compare - // against that storage's free capacity. + private long getMainLowSpaceThreshold() { File dataDir = Environment.getDataDirectory(); @SuppressWarnings("deprecation") long lowThreshold = StorageManager.from(mContext).getStorageLowBytes(dataDir); if (lowThreshold == 0) { throw new IllegalStateException("Invalid low memory threshold"); } + return lowThreshold; + } + + /** + * Returns the difference of free space to the low-storage-space threshold. Positive values + * indicate free bytes. + */ + private long getAvailableSpace() { + // TODO: If apps are not installed in the internal /data partition, we should compare + // against that storage's free capacity. + long lowThreshold = getMainLowSpaceThreshold(); + + File dataDir = Environment.getDataDirectory(); long usableSpace = dataDir.getUsableSpace(); - return (usableSpace >= lowThreshold); + + return usableSpace - lowThreshold; + } + + private static String getOatDir(PackageParser.Package pkg) { + if (!pkg.canHaveOatDir()) { + return null; + } + File codePath = new File(pkg.codePath); + if (codePath.isDirectory()) { + return PackageDexOptimizer.getOatDir(codePath).getAbsolutePath(); + } + return null; + } + + private void deleteOatArtifactsOfPackage(PackageParser.Package pkg) { + String[] instructionSets = getAppDexInstructionSets(pkg.applicationInfo); + for (String codePath : pkg.getAllCodePaths()) { + for (String isa : instructionSets) { + try { + mPackageManagerService.mInstaller.deleteOdex(codePath, isa, getOatDir(pkg)); + } catch (InstallerException e) { + Log.e(TAG, "Failed deleting oat files for " + codePath, e); + } + } + } } /** @@ -271,6 +349,55 @@ public class OtaDexoptService extends IOtaDexopt.Stub { } } + /** + * Initialize logging fields. + */ + private void prepareMetricsLogging(int important, int others, long spaceBegin, long spaceBulk) { + availableSpaceBefore = spaceBegin; + availableSpaceAfterBulkDelete = spaceBulk; + availableSpaceAfterDexopt = 0; + + importantPackageCount = important; + otherPackageCount = others; + + dexoptCommandCountTotal = mDexoptCommands.size(); + dexoptCommandCountExecuted = 0; + + otaDexoptTimeStart = System.nanoTime(); + } + + private static int inMegabytes(long value) { + long in_mega_bytes = value / (1024 * 1024); + if (in_mega_bytes > Integer.MAX_VALUE) { + Log.w(TAG, "Recording " + in_mega_bytes + "MB of free space, overflowing range"); + return Integer.MAX_VALUE; + } + return (int)in_mega_bytes; + } + + private void performMetricsLogging() { + long finalTime = System.nanoTime(); + + MetricsLogger.histogram(mContext, "ota_dexopt_available_space_before_mb", + inMegabytes(availableSpaceBefore)); + MetricsLogger.histogram(mContext, "ota_dexopt_available_space_after_bulk_delete_mb", + inMegabytes(availableSpaceAfterBulkDelete)); + MetricsLogger.histogram(mContext, "ota_dexopt_available_space_after_dexopt_mb", + inMegabytes(availableSpaceAfterDexopt)); + + MetricsLogger.histogram(mContext, "ota_dexopt_num_important_packages", + importantPackageCount); + MetricsLogger.histogram(mContext, "ota_dexopt_num_other_packages", otherPackageCount); + + MetricsLogger.histogram(mContext, "ota_dexopt_num_commands", dexoptCommandCountTotal); + MetricsLogger.histogram(mContext, "ota_dexopt_num_commands_executed", + dexoptCommandCountExecuted); + + final int elapsedTimeSeconds = + (int) TimeUnit.NANOSECONDS.toSeconds(finalTime - otaDexoptTimeStart); + MetricsLogger.histogram(mContext, "ota_dexopt_time_s", elapsedTimeSeconds); + } + private static class OTADexoptPackageDexOptimizer extends PackageDexOptimizer.ForcedUpdatePackageDexOptimizer { diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java index 751c5858446b..cfd0af7635e8 100644 --- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java @@ -19,6 +19,7 @@ package com.android.server.pm; import static com.android.server.pm.PackageManagerService.DEBUG_DEXOPT; import static com.android.server.pm.PackageManagerService.TAG; +import android.annotation.NonNull; import android.app.AppGlobals; import android.content.Intent; import android.content.pm.PackageParser; @@ -35,13 +36,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Set; +import java.util.function.Predicate; /** * Class containing helper methods for the PackageManagerService. @@ -67,34 +64,51 @@ public class PackageManagerServiceUtils { return pkgNames; } - private static void filterRecentlyUsedApps(Collection<PackageParser.Package> pkgs, - long estimatedPreviousSystemUseTime, - long dexOptLRUThresholdInMills) { - // Filter out packages that aren't recently used. - int total = pkgs.size(); - int skipped = 0; - for (Iterator<PackageParser.Package> i = pkgs.iterator(); i.hasNext();) { - PackageParser.Package pkg = i.next(); - long then = pkg.getLatestForegroundPackageUseTimeInMills(); - if (then < estimatedPreviousSystemUseTime - dexOptLRUThresholdInMills) { - if (DEBUG_DEXOPT) { - Log.i(TAG, "Skipping dexopt of " + pkg.packageName + - " last used in foreground: " + - ((then == 0) ? "never" : new Date(then))); - } - i.remove(); - skipped++; - } else { - if (DEBUG_DEXOPT) { - Log.i(TAG, "Will dexopt " + pkg.packageName + - " last used in foreground: " + - ((then == 0) ? "never" : new Date(then))); - } + // Sort a list of apps by their last usage, most recently used apps first. The order of + // packages without usage data is undefined (but they will be sorted after the packages + // that do have usage data). + public static void sortPackagesByUsageDate(List<PackageParser.Package> pkgs, + PackageManagerService packageManagerService) { + if (!packageManagerService.isHistoricalPackageUsageAvailable()) { + return; + } + + Collections.sort(pkgs, (pkg1, pkg2) -> + Long.compare(pkg2.getLatestForegroundPackageUseTimeInMills(), + pkg1.getLatestForegroundPackageUseTimeInMills())); + } + + // Apply the given {@code filter} to all packages in {@code packages}. If tested positive, the + // package will be removed from {@code packages} and added to {@code result} with its + // dependencies. If usage data is available, the positive packages will be sorted by usage + // data (with {@code sortTemp} as temporary storage). + private static void applyPackageFilter(Predicate<PackageParser.Package> filter, + Collection<PackageParser.Package> result, + Collection<PackageParser.Package> packages, + @NonNull List<PackageParser.Package> sortTemp, + PackageManagerService packageManagerService) { + for (PackageParser.Package pkg : packages) { + if (filter.test(pkg)) { + sortTemp.add(pkg); } } - if (DEBUG_DEXOPT) { - Log.i(TAG, "Skipped dexopt " + skipped + " of " + total); + + sortPackagesByUsageDate(sortTemp, packageManagerService); + packages.removeAll(sortTemp); + + for (PackageParser.Package pkg : sortTemp) { + result.add(pkg); + + Collection<PackageParser.Package> deps = + packageManagerService.findSharedNonSystemLibraries(pkg); + if (!deps.isEmpty()) { + deps.removeAll(result); + result.addAll(deps); + packages.removeAll(deps); + } } + + sortTemp.clear(); } // Sort apps by importance for dexopt ordering. Important apps are given @@ -104,46 +118,25 @@ public class PackageManagerServiceUtils { PackageManagerService packageManagerService) { ArrayList<PackageParser.Package> remainingPkgs = new ArrayList<>(packages); LinkedList<PackageParser.Package> result = new LinkedList<>(); + ArrayList<PackageParser.Package> sortTemp = new ArrayList<>(remainingPkgs.size()); // Give priority to core apps. - for (PackageParser.Package pkg : remainingPkgs) { - if (pkg.coreApp) { - if (DEBUG_DEXOPT) { - Log.i(TAG, "Adding core app " + result.size() + ": " + pkg.packageName); - } - result.add(pkg); - } - } - remainingPkgs.removeAll(result); + applyPackageFilter((pkg) -> pkg.coreApp, result, remainingPkgs, sortTemp, + packageManagerService); // Give priority to system apps that listen for pre boot complete. Intent intent = new Intent(Intent.ACTION_PRE_BOOT_COMPLETED); - ArraySet<String> pkgNames = getPackageNamesForIntent(intent, UserHandle.USER_SYSTEM); - for (PackageParser.Package pkg : remainingPkgs) { - if (pkgNames.contains(pkg.packageName)) { - if (DEBUG_DEXOPT) { - Log.i(TAG, "Adding pre boot system app " + result.size() + ": " + - pkg.packageName); - } - result.add(pkg); - } - } - remainingPkgs.removeAll(result); + final ArraySet<String> pkgNames = getPackageNamesForIntent(intent, UserHandle.USER_SYSTEM); + applyPackageFilter((pkg) -> pkgNames.contains(pkg.packageName), result, remainingPkgs, + sortTemp, packageManagerService); // Give priority to apps used by other apps. - for (PackageParser.Package pkg : remainingPkgs) { - if (PackageDexOptimizer.isUsedByOtherApps(pkg)) { - if (DEBUG_DEXOPT) { - Log.i(TAG, "Adding app used by other apps " + result.size() + ": " + - pkg.packageName); - } - result.add(pkg); - } - } - remainingPkgs.removeAll(result); + applyPackageFilter((pkg) -> PackageDexOptimizer.isUsedByOtherApps(pkg), result, + remainingPkgs, sortTemp, packageManagerService); // Filter out packages that aren't recently used, add all remaining apps. // TODO: add a property to control this? + Predicate<PackageParser.Package> remainingPredicate; if (!remainingPkgs.isEmpty() && packageManagerService.isHistoricalPackageUsageAvailable()) { if (DEBUG_DEXOPT) { Log.i(TAG, "Looking at historical package use"); @@ -159,34 +152,24 @@ public class PackageManagerServiceUtils { lastUsed.getLatestForegroundPackageUseTimeInMills(); // Be defensive if for some reason package usage has bogus data. if (estimatedPreviousSystemUseTime != 0) { - filterRecentlyUsedApps(remainingPkgs, estimatedPreviousSystemUseTime, - SEVEN_DAYS_IN_MILLISECONDS); + final long cutoffTime = estimatedPreviousSystemUseTime - SEVEN_DAYS_IN_MILLISECONDS; + remainingPredicate = + (pkg) -> pkg.getLatestForegroundPackageUseTimeInMills() >= cutoffTime; + } else { + // No meaningful historical info. Take all. + remainingPredicate = (pkg) -> true; } + sortPackagesByUsageDate(remainingPkgs, packageManagerService); + } else { + // No historical info. Take all. + remainingPredicate = (pkg) -> true; } - result.addAll(remainingPkgs); - - // Now go ahead and also add the libraries required for these packages. - // TODO: Think about interleaving things. - Set<PackageParser.Package> dependencies = new HashSet<>(); - for (PackageParser.Package p : result) { - dependencies.addAll(packageManagerService.findSharedNonSystemLibraries(p)); - } - if (!dependencies.isEmpty()) { - // We might have packages already in `result` that are dependencies - // of other packages. Make sure we don't add those to the list twice. - dependencies.removeAll(result); - } - result.addAll(dependencies); + applyPackageFilter(remainingPredicate, result, remainingPkgs, sortTemp, + packageManagerService); if (DEBUG_DEXOPT) { - StringBuilder sb = new StringBuilder(); - for (PackageParser.Package pkg : result) { - if (sb.length() > 0) { - sb.append(", "); - } - sb.append(pkg.packageName); - } - Log.i(TAG, "Packages to be dexopted: " + sb.toString()); + Log.i(TAG, "Packages to be dexopted: " + packagesToString(result)); + Log.i(TAG, "Packages skipped from dexopt: " + packagesToString(remainingPkgs)); } return result; @@ -203,4 +186,15 @@ public class PackageManagerServiceUtils { throw ee.rethrowAsIOException(); } } + + public static String packagesToString(Collection<PackageParser.Package> c) { + StringBuilder sb = new StringBuilder(); + for (PackageParser.Package pkg : c) { + if (sb.length() > 0) { + sb.append(", "); + } + sb.append(pkg.packageName); + } + return sb.toString(); + } } diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 6eb792b7aba8..3fc945a83617 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -261,6 +261,17 @@ public class CarrierConfigManager { public static final String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"; /** + * Specifies a map from dialstrings to replacements for roaming network service numbers which + * cannot be replaced on the carrier side. + * <p> + * Individual entries have the format: + * [dialstring to replace]:[replacement] + * @hide + */ + public static final String KEY_DIAL_STRING_REPLACE_STRING_ARRAY = + "dial_string_replace_string_array"; + + /** * Flag specifying whether WFC over IMS supports the "wifi only" option. If false, the wifi * calling settings will not include an option for "wifi only". If true, the wifi calling * settings will include an option for "wifi only" @@ -710,6 +721,15 @@ public class CarrierConfigManager { "duration_blocking_disabled_after_emergency_int"; /** + * For carriers which require an empty flash to be sent before sending the normal 3-way calling + * flash, the duration in milliseconds of the empty flash to send. When {@code 0}, no empty + * flash is sent. + * @hide + */ + public static final String KEY_CDMA_3WAYCALL_FLASH_DELAY_INT = "cdma_3waycall_flash_delay_int"; + + + /** * @hide * The default value for preferred CDMA roaming mode (aka CDMA system select.) * CDMA_ROAMING_MODE_RADIO_DEFAULT = the default roaming mode from the radio @@ -813,10 +833,12 @@ public class CarrierConfigManager { sDefaults.putStringArray(KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY, null); sDefaults.putStringArray(KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY, null); sDefaults.putStringArray(KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY, null); + sDefaults.putStringArray(KEY_DIAL_STRING_REPLACE_STRING_ARRAY, null); sDefaults.putBoolean(KEY_FORCE_HOME_NETWORK_BOOL, false); sDefaults.putInt(KEY_GSM_DTMF_TONE_DELAY_INT, 0); sDefaults.putInt(KEY_IMS_DTMF_TONE_DELAY_INT, 0); sDefaults.putInt(KEY_CDMA_DTMF_TONE_DELAY_INT, 100); + sDefaults.putInt(KEY_CDMA_3WAYCALL_FLASH_DELAY_INT , 0); sDefaults.putBoolean(KEY_SUPPORT_CONFERENCE_CALL_BOOL, true); sDefaults.putBoolean(KEY_EDITABLE_ENHANCED_4G_LTE_BOOL, true); sDefaults.putBoolean(KEY_HIDE_IMS_APN_BOOL, false); diff --git a/wifi/tests/Android.mk b/wifi/tests/Android.mk new file mode 100644 index 000000000000..5850feee004a --- /dev/null +++ b/wifi/tests/Android.mk @@ -0,0 +1,61 @@ +# Copyright (C) 2016 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. + +LOCAL_PATH:= $(call my-dir) + +# Make test APK +# ============================================================ +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := tests + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +# This list is generated from the java source files in this module +# The list is a comma separated list of class names with * matching zero or more characters. +# Example: +# Input files: src/com/android/server/wifi/Test.java src/com/android/server/wifi/AnotherTest.java +# Generated exclude list: com.android.server.wifi.Test*,com.android.server.wifi.AnotherTest* + +# Filter all src files to just java files +local_java_files := $(filter %.java,$(LOCAL_SRC_FILES)) +# Transform java file names into full class names. +# This only works if the class name matches the file name and the directory structure +# matches the package. +local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files))) +# Utility variables to allow replacing a space with a comma +comma:= , +empty:= +space:= $(empty) $(empty) +# Convert class name list to jacoco exclude list +# This appends a * to all classes and replace the space separators with commas. +# These patterns will match all classes in this module and their inner classes. +jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes))) + +jacoco_include := android.net.wifi.* + +LOCAL_JACK_COVERAGE_INCLUDE_FILTER := $(jacoco_include) +LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude) + +LOCAL_STATIC_JAVA_LIBRARIES := \ + android-support-test \ + mockito-target-minus-junit4 \ + frameworks-base-testutils \ + +LOCAL_JAVA_LIBRARIES := \ + android.test.runner \ + +LOCAL_PACKAGE_NAME := FrameworksWifiApiTests + +include $(BUILD_PACKAGE) diff --git a/wifi/tests/AndroidManifest.xml b/wifi/tests/AndroidManifest.xml new file mode 100644 index 000000000000..4eaca2b98a1d --- /dev/null +++ b/wifi/tests/AndroidManifest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2016 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 + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.net.wifi.test"> + + <application> + <uses-library android:name="android.test.runner" /> + <activity android:label="WifiTestDummyLabel" + android:name="WifiTestDummyName"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + </application> + + <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" + android:targetPackage="android.net.wifi.test" + android:label="Frameworks Wifi API Tests"> + </instrumentation> + +</manifest> diff --git a/wifi/tests/README.md b/wifi/tests/README.md new file mode 100644 index 000000000000..b418abd5e46b --- /dev/null +++ b/wifi/tests/README.md @@ -0,0 +1,50 @@ +# Wifi Unit Tests +This package contains unit tests for the android wifi framework APIs based on the +[Android Testing Support Library](http://developer.android.com/tools/testing-support-library/index.html). +The test cases are built using the [JUnit](http://junit.org/) and [Mockito](http://mockito.org/) +libraries. + +## Running Tests +The easiest way to run tests is simply run + +``` +frameworks/base/wifi/tests/runtests.sh +``` + +`runtests.sh` will build the test project and all of its dependencies and push the APK to the +connected device. It will then run the tests on the device. + +To pick up changes in framework/base, you will need to: +1. rebuild the framework library 'make -j32' +2. sync over the updated library to the device 'adb sync' +3. restart framework on the device 'adb shell stop' then 'adb shell start' + +To enable syncing data to the device for first time after clean reflash: +1. adb disable-verity +2. adb reboot +3. adb remount + +See below for a few example of options to limit which tests are run. +See the +[AndroidJUnitRunner Documentation](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html) +for more details on the supported options. + +``` +runtests.sh -e package android.net.wifi +runtests.sh -e class android.net.wifi.WifiScannerTest +``` + +If you manually build and push the test APK to the device you can run tests using + +``` +adb shell am instrument -w 'android.net.wifi.test/android.support.test.runner.AndroidJUnitRunner' +``` + +## Adding Tests +Tests can be added by adding classes to the src directory. JUnit4 style test cases can +be written by simply annotating test methods with `org.junit.Test`. + +## Debugging Tests +If you are trying to debug why tests are not doing what you expected, you can add android log +statements and use logcat to view them. The beginning and end of every tests is automatically logged +with the tag `TestRunner`. diff --git a/wifi/tests/runtests.sh b/wifi/tests/runtests.sh new file mode 100755 index 000000000000..ebcc2a2f34a2 --- /dev/null +++ b/wifi/tests/runtests.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +if [ -z $ANDROID_BUILD_TOP ]; then + echo "You need to source and lunch before you can use this script" + exit 1 +fi + +echo "Running tests" + +set -e # fail early + +echo "+ mmma -j32 $ANDROID_BUILD_TOP/frameworks/base/wifi/tests" +# NOTE Don't actually run the command above since this shell doesn't inherit functions from the +# caller. +make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk MODULES-IN-frameworks-base-wifi-tests + +set -x # print commands + +adb root +adb wait-for-device + +adb install -r -g "$OUT/data/app/FrameworksWifiApiTests/FrameworksWifiApiTests.apk" + +adb shell am instrument -w "$@" 'android.net.wifi.test/android.support.test.runner.AndroidJUnitRunner' diff --git a/wifi/tests/src/android/net/wifi/FakeKeys.java b/wifi/tests/src/android/net/wifi/FakeKeys.java new file mode 100644 index 000000000000..0c730705b039 --- /dev/null +++ b/wifi/tests/src/android/net/wifi/FakeKeys.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2016 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 android.net.wifi; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; + +/** + * A class containing test certificates. + */ +public class FakeKeys { + private static final String CA_CERT0_STRING = "-----BEGIN CERTIFICATE-----\n" + + "MIIDKDCCAhCgAwIBAgIJAILlFdwzLVurMA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNV\n" + + "BAMTB0VBUCBDQTEwHhcNMTYwMTEyMTE1MDE1WhcNMjYwMTA5MTE1MDE1WjASMRAw\n" + + "DgYDVQQDEwdFQVAgQ0ExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\n" + + "znAPUz26Msae4ws43czR41/J2QtrSIZUKmVUsVumDbYHrPNvTXKSMXAcewORDQYX\n" + + "RqvHvpn8CscB1+oGXZvHwxj4zV0WKoK2zeXkau3vcyl3HIKupJfq2TEACefVjj0t\n" + + "JW+X35PGWp9/H5zIUNVNVjS7Ums84IvKhRB8512PB9UyHagXYVX5GWpAcVpyfrlR\n" + + "FI9Qdhh+Pbk0uyktdbf/CdfgHOoebrTtwRljM0oDtX+2Cv6j0wBK7hD8pPvf1+uy\n" + + "GzczigAU/4Kw7eZqydf9B+5RupR+IZipX41xEiIrKRwqi517WWzXcjaG2cNbf451\n" + + "xpH5PnV3i1tq04jMGQUzFwIDAQABo4GAMH4wHQYDVR0OBBYEFIwX4vs8BiBcScod\n" + + "5noZHRM8E4+iMEIGA1UdIwQ7MDmAFIwX4vs8BiBcScod5noZHRM8E4+ioRakFDAS\n" + + "MRAwDgYDVQQDEwdFQVAgQ0ExggkAguUV3DMtW6swDAYDVR0TBAUwAwEB/zALBgNV\n" + + "HQ8EBAMCAQYwDQYJKoZIhvcNAQELBQADggEBAFfQqOTA7Rv7K+luQ7pnas4BYwHE\n" + + "9GEP/uohv6KOy0TGQFbrRTjFoLVNB9BZ1ymMDZ0/TIwIUc7wi7a8t5mEqYH153wW\n" + + "aWooiSjyLLhuI4sNrNCOtisdBq2r2MFXt6h0mAQYOPv8R8K7/fgSxGFqzhyNmmVL\n" + + "1qBJldx34SpwsTALQVPb4hGwJzZfr1PcpEQx6xMnTl8xEWZE3Ms99uaUxbQqIwRu\n" + + "LgAOkNCmY2m89VhzaHJ1uV85AdM/tD+Ysmlnnjt9LRCejbBipjIGjOXrg1JP+lxV\n" + + "muM4vH+P/mlmxsPPz0d65b+EGmJZpoLkO/tdNNvCYzjJpTEWpEsO6NMhKYo=\n" + + "-----END CERTIFICATE-----\n"; + public static final X509Certificate CA_CERT0 = loadCertificate(CA_CERT0_STRING); + + private static final String CA_CERT1_STRING = "-----BEGIN CERTIFICATE-----\n" + + "MIIDKDCCAhCgAwIBAgIJAOM5SzKO2pzCMA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNV\n" + + "BAMTB0VBUCBDQTAwHhcNMTYwMTEyMDAxMDQ3WhcNMjYwMTA5MDAxMDQ3WjASMRAw\n" + + "DgYDVQQDEwdFQVAgQ0EwMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\n" + + "89ug+IEKVQXnJGKg5g4uVHg6J/8iRUxR5k2eH5o03hrJNMfN2D+cBe/wCiZcnWbI\n" + + "GbGZACWm2nQth2wy9Zgm2LOd3b4ocrHYls3XLq6Qb5Dd7a0JKU7pdGufiNVEkrmF\n" + + "EB+N64wgwH4COTvCiN4erp5kyJwkfqAl2xLkZo0C464c9XoyQOXbmYD9A8v10wZu\n" + + "jyNsEo7Nr2USyw+qhjWSbFbEirP77Tvx+7pJQJwdtk1V9Tn73T2dGF2WHYejei9S\n" + + "mcWpdIUqsu9etYH+zDmtu7I1xlkwiaVsNr2+D+qaCJyOYqrDTKVNK5nmbBPXDWZc\n" + + "NoDbTOoqquX7xONpq9M6jQIDAQABo4GAMH4wHQYDVR0OBBYEFAZ3A2S4qJZZwuNY\n" + + "wkJ6mAdc0gVdMEIGA1UdIwQ7MDmAFAZ3A2S4qJZZwuNYwkJ6mAdc0gVdoRakFDAS\n" + + "MRAwDgYDVQQDEwdFQVAgQ0EwggkA4zlLMo7anMIwDAYDVR0TBAUwAwEB/zALBgNV\n" + + "HQ8EBAMCAQYwDQYJKoZIhvcNAQELBQADggEBAHmdMwEhtys4d0E+t7owBmoVR+lU\n" + + "hMCcRtWs8YKX5WIM2kTweT0h/O1xwE1mWmRv/IbDAEb8od4BjAQLhIcolStr2JaO\n" + + "9ZzyxjOnNzqeErh/1DHDbb/moPpqfeJ8YiEz7nH/YU56Q8iCPO7TsgS0sNNE7PfN\n" + + "IUsBW0yHRgpQ4OxWmiZG2YZWiECRzAC0ecPzo59N5iH4vLQIMTMYquiDeMPQnn1e\n" + + "NDGxG8gCtDKIaS6tMg3a28MvWB094pr2ETou8O1C8Ji0Y4hE8QJmSdT7I4+GZjgW\n" + + "g94DZ5RiL7sdp3vC48CXOmeT61YBIvhGUsE1rPhXqkpqQ3Z3C4TFF0jXZZc=\n" + + "-----END CERTIFICATE-----\n"; + public static final X509Certificate CA_CERT1 = loadCertificate(CA_CERT1_STRING); + + + private static X509Certificate loadCertificate(String blob) { + try { + final CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); + InputStream stream = new ByteArrayInputStream(blob.getBytes(StandardCharsets.UTF_8)); + + return (X509Certificate) certFactory.generateCertificate(stream); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/wifi/tests/src/android/net/wifi/WifiEnterpriseConfigTest.java b/wifi/tests/src/android/net/wifi/WifiEnterpriseConfigTest.java new file mode 100644 index 000000000000..0d964b7c92d7 --- /dev/null +++ b/wifi/tests/src/android/net/wifi/WifiEnterpriseConfigTest.java @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2016 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 android.net.wifi; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; + +import android.net.wifi.WifiEnterpriseConfig.Eap; +import android.net.wifi.WifiEnterpriseConfig.Phase2; +import android.os.Parcel; +import android.security.Credentials; +import android.test.suitebuilder.annotation.SmallTest; + +import org.junit.Before; +import org.junit.Test; + +import java.security.cert.X509Certificate; + + +/** + * Unit tests for {@link android.net.wifi.WifiEnterpriseConfig}. + */ +@SmallTest +public class WifiEnterpriseConfigTest { + // Maintain a ground truth of the keystore uri prefix which is expected by wpa_supplicant. + public static final String KEYSTORE_URI = "keystore://"; + public static final String CA_CERT_PREFIX = KEYSTORE_URI + Credentials.CA_CERTIFICATE; + public static final String KEYSTORES_URI = "keystores://"; + + private WifiEnterpriseConfig mEnterpriseConfig; + + @Before + public void setUp() throws Exception { + mEnterpriseConfig = new WifiEnterpriseConfig(); + } + + @Test + public void testGetEmptyCaCertificate() { + // A newly-constructed WifiEnterpriseConfig object should have no CA certificate. + assertNull(mEnterpriseConfig.getCaCertificate()); + assertNull(mEnterpriseConfig.getCaCertificates()); + // Setting CA certificate to null explicitly. + mEnterpriseConfig.setCaCertificate(null); + assertNull(mEnterpriseConfig.getCaCertificate()); + // Setting CA certificate to null using setCaCertificates(). + mEnterpriseConfig.setCaCertificates(null); + assertNull(mEnterpriseConfig.getCaCertificates()); + // Setting CA certificate to zero-length array. + mEnterpriseConfig.setCaCertificates(new X509Certificate[0]); + assertNull(mEnterpriseConfig.getCaCertificates()); + } + + @Test + public void testSetGetSingleCaCertificate() { + X509Certificate cert0 = FakeKeys.CA_CERT0; + mEnterpriseConfig.setCaCertificate(cert0); + assertEquals(mEnterpriseConfig.getCaCertificate(), cert0); + } + + @Test + public void testSetGetMultipleCaCertificates() { + X509Certificate cert0 = FakeKeys.CA_CERT0; + X509Certificate cert1 = FakeKeys.CA_CERT1; + mEnterpriseConfig.setCaCertificates(new X509Certificate[] {cert0, cert1}); + X509Certificate[] result = mEnterpriseConfig.getCaCertificates(); + assertEquals(result.length, 2); + assertTrue(result[0] == cert0 && result[1] == cert1); + } + + @Test + public void testSaveSingleCaCertificateAlias() { + final String alias = "single_alias 0"; + mEnterpriseConfig.setCaCertificateAliases(new String[] {alias}); + assertEquals(getCaCertField(), CA_CERT_PREFIX + alias); + } + + @Test + public void testLoadSingleCaCertificateAlias() { + final String alias = "single_alias 1"; + setCaCertField(CA_CERT_PREFIX + alias); + String[] aliases = mEnterpriseConfig.getCaCertificateAliases(); + assertEquals(aliases.length, 1); + assertEquals(aliases[0], alias); + } + + @Test + public void testSaveMultipleCaCertificates() { + final String alias0 = "single_alias 0"; + final String alias1 = "single_alias 1"; + mEnterpriseConfig.setCaCertificateAliases(new String[] {alias0, alias1}); + assertEquals(getCaCertField(), String.format("%s%s %s", + KEYSTORES_URI, + WifiEnterpriseConfig.encodeCaCertificateAlias(Credentials.CA_CERTIFICATE + alias0), + WifiEnterpriseConfig.encodeCaCertificateAlias(Credentials.CA_CERTIFICATE + alias1))); + } + + @Test + public void testLoadMultipleCaCertificates() { + final String alias0 = "single_alias 0"; + final String alias1 = "single_alias 1"; + setCaCertField(String.format("%s%s %s", + KEYSTORES_URI, + WifiEnterpriseConfig.encodeCaCertificateAlias(Credentials.CA_CERTIFICATE + alias0), + WifiEnterpriseConfig.encodeCaCertificateAlias(Credentials.CA_CERTIFICATE + alias1))); + String[] aliases = mEnterpriseConfig.getCaCertificateAliases(); + assertEquals(aliases.length, 2); + assertEquals(aliases[0], alias0); + assertEquals(aliases[1], alias1); + } + + private String getCaCertField() { + return mEnterpriseConfig.getFieldValue(WifiEnterpriseConfig.CA_CERT_KEY); + } + + private void setCaCertField(String value) { + mEnterpriseConfig.setFieldValue(WifiEnterpriseConfig.CA_CERT_KEY, value); + } + + // Retrieves the value for a specific key supplied to wpa_supplicant. + private class SupplicantConfigExtractor implements WifiEnterpriseConfig.SupplicantSaver { + private String mValue = null; + private String mKey; + + SupplicantConfigExtractor(String key) { + mKey = key; + } + + @Override + public boolean saveValue(String key, String value) { + if (key.equals(mKey)) { + mValue = value; + } + return true; + } + + public String getValue() { + return mValue; + } + } + + private String getSupplicantEapMethod() { + SupplicantConfigExtractor entryExtractor = new SupplicantConfigExtractor( + WifiEnterpriseConfig.EAP_KEY); + mEnterpriseConfig.saveToSupplicant(entryExtractor); + return entryExtractor.getValue(); + } + + private String getSupplicantPhase2Method() { + SupplicantConfigExtractor entryExtractor = new SupplicantConfigExtractor( + WifiEnterpriseConfig.PHASE2_KEY); + mEnterpriseConfig.saveToSupplicant(entryExtractor); + return entryExtractor.getValue(); + } + + /** Verifies the default value for EAP outer and inner methods */ + @Test + public void eapInnerDefault() { + assertEquals(null, getSupplicantEapMethod()); + assertEquals(null, getSupplicantPhase2Method()); + } + + /** Verifies that the EAP inner method is reset when we switch to TLS */ + @Test + public void eapPhase2MethodForTls() { + // Initially select an EAP method that supports an phase2. + mEnterpriseConfig.setEapMethod(Eap.PEAP); + mEnterpriseConfig.setPhase2Method(Phase2.MSCHAPV2); + assertEquals("PEAP", getSupplicantEapMethod()); + assertEquals("\"auth=MSCHAPV2\"", getSupplicantPhase2Method()); + + // Change the EAP method to another type which supports a phase2. + mEnterpriseConfig.setEapMethod(Eap.TTLS); + assertEquals("TTLS", getSupplicantEapMethod()); + assertEquals("\"auth=MSCHAPV2\"", getSupplicantPhase2Method()); + + // Change the EAP method to TLS which does not support a phase2. + mEnterpriseConfig.setEapMethod(Eap.TLS); + assertEquals(null, getSupplicantPhase2Method()); + } + + /** Verfies that the EAP inner method is reset when we switch phase2 to NONE */ + @Test + public void eapPhase2None() { + // Initially select an EAP method that supports an phase2. + mEnterpriseConfig.setEapMethod(Eap.PEAP); + mEnterpriseConfig.setPhase2Method(Phase2.MSCHAPV2); + assertEquals("PEAP", getSupplicantEapMethod()); + assertEquals("\"auth=MSCHAPV2\"", getSupplicantPhase2Method()); + + // Change the phase2 method to NONE and ensure the value is cleared. + mEnterpriseConfig.setPhase2Method(Phase2.NONE); + assertEquals(null, getSupplicantPhase2Method()); + } + + /** Verfies that the correct "autheap" parameter is supplied for TTLS/GTC. */ + @Test + public void peapGtcToTtls() { + mEnterpriseConfig.setEapMethod(Eap.PEAP); + mEnterpriseConfig.setPhase2Method(Phase2.GTC); + assertEquals("PEAP", getSupplicantEapMethod()); + assertEquals("\"auth=GTC\"", getSupplicantPhase2Method()); + + mEnterpriseConfig.setEapMethod(Eap.TTLS); + assertEquals("TTLS", getSupplicantEapMethod()); + assertEquals("\"autheap=GTC\"", getSupplicantPhase2Method()); + } + + /** Verfies that the correct "auth" parameter is supplied for PEAP/GTC. */ + @Test + public void ttlsGtcToPeap() { + mEnterpriseConfig.setEapMethod(Eap.TTLS); + mEnterpriseConfig.setPhase2Method(Phase2.GTC); + assertEquals("TTLS", getSupplicantEapMethod()); + assertEquals("\"autheap=GTC\"", getSupplicantPhase2Method()); + + mEnterpriseConfig.setEapMethod(Eap.PEAP); + assertEquals("PEAP", getSupplicantEapMethod()); + assertEquals("\"auth=GTC\"", getSupplicantPhase2Method()); + } + + /** Verfies that the copy constructor preseves the inner method information. */ + @Test + public void copyConstructor() { + WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig(); + enterpriseConfig.setEapMethod(Eap.TTLS); + enterpriseConfig.setPhase2Method(Phase2.GTC); + mEnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig); + assertEquals("TTLS", getSupplicantEapMethod()); + assertEquals("\"autheap=GTC\"", getSupplicantPhase2Method()); + } + + /** Verfies that parceling a WifiEnterpriseConfig preseves method information. */ + @Test + public void parcelConstructor() { + WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig(); + enterpriseConfig.setEapMethod(Eap.TTLS); + enterpriseConfig.setPhase2Method(Phase2.GTC); + Parcel parcel = Parcel.obtain(); + enterpriseConfig.writeToParcel(parcel, 0); + parcel.setDataPosition(0); // Allow parcel to be read from the beginning. + mEnterpriseConfig = WifiEnterpriseConfig.CREATOR.createFromParcel(parcel); + assertEquals("TTLS", getSupplicantEapMethod()); + assertEquals("\"autheap=GTC\"", getSupplicantPhase2Method()); + } + + /** Verifies proper operation of the getKeyId() method. */ + @Test + public void getKeyId() { + assertEquals("NULL", mEnterpriseConfig.getKeyId(null)); + WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig(); + enterpriseConfig.setEapMethod(Eap.TTLS); + enterpriseConfig.setPhase2Method(Phase2.GTC); + assertEquals("TTLS_GTC", mEnterpriseConfig.getKeyId(enterpriseConfig)); + mEnterpriseConfig.setEapMethod(Eap.PEAP); + mEnterpriseConfig.setPhase2Method(Phase2.MSCHAPV2); + assertEquals("PEAP_MSCHAPV2", mEnterpriseConfig.getKeyId(enterpriseConfig)); + } + + /** Verifies that passwords are not displayed in toString. */ + @Test + public void passwordNotInToString() { + String password = "supersecret"; + mEnterpriseConfig.setPassword(password); + assertFalse(mEnterpriseConfig.toString().contains(password)); + } +} diff --git a/wifi/tests/src/android/net/wifi/WifiScannerTest.java b/wifi/tests/src/android/net/wifi/WifiScannerTest.java new file mode 100644 index 000000000000..a829eb933b59 --- /dev/null +++ b/wifi/tests/src/android/net/wifi/WifiScannerTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2016 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 android.net.wifi; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.validateMockitoUsage; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import android.content.Context; +import android.net.wifi.WifiScanner.BssidInfo; +import android.net.wifi.WifiScanner.BssidListener; +import android.os.Handler; +import android.os.Message; +import android.os.test.TestLooper; +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.internal.util.test.BidirectionalAsyncChannelServer; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +/** + * Unit tests for {@link android.net.wifi.WifiScanner}. + */ +@SmallTest +public class WifiScannerTest { + @Mock + private Context mContext; + @Mock + private IWifiScanner mService; + @Mock + private BssidListener mBssidListener; + + private WifiScanner mWifiScanner; + private TestLooper mLooper; + private Handler mHandler; + + /** + * Setup before tests. + */ + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + mLooper = new TestLooper(); + mHandler = mock(Handler.class); + BidirectionalAsyncChannelServer server = new BidirectionalAsyncChannelServer( + mContext, mLooper.getLooper(), mHandler); + when(mService.getMessenger()).thenReturn(server.getMessenger()); + mWifiScanner = new WifiScanner(mContext, mService, mLooper.getLooper()); + mLooper.dispatchAll(); + } + + /** + * Clean up after tests. + */ + @After + public void cleanup() { + validateMockitoUsage(); + } + + private void verifySetHotlistMessage(Handler handler) { + ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class); + verify(handler, atLeastOnce()).handleMessage(messageCaptor.capture()); + assertEquals("message.what is not CMD_SET_HOTLIST", + WifiScanner.CMD_SET_HOTLIST, + messageCaptor.getValue().what); + } + + /** + * Test duplicate listeners for bssid tracking. + */ + @Test + public void testStartTrackingBssidsDuplicateListeners() throws Exception { + BssidInfo[] bssids = new BssidInfo[] { + new BssidInfo() + }; + + // First start tracking succeeds. + mWifiScanner.startTrackingBssids(bssids, -100, mBssidListener); + mLooper.dispatchAll(); + verifySetHotlistMessage(mHandler); + + // Second start tracking should fail. + mWifiScanner.startTrackingBssids(bssids, -100, mBssidListener); + mLooper.dispatchAll(); + verify(mBssidListener).onFailure(eq(WifiScanner.REASON_DUPLICATE_REQEUST), anyString()); + } +} |