Remove subtitles for the homepage IA
Remove the summary of the homepage IA if silky home enabled. Fixes: 170933968 Test: robotest & visual with turning on/off silky home Change-Id: I502b6590cece9b80e9923109fe0582cc4d9a1c56
This commit is contained in:
@@ -19,8 +19,10 @@ package com.android.settings.accounts;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.testutils.shadow.ShadowAuthenticationHelper;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -51,6 +53,10 @@ public class TopLevelAccountEntryPreferenceControllerTest {
|
||||
@After
|
||||
public void tearDown() {
|
||||
ShadowAuthenticationHelper.reset();
|
||||
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -76,4 +82,11 @@ public class TopLevelAccountEntryPreferenceControllerTest {
|
||||
// should only show the 2 accounts with labels
|
||||
assertThat(mController.getSummary()).isEqualTo(LABELS[0] + " and " + LABELS[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -22,9 +22,12 @@ import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -46,6 +49,13 @@ public class TopLevelConnectedDevicesPreferenceControllerTest {
|
||||
mController = new TopLevelConnectedDevicesPreferenceController(mContext, "test_key");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailibilityStatus_availableByDefault() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
@@ -64,6 +74,13 @@ public class TopLevelConnectedDevicesPreferenceControllerTest {
|
||||
.isEqualTo(mContext.getText(R.string.settings_label_launcher));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
|
||||
@Implements(AdvancedConnectedDeviceController.class)
|
||||
private static class ShadowAdvancedConnectedDeviceController {
|
||||
|
||||
|
@@ -55,6 +55,7 @@ import android.graphics.drawable.Icon;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@@ -65,6 +66,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.shadow.ShadowTileUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||
@@ -75,6 +77,7 @@ import com.android.settingslib.drawer.ProviderTile;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
import com.android.settingslib.drawer.TileUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -146,6 +149,13 @@ public class DashboardFeatureProviderImplTest {
|
||||
mImpl = new DashboardFeatureProviderImpl(mContext);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHoldAppContext() {
|
||||
assertThat(mImpl.mContext).isEqualTo(mContext.getApplicationContext());
|
||||
@@ -670,4 +680,31 @@ public class DashboardFeatureProviderImplTest {
|
||||
assertThat(argument.getValue().getIdentifier()).isEqualTo(0);
|
||||
verify(mActivity, never()).getSupportFragmentManager();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindPreference_silkyHomeEnabled_shouldNotBindHomepageTileSummary() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
final Preference preference = new Preference(RuntimeEnvironment.application);
|
||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||
|
||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, null /*key */,
|
||||
Preference.DEFAULT_ORDER);
|
||||
|
||||
assertThat(preference.getSummary()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindPreference_silkyHomeEnabled_shouldBindSubpageTileSummary() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
final Preference preference = new Preference(RuntimeEnvironment.application);
|
||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_SYSTEM);
|
||||
|
||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, null /*key */,
|
||||
Preference.DEFAULT_ORDER);
|
||||
|
||||
assertThat(preference.getSummary()).isEqualTo(
|
||||
mContext.getText(R.string.about_settings_summary));
|
||||
}
|
||||
}
|
||||
|
@@ -28,12 +28,15 @@ import android.content.Context;
|
||||
import android.icu.text.NumberFormat;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settingslib.deviceinfo.StorageManagerVolumeProvider;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -68,6 +71,13 @@ public class TopLevelStoragePreferenceControllerTest {
|
||||
mController = new TopLevelStoragePreferenceController(mContext, "test_key");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateSummary_shouldDisplayUsedPercentAndFreeSpace() throws Exception {
|
||||
final VolumeInfo volumeInfo = mVolumes.get(0);
|
||||
@@ -90,4 +100,11 @@ public class TopLevelStoragePreferenceControllerTest {
|
||||
assertThat(preference.getSummary()).isEqualTo(
|
||||
mContext.getString(R.string.storage_summary, percentage, freeSpace));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void refreshSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,11 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings.Global;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -42,6 +46,13 @@ public class TopLevelAboutDevicePreferenceControllerTest {
|
||||
mController = new TopLevelAboutDevicePreferenceController(mContext, "test_key");
|
||||
}
|
||||
|
||||
@After
|
||||
public void teardown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityState_shouldBeAvailable() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
@@ -57,4 +68,12 @@ public class TopLevelAboutDevicePreferenceControllerTest {
|
||||
Global.putString(mContext.getContentResolver(), Global.DEVICE_NAME, "Test");
|
||||
assertThat(mController.getSummary().toString()).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
Global.putString(mContext.getContentResolver(), Global.DEVICE_NAME, "Test");
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -31,9 +31,12 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -65,6 +68,13 @@ public class TopLevelDisplayPreferenceControllerTest {
|
||||
mController = new TopLevelDisplayPreferenceController(mContext, "test_key");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailibilityStatus_availableByDefault() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
@@ -109,4 +119,11 @@ public class TopLevelDisplayPreferenceControllerTest {
|
||||
assertThat(mController.getSummary())
|
||||
.isEqualTo(mContext.getText(R.string.display_dashboard_nowallpaper_summary));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,11 @@ import static com.android.settings.fuelgauge.TopLevelBatteryPreferenceController
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -42,6 +46,13 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
mController = new TopLevelBatteryPreferenceController(mContext, "test_key");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailibilityStatus_availableByDefault() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
@@ -66,4 +77,11 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
info.chargeLabel = "5% - charging";
|
||||
assertThat(getDashboardLabel(mContext, info)).isEqualTo("5% - charging");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -20,9 +20,12 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.LocationManager;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -43,6 +46,13 @@ public class TopLevelLocationPreferenceControllerTest {
|
||||
mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_byDefault_shouldReturnTrue() {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
@@ -83,4 +93,11 @@ public class TopLevelLocationPreferenceControllerTest {
|
||||
R.plurals.location_settings_summary_location_on,
|
||||
LOCATION_APP_COUNT, LOCATION_APP_COUNT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
@@ -24,7 +24,9 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.UserManager;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.testutils.shadow.ShadowRestrictedLockUtilsInternal;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
import com.android.settings.wifi.WifiPrimarySwitchPreferenceController;
|
||||
@@ -77,6 +79,10 @@ public class TopLevelNetworkEntryPreferenceControllerTest {
|
||||
@After
|
||||
public void tearDown() {
|
||||
ShadowUtils.reset();
|
||||
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -103,4 +109,11 @@ public class TopLevelNetworkEntryPreferenceControllerTest {
|
||||
|
||||
assertThat(mController.getSummary()).isEqualTo("Wi\u2011Fi and data usage");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.security;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -23,9 +25,12 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -35,7 +40,7 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class TopLevelSecurityPreferenceControllerTest {
|
||||
public class TopLevelSecurityEntryPreferenceControllerTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@@ -55,6 +60,13 @@ public class TopLevelSecurityPreferenceControllerTest {
|
||||
mController = new TopLevelSecurityEntryPreferenceController(mContext, "test_key");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geSummary_hasFace_hasStaticSummary() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||
@@ -128,4 +140,11 @@ public class TopLevelSecurityPreferenceControllerTest {
|
||||
|
||||
verify(mContext).getText(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user