Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 831f6302 authored by Fan Zhang's avatar Fan Zhang
Browse files

Disable DevelopmentSettingsActivity by default

And if for any reason monkey user is able to enter develop option page,
we show nothing.

And update some test to sdk 26.

Change-Id: I3f985e7fe14bd290db73b8c46dd817591df02015
Fixes: 68707778
Test: robotests
parent 65ec66e3
Loading
Loading
Loading
Loading
+2 −19
Original line number Diff line number Diff line
@@ -1893,7 +1893,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" />
@@ -1962,15 +1963,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" />
@@ -1979,15 +1971,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"
+2 −1
Original line number Diff line number Diff line
@@ -825,7 +825,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()),
+11 −2
Original line number Diff line number Diff line
@@ -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();
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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;
Loading