Use SettingsLib's MainSwitchBar to replace SwitchBar in Settings.

To log Settings metrics, the MainSwitch extends MainSwitchBar and
replace the SwitchBar in SettingsActivity.

Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui

Change-Id: I3add3702e9058ad9192b5172c7cf0e2ccfb55a70
This commit is contained in:
Stanley Wang
2020-12-25 16:27:32 +08:00
parent c61c2fb1d7
commit b87ddba6cd
51 changed files with 783 additions and 271 deletions

View File

@@ -34,7 +34,7 @@ import android.net.NetworkPolicyManager;
import android.net.wifi.WifiManager;
import android.widget.Switch;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.SettingsMainSwitchBar;
import org.junit.Before;
import org.junit.Test;
@@ -54,7 +54,7 @@ public class WifiTetherSwitchBarControllerTest {
private NetworkPolicyManager mNetworkPolicyManager;
private Context mContext;
private SwitchBar mSwitchBar;
private SettingsMainSwitchBar mSwitchBar;
private WifiTetherSwitchBarController mController;
@Before
@@ -62,7 +62,7 @@ public class WifiTetherSwitchBarControllerTest {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mSwitchBar = new SwitchBar(mContext);
mSwitchBar = new SettingsMainSwitchBar(mContext);
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(
mConnectivityManager);