Snap for 5248711 from def4fd900d to qt-release
Change-Id: I364c99224308f23fe184829741fddb92c82a6459
This commit is contained in:
59
res/drawable/wifi_dpp_error.xml
Normal file
59
res/drawable/wifi_dpp_error.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="412dp"
|
||||
android:height="280dp"
|
||||
android:viewportWidth="412"
|
||||
android:viewportHeight="280">
|
||||
<path
|
||||
android:pathData="M110.14,169.6c-3.95,-1.35 -6.07,-5.69 -4.75,-9.7l2.89,-8.7c1.33,-4 5.61,-6.15 9.57,-4.81c3.95,1.35 6.07,5.69 4.75,9.7l-2.89,8.7C118.37,168.79 114.1,170.94 110.14,169.6z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M365.39,97.33l-7.72,-7.72c-0.89,-0.89 -0.89,-2.33 0,-3.22l7.72,-7.72c0.89,-0.89 2.33,-0.89 3.22,0l7.72,7.72c0.89,0.89 0.89,2.33 0,3.22l-7.72,7.72C367.72,98.22 366.29,98.22 365.39,97.33z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M57.99,113.3l-12.86,-8.87c-1.48,-1.03 -3.56,-0.09 -3.72,1.69l-1.41,15.35c-0.16,1.78 1.7,3.07 3.35,2.32l14.27,-6.48C59.28,116.55 59.48,114.33 57.99,113.3z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M93,65m-6,0a6,6 0,1 1,12 0a6,6 0,1 1,-12 0"
|
||||
android:fillColor="#BDC1C6"/>
|
||||
<path
|
||||
android:pathData="M241.37,35.13h-0.01c-0.63,-0.32 -1.26,-0.63 -1.9,-0.92c-5.98,-2.78 -12.37,-4.82 -19.06,-6.01c-0.74,-0.13 -1.48,-0.25 -2.22,-0.36c-3.74,-0.55 -7.56,-0.84 -11.45,-0.84c-43,0 -78,34.99 -78,78s35,78 78,78c12.5,0 24.32,-2.96 34.81,-8.2l8.68,14.94l3.46,-2.01l-8.6,-14.81c10.96,-6.22 20.28,-15 27.12,-25.54c4.03,-6.18 7.19,-12.97 9.34,-20.19c2.09,-7.03 3.21,-14.48 3.21,-22.18C284.74,74.42 267.05,47.9 241.37,35.13zM277.34,127.2c-0.24,0.76 -0.49,1.51 -0.76,2.26c-1.55,4.44 -3.53,8.68 -5.86,12.68c-0.4,0.68 -0.81,1.35 -1.23,2.02C256.41,165.07 233.17,179 206.73,179c-40.8,0 -74,-33.2 -74,-74s33.2,-74 74,-74c4.38,0 8.67,0.38 12.85,1.12c0.75,0.13 1.5,0.27 2.25,0.43c4.11,0.85 8.09,2.05 11.92,3.56c0.95,0.37 1.89,0.76 2.82,1.18c25.99,11.49 44.17,37.52 44.17,67.71C280.74,112.73 279.55,120.19 277.34,127.2z"
|
||||
android:fillColor="#DADCE0"/>
|
||||
<path
|
||||
android:pathData="M241.37,35.13h-0.01c-0.63,-0.32 -1.26,-0.63 -1.9,-0.92c-5.98,-2.78 -12.37,-4.82 -19.06,-6.01c-0.74,-0.13 -1.48,-0.25 -2.22,-0.36l-1.03,-3.13c-0.53,-1.63 0.36,-3.39 1.99,-3.92l14.15,-4.64c1.63,-0.53 3.39,0.36 3.92,1.99l4.64,14.15C242.18,33.3 241.96,34.35 241.37,35.13z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M291,138.5c0,6.35 -5.15,11.5 -11.5,11.5c-2.78,0 -5.33,-0.99 -7.31,-2.63c4.03,-6.18 7.19,-12.97 9.34,-20.19C286.91,128.14 291,132.84 291,138.5z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M268,138.5c0,2.06 0.54,3.99 1.49,5.66c0.42,-0.67 0.83,-1.34 1.23,-2.02c-0.46,-1.12 -0.72,-2.35 -0.72,-3.64c0,-4.22 2.76,-7.81 6.58,-9.04c0.27,-0.75 0.52,-1.5 0.76,-2.26C272.02,128.21 268,132.89 268,138.5z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M233.75,36.11l-8.67,2.84c-0.11,0.03 -0.22,0.05 -0.34,0.05c-0.48,0 -0.9,-0.31 -1.05,-0.76l-1.86,-5.69c-0.75,-0.16 -1.5,-0.3 -2.25,-0.43l2.21,6.74c0.43,1.31 1.65,2.14 2.95,2.14c0.32,0 0.65,-0.05 0.97,-0.15l10.86,-3.56C235.64,36.87 234.7,36.48 233.75,36.11z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M242.5,194.06l38.6,66.46c0.68,1.17 2.2,1.59 3.37,0.89l15.01,-8.71c1.17,-0.68 1.59,-2.2 0.89,-3.37l-38.6,-66.46c-0.68,-1.17 -2.2,-1.59 -3.37,-0.89l-15.01,8.71C242.22,191.36 241.83,192.88 242.5,194.06z"
|
||||
android:fillColor="#F1F3F4"/>
|
||||
<path
|
||||
android:pathData="M326.73,100L334.73,109"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#DADCE0"/>
|
||||
<path
|
||||
android:pathData="M166,151.56L173,148.56"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#DADCE0"/>
|
||||
<path
|
||||
android:pathData="M235.84,119.68l-25.6,-44.23c-1.88,-3.26 -6.59,-3.26 -8.48,0l-25.6,44.23c-1.88,3.26 0.47,7.32 4.24,7.32h51.2C235.37,127 237.72,122.93 235.84,119.68z"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#EA4335"/>
|
||||
<path
|
||||
android:pathData="M203.88,117.12c-0.58,-0.59 -0.88,-1.3 -0.88,-2.14c0,-0.84 0.29,-1.54 0.88,-2.12c0.58,-0.57 1.29,-0.86 2.12,-0.86c0.83,0 1.54,0.29 2.12,0.86c0.58,0.57 0.88,1.28 0.88,2.12c0,0.84 -0.29,1.55 -0.88,2.14c-0.58,0.59 -1.29,0.88 -2.12,0.88C205.17,118 204.46,117.71 203.88,117.12zM203.5,99.09V91h5v8.09l-0.49,9.91h-4.02L203.5,99.09z"
|
||||
android:fillColor="#EA4335"/>
|
||||
<path
|
||||
android:pathData="M91.73,102L82.73,98"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#DADCE0"/>
|
||||
</vector>
|
||||
54
res/drawable/wifi_dpp_success.xml
Normal file
54
res/drawable/wifi_dpp_success.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="412dp"
|
||||
android:height="280dp"
|
||||
android:viewportWidth="412"
|
||||
android:viewportHeight="280">
|
||||
<path
|
||||
android:pathData="M185.13,171.87c-1.93,-1.91 -4.45,-2.87 -6.97,-2.87c-2.51,0 -5.03,0.96 -6.94,2.87l-0.12,0.12c0.62,0.34 1.25,0.67 1.89,0.98c1.43,-1.28 3.25,-1.97 5.17,-1.97c2.1,0 4.07,0.81 5.55,2.29c1.33,1.33 2.08,3.02 2.25,4.76c0.68,0.19 1.36,0.38 2.04,0.56C187.95,176.16 186.99,173.74 185.13,171.87z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M281.06,87.88C279.52,88.6 277.81,89 276,89c-6.62,0 -12,-5.38 -12,-12c0,-5.23 3.36,-9.69 8.04,-11.33c-0.35,-0.58 -0.71,-1.16 -1.08,-1.73C265.72,65.96 262,71.05 262,77c0,7.73 6.27,14 14,14c1.95,0 3.81,-0.4 5.49,-1.12C281.36,89.21 281.22,88.54 281.06,87.88z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M187.83,180.61c-0.34,1.9 -1.24,3.71 -2.7,5.17l-8.35,8.35c-3.85,3.83 -10.06,3.83 -13.91,0c-3.83,-3.84 -3.83,-10.06 0,-13.91l6.77,-6.77C175.32,176.56 181.42,178.99 187.83,180.61z"
|
||||
android:fillColor="#4285F4"/>
|
||||
<path
|
||||
android:pathData="M290,77c0,5.04 -2.67,9.46 -6.67,11.93c-1.94,-9.23 -5.52,-17.87 -10.42,-25.59C273.9,63.12 274.94,63 276,63C283.73,63 290,69.27 290,77z"
|
||||
android:fillColor="#FBBC04"/>
|
||||
<path
|
||||
android:pathData="M285,105c0,-5.51 -0.57,-10.88 -1.67,-16.07c-1.94,-9.23 -5.52,-17.87 -10.42,-25.59C259.07,41.51 234.7,27 207,27c-43.01,0 -78,34.99 -78,78c0,29.48 16.44,55.2 40.64,68.45c5.68,3.11 11.78,5.54 18.19,7.16c6.14,1.56 12.56,2.39 19.17,2.39c12.41,0 24.16,-2.92 34.59,-8.11l8.62,14.84l1.73,-1l1.73,-1.01l-8.54,-14.7C268.91,159.65 285,134.17 285,105zM207,179c-6.67,0 -13.14,-0.89 -19.29,-2.55c-5.23,-1.41 -10.22,-3.38 -14.92,-5.85C149.16,158.23 133,133.47 133,105c0,-40.8 33.2,-74 74,-74c26,0 48.91,13.48 62.1,33.82c5.02,7.71 8.63,16.4 10.47,25.72c0.94,4.67 1.43,9.51 1.43,14.46C281,145.8 247.8,179 207,179z"
|
||||
android:fillColor="#DADCE0"/>
|
||||
<path
|
||||
android:pathData="M374.55,125.39l-6.95,-6.95c-0.8,-0.8 -0.8,-2.1 0,-2.9l6.95,-6.95c0.8,-0.8 2.1,-0.8 2.9,0l6.95,6.95c0.8,0.8 0.8,2.1 0,2.9l-6.95,6.95C376.65,126.2 375.36,126.2 374.55,125.39z"
|
||||
android:fillColor="#32A753"/>
|
||||
<path
|
||||
android:pathData="M57.33,138.1L46.9,127.67c-1.2,-1.2 -1.2,-3.15 0,-4.35l10.43,-10.43c1.2,-1.2 3.15,-1.2 4.35,0l10.43,10.43c1.2,1.2 1.2,3.15 0,4.35L61.67,138.1C60.48,139.3 58.52,139.3 57.33,138.1z"
|
||||
android:fillColor="#FBBC04"/>
|
||||
<path
|
||||
android:pathData="M320.49,109.73l6.33,16.64c0.73,1.93 -0.9,3.93 -2.94,3.6l-17.62,-2.85c-2.04,-0.33 -2.96,-2.74 -1.65,-4.34l11.28,-13.79C317.2,107.38 319.76,107.81 320.49,109.73z"
|
||||
android:fillColor="#EA4335"/>
|
||||
<path
|
||||
android:pathData="M110,49m-5,0a5,5 0,1 1,10 0a5,5 0,1 1,-10 0"
|
||||
android:fillColor="#EA4335"/>
|
||||
<path
|
||||
android:pathData="M41.074,54.755l1.317,-1.505l16,14l-1.317,1.505z"
|
||||
android:fillColor="#DADCE0"/>
|
||||
<path
|
||||
android:pathData="M303.566,179.017l11,-1.999l0.358,1.968l-11,1.999z"
|
||||
android:fillColor="#DADCE0"/>
|
||||
<path
|
||||
android:pathData="M333.378,70.081l16,-6.005l0.703,1.872l-16,6.005z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M95.347,171.085l7.004,-3.003l0.788,1.838l-7.004,3.003z"
|
||||
android:fillColor="#E8EAED"/>
|
||||
<path
|
||||
android:pathData="M203.43,114.78l-9,-9.22l2.86,-2.79l6.21,6.36l14.42,-14.08l2.79,2.86z"
|
||||
android:fillColor="#34A853"/>
|
||||
<path
|
||||
android:pathData="M242.5,194.06l38.6,66.46c0.68,1.17 2.2,1.59 3.37,0.89l15.01,-8.71c1.17,-0.68 1.59,-2.2 0.89,-3.37l-38.6,-66.46c-0.68,-1.17 -2.2,-1.59 -3.37,-0.89l-15.01,8.71C242.22,191.36 241.83,192.88 242.5,194.06z"
|
||||
android:fillColor="#F1F3F4"/>
|
||||
<path
|
||||
android:pathData="M225.04,138h-36.08c-3.84,0 -6.96,-3.12 -6.96,-6.96V76.96c0,-3.84 3.12,-6.96 6.96,-6.96h36.08c3.84,0 6.96,3.12 6.96,6.96v54.08C232,134.88 228.88,138 225.04,138zM188.96,74c-1.63,0 -2.96,1.33 -2.96,2.96v54.08c0,1.63 1.33,2.96 2.96,2.96h36.08c1.63,0 2.96,-1.33 2.96,-2.96V76.96c0,-1.63 -1.33,-2.96 -2.96,-2.96H188.96z"
|
||||
android:fillColor="#32A753"/>
|
||||
</vector>
|
||||
@@ -19,11 +19,11 @@
|
||||
<com.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:icon="@drawable/ic_lock"
|
||||
android:layout="@layout/sud_glif_blank_template"
|
||||
settings:sucFooter="@layout/choose_lock_pattern_common_footer"
|
||||
settings:sucHeaderText="@string/lockpassword_choose_your_screen_lock_header">
|
||||
|
||||
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2017 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License")
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
|
||||
<com.google.android.setupdesign.view.ButtonBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/SudGlifButtonBar.Stackable"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- left : skip -->
|
||||
<Button android:id="@+id/skip_button"
|
||||
style="@style/SudGlifButton.Secondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/skip_label"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- left : retry -->
|
||||
<Button android:id="@+id/footerLeftButton"
|
||||
style="@style/SudGlifButton.Secondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/lockpattern_tutorial_cancel_label" />
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<!-- right : confirm or ok -->
|
||||
<Button android:id="@+id/footerRightButton"
|
||||
style="@style/SudGlifButton.Primary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/lockpattern_tutorial_continue_label" />
|
||||
|
||||
</com.google.android.setupdesign.view.ButtonBarLayout>
|
||||
@@ -38,6 +38,8 @@
|
||||
android:id="@+id/wifi_ap_picture_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/wifi_dpp_success"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintTop_toBottomOf="@+id/header"/>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -1105,8 +1105,8 @@
|
||||
</string-array>
|
||||
|
||||
<string-array name="wifi_privacy_entries">
|
||||
<item>Use device MAC</item>
|
||||
<item>Use randomized MAC (default)</item>
|
||||
<item>Use device MAC</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="wifi_hidden_entries">
|
||||
@@ -1121,8 +1121,8 @@
|
||||
</string-array>
|
||||
|
||||
<string-array name="wifi_privacy_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>0</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Titles for ui dark mode preference. -->
|
||||
|
||||
@@ -59,10 +59,12 @@
|
||||
android:entries="@array/hdcp_checking_titles"
|
||||
android:entryValues="@array/hdcp_checking_values" />
|
||||
|
||||
<SwitchPreference
|
||||
<ListPreference
|
||||
android:key="bt_hci_snoop_log"
|
||||
android:title="@string/bt_hci_snoop_log"
|
||||
android:summary="@string/bt_hci_snoop_log_summary" />
|
||||
android:dialogTitle="@string/bt_hci_snoop_log_summary"
|
||||
android:entries="@array/bt_hci_snoop_log_entries"
|
||||
android:entryValues="@array/bt_hci_snoop_log_values" />
|
||||
|
||||
<com.android.settingslib.RestrictedSwitchPreference
|
||||
android:key="oem_unlock_enable"
|
||||
|
||||
@@ -152,7 +152,7 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
|
||||
if (!mHearingAidProfileSupported) {
|
||||
return null;
|
||||
}
|
||||
if (!mBluetoothAdapter.isEnabled()) {
|
||||
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
final List<BluetoothDevice> deviceList = mLocalBluetoothManager.getProfileManager()
|
||||
@@ -166,6 +166,9 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
|
||||
}
|
||||
|
||||
private boolean isHearingAidProfileSupported() {
|
||||
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
final List<Integer> supportedList = mBluetoothAdapter.getSupportedProfiles();
|
||||
if (supportedList.contains(BluetoothProfile.HEARING_AID)) {
|
||||
return true;
|
||||
|
||||
@@ -17,12 +17,19 @@
|
||||
package com.android.settings.development;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.SystemProperties;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
@@ -31,11 +38,40 @@ public class BluetoothSnoopLogPreferenceController extends DeveloperOptionsPrefe
|
||||
|
||||
private static final String PREFERENCE_KEY = "bt_hci_snoop_log";
|
||||
@VisibleForTesting
|
||||
static final String BLUETOOTH_BTSNOOP_ENABLE_PROPERTY =
|
||||
"persist.bluetooth.btsnoopenable";
|
||||
static final int BTSNOOP_LOG_MODE_DISABLED_INDEX = 0;
|
||||
@VisibleForTesting
|
||||
static final int BTSNOOP_LOG_MODE_FILTERED_INDEX = 1;
|
||||
@VisibleForTesting
|
||||
static final int BTSNOOP_LOG_MODE_FULL_INDEX = 2;
|
||||
@VisibleForTesting
|
||||
static final String BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY = "persist.bluetooth.btsnooplogmode";
|
||||
|
||||
private final String[] mListValues;
|
||||
private final String[] mListEntries;
|
||||
|
||||
public BluetoothSnoopLogPreferenceController(Context context) {
|
||||
super(context);
|
||||
mListValues = context.getResources().getStringArray(R.array.bt_hci_snoop_log_values);
|
||||
mListEntries = context.getResources().getStringArray(R.array.bt_hci_snoop_log_entries);
|
||||
}
|
||||
|
||||
// Default mode is FILTERED on userdebug/eng build, DISABLED on user build,
|
||||
// or can be changed by modifying the global setting.
|
||||
public int getDefaultModeIndex() {
|
||||
if (!Build.IS_DEBUGGABLE) {
|
||||
return BTSNOOP_LOG_MODE_DISABLED_INDEX;
|
||||
}
|
||||
|
||||
final String default_mode = Settings.Global.getString(mContext.getContentResolver(),
|
||||
Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE);
|
||||
|
||||
for (int i = 0; i < mListValues.length; i++) {
|
||||
if (TextUtils.equals(default_mode, mListValues[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return BTSNOOP_LOG_MODE_FILTERED_INDEX;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,23 +81,32 @@ public class BluetoothSnoopLogPreferenceController extends DeveloperOptionsPrefe
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final boolean enableBtSnoopLog = (Boolean) newValue;
|
||||
SystemProperties.set(BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, Boolean.toString(enableBtSnoopLog));
|
||||
SystemProperties.set(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, newValue.toString());
|
||||
updateState(mPreference);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
final boolean enableBtSnoopLog = SystemProperties.getBoolean(
|
||||
BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, false /* def */);
|
||||
((SwitchPreference) mPreference).setChecked(enableBtSnoopLog);
|
||||
final ListPreference listPreference = (ListPreference) preference;
|
||||
final String currentValue = SystemProperties.get(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY);
|
||||
|
||||
int index = getDefaultModeIndex();
|
||||
for (int i = 0; i < mListValues.length; i++) {
|
||||
if (TextUtils.equals(currentValue, mListValues[i])) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
listPreference.setValue(mListValues[index]);
|
||||
listPreference.setSummary(mListEntries[index]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
SystemProperties.set(BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, Boolean.toString(false));
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
SystemProperties.set(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, null);
|
||||
((ListPreference) mPreference).setValue(mListValues[getDefaultModeIndex()]);
|
||||
((ListPreference) mPreference).setSummary(mListEntries[getDefaultModeIndex()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ import com.android.settings.core.InstrumentedFragment;
|
||||
import com.android.settings.notification.RedactionInterstitial;
|
||||
|
||||
import com.google.android.collect.Lists;
|
||||
import com.google.android.setupcompat.item.FooterButton;
|
||||
import com.google.android.setupcompat.template.ButtonFooterMixin;
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -171,7 +173,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
}
|
||||
|
||||
public static class ChooseLockPatternFragment extends InstrumentedFragment
|
||||
implements View.OnClickListener, SaveAndFinishWorker.Listener {
|
||||
implements SaveAndFinishWorker.Listener {
|
||||
|
||||
public static final int CONFIRM_EXISTING_REQUEST = 55;
|
||||
|
||||
@@ -193,8 +195,8 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
protected TextView mMessageText;
|
||||
protected LockPatternView mLockPatternView;
|
||||
protected TextView mFooterText;
|
||||
private TextView mFooterLeftButton;
|
||||
private TextView mFooterRightButton;
|
||||
protected FooterButton mSkipOrClearButton;
|
||||
private FooterButton mNextButton;
|
||||
protected List<LockPatternView.Cell> mChosenPattern = null;
|
||||
private ColorStateList mDefaultHeaderColorList;
|
||||
|
||||
@@ -232,11 +234,11 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
}
|
||||
|
||||
protected void setRightButtonEnabled(boolean enabled) {
|
||||
mFooterRightButton.setEnabled(enabled);
|
||||
mNextButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
protected void setRightButtonText(int text) {
|
||||
mFooterRightButton.setText(text);
|
||||
mNextButton.setText(getActivity(), text);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,8 +289,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
mHeaderText.setTextColor(mDefaultHeaderColorList);
|
||||
}
|
||||
mFooterText.setText("");
|
||||
mFooterLeftButton.setEnabled(false);
|
||||
mFooterRightButton.setEnabled(false);
|
||||
mNextButton.setEnabled(false);
|
||||
|
||||
if (mTitleHeaderScrollView != null) {
|
||||
mTitleHeaderScrollView.post(new Runnable() {
|
||||
@@ -487,6 +488,27 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
layout.setIcon(getActivity().getDrawable(R.drawable.ic_face_header));
|
||||
}
|
||||
}
|
||||
|
||||
final ButtonFooterMixin mixin = layout.getMixin(ButtonFooterMixin.class);
|
||||
mixin.setSecondaryButton(
|
||||
new FooterButton.Builder(getActivity())
|
||||
.setText(R.string.lockpattern_tutorial_cancel_label)
|
||||
.setListener(this::onSkipOrClearButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.OTHER)
|
||||
.setTheme(R.style.SudGlifButton_Secondary)
|
||||
.build()
|
||||
);
|
||||
mixin.setPrimaryButton(
|
||||
new FooterButton.Builder(getActivity())
|
||||
.setText(R.string.lockpattern_tutorial_continue_label)
|
||||
.setListener(this::onNextButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
.build()
|
||||
);
|
||||
mSkipOrClearButton = mixin.getSecondaryButton();
|
||||
mNextButton = mixin.getPrimaryButton();
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@@ -506,15 +528,9 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
|
||||
mFooterText = (TextView) view.findViewById(R.id.footerText);
|
||||
|
||||
mFooterLeftButton = (TextView) view.findViewById(R.id.footerLeftButton);
|
||||
mFooterRightButton = (TextView) view.findViewById(R.id.footerRightButton);
|
||||
|
||||
mTitleHeaderScrollView = (ScrollView) view.findViewById(R.id
|
||||
.scroll_layout_title_header);
|
||||
|
||||
mFooterLeftButton.setOnClickListener(this);
|
||||
mFooterRightButton.setOnClickListener(this);
|
||||
|
||||
// make it so unhandled touch events within the unlock screen go to the
|
||||
// lock pattern view.
|
||||
final LinearLayoutWithDefaultTouchRecepient topLayout
|
||||
@@ -623,12 +639,12 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
if (v == mFooterLeftButton) {
|
||||
handleLeftButton();
|
||||
} else if (v == mFooterRightButton) {
|
||||
handleRightButton();
|
||||
}
|
||||
protected void onSkipOrClearButtonClick(View view) {
|
||||
handleLeftButton();
|
||||
}
|
||||
|
||||
protected void onNextButtonClick(View view) {
|
||||
handleRightButton();
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
@@ -711,7 +727,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
updateFooterLeftButton(stage, mFooterLeftButton);
|
||||
updateFooterLeftButton(stage);
|
||||
|
||||
setRightButtonText(stage.rightMode.text);
|
||||
setRightButtonEnabled(stage.rightMode.enabled);
|
||||
@@ -761,13 +777,13 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateFooterLeftButton(Stage stage, TextView footerLeftButton) {
|
||||
protected void updateFooterLeftButton(Stage stage) {
|
||||
if (stage.leftMode == LeftButtonMode.Gone) {
|
||||
footerLeftButton.setVisibility(View.GONE);
|
||||
mSkipOrClearButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
footerLeftButton.setVisibility(View.VISIBLE);
|
||||
footerLeftButton.setText(stage.leftMode.text);
|
||||
footerLeftButton.setEnabled(stage.leftMode.enabled);
|
||||
mSkipOrClearButton.setVisibility(View.VISIBLE);
|
||||
mSkipOrClearButton.setText(getActivity(), stage.leftMode.text);
|
||||
mSkipOrClearButton.setEnabled(stage.leftMode.enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
|
||||
|
||||
@Nullable
|
||||
private Button mOptionsButton;
|
||||
private Button mSkipButton;
|
||||
private boolean mLeftButtonIsSkip;
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
@@ -72,14 +72,20 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
|
||||
.show(getChildFragmentManager(), null));
|
||||
}
|
||||
// Show the skip button during SUW but not during Settings > Biometric Enrollment
|
||||
mSkipButton = view.findViewById(R.id.skip_button);
|
||||
mSkipButton.setOnClickListener(v -> {
|
||||
mSkipOrClearButton.setOnClickListener(this::onSkipOrClearButtonClick);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSkipOrClearButtonClick(View view) {
|
||||
if (mLeftButtonIsSkip) {
|
||||
SetupSkipDialog dialog = SetupSkipDialog.newInstance(
|
||||
getActivity().getIntent()
|
||||
.getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
|
||||
dialog.show(getFragmentManager());
|
||||
});
|
||||
return view;
|
||||
return;
|
||||
}
|
||||
super.onSkipOrClearButtonClick(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,9 +108,11 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
|
||||
}
|
||||
|
||||
if (stage.leftMode == LeftButtonMode.Gone && stage == Stage.Introduction) {
|
||||
mSkipButton.setVisibility(View.VISIBLE);
|
||||
mSkipOrClearButton.setVisibility(View.VISIBLE);
|
||||
mSkipOrClearButton.setText(getActivity(), R.string.skip_label);
|
||||
mLeftButtonIsSkip = true;
|
||||
} else {
|
||||
mSkipButton.setVisibility(View.GONE);
|
||||
mLeftButtonIsSkip = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -442,9 +442,9 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
||||
|
||||
private void updateIpLayerInfo() {
|
||||
mButtonsPref.setButton2Visible(canSignIntoNetwork());
|
||||
mButtonsPref.setButton3Visible(isSharingNetworkEnabled());
|
||||
mButtonsPref.setButton3Visible(canShareNetwork());
|
||||
mButtonsPref.setVisible(
|
||||
canSignIntoNetwork() || canForgetNetwork() || isSharingNetworkEnabled());
|
||||
canSignIntoNetwork() || canForgetNetwork() || canShareNetwork());
|
||||
|
||||
if (mNetwork == null || mLinkProperties == null) {
|
||||
mIpAddressPref.setVisible(false);
|
||||
@@ -532,8 +532,9 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
||||
/**
|
||||
* Returns whether the user can share the network represented by this preference with QR code.
|
||||
*/
|
||||
private boolean isSharingNetworkEnabled() {
|
||||
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.WIFI_SHARING);
|
||||
private boolean canShareNetwork() {
|
||||
return mAccessPoint.getConfig() != null && FeatureFlagUtils.isEnabled(mContext,
|
||||
FeatureFlags.WIFI_SHARING);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,7 @@ public class WifiPrivacyPreferenceController extends BasePreferenceController im
|
||||
final DropDownPreference dropDownPreference = (DropDownPreference) preference;
|
||||
final int randomizationLevel = getRandomizationValue();
|
||||
dropDownPreference.setValue(Integer.toString(randomizationLevel));
|
||||
updateSummary((DropDownPreference) preference, randomizationLevel);
|
||||
updateSummary(dropDownPreference, randomizationLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +85,20 @@ public class WifiPrivacyPreferenceController extends BasePreferenceController im
|
||||
return WifiConfiguration.RANDOMIZATION_PERSISTENT;
|
||||
}
|
||||
|
||||
private final int PREF_RANDOMIZATION_PERSISTENT = 0;
|
||||
private final int PREF_RANDOMIZATION_NONE = 1;
|
||||
@VisibleForTesting
|
||||
protected int translateMacRandomizedValueToPrefValue(int macRandomized) {
|
||||
if (macRandomized == WifiConfiguration.RANDOMIZATION_PERSISTENT) {
|
||||
return PREF_RANDOMIZATION_PERSISTENT;
|
||||
} else {
|
||||
return PREF_RANDOMIZATION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSummary(DropDownPreference preference, int macRandomized) {
|
||||
preference.setSummary(preference.getEntries()[macRandomized]);
|
||||
// Translates value here to set RANDOMIZATION_PERSISTENT as first item in UI for better UX.
|
||||
final int prefMacRandomized = translateMacRandomizedValueToPrefValue(macRandomized);
|
||||
preference.setSummary(preference.getEntries()[prefMacRandomized]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
// Update success UI.
|
||||
mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
|
||||
mSummary.setVisibility(View.INVISIBLE);
|
||||
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
|
||||
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
||||
mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
|
||||
mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
|
||||
@@ -71,6 +72,7 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
// Update fail UI.
|
||||
mTitle.setText(R.string.wifi_dpp_could_not_add_device);
|
||||
mSummary.setVisibility(View.INVISIBLE);
|
||||
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_error);
|
||||
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
||||
mButtonRight.setText(R.string.retry);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,11 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
|
||||
case ACTION_PROCESS_WIFI_DPP_QR_CODE:
|
||||
String qrCode = intent.getStringExtra(WifiDppUtils.EXTRA_QR_CODE);
|
||||
mWifiDppQrCode = getValidWifiDppQrCodeOrNull(qrCode);
|
||||
if (mWifiDppQrCode == null) {
|
||||
final boolean isDppSupported = WifiDppUtils.isWifiDppEnabled(this);
|
||||
if (!isDppSupported) {
|
||||
Log.d(TAG, "Device doesn't support Wifi DPP");
|
||||
}
|
||||
if (mWifiDppQrCode == null || !isDppSupported) {
|
||||
cancelActivity = true;
|
||||
} else {
|
||||
showChooseSavedWifiNetworkFragment(/* addToBackStack */ false);
|
||||
|
||||
@@ -78,6 +78,14 @@ public class WifiDppUtils {
|
||||
com.android.settings.core.FeatureFlags.WIFI_SHARING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the device support WiFi DPP.
|
||||
*/
|
||||
public static boolean isWifiDppEnabled(Context context) {
|
||||
final WifiManager manager = context.getSystemService(WifiManager.class);
|
||||
return manager.isEasyConnectSupported();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an intent to launch QR code scanner for Wi-Fi DPP enrollee.
|
||||
*
|
||||
|
||||
@@ -16,86 +16,123 @@
|
||||
|
||||
package com.android.settings.development;
|
||||
|
||||
import static com.android.settings.development.BluetoothSnoopLogPreferenceController
|
||||
.BLUETOOTH_BTSNOOP_ENABLE_PROPERTY;
|
||||
|
||||
import static com.android.settings.development.BluetoothSnoopLogPreferenceController.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.Spy;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class BluetoothSnoopLogPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private SwitchPreference mPreference;
|
||||
@Spy
|
||||
private Context mSpyContext = RuntimeEnvironment.application;
|
||||
@Spy
|
||||
private Resources mSpyResources = RuntimeEnvironment.application.getResources();
|
||||
private ListPreference mPreference;
|
||||
@Mock
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
private BluetoothSnoopLogPreferenceController mController;
|
||||
|
||||
private CharSequence[] mListValues;
|
||||
private CharSequence[] mListEntries;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mController = new BluetoothSnoopLogPreferenceController(mContext);
|
||||
doReturn(mSpyResources).when(mSpyContext).getResources();
|
||||
// Get XML values without mock
|
||||
// Setup test list preference using XML values
|
||||
mPreference = new ListPreference(mSpyContext);
|
||||
mPreference.setEntries(R.array.bt_hci_snoop_log_entries);
|
||||
mPreference.setEntryValues(R.array.bt_hci_snoop_log_values);
|
||||
// Init the actual controller
|
||||
mController = new BluetoothSnoopLogPreferenceController(mSpyContext);
|
||||
// Construct preference in the controller via a mocked preference screen object
|
||||
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
|
||||
.thenReturn(mPreference);
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
mListValues = mPreference.getEntryValues();
|
||||
mListEntries = mPreference.getEntries();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChanged_turnOnBluetoothSnoopLog() {
|
||||
mController.onPreferenceChange(null, true);
|
||||
public void verifyResourceSizeAndRange() {
|
||||
// Verify normal list entries and default preference entries have the same size
|
||||
assertThat(mListEntries.length).isEqualTo(mListValues.length);
|
||||
// Update the preference
|
||||
mController.updateState(mPreference);
|
||||
// Verify default preference value, entry and summary
|
||||
final int defaultIndex = mController.getDefaultModeIndex();
|
||||
assertThat(mPreference.getValue()).isEqualTo(mListValues[defaultIndex]);
|
||||
assertThat(mPreference.getEntry()).isEqualTo(mListEntries[defaultIndex]);
|
||||
assertThat(mPreference.getSummary()).isEqualTo(mListEntries[defaultIndex]);
|
||||
}
|
||||
|
||||
final boolean mode = SystemProperties.getBoolean(BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, false);
|
||||
@Test
|
||||
public void onPreferenceChanged_turnOnFullBluetoothSnoopLog() {
|
||||
mController.onPreferenceChange(null,
|
||||
mListValues[BluetoothSnoopLogPreferenceController.BTSNOOP_LOG_MODE_FULL_INDEX]);
|
||||
final String mode = SystemProperties.get(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY);
|
||||
// "full" is hard-coded between Settings and system/bt
|
||||
assertThat(mode).isEqualTo("full");
|
||||
}
|
||||
|
||||
assertThat(mode).isTrue();
|
||||
@Test
|
||||
public void onPreferenceChanged_turnOnFilteredBluetoothSnoopLog() {
|
||||
mController.onPreferenceChange(null,
|
||||
mListValues[BluetoothSnoopLogPreferenceController.BTSNOOP_LOG_MODE_FILTERED_INDEX]);
|
||||
final String mode = SystemProperties.get(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY);
|
||||
// "filtered" is hard-coded between Settings and system/bt
|
||||
assertThat(mode).isEqualTo("filtered");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChanged_turnOffBluetoothSnoopLog() {
|
||||
mController.onPreferenceChange(null, false);
|
||||
|
||||
final boolean mode = SystemProperties.getBoolean(BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, false);
|
||||
|
||||
assertThat(mode).isFalse();
|
||||
mController.onPreferenceChange(null,
|
||||
mListValues[BluetoothSnoopLogPreferenceController.BTSNOOP_LOG_MODE_DISABLED_INDEX]);
|
||||
final String mode = SystemProperties.get(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY);
|
||||
// "disabled" is hard-coded between Settings and system/bt
|
||||
assertThat(mode).isEqualTo("disabled");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_preferenceShouldBeChecked() {
|
||||
SystemProperties.set(BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, Boolean.toString(true));
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_preferenceShouldNotBeChecked() {
|
||||
SystemProperties.set(BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, Boolean.toString(false));
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(false);
|
||||
public void updateState_preferenceShouldBeSetToRightValue() {
|
||||
for (int i = 0; i < mListValues.length; ++i) {
|
||||
SystemProperties.set(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, mListValues[i].toString());
|
||||
mController.updateState(mPreference);
|
||||
assertThat(mPreference.getValue()).isEqualTo(mListValues[i].toString());
|
||||
assertThat(mPreference.getSummary()).isEqualTo(mListEntries[i].toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeveloperOptionsDisabled_shouldDisablePreference() {
|
||||
mController.onDeveloperOptionsDisabled();
|
||||
|
||||
verify(mPreference).setEnabled(false);
|
||||
verify(mPreference).setChecked(false);
|
||||
assertThat(mPreference.isEnabled()).isFalse();
|
||||
assertThat(mPreference.getValue()).isEqualTo(
|
||||
mListValues[mController.getDefaultModeIndex()]
|
||||
.toString());
|
||||
assertThat(mPreference.getSummary()).isEqualTo(
|
||||
mListEntries[mController.getDefaultModeIndex()]
|
||||
.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ import com.android.settings.password.ChooseLockPattern.IntentBuilder;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
|
||||
import com.google.android.setupcompat.PartnerCustomizationLayout;
|
||||
import com.google.android.setupcompat.template.ButtonFooterMixin;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -143,11 +146,13 @@ public class SetupChooseLockPatternTest {
|
||||
|
||||
@Test
|
||||
public void skipButton_shouldBeVisible_duringNonFingerprintFlow() {
|
||||
Button skipButton = mActivity.findViewById(R.id.skip_button);
|
||||
assertThat(skipButton).isNotNull();
|
||||
assertThat(skipButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
|
||||
final Button skipOrClearButton =
|
||||
layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
|
||||
assertThat(skipOrClearButton).isNotNull();
|
||||
assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
|
||||
skipButton.performClick();
|
||||
skipOrClearButton.performClick();
|
||||
AlertDialog chooserDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
||||
assertThat(chooserDialog).isNotNull();
|
||||
}
|
||||
@@ -156,26 +161,33 @@ public class SetupChooseLockPatternTest {
|
||||
public void clearButton_shouldBeVisible_duringRetryStage() {
|
||||
enterPattern();
|
||||
|
||||
Button clearButton = mActivity.findViewById(R.id.footerLeftButton);
|
||||
assertThat(clearButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(clearButton.isEnabled()).isTrue();
|
||||
PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
|
||||
final Button skipOrClearButton =
|
||||
layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
|
||||
assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(skipOrClearButton.isEnabled()).isTrue();
|
||||
|
||||
clearButton.performClick();
|
||||
skipOrClearButton.performClick();
|
||||
assertThat(findFragment(mActivity).mChosenPattern).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createActivity_enterPattern_clearButtonShouldBeVisible() {
|
||||
public void createActivity_enterPattern_clearButtonShouldBeShown() {
|
||||
ChooseLockPatternFragment fragment = findFragment(mActivity);
|
||||
|
||||
Button skipButton = mActivity.findViewById(R.id.skip_button);
|
||||
Button clearButton = mActivity.findViewById(R.id.footerLeftButton);
|
||||
assertThat(skipButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(clearButton.getVisibility()).isEqualTo(View.GONE);
|
||||
PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
|
||||
final Button skipOrClearButton =
|
||||
layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView();
|
||||
assertThat(skipOrClearButton.isEnabled()).isTrue();
|
||||
assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(skipOrClearButton.getText())
|
||||
.isEqualTo(application.getString(R.string.skip_label));
|
||||
|
||||
enterPattern();
|
||||
assertThat(skipButton.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(clearButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(skipOrClearButton.isEnabled()).isTrue();
|
||||
assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(skipOrClearButton.getText())
|
||||
.isEqualTo(application.getString(R.string.lockpattern_retry_button_text));
|
||||
}
|
||||
|
||||
private ChooseLockPatternFragment findFragment(FragmentActivity activity) {
|
||||
|
||||
@@ -685,6 +685,15 @@ public class WifiDetailPreferenceControllerTest {
|
||||
verify(mockButtonsPref).setButton1Visible(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canShareNetwork_noNetwork() {
|
||||
when(mockAccessPoint.getConfig()).thenReturn(null);
|
||||
|
||||
displayAndResume();
|
||||
|
||||
verify(mockButtonsPref).setButton3Visible(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canModifyNetwork_saved() {
|
||||
assertThat(mController.canModifyNetwork()).isTrue();
|
||||
|
||||
@@ -70,8 +70,9 @@ public class WifiPrivacyPreferenceControllerTest {
|
||||
|
||||
mPreferenceController.updateState(mDropDownPreference);
|
||||
|
||||
|
||||
assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[PRIVACY_TRUSTED]);
|
||||
int prefValue = mPreferenceController.translateMacRandomizedValueToPrefValue(
|
||||
PRIVACY_TRUSTED);
|
||||
assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[prefValue]);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,7 +81,9 @@ public class WifiPrivacyPreferenceControllerTest {
|
||||
|
||||
mPreferenceController.updateState(mDropDownPreference);
|
||||
|
||||
assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[PRIVACY_RANDOMIZED]);
|
||||
int prefValue = mPreferenceController.translateMacRandomizedValueToPrefValue(
|
||||
PRIVACY_RANDOMIZED);
|
||||
assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[prefValue]);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user