Snap for 5229166 from e5262dbca1 to qt-release

Change-Id: Id3cee04cdd987e8cefc0553c6b432cdf698dcc1f
This commit is contained in:
android-build-team Robot
2019-01-14 04:14:39 +00:00
4 changed files with 13 additions and 18 deletions

View File

@@ -22,6 +22,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserManager;
import android.sysprop.AdbProperties;
import android.text.TextUtils;
import android.util.Log;
@@ -39,9 +40,6 @@ public class ClearAdbKeysPreferenceController extends DeveloperOptionsPreference
private static final String TAG = "ClearAdbPrefCtrl";
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
@VisibleForTesting
static final String RO_ADB_SECURE_PROPERTY_KEY = "ro.adb.secure";
private final IAdbManager mAdbManager;
private final DevelopmentSettingsDashboardFragment mFragment;
@@ -55,7 +53,7 @@ public class ClearAdbKeysPreferenceController extends DeveloperOptionsPreference
@Override
public boolean isAvailable() {
return SystemProperties.getBoolean(RO_ADB_SECURE_PROPERTY_KEY, false /* default */);
return AdbProperties.secure().orElse(false);
}
@Override

View File

@@ -621,7 +621,7 @@ public class WifiConfigController implements TextWatcher,
config.requirePMF = true;
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
config.allowedGroupMgmtCiphers.set(WifiConfiguration.GroupMgmtCipher
config.allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher
.BIP_GMAC_256);
config.allowedSuiteBCiphers.set(WifiConfiguration.SuiteBCipher.ECDHE_RSA);
}

View File

@@ -196,7 +196,7 @@ public class WifiUtils {
config.requirePMF = true;
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
config.allowedGroupMgmtCiphers.set(WifiConfiguration.GroupMgmtCipher
config.allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher
.BIP_GMAC_256);
config.allowedSuiteBCiphers.set(WifiConfiguration.SuiteBCipher.ECDHE_RSA);
}

View File

@@ -16,9 +16,6 @@
package com.android.settings.development;
import static com.android.settings.development.ClearAdbKeysPreferenceController
.RO_ADB_SECURE_PROPERTY_KEY;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
@@ -30,7 +27,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.debug.IAdbManager;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.sysprop.AdbProperties;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceScreen;
@@ -83,21 +80,21 @@ public class ClearAdbKeysPreferenceControllerTest {
@Test
public void isAvailable_roAdbSecureEnabled_shouldBeTrue() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
AdbProperties.secure(true);
assertThat(mController.isAvailable()).isTrue();
}
@Test
public void isAvailable_roAdbSecureDisabled_shouldBeFalse() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(false));
AdbProperties.secure(false);
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void displayPreference_isNotAdminUser_preferenceShouldBeDisabled() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
AdbProperties.secure(true);
doReturn(false).when(mController).isAdminUser();
mController.displayPreference(mScreen);
@@ -108,7 +105,7 @@ public class ClearAdbKeysPreferenceControllerTest {
@Test
@Config(shadows = ShadowClearAdbKeysWarningDialog.class)
public void handlePreferenceTreeClick_clearAdbKeysPreference_shouldShowWarningDialog() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
mController.displayPreference(mScreen);
final String preferenceKey = mController.getPreferenceKey();
@@ -121,7 +118,7 @@ public class ClearAdbKeysPreferenceControllerTest {
@Test
public void handlePreferenceTreeClick_notClearAdbKeysPreference_shouldReturnFalse() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
mController.displayPreference(mScreen);
when(mPreference.getKey()).thenReturn("Some random key!!!");
@@ -132,7 +129,7 @@ public class ClearAdbKeysPreferenceControllerTest {
@Test
public void handlePreferenceTreeClick_monkeyUser_shouldReturnFalse() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
ShadowUtils.setIsUserAMonkey(true);
mController.displayPreference(mScreen);
@@ -146,7 +143,7 @@ public class ClearAdbKeysPreferenceControllerTest {
@Test
public void onDeveloperOptionsSwitchEnabled_isAdminUser_shouldEnablePreference() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
mController.displayPreference(mScreen);
mController.onDeveloperOptionsSwitchEnabled();
@@ -156,7 +153,7 @@ public class ClearAdbKeysPreferenceControllerTest {
@Test
public void onDeveloperOptionsSwitchEnabled_isNotAdminUser_shouldNotEnablePreference() {
SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
AdbProperties.secure(true);
doReturn(false).when(mController).isAdminUser();
mController.displayPreference(mScreen);
mController.onDeveloperOptionsSwitchEnabled();