Merge "Add summary back to the homepage" into sc-dev
This commit is contained in:
@@ -19,10 +19,8 @@ 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 org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -40,7 +38,6 @@ public class TopLevelAccountEntryPreferenceControllerTest {
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new TopLevelAccountEntryPreferenceController(mContext, "test_key");
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -48,11 +45,4 @@ public class TopLevelAccountEntryPreferenceControllerTest {
|
||||
assertThat(mController.getSummary()).isEqualTo(
|
||||
mContext.getText(R.string.account_dashboard_default_summary));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -22,10 +22,8 @@ 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.Before;
|
||||
import org.junit.Test;
|
||||
@@ -46,7 +44,6 @@ public class TopLevelConnectedDevicesPreferenceControllerTest {
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new TopLevelConnectedDevicesPreferenceController(mContext, "test_key");
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,13 +64,6 @@ 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 {
|
||||
|
||||
|
@@ -673,33 +673,6 @@ public class DashboardFeatureProviderImplTest {
|
||||
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));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void bindPreference_specificHomepageTile_shouldOverridePosition() {
|
||||
|
@@ -23,9 +23,6 @@ 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.Before;
|
||||
import org.junit.Test;
|
||||
@@ -43,7 +40,6 @@ public class TopLevelAboutDevicePreferenceControllerTest {
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new TopLevelAboutDevicePreferenceController(mContext, "test_key");
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -61,12 +57,4 @@ 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,10 +31,8 @@ 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.Before;
|
||||
import org.junit.Test;
|
||||
@@ -65,7 +63,6 @@ public class TopLevelDisplayPreferenceControllerTest {
|
||||
when(mContext.getString(R.string.config_wallpaper_picker_class)).thenReturn("cls");
|
||||
|
||||
mController = new TopLevelDisplayPreferenceController(mContext, "test_key");
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -112,11 +109,4 @@ 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();
|
||||
}
|
||||
}
|
||||
|
@@ -22,10 +22,8 @@ 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.Before;
|
||||
import org.junit.Test;
|
||||
@@ -43,7 +41,6 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new TopLevelBatteryPreferenceController(mContext, "test_key");
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -73,16 +70,8 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
assertThat(mController.getDashboardLabel(mContext, info, true)).isEqualTo("5% - charging");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_silkyHomeEnabled_shouldBeNull() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
|
||||
|
||||
assertThat(mController.getSummary()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_batteryNotPresent_shouldShowWarningMessage() {
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
mController.mIsBatteryPresent = false;
|
||||
|
||||
assertThat(mController.getSummary())
|
||||
|
@@ -20,10 +20,8 @@ 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.Before;
|
||||
import org.junit.Test;
|
||||
@@ -43,7 +41,6 @@ public class TopLevelLocationPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new TopLevelLocationPreferenceController(mContext, PREFERENCE_KEY);
|
||||
mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -86,11 +83,4 @@ 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,9 +24,7 @@ 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;
|
||||
@@ -74,7 +72,6 @@ public class TopLevelNetworkEntryPreferenceControllerTest {
|
||||
mMobileNetworkPreferenceController);
|
||||
ReflectionHelpers.setField(mController, "mTetherPreferenceController",
|
||||
mTetherPreferenceController);
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -106,11 +103,4 @@ 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();
|
||||
}
|
||||
}
|
||||
|
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
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.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class TopLevelSecurityEntryPreferenceControllerTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private FingerprintManager mFingerprintManager;
|
||||
@Mock
|
||||
private FaceManager mFaceManager;
|
||||
private TopLevelSecurityEntryPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
when(mContext.getSystemService(Context.FINGERPRINT_SERVICE))
|
||||
.thenReturn(mFingerprintManager);
|
||||
when(mContext.getSystemService(Context.FACE_SERVICE))
|
||||
.thenReturn(mFaceManager);
|
||||
mController = new TopLevelSecurityEntryPreferenceController(mContext, "test_key");
|
||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geSummary_hasFace_hasStaticSummary() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||
.thenReturn(true);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
mController.getSummary();
|
||||
|
||||
verify(mContext).getText(R.string.security_dashboard_summary_face);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geSummary_hasFingerPrint_hasStaticSummary() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||
.thenReturn(false);
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(true);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
mController.getSummary();
|
||||
|
||||
verify(mContext).getText(R.string.security_dashboard_summary);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geSummary_noFpFeature_shouldSetSummaryWithNoBiometrics() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(false);
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||
.thenReturn(false);
|
||||
|
||||
mController.getSummary();
|
||||
|
||||
verify(mContext).getText(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geSummary_noFpHardware_shouldSetSummaryWithNoBiometrics() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||
.thenReturn(false);
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(true);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
mController.getSummary();
|
||||
|
||||
verify(mContext).getText(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geSummary_noFaceFeature_shouldSetSummaryWithNoBiometrics() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(false);
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||
.thenReturn(false);
|
||||
|
||||
mController.getSummary();
|
||||
|
||||
verify(mContext).getText(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geSummary_noFaceHardware_shouldSetSummaryWithNoBiometrics() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||
.thenReturn(true);
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(false);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
mController.getSummary();
|
||||
|
||||
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