Merge changes from topic "tc_change_22110621_19"
* changes:
[automerged blank] Import translations. DO NOT MERGE ANYWHERE 2p: 0075b291c2
Import translations. DO NOT MERGE ANYWHERE
diff --git a/res/layout/homepage_preference.xml b/res/layout/homepage_preference.xml
index ed1a2f1..18ecdcf 100644
--- a/res/layout/homepage_preference.xml
+++ b/res/layout/homepage_preference.xml
@@ -39,8 +39,8 @@
<androidx.preference.internal.PreferenceImageView
android:id="@android:id/icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
app:maxWidth="48dp"
app:maxHeight="48dp"/>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e2acc38..10430d5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5182,8 +5182,8 @@
<string name="advanced_battery_preference_title">Battery usage</string>
<!-- Preference summary for advanced battery usage, for past 24 hours [CHAR LIMIT=40] -->
<string name="advanced_battery_preference_summary_with_hours">View usage for past 24 hours</string>
- <!-- Preference summary for advanced battery usage, from last full charge [CHAR LIMIT=40] -->
- <string name="advanced_battery_preference_summary">View usage from last full charge</string>
+ <!-- Preference summary for advanced battery usage, since last full charge [CHAR LIMIT=40] -->
+ <string name="advanced_battery_preference_summary">View usage since last full charge</string>
<!-- Activity title for battery usage details for an app. or power consumer -->
<string name="battery_details_title">App battery usage</string>
@@ -5384,50 +5384,50 @@
<!-- Title for battery usage amount by this app. [CHAR LIMIT=80] -->
<string name="battery_detail_power_usage">Battery usage</string>
- <!-- Description for battery total and background usage time for an app, i.e. 1 hr 15 min total • 39 min background from last full charge. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
- <string name="battery_total_and_bg_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • <xliff:g id="time" example="39 min">^2</xliff:g> background\nfrom last full charge</string>
+ <!-- Description for battery total and background usage time for an app, i.e. 1 hr 15 min total • 39 min background since last full charge. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
+ <string name="battery_total_and_bg_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • <xliff:g id="time" example="39 min">^2</xliff:g> background\nsince last full charge</string>
<!-- Description for battery total and background usage time for an app, i.e. 1 hr 15 min total • 39 min background for past 24 hr. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_total_and_bg_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • <xliff:g id="time" example="39 min">^2</xliff:g> background\nfor past 24 hr</string>
<!-- Description for battery total and background usage time in a time period for an app, i.e. 1 hr 15 min total • 39 min background for 12 am-2 am. Note: ^1, ^2 and ^3 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_total_and_bg_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • <xliff:g id="time" example="39 min">^2</xliff:g> background\nfor <xliff:g id="time_period" example="12 am-2 am">^3</xliff:g></string>
- <!-- Description for battery total usage time is less than a minute for an app from last full charge [CHAR LIMIT=120] -->
- <string name="battery_total_usage_less_minute">Total less than a minute from last full charge</string>
+ <!-- Description for battery total usage time is less than a minute for an app since last full charge [CHAR LIMIT=120] -->
+ <string name="battery_total_usage_less_minute">Total less than a minute since last full charge</string>
<!-- Description for battery total usage time is less than a minute for an app for past 24 hr [CHAR LIMIT=120] -->
<string name="battery_total_usage_less_minute_24hr">Total less than a minute for past 24 hr</string>
<!-- Description for battery total usage time is less than a minute in a time period for an app, i.e. Total less than a minute for 12 am-2 am. Note: ^1 should be used in all translations[CHAR LIMIT=120] -->
<string name="battery_total_usage_less_minute_with_period">Total less than a minute for <xliff:g id="time_period" example="12 am-2 am">^1</xliff:g></string>
- <!-- Description for battery background usage time is less than a minute for an app from last full charge [CHAR LIMIT=120] -->
- <string name="battery_bg_usage_less_minute">Background less than a minute from last full charge</string>
+ <!-- Description for battery background usage time is less than a minute for an app since last full charge [CHAR LIMIT=120] -->
+ <string name="battery_bg_usage_less_minute">Background less than a minute since last full charge</string>
<!-- Description for battery background usage time is less than a minute for an app for past 24 hr [CHAR LIMIT=120] -->
<string name="battery_bg_usage_less_minute_24hr">Background less than a minute for past 24 hr</string>
<!-- Description for battery background usage time is less than a minute in a time period for an app, i.e. Background less than a minute for 12 am-2 am. Note: ^1 should be used in all translations[CHAR LIMIT=120] -->
<string name="battery_bg_usage_less_minute_with_period">Background less than a minute for <xliff:g id="time_period" example="12 am-2 am">^1</xliff:g></string>
- <!-- Description for battery total usage time for an app, i.e. 1 hr 15 min total from last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
- <string name="battery_total_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total from last full charge</string>
+ <!-- Description for battery total usage time for an app, i.e. 1 hr 15 min total since last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
+ <string name="battery_total_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total since last full charge</string>
<!-- Description for battery total usage time for an app, i.e. 1 hr 15 min total for past 24 hr. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_total_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total for past 24 hr</string>
<!-- Description for battery total usage time in a time period for an app, i.e. 1 hr 15 min total for 12 am-2 am. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_total_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total for <xliff:g id="time_period" example="12 am-2 am">^2</xliff:g></string>
- <!-- Description for battery background usage time for an app, i.e. 1 hr 15 min background from last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
- <string name="battery_bg_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> background from last full charge</string>
+ <!-- Description for battery background usage time for an app, i.e. 1 hr 15 min background since last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
+ <string name="battery_bg_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> background since last full charge</string>
<!-- Description for battery background usage time for an app, i.e. 1 hr 15 min background for past 24 hr. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_bg_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> background for past 24 hr</string>
<!-- Description for battery background usage time in a time period for an app, i.e. 1 hr 15 min background for 12 am-2 am. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_bg_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> background for <xliff:g id="time_period" example="12 am-2 am">^2</xliff:g></string>
- <!-- Description for battery total usage with background usage time less than a minute for an app, i.e. 1 hr 15 min total • background less than a minute from last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
- <string name="battery_total_usage_and_bg_less_minute_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • background less than a minute\nfrom last full charge</string>
+ <!-- Description for battery total usage with background usage time less than a minute for an app, i.e. 1 hr 15 min total • background less than a minute since last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
+ <string name="battery_total_usage_and_bg_less_minute_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • background less than a minute\nsince last full charge</string>
<!-- Description for battery total usage with background usage time less than a minute for an app, i.e. 1 hr 15 min total • background less than a minute for past 24 hr. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_total_usage_and_bg_less_minute_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • background less than a minute\nfor past 24 hr</string>
<!-- Description for battery total usage with background usage time less than a minute in a time period for an app, i.e. 1 hr 15 min total • background less than a minute for 12 am-2 am. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
<string name="battery_total_usage_and_bg_less_minute_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • background less than a minute\nfor <xliff:g id="time_period" example="12 am-2 am">^2</xliff:g></string>
- <!-- Description for no any battery usage from last full charge [CHAR LIMIT=120] -->
- <string name="battery_not_usage">No usage from last full charge</string>
+ <!-- Description for no any battery usage since last full charge [CHAR LIMIT=120] -->
+ <string name="battery_not_usage">No usage since last full charge</string>
<!-- Description for no any battery usage for past 24 hr [CHAR LIMIT=120] -->
<string name="battery_not_usage_24hr">No usage for past 24 hr</string>
<!-- Description for no usage time but have battery usage [CHAR LIMIT=120] -->
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java
index 71cdcf7..18db774 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java
@@ -78,7 +78,9 @@
* Returns the class name of the Settings page corresponding to fingerprint settings.
*/
public String getSettingsClassName() {
- return FingerprintSettings.class.getName();
+ return !hasEnrolled() && isAvailable()
+ ? FingerprintEnrollIntroductionInternal.class.getName()
+ : FingerprintSettings.class.getName();
}
/**
diff --git a/src/com/android/settings/bluetooth/Utils.java b/src/com/android/settings/bluetooth/Utils.java
index 24fe4e1..9aa363a 100644
--- a/src/com/android/settings/bluetooth/Utils.java
+++ b/src/com/android/settings/bluetooth/Utils.java
@@ -203,7 +203,7 @@
public static String findBluetoothPackageName(Context context)
throws NameNotFoundException {
// this activity will always be in the package where the rest of Bluetooth lives
- String sentinelActivity = "com.android.bluetooth.opp.BluetoothOppLauncherActivity";
+ final String sentinelActivity = "com.android.bluetooth.opp.BluetoothOppLauncherActivity";
PackageManager packageManager = context.createContextAsUser(UserHandle.SYSTEM, 0)
.getPackageManager();
String[] allPackages = packageManager.getPackagesForUid(BLUETOOTH_UID);
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index 80c9ec6..f6dd0b7 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
@@ -382,10 +382,8 @@
// Icon provided by the content provider overrides any static icon.
if (tile.getMetaData() != null
&& tile.getMetaData().containsKey(META_DATA_PREFERENCE_ICON_URI)) {
- // Set a transparent color before starting to fetch the real icon, this is necessary
- // to avoid preference padding change.
- setPreferenceIcon(preference, tile, forceRoundedIcon, mContext.getPackageName(),
- Icon.createWithResource(mContext, android.R.color.transparent));
+ // Reserve the icon space to avoid preference padding change.
+ preference.setIconSpaceReserved(true);
ThreadUtils.postOnBackgroundThread(() -> {
final Intent intent = tile.getIntent();
diff --git a/src/com/android/settings/development/BluetoothMaxConnectedAudioDevicesPreferenceController.java b/src/com/android/settings/development/BluetoothMaxConnectedAudioDevicesPreferenceController.java
index f1677f2..a1467c8 100644
--- a/src/com/android/settings/development/BluetoothMaxConnectedAudioDevicesPreferenceController.java
+++ b/src/com/android/settings/development/BluetoothMaxConnectedAudioDevicesPreferenceController.java
@@ -41,15 +41,13 @@
private int mDefaultMaxConnectedAudioDevices = 0;
- private final BluetoothManager mBluetoothManager;
-
public BluetoothMaxConnectedAudioDevicesPreferenceController(Context context) {
super(context);
- mBluetoothManager = context.getSystemService(BluetoothManager.class);
+ final BluetoothManager bluetoothManager = context.getSystemService(BluetoothManager.class);
mDefaultMaxConnectedAudioDevices =
- mBluetoothManager.getAdapter().getMaxConnectedAudioDevices();
+ bluetoothManager.getAdapter().getMaxConnectedAudioDevices();
}
@Override
diff --git a/src/com/android/settings/network/NetworkProviderSettings.java b/src/com/android/settings/network/NetworkProviderSettings.java
index 19ebd36..b622a3c 100644
--- a/src/com/android/settings/network/NetworkProviderSettings.java
+++ b/src/com/android/settings/network/NetworkProviderSettings.java
@@ -212,6 +212,8 @@
protected boolean mIsRestricted;
@VisibleForTesting
boolean mIsAdmin = true;
+ @VisibleForTesting
+ boolean mIsGuest = false;
@VisibleForTesting
AirplaneModeEnabler mAirplaneModeEnabler;
@@ -302,13 +304,14 @@
addPreferences();
mIsRestricted = isUiRestricted();
- mIsAdmin = isAdminUser();
+ updateUserType();
}
- private boolean isAdminUser() {
- final UserManager userManager = getSystemService(UserManager.class);
- if (userManager == null) return true;
- return userManager.isAdminUser();
+ private void updateUserType() {
+ UserManager userManager = getSystemService(UserManager.class);
+ if (userManager == null) return;
+ mIsAdmin = userManager.isAdminUser();
+ mIsGuest = userManager.isGuestUser();
}
private void addPreferences() {
@@ -1400,7 +1403,7 @@
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- if (!mAirplaneModeEnabler.isAirplaneModeOn()) {
+ if (!mIsGuest && !mAirplaneModeEnabler.isAirplaneModeOn()) {
MenuItem item = menu.add(0, MENU_FIX_CONNECTIVITY, 0, R.string.fix_connectivity);
item.setIcon(R.drawable.ic_repair_24dp);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
@@ -1447,6 +1450,11 @@
}
private void fixConnectivity() {
+ if (mIsGuest) {
+ Log.e(TAG, "Can't reset network because the user is a guest.");
+ EventLog.writeEvent(0x534e4554, "252995826", UserHandle.myUserId(), "User is a guest");
+ return;
+ }
if (mInternetResetHelper == null) {
mInternetResetHelper = new InternetResetHelper(getContext(), getLifecycle());
mInternetResetHelper.setResettingPreference(mResetInternetPreference);
diff --git a/src/com/android/settings/users/MultiUserSwitchBarController.java b/src/com/android/settings/users/MultiUserSwitchBarController.java
index 58de149..33651c3 100644
--- a/src/com/android/settings/users/MultiUserSwitchBarController.java
+++ b/src/com/android/settings/users/MultiUserSwitchBarController.java
@@ -57,6 +57,11 @@
mSwitchBar.setDisabledByAdmin(RestrictedLockUtilsInternal
.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_USER_SWITCH,
UserHandle.myUserId()));
+
+ } else if (mUserCapabilities.mDisallowAddUser) {
+ mSwitchBar.setDisabledByAdmin(RestrictedLockUtilsInternal
+ .checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_ADD_USER,
+ UserHandle.myUserId()));
} else {
mSwitchBar.setEnabled(!mUserCapabilities.mDisallowSwitchUser
&& !mUserCapabilities.mIsGuest && mUserCapabilities.isAdmin());
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index cb778c9..5f9f2fe 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -1489,7 +1489,7 @@
private void updateAddUserCommon(Context context, RestrictedPreference addUser,
boolean canAddRestrictedProfile) {
- if ((mUserCaps.mCanAddUser || mUserCaps.mDisallowAddUserSetByAdmin)
+ if ((mUserCaps.mCanAddUser || !mUserCaps.mDisallowAddUserSetByAdmin)
&& WizardManagerHelper.isDeviceProvisioned(context)
&& mUserCaps.mUserSwitcherEnabled) {
addUser.setVisible(true);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
index c3dd4f4..683313a 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
@@ -313,7 +313,7 @@
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
verify(mEntityHeaderController).setSummary(captor.capture());
assertThat(captor.getValue().toString())
- .isEqualTo("2 min background from last full charge");
+ .isEqualTo("2 min background since last full charge");
}
@Test
@@ -331,7 +331,7 @@
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
verify(mEntityHeaderController).setSummary(captor.capture());
assertThat(captor.getValue().toString())
- .isEqualTo("Background less than a minute from last full charge");
+ .isEqualTo("Background less than a minute since last full charge");
}
@Test
@@ -350,7 +350,7 @@
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
verify(mEntityHeaderController).setSummary(captor.capture());
assertThat(captor.getValue().toString())
- .isEqualTo("Total less than a minute from last full charge");
+ .isEqualTo("Total less than a minute since last full charge");
}
@Test
@@ -366,8 +366,8 @@
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
verify(mEntityHeaderController).setSummary(captor.capture());
- assertThat(captor.getValue().toString())
- .isEqualTo("1 min total • background less than a minute\nfrom last full charge");
+ assertThat(captor.getValue().toString()).isEqualTo(
+ "1 min total • background less than a minute\nsince last full charge");
}
@Test
@@ -384,7 +384,7 @@
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
verify(mEntityHeaderController).setSummary(captor.capture());
assertThat(captor.getValue().toString())
- .isEqualTo("1 min total from last full charge");
+ .isEqualTo("1 min total since last full charge");
}
@Test
@@ -401,7 +401,7 @@
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
verify(mEntityHeaderController).setSummary(captor.capture());
assertThat(captor.getValue().toString())
- .isEqualTo("6 min total • 4 min background\nfrom last full charge");
+ .isEqualTo("6 min total • 4 min background\nsince last full charge");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryTest.java
index 5cd6db0..e134490 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryTest.java
@@ -140,7 +140,7 @@
public void initPreference_hasCorrectSummary() {
mFragment.initPreference();
- verify(mBatteryUsagePreference).setSummary("View usage from last full charge");
+ verify(mBatteryUsagePreference).setSummary("View usage since last full charge");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
index b347ac0..5573ca3 100644
--- a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
@@ -15,6 +15,7 @@
*/
package com.android.settings.network;
+import static com.android.settings.network.NetworkProviderSettings.MENU_FIX_CONNECTIVITY;
import static com.android.settings.network.NetworkProviderSettings.MENU_ID_DISCONNECT;
import static com.android.settings.network.NetworkProviderSettings.MENU_ID_FORGET;
import static com.android.settings.network.NetworkProviderSettings.MENU_ID_MODIFY;
@@ -135,6 +136,8 @@
@Mock
private ContextMenu mContextMenu;
@Mock
+ private Menu mMenu;
+ @Mock
private MenuItem mMenuItem;
@Mock
InternetUpdater mInternetUpdater;
@@ -147,6 +150,8 @@
@Before
public void setUp() {
+ when(mMenu.add(anyInt(), anyInt(), anyInt(), anyInt())).thenReturn(mMenuItem);
+
mNetworkProviderSettings = spy(new NetworkProviderSettings() {
@Override
boolean showAnySubscriptionInfo(Context context) { return true; }
@@ -483,24 +488,39 @@
}
@Test
- public void onCreateOptionsMenu_airplanModeOn_fixConnectivityMenuInvisible() {
- doReturn(true).when(mAirplaneModeEnabler).isAirplaneModeOn();
- final Menu menu = mock(Menu.class);
- mNetworkProviderSettings.onCreateOptionsMenu(menu, null /* inflater */);
+ public void onCreateOptionsMenu_isGuest_neverAddFixConnectivityMenu() {
+ mNetworkProviderSettings.mIsGuest = true;
- verify(menu, never()).add(anyInt(), eq(NetworkProviderSettings.MENU_FIX_CONNECTIVITY),
- anyInt(), eq(R.string.fix_connectivity));
+ mNetworkProviderSettings.onCreateOptionsMenu(mMenu, null /* inflater */);
+
+ verify(mMenu, never()).add(anyInt(), eq(MENU_FIX_CONNECTIVITY), anyInt(), anyInt());
}
@Test
- public void onCreateOptionsMenu_airplanModeOff_fixConnectivityMenuVisible() {
- doReturn(false).when(mAirplaneModeEnabler).isAirplaneModeOn();
- final Menu menu = mock(Menu.class);
- when(menu.add(anyInt(), anyInt(), anyInt(), anyInt())).thenReturn(mock(MenuItem.class));
- mNetworkProviderSettings.onCreateOptionsMenu(menu, null /* inflater */);
+ public void onCreateOptionsMenu_isNotGuest_addFixConnectivityMenu() {
+ mNetworkProviderSettings.mIsGuest = false;
- verify(menu).add(anyInt(), eq(NetworkProviderSettings.MENU_FIX_CONNECTIVITY),
- anyInt(), eq(R.string.fix_connectivity));
+ mNetworkProviderSettings.onCreateOptionsMenu(mMenu, null /* inflater */);
+
+ verify(mMenu).add(anyInt(), eq(MENU_FIX_CONNECTIVITY), anyInt(), anyInt());
+ }
+
+ @Test
+ public void onCreateOptionsMenu_isAirplaneModeOn_neverAddFixConnectivityMenu() {
+ doReturn(true).when(mAirplaneModeEnabler).isAirplaneModeOn();
+
+ mNetworkProviderSettings.onCreateOptionsMenu(mMenu, null /* inflater */);
+
+ verify(mMenu, never()).add(anyInt(), eq(MENU_FIX_CONNECTIVITY), anyInt(), anyInt());
+ }
+
+ @Test
+ public void onCreateOptionsMenu_isNotAirplaneModeOn_addFixConnectivityMenu() {
+ doReturn(false).when(mAirplaneModeEnabler).isAirplaneModeOn();
+
+ mNetworkProviderSettings.onCreateOptionsMenu(mMenu, null /* inflater */);
+
+ verify(mMenu).add(anyInt(), eq(MENU_FIX_CONNECTIVITY), anyInt(), anyInt());
}
@Test
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index ddbcea1..54f579c 100644
--- a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
@@ -402,7 +402,7 @@
}
@Test
- public void updateUserList_addUserDisallowedByAdmin_shouldShowDisabledAddUser() {
+ public void updateUserList_addUserDisallowedByAdmin_shouldNotShowAddUser() {
RestrictedLockUtils.EnforcedAdmin enforcedAdmin = mock(
RestrictedLockUtils.EnforcedAdmin.class);
mUserCapabilities.mEnforcedAdmin = enforcedAdmin;
@@ -413,20 +413,16 @@
mFragment.updateUserList();
- verify(mAddUserPreference).setVisible(true);
- ArgumentCaptor<RestrictedLockUtils.EnforcedAdmin> captor = ArgumentCaptor.forClass(
- RestrictedLockUtils.EnforcedAdmin.class);
- verify(mAddUserPreference).setDisabledByAdmin(captor.capture());
- assertThat(captor.getValue()).isEqualTo(enforcedAdmin);
+ verify(mAddUserPreference).setVisible(false);
}
@Test
- public void updateUserList_cannotAddUserButCanSwitchUser_shouldNotShowAddUser() {
+ public void updateUserList_cannotAddUserButCanSwitchUser_shouldShowDisabledAddUser() {
mUserCapabilities.mCanAddUser = false;
mFragment.updateUserList();
- verify(mAddUserPreference).setVisible(false);
+ verify(mAddUserPreference).setEnabled(false);
}
@Test
diff --git a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java
index 69e5e2f..a5d74a0 100644
--- a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java
+++ b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java
@@ -179,8 +179,20 @@
}
@Test
- public void getSettingsClassName_whenNotEnrolled_returnsFingerprintSettings() {
+ public void getSettingsClassName_whenNotEnrolled_fingerprintOnly_returnsFingerprintEnrollInduction() {
when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(false);
+ when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+ when(mFaceManager.isHardwareDetected()).thenReturn(false);
+
+ assertThat(mFingerprintStatusUtils.getSettingsClassName())
+ .isEqualTo(FingerprintEnrollIntroductionInternal.class.getName());
+ }
+
+ @Test
+ public void getSettingsClassName_whenNotEnrolled_fingerprintNotOnly_returnsFingerprintSettings() {
+ when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(false);
+ when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+ when(mFaceManager.isHardwareDetected()).thenReturn(true);
assertThat(mFingerprintStatusUtils.getSettingsClassName())
.isEqualTo(FingerprintSettings.class.getName());