Merge "Remove "Device Controls" from Settings" into sc-dev
This commit is contained in:
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.gestures;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.Shadows;
|
||||
import org.robolectric.shadows.ShadowPackageManager;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class DeviceControlsPreferenceControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private DeviceControlsPreferenceController mController;
|
||||
private ShadowPackageManager mShadowPackageManager;
|
||||
|
||||
private static final String KEY_GESTURE_PANEL = "gesture_device_controls";
|
||||
private static final String ENABLED_SETTING =
|
||||
DeviceControlsPreferenceController.ENABLED_SETTING;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mShadowPackageManager = Shadows.shadowOf(mContext.getPackageManager());
|
||||
mController = new DeviceControlsPreferenceController(mContext, KEY_GESTURE_PANEL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChecked_panelEnabled() {
|
||||
Settings.Secure.putInt(
|
||||
mContext.getContentResolver(), ENABLED_SETTING, 1);
|
||||
assertThat(mController.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChecked_panelDisabled() {
|
||||
Settings.Secure.putInt(
|
||||
mContext.getContentResolver(), ENABLED_SETTING, 0);
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_hasSystemFeature_panelAvailable() {
|
||||
mShadowPackageManager.setSystemFeature(PackageManager.FEATURE_CONTROLS, true);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus())
|
||||
.isEqualTo(BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_hasntSystemFeature_panelUnsupported() {
|
||||
mShadowPackageManager.setSystemFeature(PackageManager.FEATURE_CONTROLS, false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus())
|
||||
.isEqualTo(BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceable_correctKey() {
|
||||
final DeviceControlsPreferenceController controller =
|
||||
new DeviceControlsPreferenceController(mContext,
|
||||
DeviceControlsPreferenceController.TOGGLE_KEY);
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceable_incorrectKey() {
|
||||
final DeviceControlsPreferenceController controller =
|
||||
new DeviceControlsPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isPublicSlice_returnTrue() {
|
||||
assertThat(mController.isPublicSlice()).isTrue();
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.gestures;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class DeviceControlsSettingsTest {
|
||||
|
||||
private DeviceControlsSettings mSettings;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mSettings = new DeviceControlsSettings();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchIndexProvider_shouldIndexResource() {
|
||||
final List<SearchIndexableResource> indexRes =
|
||||
DeviceControlsSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||
RuntimeEnvironment.application, true /* enabled */);
|
||||
|
||||
assertThat(indexRes).isNotNull();
|
||||
assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId());
|
||||
}
|
||||
}
|
@@ -21,7 +21,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.annotation.StringRes;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -31,8 +30,6 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.ParameterizedRobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.Shadows;
|
||||
import org.robolectric.shadows.ShadowPackageManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -41,53 +38,32 @@ import java.util.Collection;
|
||||
public class PowerMenuPreferenceControllerSummaryTest {
|
||||
|
||||
private static final String KEY_GESTURE_POWER_MENU = "gesture_power_menu";
|
||||
private static final String CONTROLS_ENABLED = Settings.Secure.CONTROLS_ENABLED;
|
||||
private static final String CONTROLS_FEATURE = PackageManager.FEATURE_CONTROLS;
|
||||
private static final String CARDS_ENABLED = Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED;
|
||||
private static final String CARDS_AVAILABLE = Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE;
|
||||
|
||||
@ParameterizedRobolectricTestRunner.Parameters(
|
||||
name = "ctrls available={0}, ctrls enabled={1}, cards available={2}, cards enabled={3}")
|
||||
name = "cards available={0}, cards enabled={1}")
|
||||
public static Collection data() {
|
||||
return Arrays.asList(new Object[][]{
|
||||
// controls available, controls enabled, cards available, cards enabled, summary
|
||||
{false, false, false, false, R.string.power_menu_none},
|
||||
{false, false, false, true, R.string.power_menu_none},
|
||||
{false, false, true, false, R.string.power_menu_none},
|
||||
{false, false, true, true, R.string.power_menu_cards_passes},
|
||||
{false, true, false, false, R.string.power_menu_none},
|
||||
{false, true, false, true, R.string.power_menu_none},
|
||||
{false, true, true, false, R.string.power_menu_none},
|
||||
{false, true, true, true, R.string.power_menu_cards_passes},
|
||||
{true, false, false, false, R.string.power_menu_none},
|
||||
{true, false, false, true, R.string.power_menu_none},
|
||||
{true, false, true, false, R.string.power_menu_none},
|
||||
{true, false, true, true, R.string.power_menu_cards_passes},
|
||||
{true, true, false, false, R.string.power_menu_device_controls},
|
||||
{true, true, false, true, R.string.power_menu_device_controls},
|
||||
{true, true, true, false, R.string.power_menu_device_controls},
|
||||
{true, true, true, true, R.string.power_menu_cards_passes_device_controls}
|
||||
// cards available, cards enabled, summary
|
||||
{false, false, R.string.power_menu_none},
|
||||
{false, true, R.string.power_menu_none},
|
||||
{true, false, R.string.power_menu_none},
|
||||
{true, true, R.string.power_menu_cards_passes}
|
||||
});
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
private PowerMenuPreferenceController mController;
|
||||
private ShadowPackageManager mShadowPackageManager;
|
||||
|
||||
private boolean mControlsAvailable;
|
||||
private boolean mControlsEnabled;
|
||||
private boolean mCardsAvailable;
|
||||
private boolean mCardsEnabled;
|
||||
private @StringRes int mSummaryRes;
|
||||
|
||||
public PowerMenuPreferenceControllerSummaryTest(
|
||||
boolean controlsAvailable,
|
||||
boolean controlsEnabled,
|
||||
boolean cardsAvailable,
|
||||
boolean cardsEnabled,
|
||||
@StringRes int summaryRes) {
|
||||
mControlsAvailable = controlsAvailable;
|
||||
mControlsEnabled = controlsEnabled;
|
||||
mCardsAvailable = cardsAvailable;
|
||||
mCardsEnabled = cardsEnabled;
|
||||
mSummaryRes = summaryRes;
|
||||
@@ -96,15 +72,12 @@ public class PowerMenuPreferenceControllerSummaryTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mShadowPackageManager = Shadows.shadowOf(mContext.getPackageManager());
|
||||
mController = new PowerMenuPreferenceController(mContext, KEY_GESTURE_POWER_MENU);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_possiblyAvailableAndEnabled() {
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, mControlsAvailable);
|
||||
ContentResolver cr = mContext.getContentResolver();
|
||||
Settings.Secure.putInt(cr, CONTROLS_ENABLED, mControlsEnabled ? 1 : 0);
|
||||
Settings.Secure.putInt(cr, CARDS_AVAILABLE, mCardsAvailable ? 1 : 0);
|
||||
Settings.Secure.putInt(cr, CARDS_ENABLED, mCardsEnabled ? 1 : 0);
|
||||
|
||||
|
@@ -23,7 +23,6 @@ import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.provider.Settings;
|
||||
|
||||
@@ -34,19 +33,14 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.Shadows;
|
||||
import org.robolectric.shadows.ShadowPackageManager;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class PowerMenuPreferenceControllerTest {
|
||||
private Context mContext;
|
||||
private Resources mResources;
|
||||
private PowerMenuPreferenceController mController;
|
||||
private ShadowPackageManager mShadowPackageManager;
|
||||
|
||||
private static final String KEY_GESTURE_POWER_MENU = "gesture_power_menu";
|
||||
private static final String CONTROLS_ENABLED = Settings.Secure.CONTROLS_ENABLED;
|
||||
private static final String CONTROLS_FEATURE = PackageManager.FEATURE_CONTROLS;
|
||||
private static final String CARDS_ENABLED = Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED;
|
||||
private static final String CARDS_AVAILABLE = Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE;
|
||||
|
||||
@@ -59,14 +53,12 @@ public class PowerMenuPreferenceControllerTest {
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(true);
|
||||
when(mContext.getResources()).thenReturn(mResources);
|
||||
mShadowPackageManager = Shadows.shadowOf(mContext.getPackageManager());
|
||||
mController = new PowerMenuPreferenceController(mContext, KEY_GESTURE_POWER_MENU);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_allAvailable_available() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, true);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(true);
|
||||
@@ -78,7 +70,6 @@ public class PowerMenuPreferenceControllerTest {
|
||||
@Test
|
||||
public void getAvailabilityStatus_onlyCardsAvailable_available() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, false);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(false);
|
||||
@@ -87,46 +78,9 @@ public class PowerMenuPreferenceControllerTest {
|
||||
BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_onlyControlsAvailable_available() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, true);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_controlsAndCardsAvailable_available() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, true);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_controlsAndAssistAvailable_available() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, true);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(true);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_cardsAndAssistAvailable_available() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, false);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(true);
|
||||
@@ -138,7 +92,6 @@ public class PowerMenuPreferenceControllerTest {
|
||||
@Test
|
||||
public void getAvailabilityStatus_onlyAssistAvailable_available() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, false);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(true);
|
||||
@@ -150,7 +103,6 @@ public class PowerMenuPreferenceControllerTest {
|
||||
@Test
|
||||
public void getAvailabilityStatus_allUnavailable_unavailable() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, false);
|
||||
when(mResources.getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable))
|
||||
.thenReturn(false);
|
||||
|
@@ -46,32 +46,23 @@ import java.util.Collection;
|
||||
@RunWith(ParameterizedRobolectricTestRunner.class)
|
||||
public class PowerMenuPrivacyPreferenceControllerAvailabilityTest {
|
||||
|
||||
private static final String CONTROLS_ENABLED = Settings.Secure.CONTROLS_ENABLED;
|
||||
private static final String CONTROLS_FEATURE = PackageManager.FEATURE_CONTROLS;
|
||||
private static final String CARDS_ENABLED = Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED;
|
||||
private static final String CARDS_AVAILABLE = Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE;
|
||||
|
||||
@ParameterizedRobolectricTestRunner.Parameters(
|
||||
name = "ctrls available={0}, ctrls enabled={1}, cards available={2}, cards enabled={3}")
|
||||
name = "ctrls available={0} cards available={1}, cards enabled={2}")
|
||||
public static Collection data() {
|
||||
return Arrays.asList(new Object[][]{
|
||||
// controls available, controls enabled, cards available, cards enabled, available
|
||||
{false, false, false, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, false, false, true, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, false, true, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, false, true, true, BasePreferenceController.AVAILABLE},
|
||||
{false, true, false, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, true, false, true, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, true, true, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, true, true, true, BasePreferenceController.AVAILABLE},
|
||||
{true, false, false, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{true, false, false, true, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{true, false, true, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{true, false, true, true, BasePreferenceController.AVAILABLE},
|
||||
{true, true, false, false, BasePreferenceController.AVAILABLE},
|
||||
{true, true, false, true, BasePreferenceController.AVAILABLE},
|
||||
{true, true, true, false, BasePreferenceController.AVAILABLE},
|
||||
{true, true, true, true, BasePreferenceController.AVAILABLE}
|
||||
// controls available, cards available, cards enabled, available
|
||||
{false, false, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, false, true, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, true, false, BasePreferenceController.DISABLED_DEPENDENT_SETTING},
|
||||
{false, true, true, BasePreferenceController.AVAILABLE},
|
||||
{true, false, false, BasePreferenceController.AVAILABLE},
|
||||
{true, false, true, BasePreferenceController.AVAILABLE},
|
||||
{true, true, false, BasePreferenceController.AVAILABLE},
|
||||
{true, true, true, BasePreferenceController.AVAILABLE}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,19 +74,16 @@ public class PowerMenuPrivacyPreferenceControllerAvailabilityTest {
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
|
||||
private boolean mControlsAvailable;
|
||||
private boolean mControlsEnabled;
|
||||
private boolean mCardsAvailable;
|
||||
private boolean mCardsEnabled;
|
||||
private int mAvailable;
|
||||
|
||||
public PowerMenuPrivacyPreferenceControllerAvailabilityTest(
|
||||
boolean controlsAvailable,
|
||||
boolean controlsEnabled,
|
||||
boolean cardsAvailable,
|
||||
boolean cardsEnabled,
|
||||
int available) {
|
||||
mControlsAvailable = controlsAvailable;
|
||||
mControlsEnabled = controlsEnabled;
|
||||
mCardsAvailable = cardsAvailable;
|
||||
mCardsEnabled = cardsEnabled;
|
||||
mAvailable = available;
|
||||
@@ -120,7 +108,6 @@ public class PowerMenuPrivacyPreferenceControllerAvailabilityTest {
|
||||
public void getAvailabilityStatus_possiblyAvailableAndEnabled() {
|
||||
mShadowPackageManager.setSystemFeature(CONTROLS_FEATURE, mControlsAvailable);
|
||||
ContentResolver cr = mContext.getContentResolver();
|
||||
Settings.Secure.putInt(cr, CONTROLS_ENABLED, mControlsEnabled ? 1 : 0);
|
||||
Settings.Secure.putInt(cr, CARDS_AVAILABLE, mCardsAvailable ? 1 : 0);
|
||||
Settings.Secure.putInt(cr, CARDS_ENABLED, mCardsEnabled ? 1 : 0);
|
||||
|
||||
|
@@ -54,7 +54,6 @@ public class PowerMenuPrivacyPreferenceControllerTest {
|
||||
private static final String CARDS_AVAILABLE_KEY =
|
||||
Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE;
|
||||
private static final String CARDS_ENABLED_KEY = Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED;
|
||||
private static final String CONTROLS_ENABLED_KEY = Settings.Secure.CONTROLS_ENABLED;
|
||||
|
||||
private Context mContext;
|
||||
private ContentResolver mContentResolver;
|
||||
@@ -171,18 +170,8 @@ public class PowerMenuPrivacyPreferenceControllerTest {
|
||||
mShadowPackageManager.setSystemFeature(PackageManager.FEATURE_CONTROLS, true);
|
||||
Settings.Secure.putInt(mContentResolver, CARDS_AVAILABLE_KEY, 1);
|
||||
Settings.Secure.putInt(mContentResolver, CARDS_ENABLED_KEY, 1);
|
||||
Settings.Secure.putInt(mContentResolver, CONTROLS_ENABLED_KEY, 1);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BasePreferenceController.DISABLED_DEPENDENT_SETTING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_controlsDeletedSecure_retursAvailable() {
|
||||
Settings.Secure.putString(mContentResolver, CONTROLS_ENABLED_KEY, null);
|
||||
mShadowPackageManager.setSystemFeature(PackageManager.FEATURE_CONTROLS, true);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user