Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a590aa8d authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge "Misc fixes"

parents d76496dc cb4fb095
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@
        <item name="android:paddingStart">4dip</item>
        <item name="android:layout_marginStart">4dip</item>
        <item name="android:textSize">18sp</item>
        <item name="android:textAlignment">viewStart</item>
    </style>

    <style name="wifi_section">
+12 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.UserManager;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.logging.nano.MetricsProto;
@@ -40,6 +41,7 @@ import com.android.settingslib.core.AbstractPreferenceController;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class WifiTetherSettings extends RestrictedDashboardFragment
        implements WifiTetherBasePreferenceController.OnTetherConfigUpdateListener {
@@ -156,6 +158,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment

        config.SSID = mSSIDPreferenceController.getSSID();
        config.preSharedKey = mPasswordPreferenceController.getPassword();
        ensureWifiConfigHasPassword(config);
        config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA2_PSK);
        config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
        config.apBand = mApBandPreferenceController.getBandIndex();
@@ -176,6 +179,15 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
                .updateDisplay();
    }

    @VisibleForTesting
    static void ensureWifiConfigHasPassword(WifiConfiguration config) {
        if (TextUtils.isEmpty(config.preSharedKey)) {
            String randomUUID = UUID.randomUUID().toString();
            //first 12 chars from xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
            config.preSharedKey = randomUUID.substring(0, 8) + randomUUID.substring(9, 13);
        }
    }

    @VisibleForTesting
    class TetherChangeReceiver extends BroadcastReceiver {
        @Override
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;

@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiTetherApBandPreferenceControllerTest {

    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ import org.robolectric.annotation.Config;


@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiTetherPasswordPreferenceControllerTest {

    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ import org.robolectric.util.ReflectionHelpers;
import java.util.ArrayList;

@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
        shadows = {
                WifiTetherPreferenceControllerTest.ShadowWifiTetherSettings.class,
                WifiTetherPreferenceControllerTest.ShadowWifiTetherSwitchBarController.class,
Loading