Snap for 8573834 from 6a9b989aea to udc-release
Change-Id: I96a83227b9565e8be2eeb4dcdb640b1d1e270461
This commit is contained in:
@@ -15,36 +15,16 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="true"
|
||||
android:clipChildren="true">
|
||||
<ScrollView
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollIndicators="top|bottom">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<include
|
||||
android:id="@+id/wifi_dialog_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/add_network_button_bar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
layout="@layout/wifi_dialog"/>
|
||||
android:orientation="vertical">
|
||||
<include layout="@layout/wifi_network_config"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/add_network_button_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/wifi_dialog_frame"
|
||||
layout="@*android:layout/alert_dialog_button_bar_material"/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<include layout="@*android:layout/alert_dialog_button_bar_material"/>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
@@ -15,694 +15,10 @@
|
||||
-->
|
||||
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dialog_scrollview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollIndicators="top|bottom">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/l_wifidialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dip">
|
||||
|
||||
<LinearLayout android:id="@+id/info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section" />
|
||||
|
||||
<LinearLayout android:id="@+id/type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_ssid"
|
||||
android:textDirection="locale" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText android:id="@+id/ssid"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ssid_scanner_button"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/wifi_ssid_hint"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ssid_scanner_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="@dimen/min_tap_target_size"
|
||||
android:minHeight="@dimen/min_tap_target_size"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:src="@drawable/ic_scan_24dp"
|
||||
android:contentDescription="@string/wifi_dpp_scan_qr_code"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/ssid_too_long_warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_warning"
|
||||
android:text="@string/wifi_ssid_too_long" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minEms="16"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_security" />
|
||||
|
||||
<!-- Entries are added dynamically to this spinner -->
|
||||
<!-- See WifiConfigController.configureSecuritySpinner -->
|
||||
<Spinner android:id="@+id/security"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_security" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/security_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout android:id="@+id/eap"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout android:id="@+id/l_method"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_method" />
|
||||
|
||||
<Spinner android:id="@+id/method"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_method" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_sim"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/sim_card" />
|
||||
|
||||
<Spinner android:id="@+id/sim"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/sim_card" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_phase2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/please_select_phase2" />
|
||||
|
||||
<Spinner android:id="@+id/phase2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/please_select_phase2" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_ca_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_ca_cert" />
|
||||
|
||||
<Spinner android:id="@+id/ca_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_ca_cert" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_ocsp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_ocsp" />
|
||||
|
||||
<Spinner android:id="@+id/ocsp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_ocsp"
|
||||
android:entries="@array/eap_ocsp_type" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_domain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_domain" />
|
||||
|
||||
<EditText android:id="@+id/domain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/no_domain_warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_warning"
|
||||
android:text="@string/wifi_no_domain_warning" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_user_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_user_cert" />
|
||||
|
||||
<Spinner android:id="@+id/user_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_user_cert" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/no_user_cert_warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_warning"
|
||||
android:text="@string/wifi_no_user_cert_warning" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_identity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_identity" />
|
||||
|
||||
<EditText android:id="@+id/identity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_anonymous"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_anonymous" />
|
||||
|
||||
<EditText android:id="@+id/anonymous"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_password" />
|
||||
|
||||
<EditText android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:password="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/show_password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<!-- Placeholder to enable right-justification of checkbox -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label" />
|
||||
|
||||
<CheckBox android:id="@+id/show_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_content"
|
||||
android:text="@string/wifi_show_password" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/wifi_advanced_toggle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:visibility="gone">
|
||||
<CheckBox android:id="@+id/wifi_advanced_togglebox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_advanced_toggle"
|
||||
android:importantForAccessibility="yes"
|
||||
android:contentDescription="@string/wifi_advanced_toggle_description"
|
||||
android:text="@string/wifi_show_advanced" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/wifi_advanced_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout android:id="@+id/hidden_settings_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
|
||||
<TextView android:id="@+id/hidden_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_hidden_network" />
|
||||
|
||||
<Spinner android:id="@+id/hidden_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_hidden_network"
|
||||
android:entries="@array/wifi_hidden_entries"/>
|
||||
|
||||
<TextView android:id="@+id/hidden_settings_warning"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:text="@string/wifi_hidden_network_warning"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/metered_settings_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
|
||||
<TextView android:id="@+id/metered_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/data_usage_metered_yes" />
|
||||
|
||||
<Spinner android:id="@+id/metered_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/data_usage_metered_yes"
|
||||
android:entries="@array/wifi_metered_entries"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/proxy_settings_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView android:id="@+id/proxy_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_settings_title" />
|
||||
|
||||
<Spinner android:id="@+id/proxy_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/proxy_settings_title"
|
||||
android:entries="@array/wifi_proxy_settings" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/proxy_warning_limited_support"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
<!-- Placeholder to enable right-justification of warning -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_content"
|
||||
android:text="@string/proxy_warning_limited_support" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/proxy_pac_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_url_title" />
|
||||
|
||||
<EditText android:id="@+id/proxy_pac"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_url_hint"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout android:id="@+id/proxy_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_hostname_label" />
|
||||
|
||||
<EditText android:id="@+id/proxy_hostname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_hostname_hint"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_port_label" />
|
||||
|
||||
<EditText android:id="@+id/proxy_port"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_port_hint"
|
||||
android:inputType="number"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_exclusionlist_label" />
|
||||
|
||||
<EditText android:id="@+id/proxy_exclusionlist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_exclusionlist_hint"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/ip_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_ip_settings" />
|
||||
|
||||
<Spinner android:id="@+id/ip_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_ip_settings"
|
||||
android:entries="@array/wifi_ip_settings" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/staticip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_ip_address" />
|
||||
|
||||
<EditText android:id="@+id/ipaddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_ip_address_hint"
|
||||
android:inputType="textNoSuggestions" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_gateway" />
|
||||
|
||||
<EditText android:id="@+id/gateway"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_gateway_hint"
|
||||
android:inputType="textNoSuggestions" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_network_prefix_length" />
|
||||
|
||||
<EditText android:id="@+id/network_prefix_length"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_network_prefix_length_hint"
|
||||
android:inputType="number" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_dns1" />
|
||||
|
||||
<EditText android:id="@+id/dns1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_dns1_hint"
|
||||
android:inputType="textNoSuggestions" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_dns2" />
|
||||
|
||||
<EditText android:id="@+id/dns2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_dns2_hint"
|
||||
android:inputType="textNoSuggestions" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/privacy_settings_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView android:id="@+id/privacy_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_privacy_settings" />
|
||||
|
||||
<Spinner android:id="@+id/privacy_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_privacy_settings"
|
||||
android:entries="@array/wifi_privacy_entries"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item" >
|
||||
<CheckBox android:id="@+id/shared"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_content"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/wifi_shared"
|
||||
android:checked="true" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/wifi_network_config"/>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
699
res/layout/wifi_network_config.xml
Normal file
699
res/layout/wifi_network_config.xml
Normal file
@@ -0,0 +1,699 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/l_wifidialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dip">
|
||||
|
||||
<LinearLayout android:id="@+id/info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"/>
|
||||
|
||||
<LinearLayout android:id="@+id/type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_ssid"
|
||||
android:textDirection="locale"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<EditText android:id="@+id/ssid"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/wifi_ssid_hint"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ssid_scanner_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="@dimen/min_tap_target_size"
|
||||
android:minHeight="@dimen/min_tap_target_size"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:src="@drawable/ic_scan_24dp"
|
||||
android:contentDescription="@string/wifi_dpp_scan_qr_code"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/ssid_too_long_warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_warning"
|
||||
android:text="@string/wifi_ssid_too_long"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minEms="16"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_security"/>
|
||||
|
||||
<!-- Entries are added dynamically to this spinner -->
|
||||
<!-- See WifiConfigController.configureSecuritySpinner -->
|
||||
<Spinner android:id="@+id/security"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_security"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/security_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout android:id="@+id/eap"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout android:id="@+id/l_method"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_method"/>
|
||||
|
||||
<Spinner android:id="@+id/method"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_method"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_sim"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/sim_card"/>
|
||||
|
||||
<Spinner android:id="@+id/sim"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/sim_card"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_phase2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/please_select_phase2"/>
|
||||
|
||||
<Spinner android:id="@+id/phase2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/please_select_phase2"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_ca_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_ca_cert"/>
|
||||
|
||||
<Spinner android:id="@+id/ca_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_ca_cert"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_ocsp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_ocsp"/>
|
||||
|
||||
<Spinner android:id="@+id/ocsp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_ocsp"
|
||||
android:entries="@array/eap_ocsp_type"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_domain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_domain"/>
|
||||
|
||||
<EditText android:id="@+id/domain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/no_domain_warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_warning"
|
||||
android:text="@string/wifi_no_domain_warning"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_user_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_user_cert"/>
|
||||
|
||||
<Spinner android:id="@+id/user_cert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_eap_user_cert"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/no_user_cert_warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_warning"
|
||||
android:text="@string/wifi_no_user_cert_warning"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_identity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_identity"/>
|
||||
|
||||
<EditText android:id="@+id/identity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_anonymous"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_eap_anonymous"/>
|
||||
|
||||
<EditText android:id="@+id/anonymous"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_password"/>
|
||||
|
||||
<EditText android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/show_password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<!-- Placeholder to enable right-justification of checkbox -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"/>
|
||||
|
||||
<CheckBox android:id="@+id/show_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_content"
|
||||
android:text="@string/wifi_show_password"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/wifi_advanced_toggle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:visibility="gone">
|
||||
<CheckBox android:id="@+id/wifi_advanced_togglebox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_advanced_toggle"
|
||||
android:importantForAccessibility="yes"
|
||||
android:contentDescription="@string/wifi_advanced_toggle_description"
|
||||
android:text="@string/wifi_show_advanced"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/wifi_advanced_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout android:id="@+id/hidden_settings_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item">
|
||||
|
||||
<TextView android:id="@+id/hidden_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_hidden_network"/>
|
||||
|
||||
<Spinner android:id="@+id/hidden_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_hidden_network"
|
||||
android:entries="@array/wifi_hidden_entries"/>
|
||||
|
||||
<TextView android:id="@+id/hidden_settings_warning"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:text="@string/wifi_hidden_network_warning"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/metered_settings_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
|
||||
<TextView android:id="@+id/metered_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/data_usage_metered_yes"/>
|
||||
|
||||
<Spinner android:id="@+id/metered_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/data_usage_metered_yes"
|
||||
android:entries="@array/wifi_metered_entries"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/proxy_settings_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView android:id="@+id/proxy_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_settings_title"/>
|
||||
|
||||
<Spinner android:id="@+id/proxy_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/proxy_settings_title"
|
||||
android:entries="@array/wifi_proxy_settings"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/proxy_warning_limited_support"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
<!-- Placeholder to enable right-justification of warning -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_content"
|
||||
android:text="@string/proxy_warning_limited_support"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/proxy_pac_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_url_title"/>
|
||||
|
||||
<EditText android:id="@+id/proxy_pac"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_url_hint"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout android:id="@+id/proxy_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_hostname_label"/>
|
||||
|
||||
<EditText android:id="@+id/proxy_hostname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_hostname_hint"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_port_label"/>
|
||||
|
||||
<EditText android:id="@+id/proxy_port"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_port_hint"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/proxy_exclusionlist_label"/>
|
||||
|
||||
<EditText android:id="@+id/proxy_exclusionlist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:hint="@string/proxy_exclusionlist_hint"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/ip_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_ip_settings"/>
|
||||
|
||||
<Spinner android:id="@+id/ip_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_ip_settings"
|
||||
android:entries="@array/wifi_ip_settings"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/staticip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section"
|
||||
android:visibility="gone">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_ip_address"/>
|
||||
|
||||
<EditText android:id="@+id/ipaddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_ip_address_hint"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_gateway"/>
|
||||
|
||||
<EditText android:id="@+id/gateway"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_gateway_hint"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_network_prefix_length"/>
|
||||
|
||||
<EditText android:id="@+id/network_prefix_length"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_network_prefix_length_hint"
|
||||
android:inputType="number"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_dns1"/>
|
||||
|
||||
<EditText android:id="@+id/dns1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_dns1_hint"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_dns2"/>
|
||||
|
||||
<EditText android:id="@+id/dns2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/wifi_dns2_hint"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/privacy_settings_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView android:id="@+id/privacy_settings_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_label"
|
||||
android:text="@string/wifi_privacy_settings"/>
|
||||
|
||||
<Spinner android:id="@+id/privacy_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_spinner"
|
||||
android:prompt="@string/wifi_privacy_settings"
|
||||
android:entries="@array/wifi_privacy_entries"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_section">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item">
|
||||
<CheckBox android:id="@+id/shared"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_content"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/wifi_shared"
|
||||
android:checked="true"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1413,8 +1413,10 @@
|
||||
<!-- Message shown in screen lock picker while setting up the backup/fallback screen lock method for biometrics. Users can choose to use this method to unlock the screen instead of biometrics, or when biometrics are not accepted. [CHAR LIMIT=80] [BACKUP_MESSAGE_ID=2799884038398627882] -->
|
||||
<string name="lock_settings_picker_biometric_message">Choose your backup screen lock method</string>
|
||||
|
||||
<!-- Text shown on the screen lock menu. This text is letting the user know that their IT admin can't reset their screen lock if they forget it, and they can choose to set another lock that would be specifically for their work apps. The place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring the user to enroll a work profile screen lock instead. [CHAR LIMIT=100] -->
|
||||
<string name="lock_settings_picker_admin_restricted_personal_message">If you forget your screen lock, your IT admin can\u2019t reset it. <annotation id="link">Set a separate work lock</annotation></string>
|
||||
<!-- Text shown on the screen lock menu. This text is letting the user know that their IT admin can't reset their screen lock if they forget it. [CHAR LIMIT=100] -->
|
||||
<string name="lock_settings_picker_admin_restricted_personal_message">If you forget your screen lock, your IT admin can\u2019t reset it.</string>
|
||||
<!-- Text shown on the screen lock menu. This text is letting the user know that they can choose to set another lock that would be specifically for their work apps. [CHAR LIMIT=100] -->
|
||||
<string name="lock_settings_picker_admin_restricted_personal_message_action">Set a separate work lock</string>
|
||||
|
||||
<!-- Message shown in screen lock picker for setting up a work profile screen lock. [CHAR LIMIT=80] -->
|
||||
<string name="lock_settings_picker_profile_message">If you forget this lock, ask your IT admin to reset it</string>
|
||||
|
||||
@@ -48,12 +48,4 @@
|
||||
android:persistent="true"
|
||||
android:summary="@string/talkback_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:icon="@drawable/ic_accessibility_animation"
|
||||
android:key="toggle_disable_animations"
|
||||
android:persistent="false"
|
||||
android:summary="@string/accessibility_disable_animations_summary"
|
||||
android:title="@string/accessibility_disable_animations"
|
||||
settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.android.settings.fuelgauge.BatteryUsageStatsLoader;
|
||||
import com.android.settings.fuelgauge.BatteryUtils;
|
||||
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnPause;
|
||||
@@ -71,9 +72,10 @@ public class AppBatteryPreferenceController extends BasePreferenceController
|
||||
BatteryDiffEntry mBatteryDiffEntry;
|
||||
@VisibleForTesting
|
||||
boolean mIsChartGraphEnabled;
|
||||
@VisibleForTesting
|
||||
final AppInfoDashboardFragment mParent;
|
||||
|
||||
private Preference mPreference;
|
||||
private final AppInfoDashboardFragment mParent;
|
||||
private String mBatteryPercent;
|
||||
private final String mPackageName;
|
||||
private final int mUid;
|
||||
@@ -107,6 +109,11 @@ public class AppBatteryPreferenceController extends BasePreferenceController
|
||||
super.displayPreference(screen);
|
||||
mPreference = screen.findPreference(getPreferenceKey());
|
||||
mPreference.setEnabled(false);
|
||||
if (!AppUtils.isAppInstalled(mParent.getAppEntry())) {
|
||||
mPreference.setSummary("");
|
||||
return;
|
||||
}
|
||||
|
||||
loadBatteryDiffEntries();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import android.net.NetworkStats;
|
||||
import android.net.NetworkTemplate;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.format.Formatter;
|
||||
|
||||
@@ -35,6 +36,7 @@ import com.android.settings.Utils;
|
||||
import com.android.settings.datausage.AppDataUsage;
|
||||
import com.android.settings.datausage.DataUsageUtils;
|
||||
import com.android.settingslib.AppItem;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnPause;
|
||||
import com.android.settingslib.core.lifecycle.events.OnResume;
|
||||
@@ -61,6 +63,7 @@ public class AppDataUsagePreferenceController extends AppInfoPreferenceControlle
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mPreference.setEnabled(AppUtils.isAppInstalled(mAppEntry));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,11 +92,19 @@ public class AppDataUsagePreferenceController extends AppInfoPreferenceControlle
|
||||
@Override
|
||||
public Loader<List<NetworkCycleDataForUid>> onCreateLoader(int id, Bundle args) {
|
||||
final NetworkTemplate template = getTemplate(mContext);
|
||||
return NetworkCycleDataForUidLoader.builder(mContext)
|
||||
.addUid(mParent.getAppEntry().info.uid)
|
||||
.setRetrieveDetail(false)
|
||||
.setNetworkTemplate(template)
|
||||
.build();
|
||||
final int uid = mParent.getAppEntry().info.uid;
|
||||
|
||||
final NetworkCycleDataForUidLoader.Builder builder =
|
||||
NetworkCycleDataForUidLoader.builder(mContext);
|
||||
builder.setRetrieveDetail(false)
|
||||
.setNetworkTemplate(template);
|
||||
|
||||
builder.addUid(uid);
|
||||
if (Process.isApplicationUid(uid)) {
|
||||
// Also add in network usage for the app's SDK sandbox
|
||||
builder.addUid(Process.toSdkSandboxUid(uid));
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -154,6 +154,7 @@ public class AppInfoDashboardFragment extends DashboardFragment
|
||||
final TimeSpentInAppPreferenceController timeSpentInAppPreferenceController = use(
|
||||
TimeSpentInAppPreferenceController.class);
|
||||
timeSpentInAppPreferenceController.setPackageName(packageName);
|
||||
timeSpentInAppPreferenceController.setParentFragment(this);
|
||||
timeSpentInAppPreferenceController.initLifeCycleOwner(this);
|
||||
|
||||
use(AppDataUsagePreferenceController.class).setParentFragment(this);
|
||||
|
||||
@@ -25,6 +25,7 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
/*
|
||||
* Abstract base controller for the app detail preferences that refresh the state when the app state
|
||||
@@ -35,6 +36,7 @@ public abstract class AppInfoPreferenceControllerBase extends BasePreferenceCont
|
||||
|
||||
protected AppInfoDashboardFragment mParent;
|
||||
protected Preference mPreference;
|
||||
protected ApplicationsState.AppEntry mAppEntry;
|
||||
|
||||
private final Class<? extends SettingsPreferenceFragment> mDetailFragmentClass;
|
||||
|
||||
@@ -72,10 +74,12 @@ public abstract class AppInfoPreferenceControllerBase extends BasePreferenceCont
|
||||
public void setParentFragment(AppInfoDashboardFragment parent) {
|
||||
mParent = parent;
|
||||
parent.addToCallbackList(this);
|
||||
mAppEntry = mParent.getAppEntry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fragment class to be launched when the preference is clicked.
|
||||
*
|
||||
* @return the fragment to launch
|
||||
*/
|
||||
protected Class<? extends SettingsPreferenceFragment> getDetailFragmentClass() {
|
||||
@@ -84,10 +88,10 @@ public abstract class AppInfoPreferenceControllerBase extends BasePreferenceCont
|
||||
|
||||
/**
|
||||
* Gets any extras that should be passed to the fragment class when the preference is clicked.
|
||||
*
|
||||
* @return a bundle of extras to include in the launch intent
|
||||
*/
|
||||
protected Bundle getArguments() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,11 +22,13 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.notification.app.AppNotificationSettings;
|
||||
import com.android.settings.notification.NotificationBackend;
|
||||
import com.android.settings.notification.app.AppNotificationSettings;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
public class AppNotificationPreferenceController extends AppInfoPreferenceControllerBase {
|
||||
@@ -49,6 +51,12 @@ public class AppNotificationPreferenceController extends AppInfoPreferenceContro
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mPreference.setEnabled(AppUtils.isAppInstalled(mAppEntry));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
preference.setSummary(getNotificationSummary(mParent.getAppEntry(), mContext, mBackend));
|
||||
|
||||
@@ -26,12 +26,13 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.loader.app.LoaderManager;
|
||||
import androidx.loader.content.Loader;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.applications.AppStorageSettings;
|
||||
import com.android.settings.applications.FetchPackageStorageAsyncLoader;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
import com.android.settingslib.applications.StorageStatsSource;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnPause;
|
||||
@@ -47,14 +48,22 @@ public class AppStoragePreferenceController extends AppInfoPreferenceControllerB
|
||||
super(context, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mPreference.setEnabled(AppUtils.isAppInstalled(mAppEntry));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final ApplicationsState.AppEntry entry = mParent.getAppEntry();
|
||||
if (entry != null && entry.info != null) {
|
||||
final boolean isExternal =
|
||||
(entry.info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
|
||||
preference.setSummary(getStorageSummary(mLastResult, isExternal));
|
||||
if (!AppUtils.isAppInstalled(mAppEntry)) {
|
||||
preference.setSummary("");
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean isExternal =
|
||||
(mAppEntry.info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
|
||||
preference.setSummary(getStorageSummary(mLastResult, isExternal));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,5 +111,4 @@ public class AppStoragePreferenceController extends AppInfoPreferenceControllerB
|
||||
@Override
|
||||
public void onLoaderReset(Loader<StorageStatsSource.AppStorageStats> loader) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ import androidx.preference.PreferenceScreen;
|
||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||
import com.android.settings.core.LiveDataController;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,6 +47,8 @@ public class TimeSpentInAppPreferenceController extends LiveDataController {
|
||||
private final ApplicationFeatureProvider mAppFeatureProvider;
|
||||
private Intent mIntent;
|
||||
private String mPackageName;
|
||||
protected AppInfoDashboardFragment mParent;
|
||||
protected ApplicationsState.AppEntry mAppEntry;
|
||||
|
||||
public TimeSpentInAppPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
@@ -59,6 +63,14 @@ public class TimeSpentInAppPreferenceController extends LiveDataController {
|
||||
.putExtra(Intent.EXTRA_PACKAGE_NAME, mPackageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a parent fragment for this controller.
|
||||
*/
|
||||
public void setParentFragment(AppInfoDashboardFragment parent) {
|
||||
mParent = parent;
|
||||
mAppEntry = mParent.getAppEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (TextUtils.isEmpty(mPackageName)) {
|
||||
@@ -84,6 +96,7 @@ public class TimeSpentInAppPreferenceController extends LiveDataController {
|
||||
if (pref != null) {
|
||||
pref.setIntent(mIntent);
|
||||
}
|
||||
pref.setEnabled(AppUtils.isAppInstalled(mAppEntry));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,8 @@ import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
@@ -44,6 +46,7 @@ public class ResetAppsHelper implements DialogInterface.OnClickListener,
|
||||
DialogInterface.OnDismissListener {
|
||||
|
||||
private static final String EXTRA_RESET_DIALOG = "resetDialog";
|
||||
private static final String TAG = "ResetAppsHelper";
|
||||
|
||||
private final PackageManager mPm;
|
||||
private final IPackageManager mIPm;
|
||||
@@ -51,6 +54,7 @@ public class ResetAppsHelper implements DialogInterface.OnClickListener,
|
||||
private final NetworkPolicyManager mNpm;
|
||||
private final AppOpsManager mAom;
|
||||
private final Context mContext;
|
||||
private final UserManager mUm;
|
||||
|
||||
private AlertDialog mResetDialog;
|
||||
|
||||
@@ -62,6 +66,7 @@ public class ResetAppsHelper implements DialogInterface.OnClickListener,
|
||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
||||
mNpm = NetworkPolicyManager.from(context);
|
||||
mAom = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
|
||||
mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
}
|
||||
|
||||
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
@@ -110,27 +115,35 @@ public class ResetAppsHelper implements DialogInterface.OnClickListener,
|
||||
AsyncTask.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final List<ApplicationInfo> apps = mPm.getInstalledApplications(
|
||||
PackageManager.GET_DISABLED_COMPONENTS);
|
||||
final List<String> allowList = Arrays.asList(
|
||||
mContext.getResources().getStringArray(
|
||||
R.array.config_skip_reset_apps_package_name));
|
||||
|
||||
for (int i = 0; i < apps.size(); i++) {
|
||||
ApplicationInfo app = apps.get(i);
|
||||
if (allowList.contains(app.packageName)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
mNm.clearData(app.packageName, app.uid, false);
|
||||
} catch (android.os.RemoteException ex) {
|
||||
}
|
||||
if (!app.enabled) {
|
||||
if (mPm.getApplicationEnabledSetting(app.packageName)
|
||||
== PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
|
||||
mPm.setApplicationEnabledSetting(app.packageName,
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
|
||||
PackageManager.DONT_KILL_APP);
|
||||
for (UserHandle userHandle : mUm.getEnabledProfiles()) {
|
||||
final int userId = userHandle.getIdentifier();
|
||||
final List<ApplicationInfo> apps = mPm.getInstalledApplicationsAsUser(
|
||||
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
||||
for (int i = 0; i < apps.size(); i++) {
|
||||
ApplicationInfo app = apps.get(i);
|
||||
if (allowList.contains(app.packageName)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
mNm.clearData(app.packageName, app.uid, false);
|
||||
} catch (android.os.RemoteException ex) {
|
||||
}
|
||||
if (!app.enabled) {
|
||||
try {
|
||||
if (mIPm.getApplicationEnabledSetting(app.packageName, userId)
|
||||
== PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
|
||||
mIPm.setApplicationEnabledSetting(app.packageName,
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
|
||||
PackageManager.DONT_KILL_APP,
|
||||
userId,
|
||||
mContext.getPackageName());
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error during reset disabled apps.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
|
||||
private BluetoothPairingController mPairingController;
|
||||
private BluetoothPairingDialog mPairingDialogActivity;
|
||||
private EditText mPairingView;
|
||||
private boolean mPositiveClicked = false;
|
||||
/**
|
||||
* The interface we expect a listener to implement. Typically this should be done by
|
||||
* the controller.
|
||||
@@ -82,6 +83,14 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
|
||||
return mDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (!mPositiveClicked) {
|
||||
mPairingController.onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
@@ -104,6 +113,7 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
mPositiveClicked = true;
|
||||
mPairingController.onDialogPositiveClick(this);
|
||||
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||
mPairingController.onDialogNegativeClick(this);
|
||||
|
||||
@@ -39,6 +39,7 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
private static final String SLICE_ACTION = "com.android.settings.SEARCH_RESULT_TRAMPOLINE";
|
||||
|
||||
@VisibleForTesting
|
||||
static final String KEY_CONNECTED_DEVICES = "connected_device_list";
|
||||
@@ -72,8 +73,10 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
SettingsUIDeviceConfig.BT_NEAR_BY_SUGGESTION_ENABLED, true);
|
||||
String callingAppPackageName = PasswordUtils.getCallingAppPackageName(
|
||||
getActivity().getActivityToken());
|
||||
String action = getIntent() != null ? getIntent().getAction() : "";
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onAttach() calling package name is : " + callingAppPackageName);
|
||||
Log.d(TAG, "onAttach() calling package name is : " + callingAppPackageName
|
||||
+ ", action : " + action);
|
||||
}
|
||||
use(AvailableMediaDeviceGroupController.class).init(this);
|
||||
use(ConnectedDeviceGroupController.class).init(this);
|
||||
@@ -81,9 +84,15 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
use(SlicePreferenceController.class).setSliceUri(nearbyEnabled
|
||||
? Uri.parse(getString(R.string.config_nearby_devices_slice_uri))
|
||||
: null);
|
||||
use(DiscoverableFooterPreferenceController.class).setAlwaysDiscoverable(
|
||||
TextUtils.equals(SETTINGS_PACKAGE_NAME, callingAppPackageName)
|
||||
|| TextUtils.equals(SYSTEMUI_PACKAGE_NAME, callingAppPackageName));
|
||||
use(DiscoverableFooterPreferenceController.class)
|
||||
.setAlwaysDiscoverable(isAlwaysDiscoverable(callingAppPackageName, action));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean isAlwaysDiscoverable(String callingAppPackageName, String action) {
|
||||
return TextUtils.equals(SLICE_ACTION, action) ? false
|
||||
: TextUtils.equals(SETTINGS_PACKAGE_NAME, callingAppPackageName)
|
||||
|| TextUtils.equals(SYSTEMUI_PACKAGE_NAME, callingAppPackageName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.NetworkTemplate;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.util.ArraySet;
|
||||
@@ -140,6 +141,14 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
}
|
||||
}
|
||||
|
||||
if (mAppItem.key > 0 && UserHandle.isApp(mAppItem.key)) {
|
||||
// In case we've been asked data usage for an app, automatically
|
||||
// include data usage of the corresponding SDK sandbox
|
||||
final int appSandboxUid = Process.toSdkSandboxUid(mAppItem.key);
|
||||
if (!mAppItem.uids.get(appSandboxUid)) {
|
||||
mAppItem.addUid(appSandboxUid);
|
||||
}
|
||||
}
|
||||
mTotalUsage = findPreference(KEY_TOTAL_USAGE);
|
||||
mForegroundUsage = findPreference(KEY_FOREGROUND_USAGE);
|
||||
mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
|
||||
@@ -307,6 +316,10 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
}
|
||||
|
||||
private void addUid(int uid) {
|
||||
if (Process.isSdkSandboxUid(uid)) {
|
||||
// For a sandbox process, get the associated app UID
|
||||
uid = Process.getAppUidForSdkSandboxUid(uid);
|
||||
}
|
||||
String[] packages = mPackageManager.getPackagesForUid(uid);
|
||||
if (packages != null) {
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
@@ -404,12 +417,8 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
= NetworkCycleDataForUidLoader.builder(mContext);
|
||||
builder.setRetrieveDetail(true)
|
||||
.setNetworkTemplate(mTemplate);
|
||||
if (mAppItem.category == AppItem.CATEGORY_USER) {
|
||||
for (int i = 0; i < mAppItem.uids.size(); i++) {
|
||||
builder.addUid(mAppItem.uids.keyAt(i));
|
||||
}
|
||||
} else {
|
||||
builder.addUid(mAppItem.key);
|
||||
for (int i = 0; i < mAppItem.uids.size(); i++) {
|
||||
builder.addUid(mAppItem.uids.keyAt(i));
|
||||
}
|
||||
if (mCycles != null) {
|
||||
builder.setCycles(mCycles);
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.telephony.TelephonyManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.datausage.DataUsageUtils;
|
||||
import com.android.settings.datausage.lib.DataUsageLib;
|
||||
import com.android.settingslib.NetworkPolicyEditor;
|
||||
|
||||
@@ -63,6 +64,6 @@ public class BillingCyclePreferenceController extends BasePreferenceController {
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return DataUsageUtils.hasMobileData(mContext) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
final int collapseKey;
|
||||
final int category;
|
||||
final int userId = UserHandle.getUserId(uid);
|
||||
if (UserHandle.isApp(uid)) {
|
||||
if (UserHandle.isApp(uid) || Process.isSdkSandboxUid(uid)) {
|
||||
if (profiles.contains(new UserHandle(userId))) {
|
||||
if (userId != currentUserId) {
|
||||
// Add to a managed user item.
|
||||
@@ -391,8 +391,12 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
largest = accumulate(managedKey, knownItems, bucket,
|
||||
AppItem.CATEGORY_USER, items, largest);
|
||||
}
|
||||
// Add to app item.
|
||||
collapseKey = uid;
|
||||
// Map SDK sandbox back to its corresponding app
|
||||
if (Process.isSdkSandboxUid(uid)) {
|
||||
collapseKey = Process.getAppUidForSdkSandboxUid(uid);
|
||||
} else {
|
||||
collapseKey = uid;
|
||||
}
|
||||
category = AppItem.CATEGORY_APP;
|
||||
} else {
|
||||
// If it is a removed user add it to the removed users' key
|
||||
@@ -430,6 +434,7 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
if (item == null) {
|
||||
item = new AppItem(uid);
|
||||
item.total = -1;
|
||||
item.addUid(uid);
|
||||
items.add(item);
|
||||
knownItems.put(item.key, item);
|
||||
}
|
||||
|
||||
@@ -525,20 +525,24 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
final long foregroundTimeMs = bundle.getLong(EXTRA_FOREGROUND_TIME);
|
||||
final long backgroundTimeMs = bundle.getLong(EXTRA_BACKGROUND_TIME);
|
||||
final int consumedPower = bundle.getInt(EXTRA_POWER_USAGE_AMOUNT);
|
||||
final int uid = bundle.getInt(EXTRA_UID, 0);
|
||||
final String slotTime = bundle.getString(EXTRA_SLOT_TIME, null);
|
||||
final long totalTimeMs = foregroundTimeMs + backgroundTimeMs;
|
||||
final CharSequence usageTimeSummary;
|
||||
final PowerUsageFeatureProvider powerFeatureProvider =
|
||||
FeatureFactory.getFactory(getContext()).getPowerUsageFeatureProvider(getContext());
|
||||
final boolean isChartGraphEnabled = FeatureFactory.getFactory(getContext())
|
||||
.getPowerUsageFeatureProvider(getContext()).isChartGraphEnabled(getContext());
|
||||
|
||||
if (!isChartGraphEnabled && BatteryEntry.isSystemUid(uid)) {
|
||||
return null;
|
||||
}
|
||||
if (totalTimeMs == 0) {
|
||||
final int batteryWithoutUsageTime = consumedPower > 0
|
||||
? R.string.battery_usage_without_time : R.string.battery_not_usage_24hr;
|
||||
usageTimeSummary = getText(powerFeatureProvider.isChartGraphEnabled(getContext())
|
||||
usageTimeSummary = getText(isChartGraphEnabled
|
||||
? batteryWithoutUsageTime : R.string.battery_not_usage);
|
||||
} else if (slotTime == null) {
|
||||
// Shows summary text with past 24 hr or full charge if slot time is null.
|
||||
usageTimeSummary = powerFeatureProvider.isChartGraphEnabled(getContext())
|
||||
usageTimeSummary = isChartGraphEnabled
|
||||
? getAppPast24HrActiveSummary(foregroundTimeMs, backgroundTimeMs, totalTimeMs)
|
||||
: getAppFullChargeActiveSummary(
|
||||
foregroundTimeMs, backgroundTimeMs, totalTimeMs);
|
||||
|
||||
@@ -434,7 +434,7 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
|
||||
|
||||
@VisibleForTesting
|
||||
void setUsageSummary(Preference preference, BatteryEntry entry) {
|
||||
if (entry.getUid() == Process.SYSTEM_UID) {
|
||||
if (BatteryEntry.isSystemUid(entry.getUid())) {
|
||||
return;
|
||||
}
|
||||
String packageName = entry.getDefaultPackageName();
|
||||
|
||||
@@ -612,7 +612,7 @@ public class BatteryEntry {
|
||||
return new NameAndIcon(name, null /* icon */, iconId);
|
||||
}
|
||||
|
||||
private static boolean isSystemUid(int uid) {
|
||||
static boolean isSystemUid(int uid) {
|
||||
return uid == Process.SYSTEM_UID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import com.android.settings.applications.appinfo.AppLocaleDetails;
|
||||
import com.android.settings.core.SettingsBaseActivity;
|
||||
|
||||
public class AppLocalePickerActivity extends SettingsBaseActivity
|
||||
implements LocalePickerWithRegion.LocaleSelectedListener {
|
||||
implements LocalePickerWithRegion.LocaleSelectedListener, MenuItem.OnActionExpandListener {
|
||||
private static final String TAG = AppLocalePickerActivity.class.getSimpleName();
|
||||
|
||||
private String mPackageName;
|
||||
@@ -75,9 +75,10 @@ public class AppLocalePickerActivity extends SettingsBaseActivity
|
||||
|
||||
mLocalePickerWithRegion = LocalePickerWithRegion.createLanguagePicker(
|
||||
mContextAsUser,
|
||||
AppLocalePickerActivity.this,
|
||||
this,
|
||||
false /* translate only */,
|
||||
mPackageName);
|
||||
mPackageName,
|
||||
this);
|
||||
mAppLocaleDetails = AppLocaleDetails.newInstance(mPackageName);
|
||||
mAppLocaleDetailContainer = launchAppLocaleDetailsPage();
|
||||
// Launch Locale picker part.
|
||||
@@ -103,6 +104,18 @@ public class AppLocalePickerActivity extends SettingsBaseActivity
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Sets the app's locale to the supplied language tag */
|
||||
private void setAppDefaultLocale(String languageTag) {
|
||||
LocaleManager localeManager = mContextAsUser.getSystemService(LocaleManager.class);
|
||||
|
||||
@@ -21,12 +21,14 @@ import android.app.PendingIntent;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.UiccCardInfo;
|
||||
import android.telephony.UiccSlotMapping;
|
||||
import android.telephony.euicc.EuiccManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.SidecarFragment;
|
||||
import com.android.settings.network.telephony.EuiccOperationSidecar;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -94,7 +96,7 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
|
||||
|
||||
// To check whether the esim slot's port is active. If yes, skip setSlotMapping. If no,
|
||||
// set this slot+port into setSimSlotMapping.
|
||||
mPort = (port < 0) ? getTargetPortId(removedSubInfo) : port;
|
||||
mPort = (port < 0) ? getTargetPortId(targetSlot, removedSubInfo) : port;
|
||||
mRemovedSubInfo = removedSubInfo;
|
||||
Log.d(TAG,
|
||||
String.format("set esim into the SubId%d Slot%d:Port%d",
|
||||
@@ -114,12 +116,24 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
|
||||
}
|
||||
}
|
||||
|
||||
private int getTargetPortId(SubscriptionInfo removedSubInfo) {
|
||||
if (!mTelephonyManager.isMultiSimEnabled() || !isMultipleEnabledProfilesSupported()) {
|
||||
// In the 'SS mode' or 'DSDS+no MEP', the port is 0.
|
||||
private int getTargetPortId(int physicalEsimSlotIndex, SubscriptionInfo removedSubInfo) {
|
||||
if (!isMultipleEnabledProfilesSupported()) {
|
||||
Log.d(TAG, "The device is no MEP, port is 0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!mTelephonyManager.isMultiSimEnabled()) {
|
||||
// In the 'SS mode'
|
||||
// If there is the esim slot is active, the port is from the current esim slot.
|
||||
// If there is no esim slot in device, then the esim's port is 0.
|
||||
Collection<UiccSlotMapping> uiccSlotMappings = mTelephonyManager.getSimSlotMapping();
|
||||
Log.d(TAG, "In SS mode, the UiccSlotMapping: " + uiccSlotMappings);
|
||||
return uiccSlotMappings.stream()
|
||||
.filter(i -> i.getPhysicalSlotIndex() == physicalEsimSlotIndex)
|
||||
.mapToInt(i -> i.getPortIndex())
|
||||
.findFirst().orElse(0);
|
||||
}
|
||||
|
||||
// In the 'DSDS+MEP', if the removedSubInfo is esim, then the port is
|
||||
// removedSubInfo's port.
|
||||
if (removedSubInfo != null && removedSubInfo.isEmbedded()) {
|
||||
|
||||
@@ -282,6 +282,21 @@ public class UiccSlotUtil {
|
||||
// 1. pSIM's logical slots always is [RIL 0].
|
||||
// 2. assign the new active port to the same stack that will be de-activated
|
||||
// For example: mode#3->mode#4
|
||||
// 3. Add an eSIM carrier or enable eSIM carrier. The cases are at the below.
|
||||
// 1) 1 => 2 / 2.1 / 3 / 3.1
|
||||
// 2) 2 => 1 / 3 / 3.2
|
||||
// 3) 2.1 => 3.1 / 4
|
||||
// 4) 3 => 4
|
||||
// 5) 3.1 => 3.2
|
||||
// Note:
|
||||
// 1) 2 <=> 2.1 blocked by LPA (reason: existing active port in SS so just re-use)
|
||||
// 2) 3 <=> 3.1 blocked by LPA (reason: if pSIM+an active port, re-use the active port)
|
||||
// 4. pSIM insertion or enabling
|
||||
// 1) 2 => 1 / 3
|
||||
// 2) 2.1 => 1 / 3.1
|
||||
// 3) 3.2 => 3 / 3.1
|
||||
// 4) 4 => 3 / 3.1
|
||||
|
||||
|
||||
@VisibleForTesting
|
||||
static Collection<UiccSlotMapping> prepareUiccSlotMappings(
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.datausage.DataUsageUtils;
|
||||
import com.android.settings.network.MobileDataContentObserver;
|
||||
import com.android.settings.network.SubscriptionsChangeListener;
|
||||
|
||||
@@ -102,10 +103,16 @@ public class DataDuringCallsPreferenceController extends TelephonyTogglePreferen
|
||||
return true;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected boolean hasMobileData() {
|
||||
return DataUsageUtils.hasMobileData(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus(int subId) {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(subId)
|
||||
|| SubscriptionManager.getDefaultDataSubscriptionId() == subId) {
|
||||
|| SubscriptionManager.getDefaultDataSubscriptionId() == subId
|
||||
|| (!hasMobileData())) {
|
||||
return CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
return AVAILABLE;
|
||||
|
||||
@@ -56,6 +56,7 @@ public class DataUsagePreferenceController extends TelephonyBasePreferenceContro
|
||||
@Override
|
||||
public int getAvailabilityStatus(int subId) {
|
||||
return (SubscriptionManager.isValidSubscriptionId(subId))
|
||||
&& DataUsageUtils.hasMobileData(mContext)
|
||||
? AVAILABLE
|
||||
: AVAILABLE_UNSEARCHABLE;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
@@ -27,14 +31,27 @@ public class SubscriptionActionDialogActivity extends FragmentActivity {
|
||||
private static final String TAG = "SubscriptionActionDialogActivity";
|
||||
// Arguments
|
||||
protected static final String ARG_SUB_ID = "sub_id";
|
||||
|
||||
protected SubscriptionManager mSubscriptionManager;
|
||||
|
||||
public static final String SIM_ACTION_DIALOG_PREFS = "sim_action_dialog_prefs";
|
||||
// Shared preference keys
|
||||
public static final String KEY_PROGRESS_STATE = "progress_state";
|
||||
public static final int PROGRESS_IS_NOT_SHOWING = 0;
|
||||
public static final int PROGRESS_IS_SHOWING = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mSubscriptionManager = getSystemService(SubscriptionManager.class);
|
||||
setProgressState(PROGRESS_IS_NOT_SHOWING);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
setProgressState(PROGRESS_IS_NOT_SHOWING);
|
||||
super.finish();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,11 +61,13 @@ public class SubscriptionActionDialogActivity extends FragmentActivity {
|
||||
*/
|
||||
protected void showProgressDialog(String message) {
|
||||
ProgressDialogFragment.show(getFragmentManager(), message, null);
|
||||
setProgressState(PROGRESS_IS_SHOWING);
|
||||
}
|
||||
|
||||
/** Dismisses the loading dialog. */
|
||||
protected void dismissProgressDialog() {
|
||||
ProgressDialogFragment.dismiss(getFragmentManager());
|
||||
setProgressState(PROGRESS_IS_NOT_SHOWING);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,4 +79,10 @@ public class SubscriptionActionDialogActivity extends FragmentActivity {
|
||||
protected void showErrorDialog(String title, String message) {
|
||||
AlertDialogFragment.show(this, title, message);
|
||||
}
|
||||
|
||||
protected void setProgressState(int state) {
|
||||
final SharedPreferences prefs = getSharedPreferences(SIM_ACTION_DIALOG_PREFS, MODE_PRIVATE);
|
||||
prefs.edit().putInt(KEY_PROGRESS_STATE, state).apply();
|
||||
Log.i(TAG, "setProgressState:" + state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SETTINGS_NEW_PROFILE_LOCK_TITLE;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SETTINGS_UPDATE_PROFILE_LOCK_TITLE;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK_ACTION;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_SCREEN_LOCK_SETUP_MESSAGE;
|
||||
|
||||
import static com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment.RESULT_FINISHED;
|
||||
@@ -78,7 +79,6 @@ import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settings.safetycenter.LockScreenSafetySource;
|
||||
import com.android.settings.search.SearchFeatureProvider;
|
||||
import com.android.settings.utils.AnnotationSpan;
|
||||
import com.android.settingslib.RestrictedPreference;
|
||||
import com.android.settingslib.widget.FooterPreference;
|
||||
|
||||
@@ -621,15 +621,20 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
} else if (!mForFace && !mForBiometrics && !mForFingerprint && !mIsManagedProfile
|
||||
&& mController.isScreenLockRestrictedByAdmin()
|
||||
&& profileUserId != UserHandle.USER_NULL) {
|
||||
CharSequence description =
|
||||
mDpm.getResources().getString(WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK,
|
||||
() -> null);
|
||||
if (description == null) {
|
||||
description = getText(
|
||||
R.string.lock_settings_picker_admin_restricted_personal_message);
|
||||
}
|
||||
final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(
|
||||
AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION, (view) -> {
|
||||
final StringBuilder description = new StringBuilder(
|
||||
mDpm.getResources().getString(
|
||||
WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK,
|
||||
() -> getString(
|
||||
R.string.lock_settings_picker_admin_restricted_personal_message)));
|
||||
footer.setVisible(true);
|
||||
footer.setTitle(description);
|
||||
|
||||
final StringBuilder setLockText = new StringBuilder(
|
||||
mDpm.getResources().getString(
|
||||
WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK_ACTION,
|
||||
() -> getString(
|
||||
R.string.lock_settings_picker_admin_restricted_personal_message_action)));
|
||||
View.OnClickListener setLockClickListener = (v) -> {
|
||||
final Bundle extras = new Bundle();
|
||||
extras.putInt(Intent.EXTRA_USER_ID, profileUserId);
|
||||
if (mUserPassword != null) {
|
||||
@@ -642,10 +647,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
.setArguments(extras)
|
||||
.launch();
|
||||
finish();
|
||||
});
|
||||
CharSequence footerText = AnnotationSpan.linkify(description, linkInfo);
|
||||
footer.setVisible(true);
|
||||
footer.setTitle(footerText);
|
||||
};
|
||||
footer.setLearnMoreText(setLockText);
|
||||
footer.setLearnMoreAction(setLockClickListener);
|
||||
} else {
|
||||
footer.setVisible(false);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,8 @@ public class SimLockPreferenceController extends BasePreferenceController {
|
||||
for (SubscriptionInfo subInfo : subInfoList) {
|
||||
final int simState = mTelephonyManager.getSimState(subInfo.getSimSlotIndex());
|
||||
if ((simState != TelephonyManager.SIM_STATE_ABSENT)
|
||||
&& (simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
|
||||
&& (simState != TelephonyManager.SIM_STATE_UNKNOWN)
|
||||
&& (simState != TelephonyManager.SIM_STATE_PERM_DISABLED)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
|
||||
package com.android.settings.sim;
|
||||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.telecom.PhoneAccountHandle;
|
||||
import android.telecom.TelecomManager;
|
||||
@@ -32,6 +35,7 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.network.telephony.SubscriptionActionDialogActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -60,6 +64,7 @@ public class SimDialogActivity extends FragmentActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getWindow().addSystemFlags(
|
||||
WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
|
||||
showOrUpdateDialog();
|
||||
@@ -72,6 +77,13 @@ public class SimDialogActivity extends FragmentActivity {
|
||||
showOrUpdateDialog();
|
||||
}
|
||||
|
||||
private int getProgressState() {
|
||||
final SharedPreferences prefs = getSharedPreferences(
|
||||
SubscriptionActionDialogActivity.SIM_ACTION_DIALOG_PREFS, MODE_PRIVATE);
|
||||
return prefs.getInt(SubscriptionActionDialogActivity.KEY_PROGRESS_STATE,
|
||||
SubscriptionActionDialogActivity.PROGRESS_IS_NOT_SHOWING);
|
||||
}
|
||||
|
||||
private void showOrUpdateDialog() {
|
||||
final int dialogType = getIntent().getIntExtra(DIALOG_TYPE_KEY, INVALID_PICK);
|
||||
|
||||
@@ -80,6 +92,13 @@ public class SimDialogActivity extends FragmentActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialogType == PREFERRED_PICK
|
||||
&& getProgressState() == SubscriptionActionDialogActivity.PROGRESS_IS_SHOWING) {
|
||||
Log.d(TAG, "Finish the sim dialog since the sim action dialog is showing the progress");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
final String tag = Integer.toString(dialogType);
|
||||
final FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
SimDialogFragment fragment = (SimDialogFragment) fragmentManager.findFragmentByTag(tag);
|
||||
|
||||
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.AppOpsManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.BatteryUsageStats;
|
||||
@@ -41,6 +42,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.fuelgauge.BatteryDiffEntry;
|
||||
import com.android.settings.fuelgauge.BatteryUtils;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -176,6 +178,26 @@ public class AppBatteryPreferenceControllerTest {
|
||||
assertThat(mBatteryPreference.getSummary()).isEqualTo("60% use for past 24 hours");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_noEntry_preferenceShouldSetEmptySummary() {
|
||||
mController.mParent.setAppEntry(null);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(mBatteryPreference.getSummary()).isEqualTo("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_appIsNotInstalled_preferenceShouldSetEmptySummary() {
|
||||
final ApplicationsState.AppEntry appEntry = mock(ApplicationsState.AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
mController.mParent.setAppEntry(appEntry);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(mBatteryPreference.getSummary()).isEqualTo("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isBatteryStatsAvailable_hasBatteryStatsHelperAndSipper_returnTrue() {
|
||||
mController.mBatteryUsageStats = mBatteryUsageStats;
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.loader.app.LoaderManager;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.datausage.AppDataUsage;
|
||||
@@ -54,6 +55,8 @@ public class AppDataUsagePreferenceControllerTest {
|
||||
private LoaderManager mLoaderManager;
|
||||
@Mock
|
||||
private AppInfoDashboardFragment mFragment;
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
|
||||
private Context mContext;
|
||||
private AppDataUsagePreferenceController mController;
|
||||
@@ -71,7 +74,7 @@ public class AppDataUsagePreferenceControllerTest {
|
||||
doReturn(true).when(mController).isBandwidthControlEnabled();
|
||||
|
||||
assertThat(mController.getAvailabilityStatus())
|
||||
.isEqualTo(BasePreferenceController.AVAILABLE);
|
||||
.isEqualTo(BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -79,13 +82,14 @@ public class AppDataUsagePreferenceControllerTest {
|
||||
doReturn(false).when(mController).isBandwidthControlEnabled();
|
||||
|
||||
assertThat(mController.getAvailabilityStatus())
|
||||
.isEqualTo(BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
|
||||
.isEqualTo(BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onResume_notAvailable_shouldNotRestartDataLoader() {
|
||||
doReturn(mLoaderManager).when(mFragment).getLoaderManager();
|
||||
doReturn(BasePreferenceController.CONDITIONALLY_UNAVAILABLE).when(mController).getAvailabilityStatus();
|
||||
doReturn(BasePreferenceController.CONDITIONALLY_UNAVAILABLE).when(
|
||||
mController).getAvailabilityStatus();
|
||||
|
||||
mController.onResume();
|
||||
|
||||
@@ -130,4 +134,45 @@ public class AppDataUsagePreferenceControllerTest {
|
||||
|
||||
verify(preference).setSummary(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_noEntry_preferenceShouldNotEnable() {
|
||||
mController.mAppEntry = null;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
doReturn(true).when(mController).isBandwidthControlEnabled();
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_appIsInstalled_preferenceShouldEnable() {
|
||||
final AppEntry appEntry = mock(AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
appEntry.info.flags = ApplicationInfo.FLAG_INSTALLED;
|
||||
mController.mAppEntry = appEntry;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
doReturn(true).when(mController).isBandwidthControlEnabled();
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_appIsNotInstalled_preferenceShouldDisable() {
|
||||
final AppEntry appEntry = mock(AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
mController.mAppEntry = appEntry;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
doReturn(true).when(mController).isBandwidthControlEnabled();
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -32,6 +31,7 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.loader.app.LoaderManager;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.applications.AppStorageSettings;
|
||||
import com.android.settingslib.applications.ApplicationsState.AppEntry;
|
||||
@@ -52,6 +52,8 @@ public class AppStoragePreferenceControllerTest {
|
||||
private LoaderManager mLoaderManager;
|
||||
@Mock
|
||||
private AppInfoDashboardFragment mFragment;
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
|
||||
private Context mContext;
|
||||
private AppStoragePreferenceController mController;
|
||||
@@ -89,10 +91,48 @@ public class AppStoragePreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_shouldUpdatePreferenceSummary() {
|
||||
public void displayPreference_noEntry_preferenceShouldNotEnable() {
|
||||
mController.mAppEntry = null;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_appIsInstalled_preferenceShouldEnable() {
|
||||
final AppEntry appEntry = mock(AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
when(mFragment.getAppEntry()).thenReturn(appEntry);
|
||||
appEntry.info.flags = ApplicationInfo.FLAG_INSTALLED;
|
||||
mController.mAppEntry = appEntry;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_appIsNotInstalled_preferenceShouldDisable() {
|
||||
final AppEntry appEntry = mock(AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
mController.mAppEntry = appEntry;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_hasAppEntry_shouldUpdatePreferenceSummary() {
|
||||
final AppEntry appEntry = mock(AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
mController.mAppEntry = appEntry;
|
||||
Preference preference = mock(Preference.class);
|
||||
|
||||
mController.updateState(preference);
|
||||
@@ -102,12 +142,12 @@ public class AppStoragePreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void updateState_entryIsNull_shouldNotUpdatePreferenceSummary() {
|
||||
when(mFragment.getAppEntry()).thenReturn(null);
|
||||
Preference preference = mock(Preference.class);
|
||||
mController.mAppEntry = null;
|
||||
Preference preference = new Preference(mContext);
|
||||
|
||||
mController.updateState(preference);
|
||||
|
||||
verify(preference, never()).setSummary(any());
|
||||
assertThat(preference.getSummary()).isEqualTo("");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -20,7 +20,9 @@ import static android.content.Intent.EXTRA_PACKAGE_NAME;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -35,6 +37,7 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -125,4 +128,42 @@ public class TimeSpentInAppPreferenceControllerTest {
|
||||
verify(mFeatureFactory.applicationFeatureProvider).getTimeSpentInApp(
|
||||
nullable(String.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_noEntry_preferenceShouldNotEnable() {
|
||||
mController.mAppEntry = null;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_appIsInstalled_preferenceShouldEnable() {
|
||||
final ApplicationsState.AppEntry appEntry = mock(ApplicationsState.AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
appEntry.info.flags = ApplicationInfo.FLAG_INSTALLED;
|
||||
mController.mAppEntry = appEntry;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_appIsNotInstalled_preferenceShouldDisable() {
|
||||
final ApplicationsState.AppEntry appEntry = mock(ApplicationsState.AppEntry.class);
|
||||
appEntry.info = new ApplicationInfo();
|
||||
mController.mAppEntry = appEntry;
|
||||
Preference preference = new Preference(mContext);
|
||||
when(mScreen.findPreference(any())).thenReturn(preference);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
assertThat(preference.isEnabled()).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,16 +54,24 @@ public class ConnectedDeviceDashboardFragmentTest {
|
||||
private static final String KEY_DISCOVERABLE_FOOTER = "discoverable_footer";
|
||||
private static final String KEY_SEE_ALL = "previously_connected_devices_see_all";
|
||||
private static final String KEY_ADD_BT_DEVICES = "add_bt_devices";
|
||||
private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
|
||||
private static final String SLICE_ACTION = "com.android.settings.SEARCH_RESULT_TRAMPOLINE";
|
||||
private static final String TEST_APP_NAME = "com.testapp.settings";
|
||||
private static final String TEST_ACTION = "com.testapp.settings.ACTION_START";
|
||||
|
||||
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
private Context mContext;
|
||||
private ConnectedDeviceDashboardFragment mFragment;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
mFragment = new ConnectedDeviceDashboardFragment();
|
||||
doReturn(mPackageManager).when(mContext).getPackageManager();
|
||||
doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
|
||||
}
|
||||
@@ -87,6 +95,26 @@ public class ConnectedDeviceDashboardFragmentTest {
|
||||
KEY_NEARBY_DEVICES, KEY_DISCOVERABLE_FOOTER, KEY_SEE_ALL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAlwaysDiscoverable_callingAppIsNotFromSystemApp_returnsFalse() {
|
||||
assertThat(mFragment.isAlwaysDiscoverable(TEST_APP_NAME, TEST_ACTION)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAlwaysDiscoverable_callingAppIsFromSettings_returnsTrue() {
|
||||
assertThat(mFragment.isAlwaysDiscoverable(SETTINGS_PACKAGE_NAME, TEST_ACTION)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAlwaysDiscoverable_callingAppIsFromSystemUI_returnsTrue() {
|
||||
assertThat(mFragment.isAlwaysDiscoverable(SYSTEMUI_PACKAGE_NAME, TEST_ACTION)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAlwaysDiscoverable_actionIsFromSlice_returnsFalse() {
|
||||
assertThat(mFragment.isAlwaysDiscoverable(SYSTEMUI_PACKAGE_NAME, SLICE_ACTION)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreferenceControllers_containSlicePrefController() {
|
||||
final List<BasePreferenceController> controllers =
|
||||
|
||||
@@ -302,6 +302,7 @@ public class AppDataUsageTest {
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
final int testUid = 123123;
|
||||
final AppItem appItem = new AppItem(testUid);
|
||||
appItem.addUid(testUid);
|
||||
appItem.category = AppItem.CATEGORY_APP;
|
||||
ReflectionHelpers.setField(mFragment, "mContext", context);
|
||||
ReflectionHelpers.setField(mFragment, "mAppItem", appItem);
|
||||
|
||||
@@ -43,6 +43,7 @@ import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.BatteryStats;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Pair;
|
||||
|
||||
@@ -548,6 +549,7 @@ public class AdvancedPowerUsageDetailTest {
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, backgroundTimeFourMinute);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_FOREGROUND_TIME, foregroundTimeTwoMinutes);
|
||||
when(mFragment.getArguments()).thenReturn(bundle);
|
||||
|
||||
mFragment.initHeader();
|
||||
|
||||
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
|
||||
@@ -560,7 +562,7 @@ public class AdvancedPowerUsageDetailTest {
|
||||
public void testInitHeader_totalUsageLessThanAMinWithSlotTime_hasCorrectSummary() {
|
||||
final long backgroundTimeLessThanHalfMinute = 20000;
|
||||
final long foregroundTimeLessThanHalfMinute = 20000;
|
||||
Bundle bundle = new Bundle(2);
|
||||
Bundle bundle = new Bundle(3);
|
||||
bundle.putLong(
|
||||
AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, backgroundTimeLessThanHalfMinute);
|
||||
bundle.putLong(
|
||||
@@ -580,7 +582,7 @@ public class AdvancedPowerUsageDetailTest {
|
||||
public void testInitHeader_TotalAMinBackgroundLessThanAMinWithSlotTime_hasCorrectSummary() {
|
||||
final long backgroundTimeZero = 59999;
|
||||
final long foregroundTimeTwoMinutes = 1;
|
||||
Bundle bundle = new Bundle(2);
|
||||
Bundle bundle = new Bundle(3);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, backgroundTimeZero);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_FOREGROUND_TIME, foregroundTimeTwoMinutes);
|
||||
bundle.putString(AdvancedPowerUsageDetail.EXTRA_SLOT_TIME, SLOT_TIME);
|
||||
@@ -598,7 +600,7 @@ public class AdvancedPowerUsageDetailTest {
|
||||
public void testInitHeader_TotalAMinBackgroundZeroWithSlotTime_hasCorrectSummary() {
|
||||
final long backgroundTimeZero = 0;
|
||||
final long foregroundTimeAMinutes = 60000;
|
||||
Bundle bundle = new Bundle(2);
|
||||
Bundle bundle = new Bundle(3);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, backgroundTimeZero);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_FOREGROUND_TIME, foregroundTimeAMinutes);
|
||||
bundle.putString(AdvancedPowerUsageDetail.EXTRA_SLOT_TIME, SLOT_TIME);
|
||||
@@ -616,11 +618,12 @@ public class AdvancedPowerUsageDetailTest {
|
||||
public void testInitHeader_foregroundTwoMinBackgroundFourMinWithSlotTime_hasCorrectSummary() {
|
||||
final long backgroundTimeFourMinute = 240000;
|
||||
final long foregroundTimeTwoMinutes = 120000;
|
||||
Bundle bundle = new Bundle(2);
|
||||
Bundle bundle = new Bundle(3);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, backgroundTimeFourMinute);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_FOREGROUND_TIME, foregroundTimeTwoMinutes);
|
||||
bundle.putString(AdvancedPowerUsageDetail.EXTRA_SLOT_TIME, SLOT_TIME);
|
||||
when(mFragment.getArguments()).thenReturn(bundle);
|
||||
|
||||
mFragment.initHeader();
|
||||
|
||||
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
|
||||
@@ -629,6 +632,38 @@ public class AdvancedPowerUsageDetailTest {
|
||||
.isEqualTo("6 min total • 4 min background\nfor 12 am-2 am");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitHeader_systemUidWithChartIsDisabled_nullSummary() {
|
||||
Bundle bundle = new Bundle(3);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, 240000);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_FOREGROUND_TIME, 120000);
|
||||
bundle.putInt(AdvancedPowerUsageDetail.EXTRA_UID, Process.SYSTEM_UID);
|
||||
when(mFragment.getArguments()).thenReturn(bundle);
|
||||
when(mFeatureFactory.powerUsageFeatureProvider.isChartGraphEnabled(mContext))
|
||||
.thenReturn(false);
|
||||
|
||||
mFragment.initHeader();
|
||||
|
||||
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
|
||||
verify(mEntityHeaderController).setSummary(captor.capture());
|
||||
assertThat(captor.getValue()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitHeader_systemUidWithChartIsEnabled_notNullSummary() {
|
||||
Bundle bundle = new Bundle(3);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, 240000);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_FOREGROUND_TIME, 120000);
|
||||
bundle.putInt(AdvancedPowerUsageDetail.EXTRA_UID, Process.SYSTEM_UID);
|
||||
when(mFragment.getArguments()).thenReturn(bundle);
|
||||
|
||||
mFragment.initHeader();
|
||||
|
||||
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
|
||||
verify(mEntityHeaderController).setSummary(captor.capture());
|
||||
assertThat(captor.getValue()).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartBatteryDetailPage_hasBasicData() {
|
||||
AdvancedPowerUsageDetail.startBatteryDetailPage(mActivity, mFragment,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.settings.network;
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||
|
||||
@@ -74,7 +74,10 @@ public class DataDuringCallsPreferenceControllerTest {
|
||||
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
|
||||
mSwitchPreference = new SwitchPreference(mContext);
|
||||
when(mPreferenceScreen.findPreference(PREF_KEY)).thenReturn(mSwitchPreference);
|
||||
mController = new DataDuringCallsPreferenceController(mContext, PREF_KEY);
|
||||
mController = new DataDuringCallsPreferenceController(mContext, PREF_KEY) {
|
||||
@Override
|
||||
protected boolean hasMobileData() { return true; }
|
||||
};
|
||||
mController.init(mLifecycle, SUB_ID_1);
|
||||
}
|
||||
|
||||
@@ -156,6 +156,9 @@ public class SimStatusDialogControllerTest {
|
||||
return mTelephonyManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void requestForUpdateEid() {}
|
||||
|
||||
@Override
|
||||
public AtomicReference<String> getEid(int slotIndex) {
|
||||
return mEuiccEnabled.get() ? mEid : null;
|
||||
@@ -202,6 +205,7 @@ public class SimStatusDialogControllerTest {
|
||||
doReturn(carrierName).when(mSubscriptionInfo).getCarrierName();
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).setText(NETWORK_PROVIDER_VALUE_ID, carrierName);
|
||||
}
|
||||
@@ -209,6 +213,7 @@ public class SimStatusDialogControllerTest {
|
||||
@Test
|
||||
public void initialize_shouldUpdatePhoneNumber() {
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
assertTrue(mUpdatePhoneNumberCount.get() > 0);
|
||||
}
|
||||
@@ -218,6 +223,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).removeSettingFromScreen(OPERATOR_INFO_LABEL_ID);
|
||||
verify(mDialog).removeSettingFromScreen(OPERATOR_INFO_VALUE_ID);
|
||||
@@ -228,6 +234,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mServiceState.getState()).thenReturn(ServiceState.STATE_IN_SERVICE);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String inServiceText = ResourcesUtils.getResourcesString(
|
||||
mContext, "radioInfo_service_in");
|
||||
@@ -239,6 +246,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mServiceState.getState()).thenReturn(ServiceState.STATE_POWER_OFF);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String offServiceText = ResourcesUtils.getResourcesString(
|
||||
mContext, "radioInfo_service_off");
|
||||
@@ -253,6 +261,7 @@ public class SimStatusDialogControllerTest {
|
||||
ServiceState.STATE_OUT_OF_SERVICE);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String offServiceText = ResourcesUtils.getResourcesString(
|
||||
mContext, "radioInfo_service_out");
|
||||
@@ -266,6 +275,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mServiceState.getDataRegistrationState()).thenReturn(ServiceState.STATE_IN_SERVICE);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String inServiceText = ResourcesUtils.getResourcesString(
|
||||
mContext, "radioInfo_service_in");
|
||||
@@ -281,6 +291,7 @@ public class SimStatusDialogControllerTest {
|
||||
setupCellSignalStrength_lteWcdma(lteDbm, lteAsu, wcdmaDbm, wcdmaAsu);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
||||
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
||||
@@ -296,6 +307,7 @@ public class SimStatusDialogControllerTest {
|
||||
setupCellSignalStrength_lteCdma(lteDbm, lteAsu, cdmaDbm, cdmaAsu);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
||||
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
||||
@@ -312,6 +324,7 @@ public class SimStatusDialogControllerTest {
|
||||
setupCellSignalStrength_lteOnly(lteDbm, lteAsu);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
||||
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
||||
@@ -324,6 +337,7 @@ public class SimStatusDialogControllerTest {
|
||||
TelephonyManager.NETWORK_TYPE_EDGE);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).setText(CELL_VOICE_NETWORK_TYPE_VALUE_ID,
|
||||
SimStatusDialogController.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
|
||||
@@ -335,6 +349,7 @@ public class SimStatusDialogControllerTest {
|
||||
TelephonyManager.NETWORK_TYPE_EDGE);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).setText(CELL_DATA_NETWORK_TYPE_VALUE_ID,
|
||||
SimStatusDialogController.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
|
||||
@@ -345,6 +360,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mServiceState.getRoaming()).thenReturn(true);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String roamingOnString = ResourcesUtils.getResourcesString(
|
||||
mContext, "radioInfo_roaming_in");
|
||||
@@ -356,6 +372,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mServiceState.getRoaming()).thenReturn(false);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
final String roamingOffString = ResourcesUtils.getResourcesString(
|
||||
mContext, "radioInfo_roaming_not");
|
||||
@@ -368,6 +385,7 @@ public class SimStatusDialogControllerTest {
|
||||
CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_VALUE_ID);
|
||||
@@ -379,6 +397,7 @@ public class SimStatusDialogControllerTest {
|
||||
CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, false);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_LABEL_ID);
|
||||
verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_VALUE_ID);
|
||||
@@ -390,6 +409,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(null);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog, times(2)).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any());
|
||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
||||
@@ -403,6 +423,7 @@ public class SimStatusDialogControllerTest {
|
||||
doReturn(iccid).when(mTelephonyManager).getSimSerialNumber();
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).setText(ICCID_INFO_VALUE_ID, iccid);
|
||||
}
|
||||
@@ -457,6 +478,7 @@ public class SimStatusDialogControllerTest {
|
||||
mEid.set(null);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Keep 'Not available' if neither the card nor the associated manager can provide EID.
|
||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
||||
@@ -511,6 +533,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mEuiccManager.createForCardId(0)).thenReturn(mEuiccManager);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Set EID retrieved from the card.
|
||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_CARD);
|
||||
@@ -570,14 +593,15 @@ public class SimStatusDialogControllerTest {
|
||||
when(mEuiccManager.createForCardId(1)).thenReturn(mEuiccManager);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Set EID retrieved from the manager associated with the card which cannot provide EID.
|
||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_MANAGER);
|
||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Ignore
|
||||
public void initialize_updateEid_shouldRemoveEid() {
|
||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM);
|
||||
|
||||
@@ -623,10 +647,10 @@ public class SimStatusDialogControllerTest {
|
||||
|
||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||
mEuiccEnabled.set(true);
|
||||
mEid.set(TEST_EID_FROM_MANAGER);
|
||||
mEid.set(null);
|
||||
|
||||
mController.updateEid(mController.getEid(0));
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Remove EID if the card is not eUICC.
|
||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
||||
@@ -666,6 +690,7 @@ public class SimStatusDialogControllerTest {
|
||||
mEid.set(null);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Keep 'Not available' if the default eUICC manager cannot provide EID in Single SIM mode.
|
||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
||||
@@ -707,6 +732,7 @@ public class SimStatusDialogControllerTest {
|
||||
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_MANAGER);
|
||||
@@ -748,6 +774,7 @@ public class SimStatusDialogControllerTest {
|
||||
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_MANAGER);
|
||||
@@ -786,6 +813,7 @@ public class SimStatusDialogControllerTest {
|
||||
mEid.set(null);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
// Remove EID if the default eUICC manager indicates that eSIM is not enabled.
|
||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_LABEL_ID));
|
||||
@@ -800,6 +828,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(true);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).setText(IMS_REGISTRATION_STATE_VALUE_ID,
|
||||
mContext.getString(R.string.ims_reg_status_registered));
|
||||
@@ -813,6 +842,7 @@ public class SimStatusDialogControllerTest {
|
||||
when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(false);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).setText(IMS_REGISTRATION_STATE_VALUE_ID,
|
||||
mContext.getString(R.string.ims_reg_status_not_registered));
|
||||
@@ -825,6 +855,7 @@ public class SimStatusDialogControllerTest {
|
||||
CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, true);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog, never()).removeSettingFromScreen(IMS_REGISTRATION_STATE_VALUE_ID);
|
||||
}
|
||||
@@ -836,6 +867,7 @@ public class SimStatusDialogControllerTest {
|
||||
CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, false);
|
||||
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
|
||||
verify(mDialog).removeSettingFromScreen(IMS_REGISTRATION_STATE_LABEL_ID);
|
||||
verify(mDialog).removeSettingFromScreen(IMS_REGISTRATION_STATE_VALUE_ID);
|
||||
@@ -846,6 +878,7 @@ public class SimStatusDialogControllerTest {
|
||||
doReturn(null).when(mTelephonyManager).getSignalStrength();
|
||||
// we should not crash when running the following line
|
||||
mController.initialize();
|
||||
mController.updateEid(mController.getEid(0));
|
||||
}
|
||||
|
||||
private void setupCellSignalStrength_lteWcdma(int lteDbm, int lteAsu, int wcdmaDbm,
|
||||
|
||||
Reference in New Issue
Block a user