Merge "Disable DevelopmentSettingsActivity by default"

This commit is contained in:
TreeHugger Robot
2017-11-23 01:47:53 +00:00
committed by Android (Google) Code Review
20 changed files with 32 additions and 39 deletions

View File

@@ -1920,7 +1920,8 @@
android:label="@string/development_settings_title"
android:icon="@drawable/ic_settings_development"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings">
android:parentActivityName="Settings"
android:enabled="false">
<intent-filter android:priority="1">
<action android:name="android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
<action android:name="com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
@@ -1989,15 +1990,6 @@
android:value="com.android.settings.print.PrintJobSettingsFragment" />
</activity>
<!-- Keep compatibility with old shortcuts. -->
<activity-alias android:name="DevelopmentSettings"
android:exported="true"
android:label="@string/development_settings_title"
android:targetActivity="Settings$DevelopmentSettingsDashboardActivity">
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.development.DevelopmentSettingsDashboardFragment" />
</activity-alias>
<activity android:name=".development.AppPicker"
android:label="@string/select_application"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />
@@ -2006,15 +1998,6 @@
android:label="@string/select_webview_provider_dialog_title">
</activity>
<!-- Keep compatibility with old shortcuts. -->
<activity-alias android:name="UsbSettings"
android:exported="true"
android:label="@string/storage_title_usb"
android:targetActivity="Settings$DevelopmentSettingsDashboardActivity">
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.deviceinfo.UsbSettings" />
</activity-alias>
<!-- Bluetooth stuff -->
<activity android:name=".bluetooth.BluetoothPairingDialog"

View File

@@ -835,7 +835,8 @@ public class SettingsActivity extends SettingsDrawerActivity
|| somethingChanged;
final boolean showDev = DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(this)
&& !um.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES);
&& !um.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)
&& !Utils.isMonkeyRunning();
somethingChanged = setTileEnabled(new ComponentName(packageName,
Settings.DevelopmentSettingsDashboardActivity.class.getName()),

View File

@@ -298,12 +298,15 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
@Override
protected int getPreferenceScreenResId() {
Log.d(TAG, "Creating pref screen");
return R.xml.development_settings;
return Utils.isMonkeyRunning()? R.xml.placeholder_prefs : R.xml.development_settings;
}
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
if (Utils.isMonkeyRunning()) {
mPreferenceControllers = new ArrayList<>();
return null;
}
mPreferenceControllers = buildPreferenceControllers(context, getActivity(), getLifecycle(),
this /* devOptionsDashboardFragment */,
new BluetoothA2dpConfigStore());
@@ -326,6 +329,9 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
}
private void enableDeveloperOptions() {
if (Utils.isMonkeyRunning()) {
return;
}
DevelopmentSettingsEnabler.setDevelopmentSettingsEnabled(getContext(), true);
for (AbstractPreferenceController controller : mPreferenceControllers) {
if (controller instanceof DeveloperOptionsPreferenceController) {
@@ -335,6 +341,9 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
}
private void disableDeveloperOptions() {
if (Utils.isMonkeyRunning()) {
return;
}
DevelopmentSettingsEnabler.setDevelopmentSettingsEnabled(getContext(), false);
final SystemPropPoker poker = SystemPropPoker.getInstance();
poker.blockPokes();

View File

@@ -45,7 +45,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ActionBarShadowControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ActionButtonPreferenceTest {
private Context mContext;

View File

@@ -33,7 +33,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppPreferenceTest {
private Context mContext;

View File

@@ -33,7 +33,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppSwitchPreferenceTest {
private Context mContext;

View File

@@ -32,7 +32,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AspectRatioFrameLayoutTest {
private Context mContext;

View File

@@ -29,7 +29,7 @@ import org.robolectric.annotation.Config;
import static junit.framework.Assert.assertEquals;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultIndicatorSeekBarTest {
private DefaultIndicatorSeekBar mDefaultIndicatorSeekBar;

View File

@@ -58,7 +58,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class EntityHeaderControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)

View File

@@ -38,7 +38,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FixedLineSummaryPreferenceTest {
@Mock

View File

@@ -37,7 +37,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LoadingViewControllerTest {
private Context mContext;

View File

@@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MasterSwitchPreferenceTest {
private Context mContext;

View File

@@ -36,7 +36,7 @@ import java.util.ArrayList;
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PreferenceCategoryControllerTest {
private Context mContext;

View File

@@ -45,7 +45,7 @@ import java.util.ArrayList;
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RadioButtonPickerFragmentTest {

View File

@@ -31,7 +31,7 @@ import org.robolectric.annotation.Config;
import static junit.framework.Assert.assertEquals;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RingProgressBarTest {
private Context mContext = RuntimeEnvironment.application;

View File

@@ -36,7 +36,7 @@ import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowTextUtils.class}
)
public class RtlCompatibleViewPagerTest {

View File

@@ -41,7 +41,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowView;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ScrollToParentEditTextTest {
private static final int EDIT_TEXT_SIZE = 20;

View File

@@ -34,7 +34,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SummaryUpdaterTest {
private Context mContext;

View File

@@ -42,7 +42,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ValidatedEditTextPreferenceTest {
@Mock