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

Commit b12e9adc authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add development option to force everything resizable

Bug: 24815256
Change-Id: Ic9620c3b502e92f1a628bbe696ae91896d25d5b3
parent a6885536
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -5173,6 +5173,11 @@
    <!-- UI debug setting: force allow on external summary [CHAR LIMIT=150] -->
    <string name="force_allow_on_external_summary">Makes any app elligible to be written to external storage, regardless of manifest values</string>
    <!-- UI debug setting: force all activites to be resizable for multiwindow [CHAR LIMIT=50] -->
    <string name="force_resizable_activities">Force activities to be resizable</string>
    <!-- UI debug setting: force allow on external summary [CHAR LIMIT=150] -->
    <string name="force_resizable_activities_summary">Makes all activities resizable for multi-window, regardless of manifest values.</string>
    <!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
    <string name="data_usage_summary_title">Data usage</string>
    <!-- Activity title for Appk data usage summary. [CHAR LIMIT=25] -->
+4 −0
Original line number Diff line number Diff line
@@ -348,6 +348,10 @@
            android:title="@string/force_allow_on_external"
            android:summary="@string/force_allow_on_external_summary"/>

        <SwitchPreference
            android:key="force_resizable_activities"
            android:title="@string/force_resizable_activities"
            android:summary="@string/force_resizable_activities_summary"/>
     </PreferenceCategory>

</PreferenceScreen>
+20 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import android.os.SystemProperties;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
@@ -157,6 +158,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client";
    private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
    private static final String KEY_COLOR_MODE = "color_mode";
    private static final String FORCE_RESIZABLE_KEY = "force_resizable_activities";

    private static final String INACTIVE_APPS_KEY = "inactive_apps";

@@ -259,6 +261,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment

    private ColorModePreference mColorModePreference;

    private SwitchPreference mForceResizable;

    private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();

    private final ArrayList<SwitchPreference> mResetSwitchPrefs
@@ -383,6 +387,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
        mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
        mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
        mForceResizable = findAndInitSwitchPref(FORCE_RESIZABLE_KEY);

        mImmediatelyDestroyActivities = (SwitchPreference) findPreference(
                IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
@@ -636,6 +641,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        updateMobileDataAlwaysOnOptions();
        updateSimulateColorSpace();
        updateUSBAudioOptions();
        updateForceResizableOptions();
    }

    private void resetDangerousOptions() {
@@ -1182,6 +1188,18 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
                mUSBAudio.isChecked() ? 1 : 0);
    }

    private void updateForceResizableOptions() {
        updateSwitchPreference(mForceResizable, Settings.Global.getInt(getContentResolver(),
                Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES,
                Build.IS_DEBUGGABLE ? 1 : 0) != 0);
    }

    private void writeForceResizableOptions() {
        Settings.Global.putInt(getContentResolver(),
                Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES,
                mForceResizable.isChecked() ? 1 : 0);
    }

    private void updateForceRtlOptions() {
        updateSwitchPreference(mForceRtlLayout,
                Settings.Global.getInt(getActivity().getContentResolver(),
@@ -1686,6 +1704,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            writeMobileDataAlwaysOnOptions();
        } else if (preference == mUSBAudio) {
            writeUSBAudioOptions();
        } else if (preference == mForceResizable) {
            writeForceResizableOptions();
        } else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
            startInactiveAppsFragment();
        } else {