Snap for 5212161 from d8b3fd3869 to qt-release

Change-Id: I29a0bbb2b2ef6c32d5ef4c8a81f6c1c8e2c95482
This commit is contained in:
android-build-team Robot
2019-01-06 04:08:19 +00:00
99 changed files with 1273 additions and 344 deletions

View File

@@ -3050,7 +3050,7 @@
<intent-filter>
<action android:name="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER"/>
<action android:name="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR"/>
<action android:name="android.settings.WIFI_DPP_CONFIGURATOR_CHOOSE_SAVED_WIFI_NETWORK"/>
<action android:name="android.settings.PROCESS_WIFI_DPP_QR_CODE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>

View File

@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4">
<issue
id="LintError"
severity="Error"
message="No `.class` files were found in project &quot;.&quot;, 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.&#xA;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"
@@ -225,6 +237,22 @@
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.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;homepage_status_bar_color&quot;>#cc000000&lt;/color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-night/colors.xml"
line="25"
column="3"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -1281,6 +1309,22 @@
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.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;homepage_status_bar_color&quot;>#ccFFFFFF&lt;/color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="133"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -1293,7 +1337,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="133"
line="136"
column="5"/>
</issue>
@@ -1309,7 +1353,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="134"
line="137"
column="5"/>
</issue>
@@ -1325,7 +1369,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="135"
line="138"
column="5"/>
</issue>
@@ -2477,7 +2521,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
line="5883"
line="5885"
column="36"/>
</issue>
@@ -2509,7 +2553,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="415"
line="388"
column="44"/>
</issue>
@@ -2525,7 +2569,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="421"
line="394"
column="44"/>
</issue>
@@ -2541,7 +2585,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="422"
line="395"
column="44"/>
</issue>
@@ -2557,7 +2601,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="457"
line="430"
column="34"/>
</issue>

View File

@@ -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"

View File

@@ -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>
</FrameLayout>

View File

@@ -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"

View File

@@ -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"

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"

View File

@@ -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"

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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"

View File

@@ -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"

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -40,6 +40,7 @@
style="@style/ContextualCardDismissalButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/homepage_card_dismissal_margin_bottom"
android:text="@string/contextual_card_dismiss_keep"/>
<Button
@@ -47,6 +48,7 @@
style="@style/ContextualCardDismissalButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/homepage_card_dismissal_margin_bottom"
android:text="@string/contextual_card_dismiss_remove"/>
</LinearLayout>

View File

@@ -30,6 +30,7 @@
android:id="@+id/slice_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="@dimen/homepage_card_padding_start"
android:paddingEnd="@dimen/homepage_card_padding_end"/>

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"

View File

@@ -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>

View File

@@ -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>

View File

@@ -37,5 +37,5 @@
android:ellipsize="end"
android:gravity="center_horizontal|top"
android:singleLine="true"
android:textAppearance="@android:style/TextAppearance.Material.Caption" />
</LinearLayout>
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Caption" />
</LinearLayout>

View File

@@ -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>

View File

@@ -31,8 +31,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/app_bar_height"
android:descendantFocusability="blocksDescendants">
android:descendantFocusability="blocksDescendants"
android:paddingTop="104dp">
<!-- height of status bar(24dp) + height of action bar(48dp) + top/bottom margins(16dp) -->
<FrameLayout
android:id="@+id/contextual_cards_content"
@@ -52,6 +53,13 @@
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Space
android:layout_width="match_parent"
android:layout_height="@*android:dimen/status_bar_height"
android:background="@android:color/transparent"
app:layout_scrollFlags="scroll|enterAlways"/>
<include layout="@layout/search_bar"/>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -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"

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"/>

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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" />

View File

@@ -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"

View File

@@ -68,7 +68,7 @@
android:layout_centerVertical="true"
android:layout_margin="5dp"
android:background="@null"
android:src="@drawable/ic_qrcode_24dp"
android:src="@drawable/ic_scan_24dp"
android:visibility="gone"
android:contentDescription="@string/wifi_add_network" />
</RelativeLayout>
@@ -303,7 +303,7 @@
android:layout_centerVertical="true"
android:layout_margin="5dp"
android:background="@null"
android:src="@drawable/ic_qrcode_24dp"
android:src="@drawable/ic_scan_24dp"
android:visibility="gone"
android:contentDescription="@string/wifi_add_network" />
</RelativeLayout>

View File

@@ -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>

View File

@@ -24,22 +24,19 @@
<include layout="@layout/wifi_dpp_fragment_header"/>
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"/>
<ImageView
android:id="@+id/wifi_ap_picture_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"/>
<TextView android:id="@+id/choose_different_network"
<TextView
android:id="@+id/choose_different_network"
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_choose_different_network"/>
<include layout="@layout/wifi_dpp_fragment_footer"
android:gravity="center|bottom"/>

View File

@@ -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"

View File

@@ -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" />

View File

@@ -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>

View File

@@ -21,5 +21,7 @@
<color name="switchbar_switch_thumb_tint">@android:color/black</color>
<color name="homepage_accessibility_background">#783BE5</color>
<color name="homepage_support_background">#3F5FBD</color>
<!-- 80% black for status bar of homepage -->
<color name="homepage_status_bar_color">#cc000000</color>
</resources>

View File

@@ -129,6 +129,9 @@
<!-- launcher icon color -->
<color name="icon_launcher_setting_color">@*android:color/accent_device_default_light</color>
<!-- 80% white for status bar of homepage -->
<color name="homepage_status_bar_color">#ccFFFFFF</color>
<!-- QR code scanner colors -->
<color name="qr_corner_line_color">#ffdadce0</color>
<color name="qr_focused_corner_line_color">#ff1a73e8</color>

View File

@@ -105,8 +105,6 @@
<dimen name="search_bar_avatar_size">32dp</dimen>
<dimen name="search_bar_avatar_start_margin">4dp</dimen>
<dimen name="search_bar_avatar_end_margin">16dp</dimen>
<!-- appbar height is equal search bar height (48dp) plus search bar top and bottom margin -->
<dimen name="app_bar_height">80dp</dimen>
<!-- Dimensions for Wifi Assistant Card -->
<dimen name="wifi_assistant_padding_top_bottom">16dp</dimen>
@@ -332,6 +330,7 @@
<dimen name="homepage_half_card_padding_top">12dp</dimen>
<dimen name="homepage_half_card_padding_bottom">16dp</dimen>
<dimen name="homepage_half_card_title_margin_top">12dp</dimen>
<dimen name="homepage_card_dismissal_margin_bottom">2dp</dimen>
<!-- Horizontal divider size and margin -->
<dimen name="horizontal_divider_margin_top">4dp</dimen>
@@ -367,5 +366,6 @@
<!-- QR code picture size -->
<dimen name="qrcode_size">264dp</dimen>
<dimen name="qrcode_preview_size">360dp</dimen>
</resources>

View File

@@ -2077,13 +2077,13 @@
<!-- Label for the spinner to show Wifi MAC randomization [CHAR LIMIT=25] -->
<string name="wifi_privacy_settings">Privacy</string>
<!-- Title for the fragment to add a device into the wifi network [CHAR LIMIT=50] -->
<string name="wifi_dpp_add_device_to_network">Add a device to this network</string>
<string name="wifi_dpp_add_device_to_network">Add a device</string>
<!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=120] -->
<string name="wifi_dpp_center_qr_code">Center the device\u2019s QR code below to add device to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
<string name="wifi_dpp_center_qr_code">Center the QR code below to add the device to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
<!-- Title for the fragment to scan QR code [CHAR LIMIT=50] -->
<string name="wifi_dpp_scan_qr_code">Scan QR code</string>
<!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_scan_qr_code_join_network">Join \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d by scanning a QR code</string>
<string name="wifi_dpp_scan_qr_code_join_network">Center the QR code below to connect to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
<!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_scan_qr_code_join_unknown_network">Join Wi\u2011Fi by scanning a QR code</string>
<!-- Title for the fragment to share Wi-Fi [CHAR LIMIT=50] -->
@@ -2091,7 +2091,19 @@
<!-- 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>
<string name="wifi_dpp_could_not_detect_valid_qr_code">Couldn\u2019t read QR code</string>
<!-- Title for the fragment choose network [CHAR LIMIT=50] -->
<string name="wifi_dpp_choose_network">Choose network</string>
<!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_choose_network_to_connect_device">To connect your device, choose a network</string>
<!-- Hint for the user to add the device to a Wi-Fi network [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_add_device_to_wifi">Add this device to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d?</string>
<!-- Title for the fragment to tell the user that Wi-Fi shared with device successfully [CHAR LIMIT=50] -->
<string name="wifi_dpp_wifi_shared_with_device">Wi\u2011Fi shared with device</string>
<!-- Button label to add another device to Wi-Fi [CHAR LIMIT=50] -->
<string name="wifi_dpp_add_another_device">Add another device</string>
<!-- Button label to choose different Wi-Fi network [CHAR LIMIT=80] -->
<string name="wifi_dpp_choose_different_network">Choose different network</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 -->
@@ -2646,6 +2658,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] -->
@@ -5223,6 +5238,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] -->
@@ -9455,10 +9473,14 @@
<string name="notification_log_details_parcel">parcel size</string>
<!-- Notification log debug tool: notification ashmem size -->
<string name="notification_log_details_ashmem">ashmem</string>
<!-- Notification log debug tool: header: notification alert info -->
<string name="notification_log_details_alerted">notification alerted</string>
<!-- Notification log debug tool: header: notification sound info -->
<string name="notification_log_details_sound">sound</string>
<!-- Notification log debug tool: header: notification vibration info -->
<string name="notification_log_details_vibrate">vibrate</string>
<!-- Notification log debug tool: header: notification vibration info -->
<string name="notification_log_details_vibrate_pattern">pattern</string>
<!-- Notification log debug tool: the word 'default' -->
<string name="notification_log_details_default">default</string>
<!-- Notification log debug tool: the word 'none' -->
@@ -10036,12 +10058,17 @@
<!-- 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>
<!-- Title for Game Update Packages dashboard where developers can configure apps to use GUP or not [CHAR LIMIT=50] -->
<string name="gup_dashboard_title">Game Update Packages Preferences</string>
<!-- Summary for Game Update Packages dashboard [CHAR LIMIT=50] -->
<string name="gup_dashboard_summary">Modify Game Update Packages settings</string>
<!-- Slices Strings -->

View File

@@ -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>
@@ -459,6 +459,7 @@
<style name="ContextualCardDismissalButton"
parent="android:Widget.DeviceDefault.Button.Borderless.Colored">
<item name="android:minHeight">16dp</item>
<item name="android:textAllCaps">false</item>
</style>

View File

@@ -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>

View File

@@ -191,6 +191,12 @@
android:title="@string/enable_gpu_debug_layers"
android:summary="@string/enable_gpu_debug_layers_summary" />
<Preference
android:key="gup_dashboard"
android:title="@string/gup_dashboard_title"
android:summary="@string/gup_dashboard_summary"
android:fragment="com.android.settings.development.gup.GupDashboard" />
</PreferenceCategory>
<PreferenceCategory
@@ -424,9 +430,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>

View File

@@ -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"

20
res/xml/gup_settings.xml Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/gup_dashboard_title" />

View File

@@ -26,8 +26,11 @@
app:animation="@raw/gesture_prevent_ringing"
app:preview="@drawable/gesture_prevent_ringing" />
<com.android.settingslib.widget.LayoutPreference
android:key="gesture_prevent_ringing_switch"
android:layout="@layout/styled_switch_bar" />
<PreferenceCategory
android:key="gesture_prevent_ringing_category"
android:title="@string/gesture_prevent_ringing_title">
</PreferenceCategory>
android:title="@string/gesture_prevent_ringing_title" />
</PreferenceScreen>

View File

@@ -150,7 +150,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
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 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
@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() {

View File

@@ -52,8 +52,6 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
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 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
@VisibleForTesting
protected LocalBluetoothManager mLocalManager;
private final boolean mShowDeviceWithoutNames;
@VisibleForTesting
final GearPreference.OnGearClickListener mDeviceProfilesListener = pref -> {
launchDeviceDetails(pref);
@@ -79,8 +75,6 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
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 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
if (!mPreferenceMap.containsKey(device)) {
BluetoothDevicePreference btPreference =
new BluetoothDevicePreference(mPrefContext, cachedDevice,
mShowDeviceWithoutNames);
true /* showDeviceWithoutNames */);
btPreference.setOnGearClickListener(mDeviceProfilesListener);
if (this instanceof Preference.OnPreferenceClickListener) {
btPreference.setOnPreferenceClickListener(

View File

@@ -32,5 +32,5 @@ public interface DevelopmentOptionsActivityRequestCodes {
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;
}

View File

@@ -423,7 +423,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
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));

View File

@@ -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.settings.core.PreferenceControllerMixin;
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 @@ public class UpdatedGfxDriverDevOptInPreferenceController
@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 @@ public class UpdatedGfxDriverDevOptInPreferenceController
@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 @@ public class UpdatedGfxDriverDevOptInPreferenceController
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 @@ public class UpdatedGfxDriverDevOptInPreferenceController
}
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));
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright 2019 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.development.gup;
import android.content.Context;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
public class GupDashboard extends DashboardFragment {
private static final String TAG = "GupDashboard";
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.SETTINGS_GUP_DASHBOARD;
}
@Override
protected String getLogTag() {
return TAG;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.gup_settings;
}
@Override
public int getHelpResource() {
return 0;
}
}

View File

@@ -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;
}
}

View File

@@ -21,8 +21,10 @@ import android.app.Activity;
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 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
@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 class BatteryHeaderPreferenceController extends BasePreferenceController
}
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 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
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));
}
}

View File

@@ -46,7 +46,7 @@ public class PreventRingingGesturePreferenceController extends AbstractPreferenc
OnResume, OnPause, OnCreate, PreferenceControllerMixin {
@VisibleForTesting static final String KEY_VIBRATE = "prevent_ringing_option_vibrate";
@VisibleForTesting static final String KEY_NONE = "prevent_ringing_option_none";
@VisibleForTesting static final String KEY_MUTE = "prevent_ringing_option_mute";
private final String KEY_VIDEO_PAUSED = "key_video_paused";
@@ -57,9 +57,8 @@ public class PreventRingingGesturePreferenceController extends AbstractPreferenc
private VideoPreference mVideoPreference;
private boolean mVideoPaused;
private PreferenceCategory mPreferenceCategory;
@VisibleForTesting PreferenceCategory mPreferenceCategory;
@VisibleForTesting RadioButtonPreference mVibratePref;
@VisibleForTesting RadioButtonPreference mNonePref;
@VisibleForTesting RadioButtonPreference mMutePref;
private SettingObserver mSettingObserver;
@@ -80,7 +79,6 @@ public class PreventRingingGesturePreferenceController extends AbstractPreferenc
mPreferenceCategory = (PreferenceCategory) screen.findPreference(getPreferenceKey());
mVibratePref = makeRadioPreference(KEY_VIBRATE, R.string.prevent_ringing_option_vibrate);
mMutePref = makeRadioPreference(KEY_MUTE, R.string.prevent_ringing_option_mute);
mNonePref = makeRadioPreference(KEY_NONE, R.string.prevent_ringing_option_none);
if (mPreferenceCategory != null) {
mSettingObserver = new SettingObserver(mPreferenceCategory);
@@ -124,19 +122,21 @@ public class PreventRingingGesturePreferenceController extends AbstractPreferenc
public void updateState(Preference preference) {
int preventRingingSetting = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.VOLUME_HUSH_GESTURE, Settings.Secure.VOLUME_HUSH_VIBRATE);
final boolean isVibrate = preventRingingSetting == Settings.Secure.VOLUME_HUSH_VIBRATE;
final boolean isMute = preventRingingSetting == Settings.Secure.VOLUME_HUSH_MUTE;
final boolean isOff = preventRingingSetting == Settings.Secure.VOLUME_HUSH_OFF
|| (!isVibrate && !isMute);
if (mVibratePref != null && mVibratePref.isChecked() != isVibrate) {
mVibratePref.setChecked(isVibrate);
}
if (mMutePref != null && mMutePref.isChecked() != isMute) {
mMutePref.setChecked(isMute);
}
if (mNonePref != null && mNonePref.isChecked() != isOff) {
mNonePref.setChecked(isOff);
if (preventRingingSetting == Settings.Secure.VOLUME_HUSH_OFF) {
mVibratePref.setEnabled(false);
mMutePref.setEnabled(false);
} else {
mVibratePref.setEnabled(true);
mMutePref.setEnabled(true);
}
}
@@ -173,13 +173,12 @@ public class PreventRingingGesturePreferenceController extends AbstractPreferenc
private int keyToSetting(String key) {
switch (key) {
case KEY_NONE:
return Settings.Secure.VOLUME_HUSH_OFF;
case KEY_MUTE:
return Settings.Secure.VOLUME_HUSH_MUTE;
case KEY_VIBRATE:
default:
return Settings.Secure.VOLUME_HUSH_VIBRATE;
default:
return Settings.Secure.VOLUME_HUSH_OFF;
}
}

View File

@@ -35,7 +35,6 @@ import java.util.List;
public class PreventRingingGestureSettings extends DashboardFragment {
private static final String TAG = "RingingGestureSettings";
private static final String KEY_PREVENT_RINGING = "gesture_prevent_ringing";
@Override
public void onAttach(Context context) {
@@ -51,6 +50,7 @@ public class PreventRingingGestureSettings extends DashboardFragment {
Lifecycle lifecycle) {
List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new PreventRingingGesturePreferenceController(context, lifecycle));
controllers.add(new PreventRingingSwitchPreferenceController(context));
return controllers;
}

View File

@@ -0,0 +1,125 @@
/*
* Copyright (C) 2019 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.gestures;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.provider.Settings;
import android.widget.Switch;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.SwitchBar;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.widget.LayoutPreference;
public class PreventRingingSwitchPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, SwitchBar.OnSwitchChangeListener {
private static final String KEY = "gesture_prevent_ringing_switch";
private final Context mContext;
private SettingObserver mSettingObserver;
@VisibleForTesting SwitchBar mSwitch;
public PreventRingingSwitchPreferenceController(Context context) {
super(context);
mContext = context;
}
@Override
public String getPreferenceKey() {
return KEY;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
if (isAvailable()) {
LayoutPreference pref = (LayoutPreference) screen.findPreference(getPreferenceKey());
if (pref != null) {
mSettingObserver = new SettingObserver(pref);
mSwitch = pref.findViewById(R.id.switch_bar);
if (mSwitch != null) {
mSwitch.addOnSwitchChangeListener(this);
mSwitch.show();
}
}
}
}
public void setChecked(boolean isChecked) {
if (mSwitch != null) {
mSwitch.setChecked(isChecked);
}
}
@Override
public void updateState(Preference preference) {
int preventRingingSetting = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.VOLUME_HUSH_GESTURE, Settings.Secure.VOLUME_HUSH_VIBRATE);
setChecked(preventRingingSetting != Settings.Secure.VOLUME_HUSH_OFF);
}
@Override
public boolean isAvailable() {
return mContext.getResources().getBoolean(
com.android.internal.R.bool.config_volumeHushGestureEnabled);
}
@Override
public void onSwitchChanged(Switch switchView, boolean isChecked) {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.VOLUME_HUSH_GESTURE, isChecked ? Settings.Secure.VOLUME_HUSH_VIBRATE
: Settings.Secure.VOLUME_HUSH_OFF);
}
private class SettingObserver extends ContentObserver {
private final Uri VOLUME_HUSH_GESTURE = Settings.Secure.getUriFor(
Settings.Secure.VOLUME_HUSH_GESTURE);
private final Preference mPreference;
public SettingObserver(Preference preference) {
super(new Handler());
mPreference = preference;
}
public void register(ContentResolver cr) {
cr.registerContentObserver(VOLUME_HUSH_GESTURE, false, this);
}
public void unregister(ContentResolver cr) {
cr.unregisterContentObserver(this);
}
@Override
public void onChange(boolean selfChange, Uri uri) {
super.onChange(selfChange, uri);
if (uri == null || VOLUME_HUSH_GESTURE.equals(uri)) {
updateState(mPreference);
}
}
}
}

View File

@@ -19,6 +19,7 @@ package com.android.settings.homepage;
import android.content.Intent;
import android.os.Bundle;
import android.util.FeatureFlagUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toolbar;
@@ -47,6 +48,7 @@ public class SettingsHomepageActivity extends SettingsBaseActivity {
return;
}
updateWindowProperties();
setContentView(R.layout.settings_homepage_container);
final Toolbar toolbar = findViewById(R.id.search_action_bar);
@@ -73,4 +75,15 @@ public class SettingsHomepageActivity extends SettingsBaseActivity {
}
fragmentTransaction.commit();
}
private void updateWindowProperties() {
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
decorView.getSystemUiVisibility() |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
);
getWindow().setStatusBarColor(getResources().getColor(R.color.homepage_status_bar_color));
}
}

View File

@@ -273,7 +273,7 @@ public class BluetoothDevicesSlice implements CustomSliceable {
private SliceAction buildBluetoothDetailDeepLinkAction(CachedBluetoothDevice bluetoothDevice) {
return SliceAction.createDeeplink(
getBluetoothDetailIntent(bluetoothDevice),
IconCompat.createWithResource(mContext, R.drawable.ic_settings),
IconCompat.createWithResource(mContext, R.drawable.ic_settings_24dp),
ListBuilder.ICON_IMAGE,
bluetoothDevice.getName());
}
@@ -287,9 +287,7 @@ public class BluetoothDevicesSlice implements CustomSliceable {
final CharSequence title = mContext.getText(R.string.bluetooth_pairing_pref_title);
final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_menu_add);
final SliceAction sliceAction = SliceAction.createDeeplink(
getPairNewDeviceIntent(),
IconCompat.createWithResource(mContext, R.drawable.ic_settings),
ListBuilder.ICON_IMAGE, title);
getPairNewDeviceIntent(), icon, ListBuilder.ICON_IMAGE, title);
return new ListBuilder.RowBuilder()
.setTitleItem(icon, ListBuilder.ICON_IMAGE)

View File

@@ -6,9 +6,10 @@ import static android.Manifest.permission.ACCESS_FINE_LOCATION;
import android.content.Context;
import android.location.LocationManager;
import android.permission.RuntimePermissionPresenter;
import android.permission.PermissionControllerManager;
import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.R;
@@ -24,9 +25,11 @@ public class AppLocationPermissionPreferenceController extends
private static final String KEY_APP_LEVEL_PERMISSIONS = "app_level_permissions";
/** Total number of apps that has location permission. */
private int mNumTotal = -1;
@VisibleForTesting
int mNumTotal = -1;
/** Total number of apps that has background location permission. */
private int mNumBackground = -1;
@VisibleForTesting
int mNumBackground = -1;
private final LocationManager mLocationManager;
private Preference mPreference;
@@ -70,7 +73,9 @@ public class AppLocationPermissionPreferenceController extends
if (!mLocationManager.isLocationEnabled()) {
return;
}
RuntimePermissionPresenter.getInstance(mContext).countPermissionApps(
PermissionControllerManager permController =
mContext.getSystemService(PermissionControllerManager.class);
permController.countPermissionApps(
Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), false, false,
(numApps) -> {
mNumTotal = numApps;
@@ -79,7 +84,7 @@ public class AppLocationPermissionPreferenceController extends
}
}, null);
RuntimePermissionPresenter.getInstance(mContext).countPermissionApps(
permController.countPermissionApps(
Collections.singletonList(ACCESS_BACKGROUND_LOCATION), true, false,
(numApps) -> {
mNumBackground = numApps;

View File

@@ -8,7 +8,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.location.LocationManager;
import android.permission.RuntimePermissionPresenter;
import android.permission.PermissionControllerManager;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -70,7 +70,7 @@ public class TopLevelLocationPreferenceController extends BasePreferenceControll
if (!mLocationManager.isLocationEnabled()) {
return;
}
RuntimePermissionPresenter.getInstance(mContext).countPermissionApps(
mContext.getSystemService(PermissionControllerManager.class).countPermissionApps(
Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), false, false,
(numApps) -> {
setLocationAppCount(numApps);

View File

@@ -72,7 +72,7 @@ public class WifiCallingPreferenceController extends BasePreferenceController im
&& MobileNetworkUtils.isWifiCallingEnabled(mContext,
SubscriptionManager.getPhoneId(mSubId))
? AVAILABLE
: CONDITIONALLY_UNAVAILABLE;
: UNSUPPORTED_ON_DEVICE;
}
@Override

View File

@@ -16,6 +16,7 @@
package com.android.settings.nfc;
import android.content.Context;
import android.content.pm.PackageManager;
import android.nfc.NfcAdapter;
import androidx.preference.PreferenceScreen;
@@ -54,6 +55,10 @@ public class AndroidBeamPreferenceController extends BasePreferenceController
@Override
@AvailabilityStatus
public int getAvailabilityStatus() {
PackageManager pm = mContext.getPackageManager();
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM)) {
return UNSUPPORTED_ON_DEVICE;
}
return mNfcAdapter != null
? AVAILABLE
: UNSUPPORTED_ON_DEVICE;

View File

@@ -16,10 +16,13 @@
package com.android.settings.notification;
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.INotificationManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@@ -354,28 +357,53 @@ public class NotificationStation extends SettingsPreferenceFragment {
getString(R.string.notification_log_details_group_summary)));
}
}
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_sound)))
.append(delim);
if (0 != (n.defaults & Notification.DEFAULT_SOUND)) {
sb.append(getString(R.string.notification_log_details_default));
} else if (n.sound != null) {
sb.append(n.sound.toString());
} else {
sb.append(getString(R.string.notification_log_details_none));
}
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_vibrate)))
.append(delim);
if (0 != (n.defaults & Notification.DEFAULT_VIBRATE)) {
sb.append(getString(R.string.notification_log_details_default));
} else if (n.vibrate != null) {
for (int vi=0;vi<n.vibrate.length;vi++) {
if (vi > 0) sb.append(',');
sb.append(String.valueOf(n.vibrate[vi]));
if (info.active) {
// mRanking only applies to active notifications
if (mRanking != null && mRanking.getRanking(sbn.getKey(), rank)) {
if (rank.getLastAudiblyAlertedMillis() > 0) {
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_alerted)));
}
}
} else {
sb.append(getString(R.string.notification_log_details_none));
}
try {
NotificationChannel channel = mNoMan.getNotificationChannelForPackage(
sbn.getPackageName(), sbn.getUid(), n.getChannelId(), false);
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_sound)))
.append(delim);
if (channel.getImportance() == IMPORTANCE_UNSPECIFIED) {
if (0 != (n.defaults & Notification.DEFAULT_SOUND)) {
sb.append(getString(R.string.notification_log_details_default));
} else if (n.sound != null) {
sb.append(n.sound.toString());
} else {
sb.append(getString(R.string.notification_log_details_none));
}
} else {
sb.append(String.valueOf(channel.getSound()));
}
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_vibrate)))
.append(delim);
if (channel.getImportance() == IMPORTANCE_UNSPECIFIED) {
if (0 != (n.defaults & Notification.DEFAULT_VIBRATE)) {
sb.append(getString(R.string.notification_log_details_default));
} else if (n.vibrate != null) {
sb.append(getString(R.string.notification_log_details_vibrate_pattern));
} else {
sb.append(getString(R.string.notification_log_details_none));
}
} else {
if (channel.getVibrationPattern() != null) {
sb.append(getString(R.string.notification_log_details_vibrate_pattern));
} else {
sb.append(getString(R.string.notification_log_details_none));
}
}
} catch (RemoteException e) {
Log.d(TAG, "cannot read channel info", e);
}
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_visibility)))

View File

@@ -33,12 +33,17 @@ public class SlicePreference extends LayoutPreference {
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) {

View File

@@ -54,6 +54,7 @@ public class VideoPreference extends Preference {
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 @@ public class VideoPreference extends Preference {
.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 class VideoPreference extends Preference {
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 @@ public class VideoPreference extends Preference {
@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 @@ public class VideoPreference extends Preference {
@VisibleForTesting
void updateAspectRatio() {
mAspectRadio = mMediaPlayer.getVideoWidth() / (float)mMediaPlayer.getVideoHeight();
mAspectRadio = mMediaPlayer.getVideoWidth() / (float) mMediaPlayer.getVideoHeight();
}
}

View File

@@ -240,7 +240,7 @@ public class WifiSettings extends RestrictedSettingsFragment
mAddPreference.setIcon(R.drawable.ic_menu_add);
mAddPreference.setTitle(R.string.wifi_add_network);
if (WifiDppUtils.isSharingNetworkEnabled(getContext())) {
mAddPreference.setButtonIcon(R.drawable.ic_qrcode_24dp);
mAddPreference.setButtonIcon(R.drawable.ic_scan_24dp);
mAddPreference.setButtonOnClickListener((View v) -> {
// Launch QR code scanner to join a network.
getContext().startActivity(

View File

@@ -16,6 +16,8 @@
package com.android.settings.wifi.dpp;
import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -33,7 +35,6 @@ import com.android.settings.R;
* to the Wi-Fi network.
*/
public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
private ProgressBar mProgressBar;
private ImageView mWifiApPictureView;
private TextView mChooseDifferentNetwork;
private Button mButtonLeft;
@@ -44,6 +45,16 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null) {
actionBar.hide();
}
}
@Override
public final View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -55,10 +66,26 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mProgressBar = view.findViewById(R.id.progress_bar);
final WifiNetworkConfig wifiNetworkConfig = ((WifiDppConfiguratorActivity) getActivity())
.getWifiNetworkConfig();
if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
throw new IllegalStateException("Invalid Wi-Fi network for configuring");
}
mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi,
wifiNetworkConfig.getSsid()));
mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
mButtonLeft = view.findViewById(R.id.button_left);
mButtonLeft.setText(R.string.cancel);
mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
mButtonRight = view.findViewById(R.id.button_right);
mButtonRight.setText(R.string.wifi_dpp_share_wifi);
mButtonRight.setOnClickListener(v -> startWifiDppInitiator());
}
private void startWifiDppInitiator() {
//TODO(b/122331217): starts Wi-Fi DPP initiator handshake here
}
}

View File

@@ -16,6 +16,8 @@
package com.android.settings.wifi.dpp;
import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -40,6 +42,16 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null) {
actionBar.hide();
}
}
@Override
public final View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -51,8 +63,18 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mSavedWifiNetworkList = view.findViewById(R.id.saved_wifi_network_list);
mTitle.setText(R.string.wifi_dpp_choose_network);
mSummary.setText(R.string.wifi_dpp_choose_network_to_connect_device);
mButtonLeft = view.findViewById(R.id.button_left);
mButtonLeft.setText(R.string.cancel);
mButtonLeft.setOnClickListener(v -> {
Activity activity = getActivity();
activity.setResult(Activity.RESULT_CANCELED);
activity.finish();
});
mButtonRight = view.findViewById(R.id.button_right);
mButtonRight.setVisibility(View.GONE);
}
}

View File

@@ -44,7 +44,7 @@ import com.android.settings.R;
* {@code WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY}
* {@code WifiDppUtils.EXTRA_WIFI_HIDDEN_SSID}
*
* For intent action {@code ACTION_CONFIGURATOR_CHOOSE_SAVED_WIFI_NETWORK}, specify Wi-Fi (DPP)
* For intent action {@code ACTION_PROCESS_WIFI_DPP_QR_CODE}, specify Wi-Fi (DPP)
* QR code in {@code WifiDppUtils.EXTRA_QR_CODE}
*/
public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
@@ -58,8 +58,8 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
"android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER";
public static final String ACTION_CONFIGURATOR_QR_CODE_GENERATOR =
"android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR";
public static final String ACTION_CONFIGURATOR_CHOOSE_SAVED_WIFI_NETWORK =
"android.settings.WIFI_DPP_CONFIGURATOR_CHOOSE_SAVED_WIFI_NETWORK";
public static final String ACTION_PROCESS_WIFI_DPP_QR_CODE =
"android.settings.PROCESS_WIFI_DPP_QR_CODE";
private FragmentManager mFragmentManager;
@@ -72,6 +72,9 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
/** The information from Wi-Fi DPP QR code */
private String mInformation;
/** The Wi-Fi DPP QR code from intent ACTION_PROCESS_WIFI_DPP_QR_CODE */
private WifiQrCode mWifiDppQrCode;
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
@@ -115,8 +118,14 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
showQrCodeGeneratorFragment();
}
break;
case ACTION_CONFIGURATOR_CHOOSE_SAVED_WIFI_NETWORK:
showChooseSavedWifiNetworkFragment(/* addToBackStack */ false);
case ACTION_PROCESS_WIFI_DPP_QR_CODE:
String qrCode = intent.getStringExtra(WifiDppUtils.EXTRA_QR_CODE);
mWifiDppQrCode = getValidWiFiDppQrCodeOrNull(qrCode);
if (mWifiDppQrCode == null) {
cancelActivity = true;
} else {
showChooseSavedWifiNetworkFragment(/* addToBackStack */ false);
}
break;
default:
cancelActivity = true;
@@ -199,6 +208,21 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
fragmentTransaction.commit();
}
private WifiQrCode getValidWiFiDppQrCodeOrNull(String qrCode) {
WifiQrCode wifiQrCode;
try {
wifiQrCode = new WifiQrCode(qrCode);
} catch(IllegalArgumentException e) {
return null;
}
if (WifiQrCode.SCHEME_DPP.equals(wifiQrCode.getScheme())) {
return wifiQrCode;
}
return null;
}
@Override
public WifiNetworkConfig getWifiNetworkConfig() {
return mWifiNetworkConfig;
@@ -212,6 +236,10 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
return mInformation;
}
public WifiQrCode getWifiDppQrCode() {
return mWifiDppQrCode;
}
@Override
public boolean setWifiNetworkConfig(WifiNetworkConfig config) {
if(!WifiNetworkConfig.isValidConfig(config)) {
@@ -223,7 +251,7 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
}
@Override
public boolean onNavigateUp(){
public boolean onNavigateUp() {
Fragment fragment = mFragmentManager.findFragmentById(R.id.fragment_container);
if (fragment instanceof WifiDppQrCodeGeneratorFragment) {
setResult(Activity.RESULT_CANCELED);
@@ -245,7 +273,6 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
public void onScanWifiDppSuccess(String publicKey, String information) {
mPublicKey = publicKey;
mInformation = information;
mWifiNetworkConfig = null;
showAddDeviceFragment(/* addToBackStack */ true);
}

View File

@@ -28,6 +28,7 @@ com.android.settings.bluetooth.DevicePickerFragment
com.android.settings.datausage.AppDataUsage
com.android.settings.datausage.DataUsageList
com.android.settings.datetime.timezone.TimeZoneSettings
com.android.settings.development.gup.GupDashboard
com.android.settings.deviceinfo.PrivateVolumeSettings
com.android.settings.deviceinfo.PublicVolumeSettings
com.android.settings.deviceinfo.StorageProfileFragment

View File

@@ -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" />

View File

@@ -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.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
public class GameUpdatePackageDevOptInPreferenceControllerTest {
@Mock
private PreferenceScreen mPreferenceScreen;
@@ -53,13 +53,13 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
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 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
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 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
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 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
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));
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright 2019 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.development.gup;
import static com.google.common.truth.Truth.assertThat;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@RunWith(RobolectricTestRunner.class)
public class GupDashboardTest {
private GupDashboard mDashboard;
@Before
public void setUp() {
mDashboard = new GupDashboard();
}
@Test
public void getHelpResource_shouldReturn0() {
assertThat(mDashboard.getHelpResource()).isEqualTo(0);
}
@Test
public void getMetricesCategory_shouldReturnGupDashboard() {
assertThat(mDashboard.getMetricsCategory())
.isEqualTo(MetricsProto.MetricsEvent.SETTINGS_GUP_DASHBOARD);
}
@Test
public void getPreferenceScreen_shouldReturnGupSettings() {
assertThat(mDashboard.getPreferenceScreenResId())
.isEqualTo(R.xml.gup_settings);
}
}

View File

@@ -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();
}
}

View File

@@ -140,8 +140,9 @@ public class BatteryHeaderPreferenceControllerTest {
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 @@ public class BatteryHeaderPreferenceControllerTest {
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);
}

View File

@@ -18,44 +18,47 @@ package com.android.settings.gestures;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import android.content.Context;
import android.content.res.Resources;
import android.preference.PreferenceCategory;
import android.provider.Settings;
import androidx.preference.PreferenceScreen;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import com.android.settings.widget.RadioButtonPreference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class PreventRingingGesturePreferenceControllerTest {
private Context mContext;
private Resources mResources;
private PreventRingingGesturePreferenceController mController;
@Mock
private Preference mPreference;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mResources = mock(Resources.class);
when(mContext.getResources()).thenReturn(mResources);
when(mResources.getBoolean(com.android.internal.R.bool.config_volumeHushGestureEnabled))
.thenReturn(true);
mController = new PreventRingingGesturePreferenceController(mContext, null);
mController.mPreferenceCategory = new PreferenceCategory(mContext);
mController.mVibratePref = new RadioButtonPreference(mContext);
mController.mNonePref = new RadioButtonPreference(mContext);
mController.mMutePref = new RadioButtonPreference(mContext);
}
@@ -79,9 +82,10 @@ public class PreventRingingGesturePreferenceControllerTest {
public void testUpdateState_mute() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
Settings.Secure.VOLUME_HUSH_MUTE);
mController.updateState(null);
mController.updateState(mPreference);
assertThat(mController.mVibratePref.isEnabled()).isTrue();
assertThat(mController.mMutePref.isEnabled()).isTrue();
assertThat(mController.mVibratePref.isChecked()).isFalse();
assertThat(mController.mNonePref.isChecked()).isFalse();
assertThat(mController.mMutePref.isChecked()).isTrue();
}
@@ -89,9 +93,21 @@ public class PreventRingingGesturePreferenceControllerTest {
public void testUpdateState_vibrate() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
Settings.Secure.VOLUME_HUSH_VIBRATE);
mController.updateState(null);
mController.updateState(mPreference);
assertThat(mController.mVibratePref.isEnabled()).isTrue();
assertThat(mController.mMutePref.isEnabled()).isTrue();
assertThat(mController.mVibratePref.isChecked()).isTrue();
assertThat(mController.mNonePref.isChecked()).isFalse();
assertThat(mController.mMutePref.isChecked()).isFalse();
}
@Test
public void testUpdateState_off() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
Settings.Secure.VOLUME_HUSH_OFF);
mController.updateState(mPreference);
assertThat(mController.mVibratePref.isEnabled()).isFalse();
assertThat(mController.mMutePref.isEnabled()).isFalse();
assertThat(mController.mVibratePref.isChecked()).isFalse();
assertThat(mController.mMutePref.isChecked()).isFalse();
}
@@ -99,9 +115,8 @@ public class PreventRingingGesturePreferenceControllerTest {
public void testUpdateState_other() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
7);
mController.updateState(null);
mController.updateState(mPreference);
assertThat(mController.mVibratePref.isChecked()).isFalse();
assertThat(mController.mNonePref.isChecked()).isTrue();
assertThat(mController.mMutePref.isChecked()).isFalse();
}
@@ -132,19 +147,4 @@ public class PreventRingingGesturePreferenceControllerTest {
Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.VOLUME_HUSH_GESTURE, Settings.Secure.VOLUME_HUSH_OFF));
}
@Test
public void testRadioButtonClicked_off() {
RadioButtonPreference rbPref = new RadioButtonPreference(mContext);
rbPref.setKey(PreventRingingGesturePreferenceController.KEY_NONE);
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
Settings.Secure.VOLUME_HUSH_MUTE);
mController.onRadioButtonClicked(rbPref);
assertThat(Settings.Secure.VOLUME_HUSH_OFF).isEqualTo(
Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.VOLUME_HUSH_GESTURE, Settings.Secure.VOLUME_HUSH_VIBRATE));
}
}

View File

@@ -0,0 +1,98 @@
/*
* Copyright (C) 2019 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.gestures;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.res.Resources;
import android.provider.Settings;
import androidx.preference.Preference;
import com.android.settings.widget.SwitchBar;
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 PreventRingingSwitchPreferenceControllerTest {
private Context mContext;
private Resources mResources;
private PreventRingingSwitchPreferenceController mController;
private Preference mPreference = mock(Preference.class);
@Before
public void setUp() {
mContext = spy(RuntimeEnvironment.application);
mResources = mock(Resources.class);
when(mContext.getResources()).thenReturn(mResources);
when(mResources.getBoolean(com.android.internal.R.bool.config_volumeHushGestureEnabled))
.thenReturn(true);
mController = new PreventRingingSwitchPreferenceController(mContext);
mController.mSwitch = mock(SwitchBar.class);
}
@Test
public void testIsAvailable_configIsTrue_shouldReturnTrue() {
when(mResources.getBoolean(
com.android.internal.R.bool.config_volumeHushGestureEnabled)).thenReturn(true);
assertThat(mController.isAvailable()).isTrue();
}
@Test
public void testIsAvailable_configIsFalse_shouldReturnFalse() {
when(mResources.getBoolean(
com.android.internal.R.bool.config_volumeHushGestureEnabled)).thenReturn(false);
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void testOn_updateState_hushOff() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
Settings.Secure.VOLUME_HUSH_OFF);
mController.updateState(mPreference);
verify(mController.mSwitch, times(1)).setChecked(false);
}
@Test
public void testOn_updateState_hushVibrate() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
Settings.Secure.VOLUME_HUSH_VIBRATE);
mController.updateState(mPreference);
verify(mController.mSwitch, times(1)).setChecked(true);
}
@Test
public void testOn_updateState_hushMute() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE,
Settings.Secure.VOLUME_HUSH_MUTE);
mController.updateState(mPreference);
verify(mController.mSwitch, times(1)).setChecked(true);
}
}

View File

@@ -3,10 +3,12 @@ package com.android.settings.location;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.location.LocationManager;
import android.provider.Settings;
import androidx.lifecycle.LifecycleOwner;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
@@ -27,6 +29,7 @@ public class AppLocationPermissionPreferenceControllerTest {
private LifecycleOwner mLifecycleOwner;
private Lifecycle mLifecycle;
private LocationManager mLocationManager;
@Before
public void setUp() {
@@ -35,6 +38,7 @@ public class AppLocationPermissionPreferenceControllerTest {
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mController = new AppLocationPermissionPreferenceController(mContext, mLifecycle);
mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
}
@Test
@@ -52,4 +56,40 @@ public class AppLocationPermissionPreferenceControllerTest {
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_app_permission_summary_location_off));
}
@Test
public void getSummary_whenLocationIsOn_shouldReturnLoadingString() {
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() {
mLocationManager.setLocationEnabledForUser(true, android.os.Process.myUserHandle());
mController.mNumBackground = 1;
mController.mNumTotal = 1;
assertThat(mController.getSummary()).isEqualTo(mContext.getResources().getQuantityString(
R.plurals.location_app_permission_summary_location_on, 1, 1, 1));
}
@Test
public void getSummary_whenLocationAppCountIsGreaterThanOne_shouldShowPluralString() {
mLocationManager.setLocationEnabledForUser(true, android.os.Process.myUserHandle());
mController.mNumBackground = 5;
mController.mNumTotal = 10;
assertThat(mController.getSummary()).isEqualTo(mContext.getResources().getQuantityString(
R.plurals.location_app_permission_summary_location_on, 5, 5, 10));
}
}

View File

@@ -0,0 +1,145 @@
/*
* Copyright (C) 2019 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 static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.location.RecentLocationAccesses;
import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
public class RecentLocationAccessPreferenceControllerTest {
@Mock
private LayoutPreference mLayoutPreference;
@Mock
private PreferenceScreen mScreen;
@Mock
private RecentLocationAccesses mRecentLocationApps;
private Context mContext;
private RecentLocationAccessPreferenceController mController;
private View mAppEntitiesHeaderView;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mController = spy(
new RecentLocationAccessPreferenceController(mContext, mRecentLocationApps));
final String key = mController.getPreferenceKey();
mAppEntitiesHeaderView = LayoutInflater.from(mContext).inflate(
R.layout.app_entities_header, null /* root */);
when(mScreen.findPreference(key)).thenReturn(mLayoutPreference);
when(mLayoutPreference.getKey()).thenReturn(key);
when(mLayoutPreference.getContext()).thenReturn(mContext);
when(mLayoutPreference.findViewById(R.id.app_entities_header)).thenReturn(
mAppEntitiesHeaderView);
}
/** Verifies the title text, details text are correct, and the click listener is set. */
@Test
public void updateState_whenAppListIsEmpty_shouldDisplayTitleTextAndDetailsText() {
doReturn(new ArrayList<>()).when(mRecentLocationApps).getAppListSorted();
mController.displayPreference(mScreen);
mController.updateState(mLayoutPreference);
final TextView title = mAppEntitiesHeaderView.findViewById(R.id.header_title);
assertThat(title.getText()).isEqualTo(
mContext.getText(R.string.location_category_recent_location_access));
final TextView details = mAppEntitiesHeaderView.findViewById(R.id.header_details);
assertThat(details.getText()).isEqualTo(
mContext.getText(R.string.location_recent_location_access_view_details));
assertThat(details.hasOnClickListeners()).isTrue();
}
@Test
public void updateState_whenAppListMoreThanThree_shouldDisplayTopThreeApps() {
final List<RecentLocationAccesses.Access> accesses = createMockAccesses(6);
doReturn(accesses).when(mRecentLocationApps).getAppListSorted();
mController.displayPreference(mScreen);
mController.updateState(mLayoutPreference);
// The widget can display the top 3 apps from the list when there're more than 3.
final View app1View = mAppEntitiesHeaderView.findViewById(R.id.app1_view);
final ImageView appIconView1 = app1View.findViewById(R.id.app_icon);
final TextView appTitle1 = app1View.findViewById(R.id.app_title);
final TextView appSummary1 = app1View.findViewById(R.id.app_summary);
assertThat(app1View.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(appIconView1.getDrawable()).isNotNull();
assertThat(appTitle1.getText()).isEqualTo("appTitle0");
assertThat(appSummary1.getText()).isEqualTo("appSummary0");
final View app2View = mAppEntitiesHeaderView.findViewById(R.id.app2_view);
final ImageView appIconView2 = app2View.findViewById(R.id.app_icon);
final TextView appTitle2 = app2View.findViewById(R.id.app_title);
final TextView appSummary2 = app2View.findViewById(R.id.app_summary);
assertThat(app2View.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(appIconView2.getDrawable()).isNotNull();
assertThat(appTitle2.getText()).isEqualTo("appTitle1");
assertThat(appSummary2.getText()).isEqualTo("appSummary1");
final View app3View = mAppEntitiesHeaderView.findViewById(R.id.app3_view);
final ImageView appIconView3 = app3View.findViewById(R.id.app_icon);
final TextView appTitle3 = app3View.findViewById(R.id.app_title);
final TextView appSummary3 = app3View.findViewById(R.id.app_summary);
assertThat(app3View.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(appIconView3.getDrawable()).isNotNull();
assertThat(appTitle3.getText()).isEqualTo("appTitle2");
assertThat(appSummary3.getText()).isEqualTo("appSummary2");
}
private List<RecentLocationAccesses.Access> createMockAccesses(int count) {
final List<RecentLocationAccesses.Access> accesses = new ArrayList<>();
for (int i = 0; i < count; i++) {
final Drawable icon = mock(Drawable.class);
// Add mock accesses
final RecentLocationAccesses.Access access = new RecentLocationAccesses.Access(
"packageName", android.os.Process.myUserHandle(), icon,
"appTitle" + i, "appSummary" + i, 1000 - i);
accesses.add(access);
}
return accesses;
}
}

View File

@@ -32,6 +32,7 @@ import androidx.preference.PreferenceScreen;
import com.android.ims.ImsConfig;
import com.android.ims.ImsManager;
import com.android.settings.core.BasePreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -109,4 +110,12 @@ public class WifiCallingPreferenceControllerTest {
assertThat(mPreferenceCategory.isVisible()).isFalse();
}
@Test
public void getAvailabilityStatus_noWiFiCalling_shouldReturnUnsupported() {
mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.UNSUPPORTED_ON_DEVICE);
}
}

View File

@@ -22,6 +22,7 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.pm.PackageManager;
import android.nfc.NfcAdapter;
import android.nfc.NfcManager;
import android.os.UserHandle;
@@ -57,6 +58,8 @@ public class AndroidBeamPreferenceControllerTest {
private UserManager mUserManager;
@Mock
private PreferenceScreen mScreen;
@Mock
private PackageManager mPackageManager;
private RestrictedPreference mAndroidBeamPreference;
private AndroidBeamPreferenceController mAndroidBeamController;
@@ -78,6 +81,8 @@ public class AndroidBeamPreferenceControllerTest {
mAndroidBeamPreference = new RestrictedPreference(RuntimeEnvironment.application);
when(mScreen.findPreference(mAndroidBeamController.getPreferenceKey())).thenReturn(
mAndroidBeamPreference);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM)).thenReturn(true);
Settings.Global.putString(mContext.getContentResolver(),
Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS,
@@ -94,6 +99,13 @@ public class AndroidBeamPreferenceControllerTest {
assertThat(mAndroidBeamController.isAvailable()).isTrue();
}
@Test
public void isAvailable_noNfcFeature_shouldReturnFalse() {
when(mNfcAdapter.isEnabled()).thenReturn(true);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM)).thenReturn(false);
assertThat(mAndroidBeamController.isAvailable()).isFalse();
}
@Test
public void isAvailable_noNfcAdapter_shouldReturnFalse() {
ReflectionHelpers.setField(mAndroidBeamController, "mNfcAdapter", null);

View File

@@ -92,4 +92,13 @@ public class VideoPreferenceTest {
verify(mMediaPlayer, never()).start();
}
@Test
public void onViewInvisible_shouldReleaseMediaplayer() {
mVideoPreference.onViewVisible(false);
mVideoPreference.onViewInvisible();
verify(mMediaPlayer).release();
}
}

View File

@@ -38,6 +38,7 @@ public class WifiDppConfiguratorActivityTest {
Intent intent = new Intent(WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER);
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SECURITY, "WEP");
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SSID, "GoogleGuest");
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
mActivityRule.launchActivity(intent);
@@ -50,6 +51,7 @@ public class WifiDppConfiguratorActivityTest {
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SECURITY, "WEP");
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SSID, "GoogleGuest");
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
mActivityRule.launchActivity(intent);
@@ -59,7 +61,10 @@ public class WifiDppConfiguratorActivityTest {
@Test
public void launchActivity_chooseSavedWifiNetwork_shouldNotAutoFinish() {
Intent intent = new Intent(
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_CHOOSE_SAVED_WIFI_NETWORK);
WifiDppConfiguratorActivity.ACTION_PROCESS_WIFI_DPP_QR_CODE);
String qrCode = "DPP:I:SN=4774LH2b4044;M:010203040506;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD"
+ "IgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;";
intent.putExtra(WifiDppUtils.EXTRA_QR_CODE, qrCode);
mActivityRule.launchActivity(intent);