Merge "Fix WiFi calling option is showing in search result regardless the carrier supports VoWiFi or not"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 787c559..fd0fc6c 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -2,18 +2,6 @@
<issues format="4">
<issue
- id="LintError"
- severity="Error"
- message="No `.class` files were found in project ".", so none of the classfile based checks could be run. Does the project need to be built first?"
- category="Lint"
- priority="10"
- summary="Lint Failure"
- explanation="This issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.
These errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.">
- <location
- file="."/>
- </issue>
-
- <issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
@@ -1301,6 +1289,54 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="qr_corner_line_color">#ffdadce0</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="133"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="qr_focused_corner_line_color">#ff1a73e8</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="134"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="qr_background_color">#b3ffffff</color> <!-- 70% white transparency -->"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="135"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:background="@color/lock_pattern_background" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -2441,7 +2477,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
- line="5805"
+ line="5883"
column="36"/>
</issue>
@@ -2473,7 +2509,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="425"
+ line="415"
column="44"/>
</issue>
@@ -2489,7 +2525,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="431"
+ line="421"
column="44"/>
</issue>
@@ -2505,7 +2541,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="432"
+ line="422"
column="44"/>
</issue>
@@ -2521,23 +2557,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="467"
- column="34"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <item name="strokeColor">@color/homepage_card_stroke_color</item>"
- errorLine2=" ^">
- <location
- file="res/values/styles.xml"
- line="474"
+ line="457"
column="34"/>
</issue>
@@ -2553,7 +2573,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="54"
+ line="57"
column="39"/>
</issue>
@@ -2569,7 +2589,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="55"
+ line="58"
column="40"/>
</issue>
@@ -2585,7 +2605,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="56"
+ line="59"
column="38"/>
</issue>
@@ -2601,7 +2621,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="90"
+ line="97"
column="47"/>
</issue>
@@ -2617,7 +2637,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="90"
+ line="97"
column="47"/>
</issue>
@@ -2633,7 +2653,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="96"
+ line="103"
column="40"/>
</issue>
@@ -2649,7 +2669,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="96"
+ line="103"
column="40"/>
</issue>
@@ -2665,7 +2685,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="159"
+ line="166"
column="45"/>
</issue>
@@ -2681,7 +2701,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="160"
+ line="167"
column="49"/>
</issue>
@@ -2697,7 +2717,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="168"
+ line="175"
column="45"/>
</issue>
@@ -2713,7 +2733,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="169"
+ line="176"
column="49"/>
</issue>
@@ -2729,7 +2749,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="185"
+ line="192"
column="39"/>
</issue>
@@ -2745,7 +2765,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="186"
+ line="193"
column="40"/>
</issue>
@@ -2761,7 +2781,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="187"
+ line="194"
column="38"/>
</issue>
diff --git a/res/layout-land/confirm_lock_password.xml b/res/layout-land/confirm_lock_password.xml
index 8d742fa..d140bad 100644
--- a/res/layout-land/confirm_lock_password.xml
+++ b/res/layout-land/confirm_lock_password.xml
@@ -28,7 +28,7 @@
android:layout_height="match_parent">
<TextView
- style="@android:style/TextAppearance.Material.Title"
+ style="@*android:style/TextAppearance.DeviceDefault.Title"
android:id="@+id/headerText"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
@@ -38,7 +38,7 @@
android:textColor="?android:attr/colorAccent"/>
<TextView
- style="@android:style/TextAppearance.Material.Body1"
+ style="@*android:style/TextAppearance.DeviceDefault.Body1"
android:id="@+id/detailsText"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
diff --git a/res/layout-land/confirm_lock_pattern.xml b/res/layout-land/confirm_lock_pattern.xml
index 0449e59..bcfd907 100644
--- a/res/layout-land/confirm_lock_pattern.xml
+++ b/res/layout-land/confirm_lock_pattern.xml
@@ -37,7 +37,7 @@
android:orientation="vertical">
<TextView
- style="@android:style/TextAppearance.Material.Headline"
+ style="@*android:style/TextAppearance.DeviceDefault.Headline"
android:id="@+id/headerText"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
@@ -46,7 +46,7 @@
android:textColor="?android:attr/colorAccent"/>
<TextView
- style="@android:style/TextAppearance.Material.Body1"
+ style="@*android:style/TextAppearance.DeviceDefault.Body1"
android:id="@+id/detailsText"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
@@ -111,4 +111,4 @@
</LinearLayout>
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-</FrameLayout>
\ No newline at end of file
+</FrameLayout>
diff --git a/res/layout-land/storage_summary_donut.xml b/res/layout-land/storage_summary_donut.xml
index 5fe4cc8..f43737a 100644
--- a/res/layout-land/storage_summary_donut.xml
+++ b/res/layout-land/storage_summary_donut.xml
@@ -42,7 +42,7 @@
android:fontFamily="@*android:string/config_headlineFontFamily"
android:singleLine="true"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Display1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"
android:textSize="36sp" />
<TextView
@@ -54,7 +54,7 @@
android:maxLines="10"
android:paddingBottom="20dp"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1" />
<Button
android:id="@+id/deletion_helper_button"
diff --git a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
index 4217867..21df686 100644
--- a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
@@ -25,8 +25,8 @@
<include layout="@layout/wifi_dpp_fragment_header"/>
<com.android.settings.wifi.qrcode.QrPreviewLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="@dimen/qrcode_preview_size"
+ android:layout_height="@dimen/qrcode_preview_size"
android:layout_gravity="center">
<TextureView
android:id="@+id/preview_view"
diff --git a/res/layout-sw300dp-land/font_size_activity.xml b/res/layout-sw300dp-land/font_size_activity.xml
index 69abac1..6664704 100644
--- a/res/layout-sw300dp-land/font_size_activity.xml
+++ b/res/layout-sw300dp-land/font_size_activity.xml
@@ -56,7 +56,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="6dp"
- android:textAppearance="@android:style/TextAppearance.Material.Widget.TextView"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
android:elevation="2dp" />
<com.android.settings.widget.LabeledSeekBar
@@ -102,7 +102,7 @@
android:layout_height="wrap_content"
android:text="@string/font_size_summary"
android:layout_marginBottom="16dp"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead" />
</LinearLayout>
</ScrollView>
</LinearLayout>
diff --git a/res/layout-sw300dp-land/screen_zoom_activity.xml b/res/layout-sw300dp-land/screen_zoom_activity.xml
index 8d6e735..cd7c67c 100644
--- a/res/layout-sw300dp-land/screen_zoom_activity.xml
+++ b/res/layout-sw300dp-land/screen_zoom_activity.xml
@@ -56,7 +56,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="6dp"
- android:textAppearance="@android:style/TextAppearance.Material.Widget.TextView"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
android:elevation="2dp" />
<com.android.settings.widget.LabeledSeekBar
@@ -102,7 +102,7 @@
android:layout_height="wrap_content"
android:text="@string/screen_zoom_summary"
android:layout_marginBottom="16dp"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead" />
</LinearLayout>
</ScrollView>
</LinearLayout>
diff --git a/res/layout-sw360dp/storage_summary_donut.xml b/res/layout-sw360dp/storage_summary_donut.xml
index 5fe4cc8..f43737a 100644
--- a/res/layout-sw360dp/storage_summary_donut.xml
+++ b/res/layout-sw360dp/storage_summary_donut.xml
@@ -42,7 +42,7 @@
android:fontFamily="@*android:string/config_headlineFontFamily"
android:singleLine="true"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Display1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"
android:textSize="36sp" />
<TextView
@@ -54,7 +54,7 @@
android:maxLines="10"
android:paddingBottom="20dp"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1" />
<Button
android:id="@+id/deletion_helper_button"
diff --git a/res/layout/admin_support_details_dialog.xml b/res/layout/admin_support_details_dialog.xml
index 922451f..66eaf0d 100644
--- a/res/layout/admin_support_details_dialog.xml
+++ b/res/layout/admin_support_details_dialog.xml
@@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:paddingStart="@dimen/admin_details_dialog_padding"
android:text="@string/disabled_by_policy_title"
- android:textAppearance="@android:style/TextAppearance.Material.Title" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title" />
</LinearLayout>
<ScrollView
@@ -48,7 +48,7 @@
<TextView android:id="@+id/admin_support_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:text="@string/default_admin_support_msg"
android:maxLength="200"
android:autoLink="email|phone|web"
diff --git a/res/layout/battery_header.xml b/res/layout/battery_header.xml
index 9f5bde9..b3b699a 100644
--- a/res/layout/battery_header.xml
+++ b/res/layout/battery_header.xml
@@ -22,15 +22,12 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
- android:paddingTop="24dp"
- android:paddingBottom="24dp"
style="@style/EntityHeader">
<LinearLayout
- android:layout_width="0dp"
+ android:layout_width="170dp"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginStart="56dp"
+ android:layout_marginStart="72dp"
android:layout_marginEnd="8dp"
android:orientation="vertical">
@@ -39,8 +36,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
- android:fontFamily="@*android:string/config_headlineFontFamily"
- android:textAppearance="@android:style/TextAppearance.Material.Display1"/>
+ android:textAppearance="@style/TextAppearance.EntityHeaderTitle"
+ android:textSize="36sp" />
<TextView
android:id="@+id/summary1"
@@ -48,20 +45,21 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:minLines="2"
- android:textAppearance="@android:style/TextAppearance.Material.Small"/>
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"/>
+ android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/summary2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Material.Small"/>
-
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"/>
+ android:textColor="?android:attr/textColorPrimary"/>
</LinearLayout>
<com.android.settings.fuelgauge.BatteryMeterView
android:id="@+id/battery_header_icon"
- android:layout_width="@dimen/battery_meter_width"
+ android:layout_width="match_parent"
android:layout_height="@dimen/battery_meter_height"
- android:layout_marginEnd="16dp"/>
+ android:layout_gravity="center"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/bluetooth_pin_confirm.xml b/res/layout/bluetooth_pin_confirm.xml
index 33140d9..c55c9ff 100644
--- a/res/layout/bluetooth_pin_confirm.xml
+++ b/res/layout/bluetooth_pin_confirm.xml
@@ -40,7 +40,7 @@
android:gravity="center_vertical"
android:text="@string/bluetooth_pairing_key_msg"
android:visibility="gone"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="@color/bluetooth_dialog_text_color" />
<TextView
@@ -52,7 +52,7 @@
android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
android:gravity="center_vertical"
android:visibility="gone"
- android:textAppearance="@android:style/TextAppearance.Material.Headline" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Headline" />
<TextView
android:id="@+id/pairing_code_message"
@@ -63,7 +63,7 @@
android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
android:gravity="center_vertical"
android:text="@string/bluetooth_enter_passkey_msg"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="@color/bluetooth_dialog_text_color"
android:visibility="gone" />
@@ -73,7 +73,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bluetooth_dialog_padding"
android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="@color/bluetooth_dialog_text_color" />
</LinearLayout>
diff --git a/res/layout/bluetooth_pin_entry.xml b/res/layout/bluetooth_pin_entry.xml
index c309a24..0c6861c 100644
--- a/res/layout/bluetooth_pin_entry.xml
+++ b/res/layout/bluetooth_pin_entry.xml
@@ -60,7 +60,7 @@
android:layout_marginBottom="16dp"
android:gravity="center"
android:paddingStart="@dimen/bluetooth_checkbox_padding"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"/>
<TextView
@@ -71,7 +71,7 @@
android:layout_marginEnd="@dimen/bluetooth_pairing_padding"
android:layout_marginBottom="12dp"
android:gravity="center_vertical"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorSecondary"/>
<CheckBox
@@ -84,7 +84,7 @@
android:gravity="center_vertical"
android:paddingStart="@dimen/bluetooth_checkbox_padding"
android:text="@string/bluetooth_pairing_shares_phonebook"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
diff --git a/res/layout/choose_lock_dialog_item.xml b/res/layout/choose_lock_dialog_item.xml
index 46ad539..f87b7c4 100644
--- a/res/layout/choose_lock_dialog_item.xml
+++ b/res/layout/choose_lock_dialog_item.xml
@@ -26,5 +26,5 @@
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorAlertDialogListItem" />
diff --git a/res/layout/confirm_lock_password_base.xml b/res/layout/confirm_lock_password_base.xml
index edc8e25..22934ba 100644
--- a/res/layout/confirm_lock_password_base.xml
+++ b/res/layout/confirm_lock_password_base.xml
@@ -31,7 +31,7 @@
android:paddingTop="@dimen/confirm_credentials_top_padding">
<TextView
- style="@android:style/TextAppearance.Material.Headline"
+ style="@*android:style/TextAppearance.DeviceDefault.Headline"
android:id="@+id/headerText"
android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
@@ -41,7 +41,7 @@
android:textColor="?android:attr/colorAccent"/>
<TextView
- style="@android:style/TextAppearance.Material.Body1"
+ style="@*android:style/TextAppearance.DeviceDefault.Body1"
android:id="@+id/detailsText"
android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
diff --git a/res/layout/confirm_lock_pattern_base.xml b/res/layout/confirm_lock_pattern_base.xml
index 46e2516..25fa08f 100644
--- a/res/layout/confirm_lock_pattern_base.xml
+++ b/res/layout/confirm_lock_pattern_base.xml
@@ -40,7 +40,7 @@
android:orientation="vertical">
<TextView
- style="@android:style/TextAppearance.Material.Headline"
+ style="@*android:style/TextAppearance.DeviceDefault.Headline"
android:id="@+id/headerText"
android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
@@ -50,7 +50,7 @@
android:textColor="?android:attr/colorAccent"/>
<TextView
- style="@android:style/TextAppearance.Material.Body1"
+ style="@*android:style/TextAppearance.DeviceDefault.Body1"
android:id="@+id/detailsText"
android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
diff --git a/res/layout/data_usage_detail.xml b/res/layout/data_usage_detail.xml
index 5113139..8079fe1 100644
--- a/res/layout/data_usage_detail.xml
+++ b/res/layout/data_usage_detail.xml
@@ -64,14 +64,14 @@
android:singleLine="true"
android:ellipsize="marquee"
android:text="@string/data_usage_label_foreground"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewStart" />
<TextView
android:id="@+id/app_foreground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewEnd" />
</LinearLayout>
@@ -87,14 +87,14 @@
android:singleLine="true"
android:ellipsize="marquee"
android:text="@string/data_usage_label_background"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewStart" />
<TextView
android:id="@+id/app_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewEnd" />
</LinearLayout>
diff --git a/res/layout/font_size_activity.xml b/res/layout/font_size_activity.xml
index aa3930c..3e84336 100644
--- a/res/layout/font_size_activity.xml
+++ b/res/layout/font_size_activity.xml
@@ -48,7 +48,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="6dp"
- android:textAppearance="@android:style/TextAppearance.Material.Widget.TextView"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
android:elevation="2dp" />
<LinearLayout
@@ -94,7 +94,7 @@
android:layout_height="wrap_content"
android:text="@string/font_size_summary"
android:layout_marginBottom="16dp"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead" />
</LinearLayout>
</LinearLayout>
</ScrollView>
diff --git a/res/layout/font_size_preview.xml b/res/layout/font_size_preview.xml
index d84bb39..669ece0 100644
--- a/res/layout/font_size_preview.xml
+++ b/res/layout/font_size_preview.xml
@@ -36,25 +36,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/font_size_preview_text_headline"
- android:textAppearance="@android:style/TextAppearance.Material.Headline"/>
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Headline"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/font_size_preview_text_title"
- android:textAppearance="@android:style/TextAppearance.Material.Title"/>
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/font_size_preview_text_subtitle"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"/>
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/font_size_preview_text_body"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"/>
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"/>
</LinearLayout>
</view>
</ScrollView>
diff --git a/res/layout/preference.xml b/res/layout/preference.xml
index cf85e5d..195671b 100644
--- a/res/layout/preference.xml
+++ b/res/layout/preference.xml
@@ -35,7 +35,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
@@ -48,7 +48,7 @@
android:layout_alignStart="@android:id/title"
android:visibility="gone"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="10" />
diff --git a/res/layout/preference_multiline_title.xml b/res/layout/preference_multiline_title.xml
index 16c25d5..ae93ead 100644
--- a/res/layout/preference_multiline_title.xml
+++ b/res/layout/preference_multiline_title.xml
@@ -34,7 +34,7 @@
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
@@ -47,7 +47,7 @@
android:layout_alignStart="@android:id/title"
android:visibility="gone"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="10" />
diff --git a/res/layout/preference_progress_category.xml b/res/layout/preference_progress_category.xml
index 2ac3dc1..91a0312 100644
--- a/res/layout/preference_progress_category.xml
+++ b/res/layout/preference_progress_category.xml
@@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="start|center"
- android:textAppearance="@android:style/TextAppearance.Material.Body2"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
android:textColor="?android:attr/colorAccent"/>
<ProgressBar
diff --git a/res/layout/preference_volume_slider.xml b/res/layout/preference_volume_slider.xml
index da3a028..34c732d 100644
--- a/res/layout/preference_volume_slider.xml
+++ b/res/layout/preference_volume_slider.xml
@@ -58,7 +58,7 @@
android:layout_weight="1"
android:paddingStart="12dp"
android:singleLine="true"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="marquee"
android:fadingEdge="horizontal"/>
@@ -94,7 +94,7 @@
android:singleLine="true"
android:ellipsize="end"
android:visibility="gone"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
diff --git a/res/layout/preference_widget_seekbar_settings.xml b/res/layout/preference_widget_seekbar_settings.xml
index fb1e9c8..9893a1b 100644
--- a/res/layout/preference_widget_seekbar_settings.xml
+++ b/res/layout/preference_widget_seekbar_settings.xml
@@ -35,7 +35,7 @@
android:paddingStart="56dp"
android:paddingEnd="8dp"
android:singleLine="true"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary" />
<TextView
diff --git a/res/layout/preset_picker_item.xml b/res/layout/preset_picker_item.xml
index 405b735..47887e1 100644
--- a/res/layout/preset_picker_item.xml
+++ b/res/layout/preset_picker_item.xml
@@ -44,6 +44,6 @@
android:maxLines="2"
android:minLines="2"
android:gravity="top|center_horizontal"
- android:textAppearance="@android:style/TextAppearance.Material.Body1" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1" />
</LinearLayout>
diff --git a/res/layout/preview_seek_bar_view_pager.xml b/res/layout/preview_seek_bar_view_pager.xml
index 264991a..12f2611 100644
--- a/res/layout/preview_seek_bar_view_pager.xml
+++ b/res/layout/preview_seek_bar_view_pager.xml
@@ -36,7 +36,7 @@
android:paddingStart="32dp"
android:gravity="start|center"
android:text="@string/screen_zoom_preview_title"
- android:textAppearance="@android:style/TextAppearance.Material.Widget.ActionBar.Title"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title"
android:importantForAccessibility="no" />
</LinearLayout>
diff --git a/res/layout/running_processes_header.xml b/res/layout/running_processes_header.xml
index a696b38..b2db025 100644
--- a/res/layout/running_processes_header.xml
+++ b/res/layout/running_processes_header.xml
@@ -30,7 +30,7 @@
android:layout_height="48dp"
android:singleLine="true"
android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Body2"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textAlignment="viewStart"
android:gravity="left|center_vertical"
@@ -63,7 +63,7 @@
<TextView
android:id="@+id/systemSizePrefix"
android:text="@string/running_processes_header_system_prefix"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -81,7 +81,7 @@
android:contentDescription="@null" />
<TextView
android:id="@+id/systemSize"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -108,7 +108,7 @@
<TextView
android:id="@+id/appsSizePrefix"
android:text="@string/running_processes_header_apps_prefix"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -126,7 +126,7 @@
android:contentDescription="@null" />
<TextView
android:id="@+id/appsSize"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -153,7 +153,7 @@
<TextView
android:id="@+id/freeSizePrefix"
android:text="@string/running_processes_header_free_prefix"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -171,7 +171,7 @@
android:contentDescription="@null" />
<TextView
android:id="@+id/freeSize"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -186,7 +186,7 @@
android:layout_marginTop="8dp"
android:singleLine="true"
android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Body2"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textAlignment="viewStart"
android:gravity="left|center_vertical"
diff --git a/res/layout/running_processes_item.xml b/res/layout/running_processes_item.xml
index 036a90e..45121eb 100644
--- a/res/layout/running_processes_item.xml
+++ b/res/layout/running_processes_item.xml
@@ -48,7 +48,7 @@
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textAlignment="viewStart" />
<TextView
@@ -56,7 +56,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dip"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
@@ -70,7 +70,7 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewStart" />
@@ -79,7 +79,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dip"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
diff --git a/res/layout/screen_zoom_activity.xml b/res/layout/screen_zoom_activity.xml
index 0141019..4cfa7b6 100644
--- a/res/layout/screen_zoom_activity.xml
+++ b/res/layout/screen_zoom_activity.xml
@@ -48,7 +48,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="6dp"
- android:textAppearance="@android:style/TextAppearance.Material.Widget.TextView"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
android:elevation="2dp" />
<LinearLayout
@@ -93,7 +93,7 @@
android:layout_height="wrap_content"
android:text="@string/screen_zoom_summary"
android:layout_marginBottom="16dp"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead" />
</LinearLayout>
</LinearLayout>
</ScrollView>
diff --git a/res/layout/screen_zoom_preview_app_icon.xml b/res/layout/screen_zoom_preview_app_icon.xml
index 087afb8..1d56410 100644
--- a/res/layout/screen_zoom_preview_app_icon.xml
+++ b/res/layout/screen_zoom_preview_app_icon.xml
@@ -37,5 +37,5 @@
android:ellipsize="end"
android:gravity="center_horizontal|top"
android:singleLine="true"
- android:textAppearance="@android:style/TextAppearance.Material.Caption" />
-</LinearLayout>
\ No newline at end of file
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Caption" />
+</LinearLayout>
diff --git a/res/layout/screen_zoom_preview_settings.xml b/res/layout/screen_zoom_preview_settings.xml
index 9a0cc59..3401fcf 100644
--- a/res/layout/screen_zoom_preview_settings.xml
+++ b/res/layout/screen_zoom_preview_settings.xml
@@ -57,7 +57,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wifi_settings"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary" />
@@ -65,7 +65,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wifi_display_status_not_available"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
</LinearLayout>
@@ -96,14 +96,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/data_usage_summary_title"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_data_usage"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
</LinearLayout>
@@ -134,14 +134,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/display_settings_title"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/display_summary_example"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
</LinearLayout>
@@ -172,14 +172,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sound_settings"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sound_settings_example_summary"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
</LinearLayout>
@@ -210,14 +210,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/applications_settings"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/apps_summary_example"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
</LinearLayout>
diff --git a/res/layout/settings_summary_preference.xml b/res/layout/settings_summary_preference.xml
index ae3b70d..e76190f 100644
--- a/res/layout/settings_summary_preference.xml
+++ b/res/layout/settings_summary_preference.xml
@@ -31,7 +31,7 @@
android:fontFamily="@*android:string/config_headlineFontFamily"
android:paddingTop="0dp"
android:textColor="?android:attr/colorAccent"
- android:textAppearance="@android:style/TextAppearance.Material.Display1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"
/>
<TextView android:id="@android:id/summary"
diff --git a/res/layout/storage_internal_forget.xml b/res/layout/storage_internal_forget.xml
index cb47d3b..5ff232a 100644
--- a/res/layout/storage_internal_forget.xml
+++ b/res/layout/storage_internal_forget.xml
@@ -33,7 +33,7 @@
android:paddingStart="@dimen/suw_layout_margin_sides"
android:paddingEnd="@dimen/suw_layout_margin_sides"
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorPrimary" />
</ScrollView>
diff --git a/res/layout/storage_internal_format.xml b/res/layout/storage_internal_format.xml
index 8aec28f..500592f 100644
--- a/res/layout/storage_internal_format.xml
+++ b/res/layout/storage_internal_format.xml
@@ -33,7 +33,7 @@
android:paddingStart="@dimen/suw_layout_margin_sides"
android:paddingEnd="@dimen/suw_layout_margin_sides"
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorPrimary" />
</ScrollView>
diff --git a/res/layout/storage_internal_unmount.xml b/res/layout/storage_internal_unmount.xml
index 7e728c8..2e394df 100644
--- a/res/layout/storage_internal_unmount.xml
+++ b/res/layout/storage_internal_unmount.xml
@@ -33,7 +33,7 @@
android:paddingStart="@dimen/suw_layout_margin_sides"
android:paddingEnd="@dimen/suw_layout_margin_sides"
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorPrimary" />
</ScrollView>
diff --git a/res/layout/storage_item.xml b/res/layout/storage_item.xml
index aa2b4f8..cefb399 100644
--- a/res/layout/storage_item.xml
+++ b/res/layout/storage_item.xml
@@ -61,7 +61,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textAlignment="viewStart"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
@@ -71,7 +71,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="10"
android:layout_alignParentEnd="true"/>
diff --git a/res/layout/storage_summary.xml b/res/layout/storage_summary.xml
index d48d62d..ce03b54 100644
--- a/res/layout/storage_summary.xml
+++ b/res/layout/storage_summary.xml
@@ -35,7 +35,7 @@
android:fontFamily="@*android:string/config_headlineFontFamily"
android:singleLine="true"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/colorAccent"
android:textSize="36sp"/>
@@ -44,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:maxLines="10" />
<ProgressBar
diff --git a/res/layout/storage_summary_donut.xml b/res/layout/storage_summary_donut.xml
index 7a10fe7..1637189 100644
--- a/res/layout/storage_summary_donut.xml
+++ b/res/layout/storage_summary_donut.xml
@@ -32,7 +32,7 @@
android:fontFamily="@*android:string/config_headlineFontFamily"
android:singleLine="true"
android:textAlignment="center"
- android:textAppearance="@android:style/TextAppearance.Material.Display1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"
android:textSize="36sp" />
<TextView
@@ -43,7 +43,7 @@
android:layout_marginEnd="4dp"
android:maxLines="10"
android:textAlignment="center"
- android:textAppearance="@android:style/TextAppearance.Material.Body1" />
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1" />
<com.android.settings.widget.DonutView
android:id="@+id/donut"
diff --git a/res/layout/storage_wizard_init.xml b/res/layout/storage_wizard_init.xml
index 73af8da..bca2676 100644
--- a/res/layout/storage_wizard_init.xml
+++ b/res/layout/storage_wizard_init.xml
@@ -48,7 +48,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/suw_description_margin_bottom"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:text="@string/storage_wizard_init_v2_internal_title" />
<TextView
android:layout_width="match_parent"
@@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/suw_description_margin_bottom"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:text="@string/storage_wizard_init_v2_external_title" />
<TextView
android:layout_width="match_parent"
diff --git a/res/layout/tall_preference_category.xml b/res/layout/tall_preference_category.xml
index f0630f8..7eefdab 100644
--- a/res/layout/tall_preference_category.xml
+++ b/res/layout/tall_preference_category.xml
@@ -21,7 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dip"
- android:textAppearance="@android:style/TextAppearance.Material.Body2"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
android:textColor="?android:attr/colorAccent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
diff --git a/res/layout/text_description_preference.xml b/res/layout/text_description_preference.xml
index 6b8594b..70385aa 100644
--- a/res/layout/text_description_preference.xml
+++ b/res/layout/text_description_preference.xml
@@ -18,5 +18,5 @@
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:padding="16dip" />
diff --git a/res/layout/widget_text_views.xml b/res/layout/widget_text_views.xml
index d95599d..9f0506e 100644
--- a/res/layout/widget_text_views.xml
+++ b/res/layout/widget_text_views.xml
@@ -26,7 +26,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="fill_horizontal|top"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewStart"
android:singleLine="true"
@@ -40,7 +40,7 @@
android:layout_weight="1"
android:layout_marginStart="8dip"
android:layout_gravity="fill_horizontal|top"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewEnd"
android:singleLine="true"
diff --git a/res/layout/wifi_dpp_activity.xml b/res/layout/wifi_dpp_activity.xml
index cb82f66..48f2b65 100644
--- a/res/layout/wifi_dpp_activity.xml
+++ b/res/layout/wifi_dpp_activity.xml
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<LinearLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
@@ -27,4 +27,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
-</LinearLayout>
+</ScrollView>
diff --git a/res/layout/wifi_dpp_fragment_header.xml b/res/layout/wifi_dpp_fragment_header.xml
index 266a3e8..20bcd7d 100644
--- a/res/layout/wifi_dpp_fragment_header.xml
+++ b/res/layout/wifi_dpp_fragment_header.xml
@@ -27,13 +27,13 @@
android:paddingEnd="16dp">
<ImageView
- android:id="@+id/header_icon"
+ android:id="@android:id/icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="fitCenter"/>
<TextView
- android:id="@+id/title"
+ android:id="@android:id/title"
style="@style/TextAppearance.EntityHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -44,7 +44,7 @@
android:paddingEnd="32dp"/>
<TextView
- android:id="@+id/description"
+ android:id="@android:id/summary"
style="@style/TextAppearance.EntityHeaderSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
index 913998f..f09fc69 100644
--- a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
@@ -39,10 +39,15 @@
android:layout_gravity="center"/>
</com.android.settings.wifi.qrcode.QrPreviewLayout>
- <TextView android:id="@+id/error_message"
+ <TextView
+ android:id="@+id/error_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center"/>
+ android:layout_gravity="center"
+ android:layout_marginTop="8dp"
+ android:text="@string/wifi_dpp_could_not_detect_valid_qr_code"
+ android:visibility="invisible"
+ android:textColor="?android:attr/colorError"/>
</LinearLayout>
diff --git a/res/layout/zen_onboarding.xml b/res/layout/zen_onboarding.xml
index 35b992d..27922c6 100644
--- a/res/layout/zen_onboarding.xml
+++ b/res/layout/zen_onboarding.xml
@@ -32,7 +32,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/zen_onboarding_dnd_visual_disturbances_header"
- android:textAppearance="@android:style/TextAppearance.Material.DialogWindowTitle" />
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle" />
<LinearLayout
android:id="@+id/zen_onboarding_new_setting"
diff --git a/res/layout/zen_rule_type.xml b/res/layout/zen_rule_type.xml
index dea39ed..bd50273 100644
--- a/res/layout/zen_rule_type.xml
+++ b/res/layout/zen_rule_type.xml
@@ -42,7 +42,7 @@
android:singleLine="true"
android:textSize="16sp"
android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:fadingEdge="horizontal" />
<TextView android:id="@+id/subtitle"
@@ -52,7 +52,7 @@
android:layout_alignStart="@id/title"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:maxLines="2"
android:visibility="gone" />
diff --git a/res/layout/zen_rule_widget.xml b/res/layout/zen_rule_widget.xml
index c6214e7..3d75469 100644
--- a/res/layout/zen_rule_widget.xml
+++ b/res/layout/zen_rule_widget.xml
@@ -19,14 +19,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
- <ImageView
- android:id="@+id/zen_automatic_rule_widget"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
- android:paddingStart="16dip"
- android:paddingEnd="16dip"
- android:src="@drawable/ic_settings"
- android:contentDescription="zen_mode_rule_settings"
- android:layout_gravity="center"
- android:background="?android:attr/selectableItemBackground" />
+
+ <include layout="@layout/preference_widget_gear"
+ android:id="@+id/zen_automatic_rule_widget" />
</LinearLayout>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index e80d151..6f336eb 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1105,8 +1105,8 @@
</string-array>
<string-array name="wifi_privacy_entries">
- <item>Default (use randomized MAC)</item>
- <item>Trusted</item>
+ <item>Use device MAC</item>
+ <item>Use randomized MAC (default)</item>
</string-array>
<string-array name="wifi_hidden_entries">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 587184b..2103649 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -128,5 +128,10 @@
<!-- launcher icon color -->
<color name="icon_launcher_setting_color">@*android:color/accent_device_default_light</color>
-</resources>
+ <!-- QR code scanner colors -->
+ <color name="qr_corner_line_color">#ffdadce0</color>
+ <color name="qr_focused_corner_line_color">#ff1a73e8</color>
+ <color name="qr_background_color">#b3ffffff</color> <!-- 70% white transparency -->
+ <!-- End of QR code scanner colors -->
+</resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0859d2c..383f564 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -367,5 +367,6 @@
<!-- QR code picture size -->
<dimen name="qrcode_size">264dp</dimen>
+ <dimen name="qrcode_preview_size">360dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c6c066e..089ade9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2090,6 +2090,8 @@
<string name="wifi_dpp_share_wifi">Share Wi\u2011Fi</string>
<!-- Hint for the user to use another device to scan QR code on screen to join Wi-Fi [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_scan_qr_code_with_another_device">Scan this QR code with another device to join \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
+ <!-- Hint for QR code detection [CHAR LIMIT=NONE] -->
+ <string name="wifi_dpp_could_not_detect_valid_qr_code">Could not detect valid QR code</string>
<!-- Label for the check box to share a network with other users on the same device -->
<string name="wifi_shared">Share with other device users</string>
<!-- Hint for unchanged fields -->
@@ -2644,6 +2646,9 @@
<!-- Description about the feature adaptive brightness -->
<string name="auto_brightness_description">Your screen brightness will automatically adjust to your environment and activities. You can move the slider manually to help adaptive brightness learn your preferences.</string>
+ <!-- Display settings screen, display white balance settings title [CHAR LIMIT=30] -->
+ <string name="display_white_balance_title">Display white balance</string>
+
<!-- Night display screen, setting option name to enable night display (renamed "Night Light" with title caps). [CHAR LIMIT=30] -->
<string name="night_display_title">Night Light</string>
<!-- Night display screen, description of night display feature (renamed "Night Light" with title caps). [CHAR LIMIT=NONE] -->
@@ -5221,6 +5226,9 @@
<item quantity="other">%1$d apps restricted</item>
</plurals>
+ <!-- Title to display the battery percentage. [CHAR LIMIT=24] -->
+ <string name="battery_header_title_alternate"><xliff:g id="number" example="88">^1</xliff:g><small> <font size="20"><xliff:g id="unit" example="%">%</xliff:g></font></small></string>
+
<!-- Title for force stop dialog [CHAR LIMIT=30] -->
<string name="dialog_stop_title">Stop app?</string>
<!-- Message body for force stop dialog [CHAR LIMIT=NONE] -->
@@ -10034,12 +10042,12 @@
<!-- UI debug setting: ANGLE enabled app has been set [CHAR LIMIT=NONE] -->
<string name="angle_enabled_app_set">ANGLE enabled application: <xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
- <!-- UI debug setting: select an app to use updated graphics driver [CHAR LIMIT=100] -->
- <string name="updated_gfx_driver_dev_opt_in_app">Select app to use updated graphics driver</string>
- <!-- UI debug setting: no app selected to use updated GPU driver [CHAR LIMIT=100] -->
- <string name="updated_gfx_driver_dev_opt_in_app_not_set">No selected app to use updated graphics driver</string>
- <!-- UI debug setting: app selected to use updated graphics driver [CHAR LIMIT=NONE] -->
- <string name="updated_gfx_driver_dev_opt_in_app_set">Opt in application: <xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
+ <!-- UI debug setting: select an app to use Game Update Package [CHAR LIMIT=100] -->
+ <string name="gup_dev_opt_in_app">Use Game Update Package</string>
+ <!-- UI debug setting: no app selected to use Game Update Package [CHAR LIMIT=100] -->
+ <string name="gup_dev_opt_in_app_not_set">No selected app</string>
+ <!-- UI debug setting: app selected to use Game Update Package [CHAR LIMIT=NONE] -->
+ <string name="gup_dev_opt_in_app_set"><xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
<!-- Slices Strings -->
@@ -10338,9 +10346,9 @@
<string name="see_less">See less</string>
<!-- Title for Network connection request Dialog [CHAR LIMIT=30] -->
- <string name="network_connection_request_dialog_title">Choose device</string>
+ <string name="network_connection_request_dialog_title">Choose a device</string>
<!-- Message for Network connection timeout Dialog [CHAR LIMIT=NONE] -->
- <string name="network_connection_timeout_dialog_message">No devices found. Make sure the device is turned on and available to connect.</string>
+ <string name="network_connection_timeout_dialog_message">No devices found. Make sure devices are turned on and available to connect.</string>
<!-- OK button for Network connection timeout Dialog [CHAR LIMIT=30] -->
<string name="network_connection_timeout_dialog_ok">Try again</string>
<!-- Message for Network connection error state Dialog [CHAR LIMIT=NONE] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 9a72ff5..98b6283 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -121,7 +121,7 @@
<item name="android:paddingStart">8dip</item>
<item name="android:textSize">14sp</item>
<item name="android:textAlignment">viewStart</item>
- <item name="android:textAppearance">@android:style/TextAppearance.Material.Body1</item>
+ <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Body1</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
@@ -129,13 +129,13 @@
<item name="android:paddingStart">8dip</item>
<item name="android:textSize">12sp</item>
<item name="android:textAlignment">viewStart</item>
- <item name="android:textAppearance">@android:style/TextAppearance.Material.Body1</item>
+ <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Body1</item>
<item name="android:textColor">?android:attr/colorError</item>
</style>
<style name="wifi_item_content">
<item name="android:textAlignment">viewStart</item>
- <item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
+ <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Subhead</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:minHeight">@dimen/min_tap_target_size</item>
</style>
@@ -189,13 +189,13 @@
<style name="vpn_label">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
- <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Small</item>
</style>
<style name="vpn_value">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
- <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Medium</item>
<item name="android:singleLine">true</item>
<item name="android:textAlignment">viewStart</item>
<item name="android:minHeight">@dimen/min_tap_target_size</item>
@@ -205,10 +205,10 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingStart">8dip</item>
- <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Small</item>
</style>
- <style name="TextAppearance" parent="android:TextAppearance.Material"/>
+ <style name="TextAppearance" parent="android:TextAppearance.DeviceDefault"/>
<style name="TextAppearance.info_label">
<item name="android:textSize">14sp</item>
@@ -225,14 +225,14 @@
<item name="android:textStyle">normal</item>
</style>
- <style name="TextAppearance.PasswordEntry" parent="android:TextAppearance.Material">
+ <style name="TextAppearance.PasswordEntry" parent="android:TextAppearance.DeviceDefault">
<item name="android:gravity">center</item>
<item name="android:singleLine">true</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">24sp</item>
</style>
- <style name="TextAppearance.CryptKeeper_PasswordEntry" parent="android:TextAppearance.Material">
+ <style name="TextAppearance.CryptKeeper_PasswordEntry" parent="android:TextAppearance.DeviceDefault">
<item name="android:gravity">center_horizontal</item>
<item name="android:background">@null</item>
<item name="android:textCursorDrawable">@null</item>
@@ -240,22 +240,22 @@
<item name="android:imeOptions">flagForceAscii|actionDone</item>
</style>
- <style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Material.Medium"/>
- <style name="TextAppearance.Small" parent="@android:style/TextAppearance.Material.Small"/>
+ <style name="TextAppearance.Medium" parent="@android:style/TextAppearance.DeviceDefault.Medium"/>
+ <style name="TextAppearance.Small" parent="@android:style/TextAppearance.DeviceDefault.Small"/>
<style name="TextAppearance.Switch"
parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title">
<item name="android:textSize">16sp</item>
</style>
<style name="TextAppearance.CategoryTitle"
- parent="@android:style/TextAppearance.Material.Body2">
+ parent="@*android:style/TextAppearance.DeviceDefault.Body2">
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
- <style name="TextAppearance.TileTitle" parent="@android:style/TextAppearance.Material.Subhead"/>
+ <style name="TextAppearance.TileTitle" parent="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
<style name="TextAppearance.SuggestionTitle"
- parent="@android:style/TextAppearance.Material.Subhead">
+ parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
<item name="android:textSize">16sp</item>
</style>
@@ -264,7 +264,7 @@
</style>
<style name="TextAppearance.ErrorText"
- parent="android:TextAppearance.Material.Body1">
+ parent="@*android:TextAppearance.DeviceDefault.Body1">
<item name="android:textColor">?android:attr/colorError</item>
</style>
@@ -274,29 +274,29 @@
</style>
<style name="TextAppearance.RemoveDialogContent"
- parent="@android:style/TextAppearance.Material">
+ parent="@android:style/TextAppearance.DeviceDefault">
<item name="android:textSize">16sp</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="TextAppearance.SearchBar"
- parent="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle">
+ parent="@*android:style/TextAppearance.DeviceDefault.Widget.Toolbar.Subtitle">
<item name="android:textSize">@dimen/search_bar_text_size</item>
</style>
<style name="TextAppearance.SuggestionHeader"
- parent="@android:style/TextAppearance.Material.Subhead">
+ parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?android:attr/colorAccent</item>
</style>
<style name="TextAppearance.ConditionCardTitle"
- parent="@android:style/TextAppearance.Material.Body2">
+ parent="@*android:style/TextAppearance.DeviceDefault.Body2">
<item name="android:textSize">16sp</item>
</style>
<style name="TextAppearance.ConditionCardSummary"
- parent="@android:style/TextAppearance.Material.Body1">
+ parent="@*android:style/TextAppearance.DeviceDefault.Body1">
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
@@ -311,7 +311,7 @@
</style>
<style name="TextAppearance.ContextualCardDismissalText"
- parent="@android:style/TextAppearance.Material.Body1">
+ parent="@*android:style/TextAppearance.DeviceDefault.Body1">
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
<item name="android:textSize">16sp</item>
</style>
@@ -350,13 +350,13 @@
<item name="android:gravity">center_vertical</item>
</style>
- <style name="FingerprintHeaderStyle" parent="android:style/TextAppearance.Material.Subhead">
+ <style name="FingerprintHeaderStyle" parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
<item name="android:paddingTop">16dp</item>
<item name="android:textColor">@color/primary_dark_material_light</item>
<item name="android:lineSpacingMultiplier">1.2</item>
</style>
- <style name="FaceHeaderStyle" parent="android:style/TextAppearance.Material.Subhead">
+ <style name="FaceHeaderStyle" parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
<item name="android:paddingTop">16dp</item>
<item name="android:textColor">@color/primary_dark_material_light</item>
<item name="android:lineSpacingMultiplier">1.2</item>
@@ -411,13 +411,13 @@
<style name="device_info_dialog_label">
<item name="android:textAlignment">viewStart</item>
- <item name="android:textAppearance">@android:style/TextAppearance.Material.Body1</item>
+ <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Body1</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="device_info_dialog_value">
<item name="android:textAlignment">viewStart</item>
- <item name="android:textAppearance">@android:style/TextAppearance.Material.Body2</item>
+ <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Body2</item>
<item name="android:paddingBottom">24dp</item>
</style>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 6b05a7c..6041ef8 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -180,7 +180,7 @@
<item name="android:windowNoTitle">true</item>
</style>
- <style name="Theme.Settings.HomeBase" parent="Theme.AppCompat.DayNight.NoActionBar">
+ <style name="Theme.Settings.HomeBase" parent="Theme.Settings.NoActionBar">
<item name="colorPrimary">@*android:color/primary_device_default_settings_light</item>
<item name="colorAccent">@*android:color/accent_device_default_light</item>
<item name="preferenceTheme">@style/PreferenceTheme</item>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index be45cd0..214c00c 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -424,9 +424,10 @@
android:summary="%s"
android:title="@string/simulate_color_space" />
- <Preference android:key="updated_gfx_driver_dev_opt_in_app"
- android:summary="@string/updated_gfx_driver_dev_opt_in_app_summary"
- android:title="@string/updated_gfx_driver_dev_opt_in_app" />
+ <Preference
+ android:title="@string/gup_dev_opt_in_app"
+ android:key="gup_dev_opt_in_app"
+ android:summary="@string/gup_dev_opt_in_app_summary" />
</PreferenceCategory>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 50a5649..76b3d2e 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -79,6 +79,11 @@
settings:controller="com.android.settings.display.ColorModePreferenceController"
settings:keywords="@string/keywords_color_mode" />
+ <SwitchPreference
+ android:key="display_white_balance"
+ android:title="@string/display_white_balance_title"
+ settings:controller="com.android.settings.display.DisplayWhiteBalancePreferenceController" />
+
<Preference
android:key="font_size"
android:title="@string/title_font_size"
diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
index 0ddc1fc..798c188 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
@@ -150,7 +150,8 @@
getNextButton().setVisibility(View.VISIBLE);
} else {
mErrorText.setText(errorMsg);
- getNextButton().setVisibility(View.GONE);
+ getNextButton().setText(getResources().getString(R.string.done));
+ getNextButton().setVisibility(View.VISIBLE);
}
}
@@ -162,8 +163,13 @@
@Override
protected void onNextButtonClick(View view) {
- // Lock thingy is already set up, launch directly to the next page
- launchNextEnrollingActivity(mToken);
+ if (checkMaxEnrolled() == 0) {
+ // Lock thingy is already set up, launch directly to the next page
+ launchNextEnrollingActivity(mToken);
+ } else {
+ setResult(RESULT_FINISHED);
+ finish();
+ }
}
private void launchChooseLock() {
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
index eab2a28..2ea3371 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
@@ -52,8 +52,6 @@
LocalBluetoothProfileManager.ServiceListener {
private static final String TAG = "BluetoothDeviceUpdater";
private static final boolean DBG = true;
- private static final String BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY =
- "persist.bluetooth.showdeviceswithoutnames";
protected final DevicePreferenceCallback mDevicePreferenceCallback;
protected final Map<BluetoothDevice, Preference> mPreferenceMap;
@@ -62,8 +60,6 @@
@VisibleForTesting
protected LocalBluetoothManager mLocalManager;
- private final boolean mShowDeviceWithoutNames;
-
@VisibleForTesting
final GearPreference.OnGearClickListener mDeviceProfilesListener = pref -> {
launchDeviceDetails(pref);
@@ -79,8 +75,6 @@
DevicePreferenceCallback devicePreferenceCallback, LocalBluetoothManager localManager) {
mFragment = fragment;
mDevicePreferenceCallback = devicePreferenceCallback;
- mShowDeviceWithoutNames = SystemProperties.getBoolean(
- BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false);
mPreferenceMap = new HashMap<>();
mLocalManager = localManager;
}
@@ -223,7 +217,7 @@
if (!mPreferenceMap.containsKey(device)) {
BluetoothDevicePreference btPreference =
new BluetoothDevicePreference(mPrefContext, cachedDevice,
- mShowDeviceWithoutNames);
+ true /* showDeviceWithoutNames */);
btPreference.setOnGearClickListener(mDeviceProfilesListener);
if (this instanceof Preference.OnPreferenceClickListener) {
btPreference.setOnPreferenceClickListener(
diff --git a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
index e65d2ad..a67aac4 100644
--- a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
+++ b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
@@ -32,5 +32,5 @@
int REQUEST_CODE_ANGLE_DRIVER_VALUES = 5;
- int REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP = 6;
+ int REQUEST_CODE_GUP_DEV_OPT_IN_APPS = 6;
}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index aa9918c..5990320 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -423,7 +423,7 @@
controllers.add(new SelectDebugAppPreferenceController(context, fragment));
controllers.add(new WaitForDebuggerPreferenceController(context));
controllers.add(new EnableGpuDebugLayersPreferenceController(context));
- controllers.add(new UpdatedGfxDriverDevOptInPreferenceController(context, fragment));
+ controllers.add(new GameUpdatePackageDevOptInPreferenceController(context, fragment));
controllers.add(new VerifyAppsOverUsbPreferenceController(context));
controllers.add(new LogdSizePreferenceController(context));
controllers.add(new LogPersistPreferenceController(context, fragment, lifecycle));
diff --git a/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceController.java b/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
similarity index 74%
rename from src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceController.java
rename to src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
index ad2131e..2d29505 100644
--- a/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceController.java
+++ b/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
@@ -17,7 +17,7 @@
package com.android.settings.development;
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes
- .REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP;
+ .REQUEST_CODE_GUP_DEV_OPT_IN_APPS;
import android.app.Activity;
import android.content.Context;
@@ -33,17 +33,16 @@
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
// TODO(b/119221883): Need to override isAvailable() to return false when updatable graphics driver is not supported.
-public class UpdatedGfxDriverDevOptInPreferenceController
+public class GameUpdatePackageDevOptInPreferenceController
extends DeveloperOptionsPreferenceController
implements PreferenceControllerMixin, OnActivityResultListener {
- private static final String UPDATED_GFX_DRIVER_DEV_OPT_IN_APP_KEY =
- "updated_gfx_driver_dev_opt_in_app";
+ private static final String GUP_DEV_OPT_IN_APP_KEY = "gup_dev_opt_in_app";
private final DevelopmentSettingsDashboardFragment mFragment;
private final PackageManager mPackageManager;
- public UpdatedGfxDriverDevOptInPreferenceController(Context context,
+ public GameUpdatePackageDevOptInPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
@@ -52,16 +51,15 @@
@Override
public String getPreferenceKey() {
- return UPDATED_GFX_DRIVER_DEV_OPT_IN_APP_KEY;
+ return GUP_DEV_OPT_IN_APP_KEY;
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
- if (UPDATED_GFX_DRIVER_DEV_OPT_IN_APP_KEY.equals(preference.getKey())) {
+ if (GUP_DEV_OPT_IN_APP_KEY.equals(preference.getKey())) {
// pass it on to settings
final Intent intent = getActivityStartIntent();
- mFragment.startActivityForResult(intent,
- REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP);
+ mFragment.startActivityForResult(intent, REQUEST_CODE_GUP_DEV_OPT_IN_APPS);
return true;
}
return false;
@@ -74,12 +72,12 @@
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode != REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP
+ if (requestCode != REQUEST_CODE_GUP_DEV_OPT_IN_APPS
|| resultCode != Activity.RESULT_OK) {
return false;
}
Settings.Global.putString(mContext.getContentResolver(),
- Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, data.getAction());
+ Settings.Global.GUP_DEV_OPT_IN_APPS, data.getAction());
updatePreferenceSummary();
return true;
}
@@ -88,7 +86,7 @@
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
mPreference.setSummary(mContext.getResources().getString(
- R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ R.string.gup_dev_opt_in_app_not_set));
}
@VisibleForTesting
@@ -99,15 +97,14 @@
}
private void updatePreferenceSummary() {
- final String updatedGfxDriverDevOptInApp = Settings.Global.getString(
- mContext.getContentResolver(), Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP);
- if (updatedGfxDriverDevOptInApp != null && !updatedGfxDriverDevOptInApp.isEmpty()) {
+ final String optInApp = Settings.Global.getString(
+ mContext.getContentResolver(), Settings.Global.GUP_DEV_OPT_IN_APPS);
+ if (optInApp != null && !optInApp.isEmpty()) {
mPreference.setSummary(mContext.getResources().getString(
- R.string.updated_gfx_driver_dev_opt_in_app_set,
- getAppLabel(updatedGfxDriverDevOptInApp)));
+ R.string.gup_dev_opt_in_app_set, getAppLabel(optInApp)));
} else {
mPreference.setSummary(mContext.getResources().getString(
- R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ R.string.gup_dev_opt_in_app_not_set));
}
}
diff --git a/src/com/android/settings/display/DisplayWhiteBalancePreferenceController.java b/src/com/android/settings/display/DisplayWhiteBalancePreferenceController.java
new file mode 100644
index 0000000..f1363a3
--- /dev/null
+++ b/src/com/android/settings/display/DisplayWhiteBalancePreferenceController.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.android.settings.display;
+
+import android.content.Context;
+import android.hardware.display.ColorDisplayManager;
+import android.os.UserHandle;
+import android.provider.Settings.Secure;
+import com.android.settings.core.TogglePreferenceController;
+
+public class DisplayWhiteBalancePreferenceController extends TogglePreferenceController {
+
+ public DisplayWhiteBalancePreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return ColorDisplayManager.isDisplayWhiteBalanceAvailable(mContext) ?
+ AVAILABLE : DISABLED_FOR_USER;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return Secure.getIntForUser(mContext.getContentResolver(),
+ Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0, UserHandle.USER_CURRENT) == 1;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ Secure.putIntForUser(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED,
+ isChecked ? 1 : 0, UserHandle.USER_CURRENT);
+ return true;
+ }
+}
diff --git a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
index 48f4cc1..3064d4f 100644
--- a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
@@ -21,8 +21,10 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.icu.text.NumberFormat;
import android.os.BatteryManager;
import android.os.PowerManager;
+import android.text.TextUtils;
import android.widget.TextView;
import androidx.annotation.VisibleForTesting;
@@ -83,7 +85,7 @@
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
- mBatteryLayoutPref = (LayoutPreference) screen.findPreference(getPreferenceKey());
+ mBatteryLayoutPref = screen.findPreference(getPreferenceKey());
mBatteryMeterView = mBatteryLayoutPref
.findViewById(R.id.battery_header_icon);
mBatteryPercentText = mBatteryLayoutPref.findViewById(R.id.battery_percent);
@@ -107,7 +109,7 @@
}
public void updateHeaderPreference(BatteryInfo info) {
- mBatteryPercentText.setText(Utils.formatPercentage(info.batteryLevel));
+ mBatteryPercentText.setText(formatBatteryPercentageText(info.batteryLevel));
if (info.remainingLabel == null) {
mSummary1.setText(info.statusLabel);
} else {
@@ -133,6 +135,11 @@
mBatteryMeterView.setBatteryLevel(batteryLevel);
mBatteryMeterView.setCharging(!discharging);
mBatteryMeterView.setPowerSave(mPowerManager.isPowerSaveMode());
- mBatteryPercentText.setText(Utils.formatPercentage(batteryLevel));
+ mBatteryPercentText.setText(formatBatteryPercentageText(batteryLevel));
+ }
+
+ private CharSequence formatBatteryPercentageText(int batteryLevel) {
+ return TextUtils.expandTemplate(mContext.getText(R.string.battery_header_title_alternate),
+ NumberFormat.getIntegerInstance().format(batteryLevel));
}
}
diff --git a/src/com/android/settings/location/TopLevelLocationPreferenceController.java b/src/com/android/settings/location/TopLevelLocationPreferenceController.java
index d0bd9a9..455af21 100644
--- a/src/com/android/settings/location/TopLevelLocationPreferenceController.java
+++ b/src/com/android/settings/location/TopLevelLocationPreferenceController.java
@@ -1,6 +1,5 @@
package com.android.settings.location;
-import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION;
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
@@ -11,6 +10,7 @@
import android.location.LocationManager;
import android.permission.RuntimePermissionPresenter;
+import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.R;
@@ -20,7 +20,6 @@
import com.android.settingslib.core.lifecycle.events.OnStop;
import java.util.Arrays;
-import java.util.Collections;
public class TopLevelLocationPreferenceController extends BasePreferenceController implements
LifecycleObserver, OnStart, OnStop {
@@ -56,6 +55,12 @@
}
}
+ @VisibleForTesting
+ void setLocationAppCount(int numApps) {
+ mNumTotal = numApps;
+ refreshSummary(mPreference);
+ }
+
@Override
public void updateState(Preference preference) {
super.updateState(preference);
@@ -68,8 +73,7 @@
RuntimePermissionPresenter.getInstance(mContext).countPermissionApps(
Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), false, false,
(numApps) -> {
- mNumTotal = numApps;
- refreshSummary(preference);
+ setLocationAppCount(numApps);
}, null);
}
diff --git a/src/com/android/settings/slices/SlicePreference.java b/src/com/android/settings/slices/SlicePreference.java
index 98719f7..37a53f4 100644
--- a/src/com/android/settings/slices/SlicePreference.java
+++ b/src/com/android/settings/slices/SlicePreference.java
@@ -33,12 +33,17 @@
public SlicePreference(Context context, AttributeSet attrs) {
super(context, attrs, R.attr.slicePreferenceStyle);
- mSliceView = findViewById(R.id.slice_view);
+ init();
}
public SlicePreference(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, R.attr.slicePreferenceStyle);
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ private void init() {
mSliceView = findViewById(R.id.slice_view);
+ mSliceView.showTitleItems(true);
}
public void onSliceUpdated(Slice slice) {
diff --git a/src/com/android/settings/widget/VideoPreference.java b/src/com/android/settings/widget/VideoPreference.java
index d5d4f5e..fd215d8 100644
--- a/src/com/android/settings/widget/VideoPreference.java
+++ b/src/com/android/settings/widget/VideoPreference.java
@@ -54,6 +54,7 @@
private float mAspectRadio = 1.0f;
private int mPreviewResource;
private boolean mViewVisible;
+ private Surface mSurface;
public VideoPreference(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -68,17 +69,12 @@
.authority(context.getPackageName())
.appendPath(String.valueOf(animation))
.build();
- mMediaPlayer = MediaPlayer.create(mContext, mVideoPath);
+ mPreviewResource = attributes.getResourceId(
+ R.styleable.VideoPreference_preview, 0);
+ initMediaPlayer();
if (mMediaPlayer != null && mMediaPlayer.getDuration() > 0) {
setVisible(true);
setLayoutResource(R.layout.video_preference);
-
- mPreviewResource = attributes.getResourceId(
- R.styleable.VideoPreference_preview, 0);
-
- mMediaPlayer.setOnSeekCompleteListener(mp -> mVideoReady = true);
-
- mMediaPlayer.setOnPreparedListener(mediaPlayer -> mediaPlayer.setLooping(true));
mAnimationAvailable = true;
updateAspectRatio();
} else {
@@ -127,9 +123,8 @@
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width,
int height) {
if (mMediaPlayer != null) {
- mMediaPlayer.setSurface(new Surface(surfaceTexture));
- mVideoReady = false;
- mMediaPlayer.seekTo(0);
+ mSurface = new Surface(surfaceTexture);
+ mMediaPlayer.setSurface(mSurface);
}
}
@@ -168,26 +163,40 @@
@Override
public void onDetached() {
- if (mMediaPlayer != null) {
- mMediaPlayer.stop();
- mMediaPlayer.reset();
- mMediaPlayer.release();
- }
+ releaseMediaPlayer();
super.onDetached();
}
public void onViewVisible(boolean videoPaused) {
mViewVisible = true;
mVideoPaused = videoPaused;
- if (mVideoReady && mMediaPlayer != null && !mMediaPlayer.isPlaying()) {
- mMediaPlayer.seekTo(0);
- }
+ initMediaPlayer();
}
public void onViewInvisible() {
mViewVisible = false;
- if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
- mMediaPlayer.pause();
+ releaseMediaPlayer();
+ }
+
+ private void initMediaPlayer() {
+ if (mMediaPlayer == null) {
+ mMediaPlayer = MediaPlayer.create(mContext, mVideoPath);
+ mMediaPlayer.seekTo(0);
+ mMediaPlayer.setOnSeekCompleteListener(mp -> mVideoReady = true);
+ mMediaPlayer.setOnPreparedListener(mediaPlayer -> mediaPlayer.setLooping(true));
+ if (mSurface != null) {
+ mMediaPlayer.setSurface(mSurface);
+ }
+ }
+ }
+
+ private void releaseMediaPlayer() {
+ if (mMediaPlayer != null) {
+ mMediaPlayer.stop();
+ mMediaPlayer.reset();
+ mMediaPlayer.release();
+ mMediaPlayer = null;
+ mVideoReady = false;
}
}
@@ -197,7 +206,6 @@
@VisibleForTesting
void updateAspectRatio() {
- mAspectRadio = mMediaPlayer.getVideoWidth() / (float)mMediaPlayer.getVideoHeight();
+ mAspectRadio = mMediaPlayer.getVideoWidth() / (float) mMediaPlayer.getVideoHeight();
}
-
}
diff --git a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
index 30c2cd9..7a1bdb4 100644
--- a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
+++ b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
@@ -16,6 +16,7 @@
package com.android.settings.wifi;
+import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -328,8 +329,12 @@
@Override
public void onUserSelectionConnectSuccess(WifiConfiguration wificonfiguration) {
- // Dismisses current dialog, since connection is success.
+ // Dismisses current dialog and finishes Activity, since connection is success.
dismiss();
+ final Activity activity = getActivity();
+ if (activity != null) {
+ activity.finish();
+ }
}
@Override
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 8d6aa68..90fb850 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -17,6 +17,13 @@
package com.android.settings.wifi.dpp;
import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
@@ -26,10 +33,11 @@
* to the Wi-Fi network.
*/
public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
- @Override
- protected int getLayout() {
- return R.layout.wifi_dpp_add_device_fragment;
- }
+ private ProgressBar mProgressBar;
+ private ImageView mWifiApPictureView;
+ private TextView mChooseDifferentNetwork;
+ private Button mButtonLeft;
+ private Button mButtonRight;
@Override
public int getMetricsCategory() {
@@ -37,7 +45,20 @@
}
@Override
- public void onActivityCreated (Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.wifi_dpp_add_device_fragment, container,
+ /* attachToRoot */ false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ mProgressBar = view.findViewById(R.id.progress_bar);
+ mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
+ mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
+ mButtonLeft = view.findViewById(R.id.button_left);
+ mButtonRight = view.findViewById(R.id.button_right);
}
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
index 66bc349..a3e6db3 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
@@ -17,6 +17,11 @@
package com.android.settings.wifi.dpp;
import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ListView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
@@ -26,10 +31,9 @@
* {@code WifiDppConfiguratorActivity} to start with this fragment to choose a saved Wi-Fi network.
*/
public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFragment {
- @Override
- protected int getLayout() {
- return R.layout.wifi_dpp_choose_saved_wifi_network_fragment;
- }
+ private ListView mSavedWifiNetworkList;
+ private Button mButtonLeft;
+ private Button mButtonRight;
@Override
public int getMetricsCategory() {
@@ -37,7 +41,18 @@
}
@Override
- public void onActivityCreated (Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.wifi_dpp_choose_saved_wifi_network_fragment, container,
+ /* attachToRoot */ false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ mSavedWifiNetworkList = view.findViewById(R.id.saved_wifi_network_list);
+ mButtonLeft = view.findViewById(R.id.button_left);
+ mButtonRight = view.findViewById(R.id.button_right);
}
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
index 6c95f09..e89ebaa 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
@@ -49,7 +49,9 @@
*/
public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
WifiNetworkConfig.Retriever,
- WifiDppQrCodeGeneratorFragment.OnQrCodeGeneratorFragmentAddButtonClickedListener {
+ WifiDppQrCodeGeneratorFragment.OnQrCodeGeneratorFragmentAddButtonClickedListener,
+ WifiDppQrCodeScannerFragment.OnScanWifiDppSuccessListener,
+ WifiDppQrCodeScannerFragment.OnScanZxingWifiFormatSuccessListener {
private static final String TAG = "WifiDppConfiguratorActivity";
public static final String ACTION_CONFIGURATOR_QR_CODE_SCANNER =
@@ -64,6 +66,12 @@
/** The Wi-Fi network which will be configured */
private WifiNetworkConfig mWifiNetworkConfig;
+ /** The public key from Wi-Fi DPP QR code */
+ private String mPublicKey;
+
+ /** The information from Wi-Fi DPP QR code */
+ private String mInformation;
+
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
@@ -127,8 +135,8 @@
return;
}
- WifiDppQrCodeScannerFragment fragment = new WifiDppQrCodeScannerFragment();
- FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
+ final WifiDppQrCodeScannerFragment fragment = new WifiDppQrCodeScannerFragment();
+ final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, fragment,
WifiDppUtils.TAG_FRAGMENT_QR_CODE_SCANNER);
@@ -145,8 +153,8 @@
return;
}
- WifiDppQrCodeGeneratorFragment fragment = new WifiDppQrCodeGeneratorFragment();
- FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
+ final WifiDppQrCodeGeneratorFragment fragment = new WifiDppQrCodeGeneratorFragment();
+ final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, fragment,
WifiDppUtils.TAG_FRAGMENT_QR_CODE_GENERATOR);
@@ -160,9 +168,9 @@
return;
}
- WifiDppChooseSavedWifiNetworkFragment fragment =
+ final WifiDppChooseSavedWifiNetworkFragment fragment =
new WifiDppChooseSavedWifiNetworkFragment();
- FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
+ final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, fragment,
WifiDppUtils.TAG_FRAGMENT_CHOOSE_SAVED_WIFI_NETWORK);
@@ -172,11 +180,38 @@
fragmentTransaction.commit();
}
+ private void showAddDeviceFragment(boolean addToBackStack) {
+ // Avoid to replace the same fragment during configuration change
+ if (mFragmentManager.findFragmentByTag(
+ WifiDppUtils.TAG_FRAGMENT_ADD_DEVICE) != null) {
+ return;
+ }
+
+ final WifiDppAddDeviceFragment fragment =
+ new WifiDppAddDeviceFragment();
+ final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
+
+ fragmentTransaction.replace(R.id.fragment_container, fragment,
+ WifiDppUtils.TAG_FRAGMENT_ADD_DEVICE);
+ if (addToBackStack) {
+ fragmentTransaction.addToBackStack(/* name */ null);
+ }
+ fragmentTransaction.commit();
+ }
+
@Override
public WifiNetworkConfig getWifiNetworkConfig() {
return mWifiNetworkConfig;
}
+ public String getPublicKey() {
+ return mPublicKey;
+ }
+
+ public String getInformation() {
+ return mInformation;
+ }
+
@Override
public boolean setWifiNetworkConfig(WifiNetworkConfig config) {
if(!WifiNetworkConfig.isValidConfig(config)) {
@@ -201,7 +236,26 @@
return false;
}
- @Override public void onQrCodeGeneratorFragmentAddButtonClicked() {
+ @Override
+ public void onQrCodeGeneratorFragmentAddButtonClicked() {
showQrCodeScannerFragment(/* addToBackStack */ true);
}
+
+ @Override
+ public void onScanWifiDppSuccess(String publicKey, String information) {
+ mPublicKey = publicKey;
+ mInformation = information;
+ mWifiNetworkConfig = null;
+
+ showAddDeviceFragment(/* addToBackStack */ true);
+ }
+
+ @Override
+ public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig) {
+ mPublicKey = null;
+ mInformation = null;
+ mWifiNetworkConfig = new WifiNetworkConfig(wifiNetworkConfig);
+
+ showAddDeviceFragment(/* addToBackStack */ true);
+ }
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
index 920e736..584a819 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
@@ -16,9 +16,11 @@
package com.android.settings.wifi.dpp;
+import android.provider.Settings;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
+import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.util.Log;
@@ -36,7 +38,10 @@
* To use intent action {@code ACTION_ENROLLEE_QR_CODE_SCANNER}, specify the SSID string of the
* Wi-Fi network to be provisioned in {@code WifiDppUtils.EXTRA_WIFI_SSID}.
*/
-public class WifiDppEnrolleeActivity extends InstrumentedActivity {
+public class WifiDppEnrolleeActivity extends InstrumentedActivity implements
+ WifiManager.ActionListener,
+ WifiDppQrCodeScannerFragment.OnScanWifiDppSuccessListener,
+ WifiDppQrCodeScannerFragment.OnScanZxingWifiFormatSuccessListener {
private static final String TAG = "WifiDppEnrolleeActivity";
public static final String ACTION_ENROLLEE_QR_CODE_SCANNER =
@@ -101,4 +106,31 @@
finish();
return true;
}
+
+ @Override
+ public void onScanWifiDppSuccess(String publicKey, String information) {
+ // TODO(b/1023597): starts DPP enrollee handshake here
+ }
+
+ @Override
+ public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig) {
+ wifiNetworkConfig.connect(/* context */ this, /* listener */ this);
+ }
+
+ @Override
+ public void onSuccess() {
+ startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ setResult(Activity.RESULT_OK);
+ finish();
+ }
+
+ @Override
+ public void onFailure(int reason) {
+ Log.d(TAG, "Wi-Fi connect onFailure reason - " + reason);
+
+ final Fragment fragment = mFragmentManager.findFragmentById(R.id.fragment_container);
+ if (fragment instanceof WifiDppQrCodeScannerFragment) {
+ ((WifiDppQrCodeScannerFragment)fragment).showErrorMessage(true);
+ }
+ }
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
index 6792dee..4ac5850 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
@@ -17,25 +17,16 @@
package com.android.settings.wifi.dpp;
import android.os.Bundle;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.settings.core.InstrumentedFragment;
import com.android.settings.R;
/**
- * TODO: b/120645817 should refine code to only initiate UI component in each child fragment.
- */
-
-/**
* There are below 4 fragments for Wi-Fi DPP UI flow, to reduce redundant code of UI components,
- * this parent fragment instantiates all UI components and provides setting APIs for them.
+ * this parent fragment instantiates common UI components
*
* {@code WifiDppQrCodeScannerFragment}
* {@code WifiDppQrCodeGeneratorFragment}
@@ -43,128 +34,16 @@
* {@code WifiDppAddDeviceFragment}
*/
public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
- private ImageView mHeaderIcon;
- private TextView mTitle;
- private TextView mDescription;
-
- private TextView mErrorMessage; //optional, for WifiDppQrCodeScannerFragment
- private ListView mSavedWifiNetworkList; //optional, for WifiDppChooseSavedWifiNetworkFragment
- private ProgressBar mProgressBar; //optional, for WifiDppAddDeviceFragment
- private ImageView mWifiApPictureView; //optional, for WifiDppAddDeviceFragment
- private TextView mChooseDifferentNetwork;//optional, for WifiDppAddDeviceFragment
-
- private Button mButtonLeft; //optional, for WifiDppChooseSavedWifiNetworkFragment,
- // WifiDppAddDeviceFragment
- private Button mButtonRight; //optional, for WifiDppChooseSavedWifiNetworkFragment,
- // WifiDppAddDeviceFragment
-
- abstract protected int getLayout();
+ protected ImageView mHeaderIcon;
+ protected TextView mTitle;
+ protected TextView mSummary;
@Override
- public final void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
- @Override
- public final View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(getLayout(), container, false);
- initView(view);
- return view;
- }
-
- private void initView(View view) {
- mHeaderIcon = view.findViewById(R.id.header_icon);
- mTitle = view.findViewById(R.id.title);
- mDescription = view.findViewById(R.id.description);
- mErrorMessage = view.findViewById(R.id.error_message);
-
- mSavedWifiNetworkList = view.findViewById(R.id.saved_wifi_network_list);
-
- mProgressBar = view.findViewById(R.id.progress_bar);
- mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
- mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
-
- mButtonLeft = view.findViewById(R.id.button_left);
- mButtonRight = view.findViewById(R.id.button_right);
- }
-
- protected void setHeaderIconImageResource(int resId) {
- mHeaderIcon.setImageResource(resId);
- }
-
- protected void setTitle(String title) {
- mTitle.setText(title);
- }
-
- protected void setDescription(String description) {
- mDescription.setText(description);
- }
-
- /** optional, for WifiDppQrCodeScannerFragment */
- protected void setErrorMessage(String errorMessage) {
- if (mErrorMessage != null) {
- mErrorMessage.setText(errorMessage);
- }
- }
-
- /**
- * optional, for WifiDppChooseSavedWifiNetworkFragment,
- * WifiDppAddDeviceFragment
- */
- protected void setLeftButtonText(String text) {
- if (mButtonLeft != null) {
- mButtonLeft.setText(text);
- }
- }
-
- /**
- * optional, for WifiDppChooseSavedWifiNetworkFragment,
- * WifiDppAddDeviceFragment
- */
- protected void setRightButtonText(String text) {
- if (mButtonRight != null) {
- mButtonRight.setText(text);
- }
- }
-
- /**
- * optional, for WifiDppChooseSavedWifiNetworkFragment,
- * WifiDppAddDeviceFragment
- */
- protected void hideLeftButton() {
- if (mButtonLeft != null) {
- mButtonLeft.setVisibility(View.INVISIBLE);
- }
- }
-
- /**
- * optional, for WifiDppChooseSavedWifiNetworkFragment,
- * WifiDppAddDeviceFragment
- */
- protected void hideRightButton() {
- if (mButtonRight != null) {
- mButtonRight.setVisibility(View.INVISIBLE);
- }
- }
-
- /**
- * optional, for WifiDppChooseSavedWifiNetworkFragment,
- * WifiDppAddDeviceFragment
- */
- protected void setLeftButtonOnClickListener(View.OnClickListener listener) {
- if (mButtonLeft != null) {
- mButtonLeft.setOnClickListener(listener);
- }
- }
-
- /**
- * optional, for WifiDppChooseSavedWifiNetworkFragment,
- * WifiDppAddDeviceFragment
- */
- protected void setRightButtonOnClickListener(View.OnClickListener listener) {
- if (mButtonRight != null) {
- mButtonRight.setOnClickListener(listener);
- }
+ mHeaderIcon = view.findViewById(android.R.id.icon);
+ mTitle = view.findViewById(android.R.id.title);
+ mSummary = view.findViewById(android.R.id.summary);
}
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
index 02ebffc..f4bbcc1 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
@@ -21,10 +21,12 @@
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.ImageView;
import com.android.internal.logging.nano.MetricsProto;
@@ -44,11 +46,6 @@
private String mQrCode;
@Override
- protected int getLayout() {
- return R.layout.wifi_dpp_qrcode_generator_fragment;
- }
-
- @Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
}
@@ -63,25 +60,12 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- setHeaderIconImageResource(R.drawable.ic_qrcode_24dp);
- WifiNetworkConfig wifiNetworkConfig = ((WifiNetworkConfig.Retriever) getActivity())
- .getWifiNetworkConfig();
- if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
- throw new IllegalArgumentException("Invalid Wi-Fi network for configuring");
- }
- setTitle(getString(R.string.wifi_dpp_share_wifi));
- setDescription(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
- wifiNetworkConfig.getSsid()));
-
setHasOptionsMenu(true);
- ActionBar actionBar = getActivity().getActionBar();
+ final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.show();
}
-
- mQrCode = wifiNetworkConfig.getQrCode();
- setQrCode();
}
@Override
@@ -119,9 +103,30 @@
}
@Override
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.wifi_dpp_qrcode_generator_fragment, container,
+ /* attachToRoot */ false);
+ }
+
+ @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
+
mQrCodeView = view.findViewById(R.id.qrcode_view);
+
+ mHeaderIcon.setImageResource(R.drawable.ic_qrcode_24dp);
+ WifiNetworkConfig wifiNetworkConfig = ((WifiNetworkConfig.Retriever) getActivity())
+ .getWifiNetworkConfig();
+ if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
+ throw new IllegalStateException("Invalid Wi-Fi network for configuring");
+ }
+ mTitle.setText(R.string.wifi_dpp_share_wifi);
+ mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
+ wifiNetworkConfig.getSsid()));
+
+ mQrCode = wifiNetworkConfig.getQrCode();
+ setQrCode();
}
private void setQrCode() {
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 8cd3c562..c7c1461 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -16,7 +16,6 @@
package com.android.settings.wifi.dpp;
-import android.annotation.Nullable;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
@@ -25,13 +24,18 @@
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
import android.text.TextUtils;
import android.util.Size;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.TextureView;
import android.view.TextureView.SurfaceTextureListener;
import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
@@ -41,37 +45,69 @@
public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment implements
SurfaceTextureListener,
QrCamera.ScannerCallback {
+ private static final String TAG = "WifiDppQrCodeScannerFragment";
+
+ /** Message sent to hide error message */
+ private static final int MESSAGE_HIDE_ERROR_MESSAGE = 1;
+
+ /** Message sent to show error message */
+ private static final int MESSAGE_SHOW_ERROR_MESSAGE = 2;
+
+ /** Message sent to manipulate Wi-Fi DPP QR code */
+ private static final int MESSAGE_SCAN_WIFI_DPP_SUCCESS = 3;
+
+ /** Message sent to manipulate ZXing Wi-Fi QR code */
+ private static final int MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS = 4;
+
+ private static final long SHOW_ERROR_MESSAGE_INTERVAL = 2000;
+ private static final long SHOW_SUCCESS_SQUARE_INTERVAL = 1000;
+
+ // Keys for Bundle usage
+ private static final String KEY_PUBLIC_KEY = "key_public_key";
+ private static final String KEY_INFORMATION = "key_information";
+
private QrCamera mCamera;
private TextureView mTextureView;
private QrDecorateView mDecorateView;
+ private TextView mErrorMessage;
/** true if the fragment working for configurator, false enrollee*/
- private final boolean mConfiguratorMode;
+ private final boolean mIsConfiguratorMode;
/** The SSID of the Wi-Fi network which the user specify to enroll */
private String mSsid;
- @Override
- protected int getLayout() {
- return R.layout.wifi_dpp_qrcode_scanner_fragment;
- }
+ /** QR code data scanned by camera */
+ private WifiQrCode mWifiQrCode;
@Override
public int getMetricsCategory() {
- if (mConfiguratorMode) {
+ if (mIsConfiguratorMode) {
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
} else {
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_ENROLLEE;
}
}
+ // Container Activity must implement this interface
+ public interface OnScanWifiDppSuccessListener {
+ public void onScanWifiDppSuccess(String publicKey, String information);
+ }
+ OnScanWifiDppSuccessListener mScanWifiDppSuccessListener;
+
+ // Container Activity must implement this interface
+ public interface OnScanZxingWifiFormatSuccessListener {
+ public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig);
+ }
+ OnScanZxingWifiFormatSuccessListener mScanScanZxingWifiFormatSuccessListener;
+
/**
* Configurator container activity of the fragment should create instance with this constructor.
*/
public WifiDppQrCodeScannerFragment() {
super();
- mConfiguratorMode = true;
+ mIsConfiguratorMode = true;
}
/**
@@ -81,7 +117,7 @@
public WifiDppQrCodeScannerFragment(String ssid) {
super();
- mConfiguratorMode = false;
+ mIsConfiguratorMode = false;
mSsid = ssid;
}
@@ -89,30 +125,7 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- setHeaderIconImageResource(R.drawable.ic_scan_24dp);
-
- if (mConfiguratorMode) {
- setTitle(getString(R.string.wifi_dpp_add_device_to_network));
-
- WifiNetworkConfig wifiNetworkConfig = ((WifiNetworkConfig.Retriever) getActivity())
- .getWifiNetworkConfig();
- if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
- throw new IllegalArgumentException("Invalid Wi-Fi network for configuring");
- }
- setDescription(getString(R.string.wifi_dpp_center_qr_code, wifiNetworkConfig.getSsid()));
- } else {
- setTitle(getString(R.string.wifi_dpp_scan_qr_code));
-
- String description;
- if (TextUtils.isEmpty(mSsid)) {
- description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
- } else {
- description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
- }
- setDescription(description);
- }
-
- ActionBar actionBar = getActivity().getActionBar();
+ final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.show();
@@ -120,13 +133,61 @@
}
@Override
- public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ public void onAttach(Context context) {
+ super.onAttach(context);
+
+ mScanWifiDppSuccessListener = (OnScanWifiDppSuccessListener) context;
+ mScanScanZxingWifiFormatSuccessListener = (OnScanZxingWifiFormatSuccessListener) context;
+ }
+
+ @Override
+ public void onDetach() {
+ mScanWifiDppSuccessListener = null;
+ mScanScanZxingWifiFormatSuccessListener = null;
+
+ super.onDetach();
+ }
+
+ @Override
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.wifi_dpp_qrcode_scanner_fragment, container,
+ /* attachToRoot */ false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mTextureView = (TextureView) view.findViewById(R.id.preview_view);
mTextureView.setSurfaceTextureListener(this);
mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
+
+ mHeaderIcon.setImageResource(R.drawable.ic_scan_24dp);
+ if (mIsConfiguratorMode) {
+ mTitle.setText(R.string.wifi_dpp_add_device_to_network);
+
+ WifiNetworkConfig wifiNetworkConfig = ((WifiNetworkConfig.Retriever) getActivity())
+ .getWifiNetworkConfig();
+ if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
+ throw new IllegalStateException("Invalid Wi-Fi network for configuring");
+ }
+ mSummary.setText(getString(R.string.wifi_dpp_center_qr_code,
+ wifiNetworkConfig.getSsid()));
+ } else {
+ mTitle.setText(R.string.wifi_dpp_scan_qr_code);
+
+ String description;
+ if (TextUtils.isEmpty(mSsid)) {
+ description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
+ } else {
+ description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
+ }
+ mSummary.setText(description);
+ }
+
+ mErrorMessage = view.findViewById(R.id.error_message);
}
@Override
@@ -173,10 +234,75 @@
}
@Override
+ public boolean isValid(String qrCode) {
+ try {
+ mWifiQrCode = new WifiQrCode(qrCode);
+ } catch (IllegalArgumentException e) {
+ mHandler.sendEmptyMessage(MESSAGE_SHOW_ERROR_MESSAGE);
+ return false;
+ }
+
+ final String scheme = mWifiQrCode.getScheme();
+
+ // When SSID is specified for enrollee, avoid to connect to the Wi-Fi of different SSID
+ if (!mIsConfiguratorMode && WifiQrCode.SCHEME_ZXING_WIFI_NETWORK_CONFIG.equals(scheme)) {
+ final String ssidQrCode = mWifiQrCode.getWifiNetworkConfig().getSsid();
+ if (!TextUtils.isEmpty(mSsid) && !mSsid.equals(ssidQrCode)) {
+ mHandler.sendEmptyMessage(MESSAGE_SHOW_ERROR_MESSAGE);
+ return false;
+ }
+ }
+
+ // It's impossible to provision other device with ZXing Wi-Fi Network config format
+ if (mIsConfiguratorMode && WifiQrCode.SCHEME_ZXING_WIFI_NETWORK_CONFIG.equals(scheme)) {
+ mHandler.sendEmptyMessage(MESSAGE_SHOW_ERROR_MESSAGE);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * This method is only called when QrCamera.ScannerCallback.isValid returns true;
+ */
+ @Override
public void handleSuccessfulResult(String qrCode) {
+ switch (mWifiQrCode.getScheme()) {
+ case WifiQrCode.SCHEME_DPP:
+ handleWifiDpp(mWifiQrCode.getPublicKey(), mWifiQrCode.getInformation());
+ break;
+
+ case WifiQrCode.SCHEME_ZXING_WIFI_NETWORK_CONFIG:
+ handleZxingWifiFormat(mWifiQrCode.getWifiNetworkConfig());
+ break;
+
+ default:
+ // continue below
+ }
+ }
+
+ private void handleWifiDpp(String publicKey, String information) {
destroyCamera();
mDecorateView.setFocused(true);
- // TODO(b/120243131): Add a network by Wi-Fi Network config shared via QR code.
+
+ final Bundle bundle = new Bundle();
+ bundle.putString(KEY_PUBLIC_KEY, publicKey);
+ bundle.putString(KEY_INFORMATION, information);
+
+ Message message = mHandler.obtainMessage(MESSAGE_SCAN_WIFI_DPP_SUCCESS);
+ message.setData(bundle);
+
+ mHandler.sendMessageDelayed(message, SHOW_SUCCESS_SQUARE_INTERVAL);
+ }
+
+ private void handleZxingWifiFormat(WifiNetworkConfig wifiNetworkConfig) {
+ destroyCamera();
+ mDecorateView.setFocused(true);
+
+ Message message = mHandler.obtainMessage(MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS);
+ message.obj = wifiNetworkConfig;
+
+ mHandler.sendMessageDelayed(message, SHOW_SUCCESS_SQUARE_INTERVAL);
}
@Override
@@ -198,4 +324,51 @@
mCamera = null;
}
}
+
+ public void showErrorMessage(boolean show) {
+ mErrorMessage.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
+
+ if (show) {
+ mHandler.removeMessages(MESSAGE_HIDE_ERROR_MESSAGE);
+ mHandler.sendEmptyMessageDelayed(MESSAGE_HIDE_ERROR_MESSAGE,
+ SHOW_ERROR_MESSAGE_INTERVAL);
+ }
+ }
+
+ private final Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MESSAGE_HIDE_ERROR_MESSAGE:
+ showErrorMessage(false);
+ break;
+
+ case MESSAGE_SHOW_ERROR_MESSAGE:
+ showErrorMessage(true);
+ break;
+
+ case MESSAGE_SCAN_WIFI_DPP_SUCCESS:
+ if (mScanWifiDppSuccessListener == null) {
+ return;
+ }
+ final Bundle bundle = msg.getData();
+ final String publicKey = bundle.getString(KEY_PUBLIC_KEY);
+ final String information = bundle.getString(KEY_INFORMATION);
+
+ mScanWifiDppSuccessListener.onScanWifiDppSuccess(publicKey, information);
+ break;
+
+ case MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS:
+ if (mScanScanZxingWifiFormatSuccessListener == null) {
+ return;
+ }
+ mScanScanZxingWifiFormatSuccessListener.onScanZxingWifiFormatSuccess(
+ (WifiNetworkConfig)msg.obj);
+ break;
+
+ default:
+ return;
+ }
+ }
+ };
}
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
index 0823294..c9bfbd6 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
@@ -16,8 +16,18 @@
package com.android.settings.wifi.dpp;
+import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_NO_PASSWORD;
+import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WEP;
+import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WPA;
+
+import android.content.Context;
import android.content.Intent;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiConfiguration.AuthAlgorithm;
+import android.net.wifi.WifiConfiguration.KeyMgmt;
+import android.net.wifi.WifiManager;
import android.text.TextUtils;
+import android.util.Log;
import androidx.annotation.Keep;
@@ -30,8 +40,7 @@
* EXTRA_QR_CODE
*/
public class WifiNetworkConfig {
- // Ignores password if security is NO_PASSWORD or absent
- public static final String NO_PASSWORD = "nopass";
+ private static final String TAG = "WifiNetworkConfig";
private String mSecurity;
private String mSsid;
@@ -47,18 +56,9 @@
}
public WifiNetworkConfig(WifiNetworkConfig config) {
- if (config.mSecurity != null) {
- mSecurity = new String(config.mSecurity);
- }
-
- if (config.mSsid != null) {
- mSsid = new String(config.mSsid);
- }
-
- if (config.mPreSharedKey != null) {
- mPreSharedKey = new String(config.mPreSharedKey);
- }
-
+ mSecurity = config.mSecurity;
+ mSsid = config.mSsid;
+ mPreSharedKey = config.mPreSharedKey;
mHiddenSsid = config.mHiddenSsid;
}
@@ -106,7 +106,7 @@
public static boolean isValidConfig(String security, String ssid, String preSharedKey,
boolean hiddenSsid) {
- if (!TextUtils.isEmpty(security) && !NO_PASSWORD.equals(security)) {
+ if (!TextUtils.isEmpty(security) && !SECURITY_NO_PASSWORD.equals(security)) {
if (TextUtils.isEmpty(preSharedKey)) {
return false;
}
@@ -183,4 +183,77 @@
public boolean getHiddenSsid() {
return mHiddenSsid;
}
+
+ public void connect(Context context, WifiManager.ActionListener listener) {
+ WifiConfiguration wifiConfiguration = getWifiConfigurationOrNull();
+ if (wifiConfiguration == null) {
+ if (listener != null) {
+ listener.onFailure(WifiManager.ERROR);
+ }
+ return;
+ }
+
+ WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
+ wifiManager.connect(wifiConfiguration, listener);
+ }
+
+ /**
+ * This is a simplified method from {@code WifiConfigController.getConfig()}
+ */
+ private WifiConfiguration getWifiConfigurationOrNull() {
+ if (!isValidConfig(this)) {
+ return null;
+ }
+
+ final WifiConfiguration wifiConfiguration = new WifiConfiguration();
+ wifiConfiguration.SSID = addQuotationIfNeeded(mSsid);
+ wifiConfiguration.hiddenSSID = mHiddenSsid;
+
+ if (TextUtils.isEmpty(mSecurity) || SECURITY_NO_PASSWORD.equals(mSecurity)) {
+ wifiConfiguration.allowedKeyManagement.set(KeyMgmt.NONE);
+ return wifiConfiguration;
+ }
+
+ if (mSecurity.startsWith(SECURITY_WEP)) {
+ wifiConfiguration.allowedKeyManagement.set(KeyMgmt.NONE);
+ wifiConfiguration.allowedAuthAlgorithms.set(AuthAlgorithm.OPEN);
+ wifiConfiguration.allowedAuthAlgorithms.set(AuthAlgorithm.SHARED);
+
+ // WEP-40, WEP-104, and 256-bit WEP (WEP-232?)
+ final int length = mPreSharedKey.length();
+ if ((length == 10 || length == 26 || length == 58)
+ && mPreSharedKey.matches("[0-9A-Fa-f]*")) {
+ wifiConfiguration.wepKeys[0] = mPreSharedKey;
+ } else {
+ wifiConfiguration.wepKeys[0] = addQuotationIfNeeded(mPreSharedKey);
+ }
+ } else if (mSecurity.startsWith(SECURITY_WPA)) {
+ wifiConfiguration.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
+
+ if (mPreSharedKey.matches("[0-9A-Fa-f]{64}")) {
+ wifiConfiguration.preSharedKey = mPreSharedKey;
+ } else {
+ wifiConfiguration.preSharedKey = addQuotationIfNeeded(mPreSharedKey);
+ }
+ } else {
+ Log.w(TAG, "Unsupported security");
+ return null;
+ }
+
+ return wifiConfiguration;
+ }
+
+ private String addQuotationIfNeeded(String input) {
+ if (TextUtils.isEmpty(input)) {
+ return "";
+ }
+
+ if (input.length() >= 2 && input.startsWith("\"") && input.endsWith("\"")) {
+ return input;
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("\"").append(input).append("\"");
+ return sb.toString();
+ }
}
diff --git a/src/com/android/settings/wifi/dpp/WifiQrCode.java b/src/com/android/settings/wifi/dpp/WifiQrCode.java
index ebc39c3..a8562bb 100644
--- a/src/com/android/settings/wifi/dpp/WifiQrCode.java
+++ b/src/com/android/settings/wifi/dpp/WifiQrCode.java
@@ -22,7 +22,8 @@
import androidx.annotation.Keep;
import androidx.annotation.VisibleForTesting;
-import java.util.regex.Matcher;
+import java.util.Arrays;
+import java.util.List;
import java.util.regex.Pattern;
/**
@@ -62,7 +63,12 @@
public static final String PREFIX_ZXING_PASSWORD = "P:";
public static final String PREFIX_ZXING_HIDDEN_SSID = "H:";
- public static final String SUFFIX_QR_CODE = ";";
+ public static final String DELIMITER_QR_CODE = ";";
+
+ // Ignores password if security is SECURITY_NO_PASSWORD or absent
+ public static final String SECURITY_NO_PASSWORD = "nopass";
+ public static final String SECURITY_WEP = "WEP";
+ public static final String SECURITY_WPA = "WPA";
private String mQrCode;
@@ -100,22 +106,27 @@
/** Parses Wi-Fi DPP QR code string */
private void parseWifiDppQrCode(String qrCode) throws IllegalArgumentException {
- String publicKey = getSubStringOrNull(qrCode, PREFIX_DPP_PUBLIC_KEY, SUFFIX_QR_CODE);
+ List keyValueList = getKeyValueList(qrCode, PREFIX_DPP, DELIMITER_QR_CODE);
+
+ String publicKey = getValueOrNull(keyValueList, PREFIX_DPP_PUBLIC_KEY);
if (TextUtils.isEmpty(publicKey)) {
throw new IllegalArgumentException("Invalid format");
}
mPublicKey = publicKey;
- mInformation = getSubStringOrNull(qrCode, PREFIX_DPP_INFORMATION, SUFFIX_QR_CODE);
+ mInformation = getValueOrNull(keyValueList, PREFIX_DPP_INFORMATION);
}
/** Parses ZXing reader library's Wi-Fi Network config format */
private void parseZxingWifiQrCode(String qrCode) throws IllegalArgumentException {
- String security = getSubStringOrNull(qrCode, PREFIX_ZXING_SECURITY, SUFFIX_QR_CODE);
- String ssid = getSubStringOrNull(qrCode, PREFIX_ZXING_SSID, SUFFIX_QR_CODE);
- String password = getSubStringOrNull(qrCode, PREFIX_ZXING_PASSWORD, SUFFIX_QR_CODE);
- String hiddenSsidString = getSubStringOrNull(qrCode, PREFIX_ZXING_HIDDEN_SSID,
- SUFFIX_QR_CODE);
+ List keyValueList = getKeyValueList(qrCode, PREFIX_ZXING_WIFI_NETWORK_CONFIG,
+ DELIMITER_QR_CODE);
+
+ String security = getValueOrNull(keyValueList, PREFIX_ZXING_SECURITY);
+ String ssid = getValueOrNull(keyValueList, PREFIX_ZXING_SSID);
+ String password = getValueOrNull(keyValueList, PREFIX_ZXING_PASSWORD);
+ String hiddenSsidString = getValueOrNull(keyValueList, PREFIX_ZXING_HIDDEN_SSID);
+
boolean hiddenSsid = "true".equalsIgnoreCase(hiddenSsidString);
//"\", ";", "," and ":" are escaped with a backslash "\", should remove at first
@@ -132,33 +143,37 @@
}
/**
- * Gets the substring between prefix & suffix from input.
+ * Splits key/value pairs from qrCode
*
- * @param prefix the string before the returned substring
- * @param suffix the string after the returned substring
- * @return null if not exists, non-null otherwise
+ * @param qrCode the QR code raw string
+ * @param prefixQrCode the string before all key/value pairs in qrCode
+ * @param delimiter the string to split key/value pairs, can't contain a backslash
+ * @return a list contains string of key/value (e.g. K:key1)
*/
- private static String getSubStringOrNull(String input, String prefix, String suffix) {
- StringBuilder sb = new StringBuilder();
- String regex = sb.append(prefix).append("(.*?)").append(suffix).toString();
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(input);
+ private List<String> getKeyValueList(String qrCode, String prefixQrCode,
+ String delimiter) {
+ String keyValueString = qrCode.substring(prefixQrCode.length());
- if (!matcher.find()) {
- return null;
+ // Should not treat \delimiter as a delimiter
+ String regex = "(?<!\\\\)" + Pattern.quote(delimiter);
+
+ List<String> result = Arrays.asList(keyValueString.split(regex));
+ return result;
+ }
+
+ private String getValueOrNull(List<String> keyValueList, String prefix) {
+ for (String keyValue : keyValueList) {
+ if (keyValue.startsWith(prefix)) {
+ return keyValue.substring(prefix.length());
+ }
}
- String target = matcher.group(1);
- if (TextUtils.isEmpty(target)) {
- return null;
- }
-
- return target;
+ return null;
}
@Keep
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
- protected static String removeBackSlash(String input) {
+ protected String removeBackSlash(String input) {
if (input == null) {
return null;
}
diff --git a/src/com/android/settings/wifi/qrcode/QrCamera.java b/src/com/android/settings/wifi/qrcode/QrCamera.java
index c60c30e..af366bc 100644
--- a/src/com/android/settings/wifi/qrcode/QrCamera.java
+++ b/src/com/android/settings/wifi/qrcode/QrCamera.java
@@ -152,6 +152,15 @@
* @param transform The transform to apply to the content of preview
*/
void setTransform(Matrix transform);
+
+ /**
+ * Verify QR code is valid or not. The camera will stop scanning if this callback returns
+ * true.
+ *
+ * @param qrCode The result QR code after decoding.
+ * @return Returns true if qrCode hold valid information.
+ */
+ boolean isValid(String qrCode);
}
private void setCameraParameter() {
@@ -245,7 +254,9 @@
mReader.reset();
}
if (qrCode != null) {
- return qrCode.getText();
+ if (mScannerCallback.isValid(qrCode.getText())) {
+ return qrCode.getText();
+ }
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
diff --git a/src/com/android/settings/wifi/qrcode/QrDecorateView.java b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
index 253bdb8..6952a63 100644
--- a/src/com/android/settings/wifi/qrcode/QrDecorateView.java
+++ b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
@@ -17,10 +17,13 @@
package com.android.settings.wifi.qrcode;
import android.content.Context;
+import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
@@ -33,11 +36,26 @@
* Draws the lines at the corner of the inner frame.
*/
public class QrDecorateView extends View {
- private static final float CORNER_STROKE_WIDTH = 3f; // 3dp
- private static final float CORNER_LINE_LENGTH = 20f; // 20dp
+ private static final float CORNER_STROKE_WIDTH = 4f; // 4dp
+ private static final float CORNER_LINE_LENGTH = 264f; // 264dp
+ private static final float CORNER_RADIUS = 16f; // 16dp
- final private Paint mPaint;
- private RectF mFrame;
+ final private int mCornerColor;
+ final private int mFocusedCornerColor;
+ final private int mBackgroundColor;
+
+ final private Paint mStrokePaint;
+ final private Paint mTransparentPaint;
+ final private Paint mBackgroundPaint;
+
+ final private float mRadius;
+
+ private Bitmap mMaskBitmap;
+ private Canvas mMaskCanvas;
+
+ private RectF mOuterFrame;
+ private RectF mInnerFrame;
+
private boolean mFocused;
public QrDecorateView(Context context) {
@@ -54,78 +72,66 @@
public QrDecorateView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- final float strokeWidth = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP,
- CORNER_STROKE_WIDTH,
- getResources().getDisplayMetrics()
- );
- mPaint = new Paint();
- mPaint.setStrokeWidth(strokeWidth);
+
mFocused = false;
+ mRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, CORNER_RADIUS,
+ getResources().getDisplayMetrics());
+
+ mCornerColor = context.getResources().getColor(R.color.qr_corner_line_color);
+ mFocusedCornerColor = context.getResources().getColor(R.color.qr_focused_corner_line_color);
+ mBackgroundColor = context.getResources().getColor(R.color.qr_background_color);
+
+ mStrokePaint = new Paint();
+ mStrokePaint.setAntiAlias(true);
+
+ mTransparentPaint = new Paint();
+ mTransparentPaint.setAntiAlias(true);
+ mTransparentPaint.setColor(getResources().getColor(android.R.color.transparent));
+ mTransparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
+
+ mBackgroundPaint = new Paint();
+ mBackgroundPaint.setColor(mBackgroundColor);
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+
+ if(mMaskBitmap == null) {
+ mMaskBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
+ mMaskCanvas = new Canvas(mMaskBitmap);
+ }
+
+ calculateFramePos();
}
@Override
protected void onDraw(Canvas canvas) {
- calculateFramePos();
- final float cornerLineLength = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP,
- CORNER_LINE_LENGTH,
- getResources().getDisplayMetrics()
- );
- mPaint.setColor(mFocused ? Color.GREEN : Color.WHITE);
- drawCorner(mFrame, cornerLineLength, canvas);
- super.onDraw(canvas);
- }
+ // Set frame line color.
+ mStrokePaint.setColor(mFocused ? mFocusedCornerColor : mCornerColor);
+ // Draw background color.
+ mMaskCanvas.drawColor(mBackgroundColor);
+ // Draw outer corner.
+ mMaskCanvas.drawRoundRect(mOuterFrame, mRadius, mRadius, mStrokePaint);
+ // Draw inner transparent corner.
+ mMaskCanvas.drawRoundRect(mInnerFrame, mRadius, mRadius, mTransparentPaint);
- private void drawCorner(RectF frame, float lineLength, Canvas canvas) {
- final float strokeWidth = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP,
- CORNER_STROKE_WIDTH,
- getResources().getDisplayMetrics()
- );
- // Draw top-left corner.
- canvas.drawLine(
- frame.left - strokeWidth / 2,
- frame.top,
- frame.left + lineLength,
- frame.top,
- mPaint);
- canvas.drawLine(frame.left, frame.top, frame.left, frame.top + lineLength, mPaint);
- // Draw top-right corner.
- canvas.drawLine(
- frame.right + strokeWidth / 2,
- frame.top,
- frame.right - lineLength,
- frame.top,
- mPaint);
- canvas.drawLine(frame.right, frame.top, frame.right, frame.top + lineLength, mPaint);
- // Draw bottom-left corner.
- canvas.drawLine(
- frame.left - strokeWidth / 2,
- frame.bottom,
- frame.left + lineLength,
- frame.bottom,
- mPaint);
- canvas.drawLine(frame.left, frame.bottom, frame.left, frame.bottom - lineLength, mPaint);
- // Draw bottom-right corner.
- canvas.drawLine(
- frame.right + strokeWidth / 2,
- frame.bottom,
- frame.right - lineLength,
- frame.bottom,
- mPaint);
- canvas.drawLine(frame.right, frame.bottom, frame.right, frame.bottom - lineLength, mPaint);
+ canvas.drawBitmap(mMaskBitmap, 0, 0, mBackgroundPaint);
+ super.onDraw(canvas);
}
private void calculateFramePos() {
final int centralX = getWidth() / 2;
final int centralY = getHeight() / 2;
- final float halfFrameWidth = getWidth() / 3;
- mFrame = new RectF(
- centralX - halfFrameWidth,
- centralY - halfFrameWidth,
- centralX + halfFrameWidth,
- centralY + halfFrameWidth);
+ final float cornerLineLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ CORNER_LINE_LENGTH, getResources().getDisplayMetrics()) / 2;
+ final float strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ CORNER_STROKE_WIDTH, getResources().getDisplayMetrics()) / 2;
+
+ mOuterFrame = new RectF(centralX - cornerLineLength, centralY - cornerLineLength,
+ centralX + cornerLineLength, centralY + cornerLineLength);
+ mInnerFrame = new RectF(mOuterFrame.left + strokeWidth, mOuterFrame.top + strokeWidth,
+ mOuterFrame.right - strokeWidth, mOuterFrame.bottom - strokeWidth);
}
// Draws green lines if focued. Otherwise, draws white lines.
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
index c98fbdb..5f23f0c 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
@@ -178,6 +178,8 @@
controllers.add(new WifiTetherSecurityPreferenceController(context, listener));
controllers.add(new WifiTetherPasswordPreferenceController(context, listener));
controllers.add(new WifiTetherApBandPreferenceController(context, listener));
+ controllers.add(
+ new WifiTetherAutoOffPreferenceController(context, KEY_WIFI_TETHER_AUTO_OFF));
return controllers;
}
diff --git a/tests/robotests/res/layout/preference.xml b/tests/robotests/res/layout/preference.xml
index 3f73161..7ac733f 100644
--- a/tests/robotests/res/layout/preference.xml
+++ b/tests/robotests/res/layout/preference.xml
@@ -30,7 +30,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
@@ -43,7 +43,7 @@
android:layout_alignStart="@android:id/title"
android:visibility="gone"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="10" />
diff --git a/tests/robotests/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
similarity index 76%
rename from tests/robotests/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
index e92f1a5..199cad6 100644
--- a/tests/robotests/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
@@ -16,7 +16,7 @@
package com.android.settings.development;
-import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP;
+import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_GUP_DEV_OPT_IN_APPS;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
@@ -44,7 +44,7 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
-public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
+public class GameUpdatePackageDevOptInPreferenceControllerTest {
@Mock
private PreferenceScreen mPreferenceScreen;
@@ -53,13 +53,13 @@
private Context mContext;
private Preference mPreference;
- private UpdatedGfxDriverDevOptInPreferenceController mController;
+ private GameUpdatePackageDevOptInPreferenceController mController;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mController = spy(new UpdatedGfxDriverDevOptInPreferenceController(mContext, mFragment));
+ mController = spy(new GameUpdatePackageDevOptInPreferenceController(mContext, mFragment));
mPreference = new Preference(mContext);
mPreference.setKey(mController.getPreferenceKey());
@@ -75,18 +75,19 @@
mController.handlePreferenceTreeClick(mPreference);
verify(mFragment).startActivityForResult(activityStartIntent,
- REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP);
+ REQUEST_CODE_GUP_DEV_OPT_IN_APPS);
}
@Test
- public void updateState_foobarAppSelected_shouldUpdateSummaryWithUpdatedDriverDevOptInAppLabel() {
+ public void updateState_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInAppLabel() {
final String selectedApp = "foobar";
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Global.putString(contentResolver,
- Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, selectedApp);
+ Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
mController.updateState(mPreference);
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_set, selectedApp));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_set, selectedApp));
}
@Test
@@ -94,23 +95,25 @@
final String selectedApp = null;
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Global.putString(contentResolver,
- Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, selectedApp);
+ Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
mController.updateState(mPreference);
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_not_set));
}
@Test
- public void onActivityResult_foobarAppSelected_shouldUpdateSummaryWithUpdatedDriverDevOptInLabel() {
+ public void onActivityResult_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInLabel() {
Intent activityResultIntent = new Intent(mContext, AppPicker.class);
final String appLabel = "foobar";
activityResultIntent.setAction(appLabel);
final boolean result = mController
- .onActivityResult(REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, Activity.RESULT_OK,
+ .onActivityResult(REQUEST_CODE_GUP_DEV_OPT_IN_APPS, Activity.RESULT_OK,
activityResultIntent);
assertThat(result).isTrue();
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_set, appLabel));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_set, appLabel));
}
@Test
@@ -124,6 +127,7 @@
mController.onDeveloperOptionsSwitchDisabled();
assertThat(mPreference.isEnabled()).isFalse();
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_not_set));
}
}
diff --git a/tests/robotests/src/com/android/settings/display/DisplayWhiteBalancePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/DisplayWhiteBalancePreferenceControllerTest.java
new file mode 100644
index 0000000..0ce72fb
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/DisplayWhiteBalancePreferenceControllerTest.java
@@ -0,0 +1,78 @@
+package com.android.settings.display;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.provider.Settings;
+import android.provider.Settings.Secure;
+import com.android.settings.testutils.shadow.SettingsShadowResources;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {
+ SettingsShadowResources.class
+})
+public class DisplayWhiteBalancePreferenceControllerTest {
+
+ private Context mContext;
+ private DisplayWhiteBalancePreferenceController mController;
+
+ @After
+ public void tearDown() {
+ SettingsShadowResources.reset();
+ }
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mController = new DisplayWhiteBalancePreferenceController(mContext, "display_white_balance");
+ }
+
+ @Test
+ public void isAvailable_configuredAvailable() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_displayWhiteBalanceAvailable, true);
+ assertThat(mController.isAvailable()).isTrue();
+ }
+
+ @Test
+ public void isAvailable_configuredUnavailable() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_displayWhiteBalanceAvailable, false);
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void setChecked_true() {
+ mController.setChecked(true);
+ assertThat(Settings.Secure
+ .getInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0) == 1)
+ .isTrue();
+ }
+
+ @Test
+ public void setChecked_false() {
+ mController.setChecked(false);
+ assertThat(Settings.Secure
+ .getInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0) == 1)
+ .isFalse();
+ }
+
+ @Test
+ public void isChecked_true() {
+ Settings.Secure.putInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 1);
+ assertThat(mController.isChecked()).isTrue();
+ }
+
+ @Test
+ public void isChecked_false() {
+ Settings.Secure.putInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0);
+ assertThat(mController.isChecked()).isFalse();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
index b22821b..5be7274 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
@@ -140,8 +140,9 @@
assertThat(((BatteryMeterView) mBatteryLayoutPref.findViewById(
R.id.battery_header_icon)).getBatteryLevel()).isEqualTo(BATTERY_LEVEL);
- assertThat(((TextView) mBatteryLayoutPref.findViewById(R.id.battery_percent)).getText())
- .isEqualTo("60%");
+ assertThat(((TextView) mBatteryLayoutPref.findViewById(R.id.battery_percent))
+ .getText().toString())
+ .isEqualTo("60 %");
}
@Test
@@ -195,7 +196,7 @@
assertThat(mBatteryMeterView.getBatteryLevel()).isEqualTo(BATTERY_LEVEL);
assertThat(mBatteryMeterView.getCharging()).isTrue();
- assertThat(mBatteryPercentText.getText()).isEqualTo("60%");
+ assertThat(mBatteryPercentText.getText().toString()).isEqualTo("60 %");
assertThat(mSummary.getText()).isEqualTo(BATTERY_STATUS);
assertThat(mSummary2.getText()).isEqualTo(BATTERY_STATUS);
}
diff --git a/tests/robotests/src/com/android/settings/location/TopLevelLocationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/TopLevelLocationPreferenceControllerTest.java
new file mode 100644
index 0000000..68e7f88
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/location/TopLevelLocationPreferenceControllerTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.location;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.location.LocationManager;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class TopLevelLocationPreferenceControllerTest {
+ private static final String PREFERENCE_KEY = "top_level_location";
+ private Context mContext;
+ private TopLevelLocationPreferenceController mController;
+ private LocationManager mLocationManager;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mController = new TopLevelLocationPreferenceController(mContext, PREFERENCE_KEY);
+ mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
+ }
+
+ @Test
+ public void isAvailable_byDefault_shouldReturnTrue() {
+ assertThat(mController.isAvailable()).isTrue();
+ }
+
+ @Test
+ public void getSummary_whenLocationIsOff_shouldReturnStringForOff() {
+ mLocationManager.setLocationEnabledForUser(false, android.os.Process.myUserHandle());
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getString(R.string.location_settings_summary_location_off));
+ }
+
+ @Test
+ public void getSummary_whenLocationIsOn_shouldShowLoadingString() {
+ mLocationManager.setLocationEnabledForUser(true, android.os.Process.myUserHandle());
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getString(R.string.location_settings_loading_app_permission_stats));
+ }
+
+ @Test
+ public void getSummary_whenLocationAppCountIsOne_shouldShowSingularString() {
+ final int LOCATION_APP_COUNT = 1;
+ mLocationManager.setLocationEnabledForUser(true, android.os.Process.myUserHandle());
+ mController.setLocationAppCount(LOCATION_APP_COUNT);
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getResources().getQuantityString(
+ R.plurals.location_settings_summary_location_on,
+ LOCATION_APP_COUNT, LOCATION_APP_COUNT));
+ }
+
+ @Test
+ public void getSummary_whenLocationAppCountIsGreaterThanOne_shouldShowPluralString() {
+ final int LOCATION_APP_COUNT = 5;
+ mLocationManager.setLocationEnabledForUser(true, android.os.Process.myUserHandle());
+ mController.setLocationAppCount(LOCATION_APP_COUNT);
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getResources().getQuantityString(
+ R.plurals.location_settings_summary_location_on,
+ LOCATION_APP_COUNT, LOCATION_APP_COUNT));
+ }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
index 396b9df..4cd6be4 100644
--- a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
@@ -92,4 +92,13 @@
verify(mMediaPlayer, never()).start();
}
+
+ @Test
+ public void onViewInvisible_shouldReleaseMediaplayer() {
+ mVideoPreference.onViewVisible(false);
+
+ mVideoPreference.onViewInvisible();
+
+ verify(mMediaPlayer).release();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java
index 8bbb2be..20c5838 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java
@@ -38,8 +38,8 @@
@RunWith(RobolectricTestRunner.class)
public class WifiPrivacyPreferenceControllerTest {
- private static final int PRIVACY_RANDOMIZED = 0;
- private static final int PRIVACY_TRUSTED = 1;
+ private static final int PRIVACY_RANDOMIZED = WifiConfiguration.RANDOMIZATION_PERSISTENT;
+ private static final int PRIVACY_TRUSTED = WifiConfiguration.RANDOMIZATION_NONE;
@Mock
private WifiConfiguration mWifiConfiguration;
@@ -47,6 +47,7 @@
private WifiPrivacyPreferenceController mPreferenceController;
private Context mContext;
private DropDownPreference mDropDownPreference;
+ private String[] perferenceString;
@Before
public void setUp() {
@@ -59,6 +60,8 @@
mDropDownPreference = new DropDownPreference(mContext);
mDropDownPreference.setEntries(R.array.wifi_privacy_entries);
mDropDownPreference.setEntryValues(R.array.wifi_privacy_values);
+
+ perferenceString = mContext.getResources().getStringArray(R.array.wifi_privacy_entries);
}
@Test
@@ -67,7 +70,8 @@
mPreferenceController.updateState(mDropDownPreference);
- assertThat(mDropDownPreference.getEntry()).isEqualTo("Trusted");
+
+ assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[PRIVACY_TRUSTED]);
}
@Test
@@ -76,7 +80,7 @@
mPreferenceController.updateState(mDropDownPreference);
- assertThat(mDropDownPreference.getEntry()).isEqualTo("Default (use randomized MAC)");
+ assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[PRIVACY_RANDOMIZED]);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java b/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java
index 0ef0273..a57fefc 100644
--- a/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java
@@ -85,6 +85,11 @@
public void setTransform(Matrix transform) {
// Do nothing
}
+
+ @Override
+ public boolean isValid(String qrCode) {
+ return true;
+ }
}
private ScannerTestCallback mScannerCallback;
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
index 40d651e..cdc74b3 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
@@ -35,6 +35,9 @@
import android.os.UserManager;
import android.widget.TextView;
+import androidx.fragment.app.FragmentActivity;
+import androidx.preference.PreferenceScreen;
+
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.ShadowWifiManager;
@@ -51,15 +54,13 @@
import java.util.ArrayList;
import java.util.List;
-import androidx.fragment.app.FragmentActivity;
-import androidx.preference.PreferenceScreen;
-
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowWifiManager.class})
public class WifiTetherSettingsTest {
private static final String[] WIFI_REGEXS = {"wifi_regexs"};
private Context mContext;
+ private WifiTetherSettings mWifiTetherSettings;
@Mock
private ConnectivityManager mConnectivityManager;
@@ -75,6 +76,8 @@
.when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
doReturn(WIFI_REGEXS).when(mConnectivityManager).getTetherableWifiRegexs();
doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
+
+ mWifiTetherSettings = new WifiTetherSettings();
}
@Test
@@ -136,6 +139,15 @@
verify(screen).removeAll();
}
+ @Test
+ public void createPreferenceControllers_hasAutoOffPreference() {
+ assertThat(mWifiTetherSettings.createPreferenceControllers(mContext)
+ .stream()
+ .filter(controller -> controller instanceof WifiTetherAutoOffPreferenceController)
+ .count())
+ .isEqualTo(1);
+ }
+
private void setupIsTetherAvailable(boolean returnValue) {
when(mConnectivityManager.isTetheringSupported()).thenReturn(true);
diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
index 235f182..61033e9 100644
--- a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
+++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
@@ -80,4 +80,20 @@
assertThat(activity instanceof WifiDppQrCodeGeneratorFragment
.OnQrCodeGeneratorFragmentAddButtonClickedListener).isEqualTo(true);
}
+
+ @Test
+ public void testActivity_shouldImplementsOnScanWifiDppSuccessCallback() {
+ WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
+
+ assertThat(activity instanceof WifiDppQrCodeScannerFragment
+ .OnScanWifiDppSuccessListener).isEqualTo(true);
+ }
+
+ @Test
+ public void testActivity_shouldImplementsOnScanZxingWifiFormatSuccessCallback() {
+ WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
+
+ assertThat(activity instanceof WifiDppQrCodeScannerFragment
+ .OnScanZxingWifiFormatSuccessListener).isEqualTo(true);
+ }
}
diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivityTest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivityTest.java
new file mode 100644
index 0000000..283da13
--- /dev/null
+++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivityTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.wifi.dpp;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class WifiDppEnrolleeActivityTest {
+ @Rule
+ public final ActivityTestRule<WifiDppEnrolleeActivity> mActivityRule =
+ new ActivityTestRule<>(WifiDppEnrolleeActivity.class);
+
+ @Test
+ public void testActivity_shouldImplementsOnScanWifiDppSuccessCallback() {
+ WifiDppEnrolleeActivity activity = mActivityRule.getActivity();
+
+ assertThat(activity instanceof WifiDppQrCodeScannerFragment
+ .OnScanWifiDppSuccessListener).isEqualTo(true);
+ }
+
+ @Test
+ public void testActivity_shouldImplementsOnScanZxingWifiFormatSuccessCallback() {
+ WifiDppEnrolleeActivity activity = mActivityRule.getActivity();
+
+ assertThat(activity instanceof WifiDppQrCodeScannerFragment
+ .OnScanZxingWifiFormatSuccessListener).isEqualTo(true);
+ }
+}
diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiQrCodetest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiQrCodeTest.java
similarity index 83%
rename from tests/unit/src/com/android/settings/wifi/dpp/WifiQrCodetest.java
rename to tests/unit/src/com/android/settings/wifi/dpp/WifiQrCodeTest.java
index 775ca48..3595597 100644
--- a/tests/unit/src/com/android/settings/wifi/dpp/WifiQrCodetest.java
+++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiQrCodeTest.java
@@ -29,7 +29,7 @@
@SmallTest
@RunWith(AndroidJUnit4.class)
-public class WifiQrCodetest {
+public class WifiQrCodeTest {
// Valid Wi-Fi DPP QR code & it's parameters
private static final String VALID_WIFI_DPP_QR_CODE = "DPP:I:SN=4774LH2b4044;M:010203040506;K:"
+ "MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;";
@@ -57,6 +57,13 @@
private static final String SSID_OF_VALID_ZXING_WIFI_QR_CODE = "mynetwork";
private static final String PASSWORD_OF_VALID_ZXING_WIFI_QR_CODE = "mypass";
+ // Valid ZXing reader library's Wi-Fi Network config format - escaped characters
+ private static final String VALID_ZXING_WIFI_QR_CODE_SPECIAL_CHARACTERS =
+ "WIFI:T:WPA;S:mynetwork;P:m\\;y\\:p\\\\a\\,ss;H:true;;";
+
+ private static final String PASSWORD_OF_VALID_ZXING_WIFI_QR_CODE_SPECIAL_CHARACTERS =
+ "m;y:p\\a,ss";
+
// Invalid scheme QR code
private static final String INVALID_SCHEME_QR_CODE = "BT:T:WPA;S:mynetwork;P:mypass;H:true;;";
@@ -118,19 +125,35 @@
assertEquals(WifiQrCode.SCHEME_ZXING_WIFI_NETWORK_CONFIG, wifiQrCode.getScheme());
assertNotNull(config);
- assertNull(config.getSecurity());
+ assertEquals("", config.getSecurity());
assertEquals(SSID_OF_VALID_ZXING_WIFI_QR_CODE, config.getSsid());
- assertNull(config.getPreSharedKey());
+ assertEquals("", config.getPreSharedKey());
assertEquals(false, config.getHiddenSsid());
}
@Test
+ public void parseValidZxingWifiQrCode_specialCharacters() {
+ WifiQrCode wifiQrCode = new WifiQrCode(VALID_ZXING_WIFI_QR_CODE_SPECIAL_CHARACTERS);
+ WifiNetworkConfig config = wifiQrCode.getWifiNetworkConfig();
+
+ assertEquals(WifiQrCode.SCHEME_ZXING_WIFI_NETWORK_CONFIG, wifiQrCode.getScheme());
+ assertNotNull(config);
+ assertEquals(SECURITY_OF_VALID_ZXING_WIFI_QR_CODE, config.getSecurity());
+ assertEquals(SSID_OF_VALID_ZXING_WIFI_QR_CODE, config.getSsid());
+ assertEquals(PASSWORD_OF_VALID_ZXING_WIFI_QR_CODE_SPECIAL_CHARACTERS,
+ config.getPreSharedKey());
+ assertEquals(true, config.getHiddenSsid());
+ }
+
+ @Test
public void testRemoveBackSlash() {
- assertEquals("\\", WifiQrCode.removeBackSlash("\\\\"));
- assertEquals("ab", WifiQrCode.removeBackSlash("a\\b"));
- assertEquals("a", WifiQrCode.removeBackSlash("\\a"));
- assertEquals("\\b", WifiQrCode.removeBackSlash("\\\\b"));
- assertEquals("c\\", WifiQrCode.removeBackSlash("c\\\\"));
+ WifiQrCode wifiQrCode = new WifiQrCode(VALID_WIFI_DPP_QR_CODE);
+
+ assertEquals("\\", wifiQrCode.removeBackSlash("\\\\"));
+ assertEquals("ab", wifiQrCode.removeBackSlash("a\\b"));
+ assertEquals("a", wifiQrCode.removeBackSlash("\\a"));
+ assertEquals("\\b", wifiQrCode.removeBackSlash("\\\\b"));
+ assertEquals("c\\", wifiQrCode.removeBackSlash("c\\\\"));
}
@Test