Merge "Rephrase the see more button of Internet panel when ProviderModel is enabled"
This commit is contained in:
committed by
Android (Google) Code Review
commit
91c03a3254
@@ -34,10 +34,6 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the Internet Connectivity Panel.
|
* Represents the Internet Connectivity Panel.
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Displays Wifi (full Slice) and Airplane mode.
|
|
||||||
* </p>
|
|
||||||
*/
|
*/
|
||||||
public class InternetConnectivityPanel implements PanelContent {
|
public class InternetConnectivityPanel implements PanelContent {
|
||||||
|
|
||||||
@@ -78,6 +74,21 @@ public class InternetConnectivityPanel implements PanelContent {
|
|||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCustomizedButtonUsed() {
|
||||||
|
return Utils.isProviderModelEnabled(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getCustomizedButtonTitle() {
|
||||||
|
return mContext.getText(R.string.settings_button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClickCustomizedButton() {
|
||||||
|
mContext.startActivity(getSeeMoreIntent());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.PANEL_INTERNET_CONNECTIVITY;
|
return SettingsEnums.PANEL_INTERNET_CONNECTIVITY;
|
||||||
|
@@ -452,13 +452,13 @@ public class PanelFragment extends Fragment {
|
|||||||
View.OnClickListener getSeeMoreListener() {
|
View.OnClickListener getSeeMoreListener() {
|
||||||
return (v) -> {
|
return (v) -> {
|
||||||
mPanelClosedKey = PanelClosedKeys.KEY_SEE_MORE;
|
mPanelClosedKey = PanelClosedKeys.KEY_SEE_MORE;
|
||||||
|
final FragmentActivity activity = getActivity();
|
||||||
if (mPanel.isCustomizedButtonUsed()) {
|
if (mPanel.isCustomizedButtonUsed()) {
|
||||||
mPanel.onClickCustomizedButton();
|
mPanel.onClickCustomizedButton();
|
||||||
} else {
|
} else {
|
||||||
final FragmentActivity activity = getActivity();
|
|
||||||
activity.startActivityForResult(mPanel.getSeeMoreIntent(), 0);
|
activity.startActivityForResult(mPanel.getSeeMoreIntent(), 0);
|
||||||
activity.finish();
|
|
||||||
}
|
}
|
||||||
|
activity.finish();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,10 +20,12 @@ package com.android.settings.panel;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.SystemProperties;
|
||||||
|
|
||||||
import com.android.settings.network.AirplaneModePreferenceController;
|
import com.android.settings.network.AirplaneModePreferenceController;
|
||||||
import com.android.settings.slices.CustomSliceRegistry;
|
import com.android.settings.slices.CustomSliceRegistry;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -37,14 +39,25 @@ import java.util.List;
|
|||||||
public class InternetConnectivityPanelTest {
|
public class InternetConnectivityPanelTest {
|
||||||
|
|
||||||
private InternetConnectivityPanel mPanel;
|
private InternetConnectivityPanel mPanel;
|
||||||
|
private static final String SETTINGS_PROVIDER_MODEL =
|
||||||
|
"persist.sys.fflag.override.settings_provider_model";
|
||||||
|
private boolean mSettingsProviderModelState;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
mPanel = InternetConnectivityPanel.create(RuntimeEnvironment.application);
|
mPanel = InternetConnectivityPanel.create(RuntimeEnvironment.application);
|
||||||
|
mSettingsProviderModelState = SystemProperties.getBoolean(SETTINGS_PROVIDER_MODEL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
SystemProperties.set(SETTINGS_PROVIDER_MODEL,
|
||||||
|
mSettingsProviderModelState ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSlices_containsNecessarySlices() {
|
public void getSlices_providerModelDisabled_containsNecessarySlices() {
|
||||||
|
SystemProperties.set(SETTINGS_PROVIDER_MODEL, "false");
|
||||||
final List<Uri> uris = mPanel.getSlices();
|
final List<Uri> uris = mPanel.getSlices();
|
||||||
|
|
||||||
assertThat(uris).containsExactly(
|
assertThat(uris).containsExactly(
|
||||||
@@ -53,6 +66,16 @@ public class InternetConnectivityPanelTest {
|
|||||||
CustomSliceRegistry.WIFI_SLICE_URI);
|
CustomSliceRegistry.WIFI_SLICE_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSlices_providerModelEnabled_containsNecessarySlices() {
|
||||||
|
SystemProperties.set(SETTINGS_PROVIDER_MODEL, "true");
|
||||||
|
final List<Uri> uris = mPanel.getSlices();
|
||||||
|
|
||||||
|
assertThat(uris).containsExactly(
|
||||||
|
CustomSliceRegistry.PROVIDER_MODEL_SLICE_URI,
|
||||||
|
CustomSliceRegistry.AIRPLANE_SAFE_NETWORKS_SLICE_URI);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSeeMoreIntent_notNull() {
|
public void getSeeMoreIntent_notNull() {
|
||||||
assertThat(mPanel.getSeeMoreIntent()).isNotNull();
|
assertThat(mPanel.getSeeMoreIntent()).isNotNull();
|
||||||
|
Reference in New Issue
Block a user