Snap for 10449897 from bee02bbbe7 to udc-qpr1-release

Change-Id: I3bd95cca0c8258d8e0cee4cf96d25842db93b222
This commit is contained in:
Android Build Coastguard Worker
2023-07-06 23:20:05 +00:00
6 changed files with 40 additions and 82 deletions

View File

@@ -3493,18 +3493,18 @@
<!-- Checkbox label to set password as new screen lock if remote device credential validation succeeds. [CHAR LIMIT=43] --> <!-- Checkbox label to set password as new screen lock if remote device credential validation succeeds. [CHAR LIMIT=43] -->
<string name="lockpassword_remote_validation_set_password_as_screenlock">Also use password to unlock this device</string> <string name="lockpassword_remote_validation_set_password_as_screenlock">Also use password to unlock this device</string>
<!-- Header shown when pattern needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string --> <!-- Header shown when pattern needs to be solved before the device exits repair mode. [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_repair_mode_pattern_header">Verify pattern</string> <string name="lockpassword_confirm_repair_mode_pattern_header">Verify pattern</string>
<!-- Header shown when the pin needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string --> <!-- Header shown when the pin needs to be solved before the device exits repair mode. [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_repair_mode_pin_header">Verify PIN</string> <string name="lockpassword_confirm_repair_mode_pin_header">Verify PIN</string>
<!-- Header shown when the password needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string --> <!-- Header shown when the password needs to be solved before the device exits repair mode. [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_repair_mode_password_header">Verify password</string> <string name="lockpassword_confirm_repair_mode_password_header">Verify password</string>
<!-- An explanation text that the pattern needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string --> <!-- An explanation text that the pattern needs to be solved before the device exits repair mode. [CHAR LIMIT=100] -->
<string name="lockpassword_confirm_repair_mode_pattern_details" translatable="false">Enter your device pattern enrolled in normal mode to continue</string> <string name="lockpassword_confirm_repair_mode_pattern_details">Use your device pattern to continue</string>
<!-- An explanation text that the PIN needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string --> <!-- An explanation text that the PIN needs to be solved before the device exits repair mode. [CHAR LIMIT=100] -->
<string name="lockpassword_confirm_repair_mode_pin_details" translatable="false">Enter your device PIN enrolled in normal mode to continue</string> <string name="lockpassword_confirm_repair_mode_pin_details">Enter your device PIN to continue</string>
<!-- An explanation text that the password needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string --> <!-- An explanation text that the password needs to be solved before the device exits repair mode. [CHAR LIMIT=100] -->
<string name="lockpassword_confirm_repair_mode_password_details" translatable="false">Enter your device password enrolled in normal mode to continue</string> <string name="lockpassword_confirm_repair_mode_password_details">Enter your device password to continue</string>
<!-- Security & location settings screen, change security method screen instruction if user <!-- Security & location settings screen, change security method screen instruction if user
enters incorrect PIN [CHAR LIMIT=30] --> enters incorrect PIN [CHAR LIMIT=30] -->

View File

@@ -1101,9 +1101,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
} }
} }
@SuppressWarnings("MissingSuperCall") // TODO: Fix me
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
maybeHideSfpsText(newConfig); maybeHideSfpsText(newConfig);
switch(newConfig.orientation) { switch(newConfig.orientation) {
case Configuration.ORIENTATION_LANDSCAPE: { case Configuration.ORIENTATION_LANDSCAPE: {

View File

@@ -34,14 +34,11 @@ public class GuestTelephonyPreferenceController extends TogglePreferenceControll
private final UserManager mUserManager; private final UserManager mUserManager;
private final UserCapabilities mUserCaps; private final UserCapabilities mUserCaps;
private Bundle mDefaultGuestRestrictions;
public GuestTelephonyPreferenceController(Context context, String preferenceKey) { public GuestTelephonyPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey); super(context, preferenceKey);
mUserManager = context.getSystemService(UserManager.class); mUserManager = context.getSystemService(UserManager.class);
mUserCaps = UserCapabilities.create(context); mUserCaps = UserCapabilities.create(context);
mDefaultGuestRestrictions = mUserManager.getDefaultGuestRestrictions();
mDefaultGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
} }
@Override @Override
@@ -55,13 +52,16 @@ public class GuestTelephonyPreferenceController extends TogglePreferenceControll
@Override @Override
public boolean isChecked() { public boolean isChecked() {
return !mDefaultGuestRestrictions.getBoolean(UserManager.DISALLOW_OUTGOING_CALLS, false); return !mUserManager.getDefaultGuestRestrictions()
.getBoolean(UserManager.DISALLOW_OUTGOING_CALLS, false);
} }
@Override @Override
public boolean setChecked(boolean isChecked) { public boolean setChecked(boolean isChecked) {
mDefaultGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, !isChecked); Bundle guestRestrictions = mUserManager.getDefaultGuestRestrictions();
mUserManager.setDefaultGuestRestrictions(mDefaultGuestRestrictions); guestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
guestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, !isChecked);
mUserManager.setDefaultGuestRestrictions(guestRestrictions);
return true; return true;
} }
@@ -74,7 +74,7 @@ public class GuestTelephonyPreferenceController extends TogglePreferenceControll
public void updateState(Preference preference) { public void updateState(Preference preference) {
super.updateState(preference); super.updateState(preference);
mUserCaps.updateAddUserCapabilities(mContext); mUserCaps.updateAddUserCapabilities(mContext);
preference.setVisible(isAvailable() && mUserCaps.mUserSwitcherEnabled && mContext preference.setVisible(isAvailable() && mUserCaps.mUserSwitcherEnabled
.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)); && mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY));
} }
} }

View File

@@ -637,29 +637,23 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
} }
private void refreshTxSpeed() { private void refreshTxSpeed() {
if (mWifiInfo == null String summary = mWifiEntry.getTxSpeedString();
|| mWifiEntry.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED) { if (TextUtils.isEmpty(summary)) {
mTxLinkSpeedPref.setVisible(false); mTxLinkSpeedPref.setVisible(false);
return; return;
} }
mTxLinkSpeedPref.setVisible(true);
int txLinkSpeedMbps = mWifiInfo.getTxLinkSpeedMbps(); mTxLinkSpeedPref.setSummary(summary);
mTxLinkSpeedPref.setVisible(txLinkSpeedMbps >= 0);
mTxLinkSpeedPref.setSummary(mContext.getString(
R.string.tx_link_speed, mWifiInfo.getTxLinkSpeedMbps()));
} }
private void refreshRxSpeed() { private void refreshRxSpeed() {
if (mWifiInfo == null String summary = mWifiEntry.getRxSpeedString();
|| mWifiEntry.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED) { if (TextUtils.isEmpty(summary)) {
mRxLinkSpeedPref.setVisible(false); mRxLinkSpeedPref.setVisible(false);
return; return;
} }
mRxLinkSpeedPref.setVisible(true);
int rxLinkSpeedMbps = mWifiInfo.getRxLinkSpeedMbps(); mRxLinkSpeedPref.setSummary(summary);
mRxLinkSpeedPref.setVisible(rxLinkSpeedMbps >= 0);
mRxLinkSpeedPref.setSummary(mContext.getString(
R.string.rx_link_speed, mWifiInfo.getRxLinkSpeedMbps()));
} }
private void refreshSsid() { private void refreshSsid() {

View File

@@ -18,12 +18,14 @@ package com.android.settings.users;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.mockito.Answers.RETURNS_DEEP_STUBS; import static org.mockito.Answers.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.UserManager; import android.os.UserManager;
@@ -103,6 +105,8 @@ public class GuestTelephonyPreferenceControllerTest {
@Test @Test
public void updateState_Admin_shouldDisplayPreference() { public void updateState_Admin_shouldDisplayPreference() {
assumeTrue("Device does not have telephony feature ",
mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY));
SystemProperties.set("fw.max_users", Long.toBinaryString(4)); SystemProperties.set("fw.max_users", Long.toBinaryString(4));
mDpm.setDeviceOwner(null); mDpm.setDeviceOwner(null);
mUserManager.setIsAdminUser(true); mUserManager.setIsAdminUser(true);

View File

@@ -701,10 +701,10 @@ public class WifiDetailPreferenceController2Test {
} }
@Test @Test
public void linkSpeedPref_shouldNotShowIfNotSet() { public void linkSpeedPref_shouldNotShowIfSpeedStringIsEmpty() {
setUpForConnectedNetwork(); setUpForConnectedNetwork();
setUpSpyController(); setUpSpyController();
when(mMockWifiInfo.getTxLinkSpeedMbps()).thenReturn(WifiInfo.LINK_SPEED_UNKNOWN); when(mMockWifiEntry.getTxSpeedString()).thenReturn("");
displayAndResume(); displayAndResume();
@@ -712,42 +712,22 @@ public class WifiDetailPreferenceController2Test {
} }
@Test @Test
public void linkSpeedPref_shouldVisibleForConnectedNetwork() { public void linkSpeedPref_shouldBeVisibleIfSpeedStringIsNotEmpty() {
setUpForConnectedNetwork(); setUpForConnectedNetwork();
setUpSpyController(); setUpSpyController();
String expectedLinkSpeed = mContext.getString(R.string.tx_link_speed, TX_LINK_SPEED); when(mMockWifiEntry.getTxSpeedString()).thenReturn("100 Mbps");
displayAndResume(); displayAndResume();
verify(mMockTxLinkSpeedPref).setVisible(true); verify(mMockTxLinkSpeedPref).setVisible(true);
verify(mMockTxLinkSpeedPref).setSummary(expectedLinkSpeed); verify(mMockTxLinkSpeedPref).setSummary("100 Mbps");
} }
@Test @Test
public void linkSpeedPref_shouldInvisibleForDisconnectedNetwork() { public void rxLinkSpeedPref_shouldNotShowIfSpeedStringIsEmpty() {
setUpForDisconnectedNetwork();
displayAndResume();
verify(mMockTxLinkSpeedPref).setVisible(false);
verify(mMockTxLinkSpeedPref, never()).setSummary(any(String.class));
}
@Test
public void linkSpeedPref_shouldInvisibleForNotInRangeNetwork() {
setUpForNotInRangeNetwork();
displayAndResume();
verify(mMockTxLinkSpeedPref).setVisible(false);
verify(mMockTxLinkSpeedPref, never()).setSummary(any(String.class));
}
@Test
public void rxLinkSpeedPref_shouldNotShowIfNotSet() {
setUpForConnectedNetwork(); setUpForConnectedNetwork();
setUpSpyController(); setUpSpyController();
when(mMockWifiInfo.getRxLinkSpeedMbps()).thenReturn(WifiInfo.LINK_SPEED_UNKNOWN); when(mMockWifiEntry.getRxSpeedString()).thenReturn("");
displayAndResume(); displayAndResume();
@@ -755,35 +735,15 @@ public class WifiDetailPreferenceController2Test {
} }
@Test @Test
public void rxLinkSpeedPref_shouldVisibleForConnectedNetwork() { public void rxLinkSpeedPref_shouldBeVisibleIfSpeedStringIsNotEmpty() {
setUpForConnectedNetwork(); setUpForConnectedNetwork();
setUpSpyController(); setUpSpyController();
String expectedLinkSpeed = mContext.getString(R.string.rx_link_speed, RX_LINK_SPEED); when(mMockWifiEntry.getRxSpeedString()).thenReturn("100 Mbps");
displayAndResume(); displayAndResume();
verify(mMockRxLinkSpeedPref).setVisible(true); verify(mMockRxLinkSpeedPref).setVisible(true);
verify(mMockRxLinkSpeedPref).setSummary(expectedLinkSpeed); verify(mMockRxLinkSpeedPref).setSummary("100 Mbps");
}
@Test
public void rxLinkSpeedPref_shouldInvisibleForDisconnectedNetwork() {
setUpForDisconnectedNetwork();
displayAndResume();
verify(mMockRxLinkSpeedPref).setVisible(false);
verify(mMockRxLinkSpeedPref, never()).setSummary(any(String.class));
}
@Test
public void rxLinkSpeedPref_shouldInvisibleForNotInRangeNetwork() {
setUpForNotInRangeNetwork();
displayAndResume();
verify(mMockRxLinkSpeedPref).setVisible(false);
verify(mMockRxLinkSpeedPref, never()).setSummary(any(String.class));
} }
@Test @Test