OSDN Git Service

Turn off WifiTetherSettings page.
authorFan Zhang <zhfan@google.com>
Mon, 18 Sep 2017 23:16:57 +0000 (16:16 -0700)
committerFan Zhang <zhfan@google.com>
Tue, 19 Sep 2017 17:16:38 +0000 (10:16 -0700)
Merged-In: If92798ddf075801e66cd97ecacff2f8df1e41985
Change-Id: Idab770509a8049907a256cce2b8f00f236c2dbdc
Fixes: 65852564
Test: rerun robotests
Test: new instrumentation test to check flag initial state

src/com/android/settings/wifi/WifiApEnabler.java
src/com/android/settings/wifi/tether/WifiTetherSettings.java
tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java

index 675bf28..2a8015b 100644 (file)
@@ -81,7 +81,7 @@ public class WifiApEnabler {
         mContext = context;
         mDataSaverBackend = dataSaverBackend;
         mSwitch = switchPreference;
-        mOriginalSummary = switchPreference.getSummary();
+        mOriginalSummary = context.getText(R.string.wifi_hotspot_off_subtext);
         switchPreference.setPersistent(false);
 
         mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
index 5dcdeab..3a1d5c6 100644 (file)
@@ -46,7 +46,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
         implements WifiTetherBasePreferenceController.OnTetherConfigUpdateListener {
 
     public static boolean isTetherSettingPageEnabled() {
-        return SystemProperties.getBoolean("settings.ui.wifi.tether.enabled", true);
+        return SystemProperties.getBoolean("settings.ui.wifi.tether.enabled", false);
     }
 
     private static final IntentFilter TETHER_STATE_CHANGE_FILTER;
index 26a711b..add988c 100644 (file)
 
 package com.android.settings.wifi.tether;
 
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static android.support.test.espresso.matcher.ViewMatchers.withText;
+import static com.google.common.truth.Truth.assertThat;
+
 import android.app.Instrumentation;
 import android.content.Intent;
 import android.support.test.InstrumentationRegistry;
@@ -33,11 +39,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class WifiTetherSettingsTest {
@@ -64,6 +65,11 @@ public class WifiTetherSettingsTest {
     }
 
     @Test
+    public void verifyPageIsDisabledByDefault() {
+        assertThat(WifiTetherSettings.isTetherSettingPageEnabled()).isFalse();
+    }
+
+    @Test
     public void launchTetherSettings_shouldHaveAllFields() {
         launchWifiTetherActivity();
         onView(withText("Network name")).check(matches(isDisplayed()));