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

Commit 7518b049 authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Gerrit Code Review
Browse files

Settings: Mock SMS (3/4)

This change brings the possibility of simulate the reception of SMS on real devices.
This change includes the settings to enable/disable the mock SMS feature.

Ported from http://review.cyanogenmod.org/#/c/23018



Patchset 2/3: Rebased

Change-Id: I8818995147c41db261d9c9506c1741ed99ef581e
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent 4b709edb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -653,6 +653,8 @@

    <!-- Launches Dev Tools -->
    <string name="development_tools_title">Launch Tools</string>
    <!-- Whether to allow mock SMS -->
    <string name="allow_mock_sms">Allow mock SMS</string>

    <!-- USB Mass Storage -->
    <string name="usb_mass_storage_title">Mass storage</string>
+5 −1
Original line number Diff line number Diff line
@@ -116,6 +116,10 @@
            android:title="@string/allow_mock_location"
            android:summary="@string/allow_mock_location_summary"/>

        <CheckBoxPreference
            android:key="allow_mock_sms"
            android:title="@string/allow_mock_sms"/>

        <PreferenceScreen android:key="debug_app"
            android:title="@string/debug_app" />

+9 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
    private static final String KEEP_SCREEN_ON = "keep_screen_on";
    private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
    private static final String ALLOW_MOCK_SMS = "allow_mock_sms";
    private static final String HDCP_CHECKING_KEY = "hdcp_checking";
    private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
    private static final String ENFORCE_READ_EXTERNAL = "enforce_read_external";
@@ -178,6 +179,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private CheckBoxPreference mKeepScreenOn;
    private CheckBoxPreference mEnforceReadExternal;
    private CheckBoxPreference mAllowMockLocation;
    private CheckBoxPreference mAllowMockSMS;
    private PreferenceScreen mPassword;

    private String mDebugApp;
@@ -270,6 +272,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON);
        mEnforceReadExternal = findAndInitCheckboxPref(ENFORCE_READ_EXTERNAL);
        mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION);
        mAllowMockSMS = findAndInitCheckboxPref(ALLOW_MOCK_SMS);
        mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
        mAllPrefs.add(mPassword);
        mAdvancedReboot = findAndInitCheckboxPref(ADVANCED_REBOOT_KEY);
@@ -515,6 +518,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        updateAdbOverNetwork();
        updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
                Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
        updateCheckBox(mAllowMockSMS, Settings.Secure.getInt(cr,
                Settings.Secure.ALLOW_MOCK_SMS, 0) != 0);
        updateHdcpValues();
        updatePasswordSummary();
        updateDebuggerOptions();
@@ -1306,6 +1311,10 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            Settings.Secure.putInt(getActivity().getContentResolver(),
                    Settings.Secure.ALLOW_MOCK_LOCATION,
                    mAllowMockLocation.isChecked() ? 1 : 0);
        } else if (preference == mAllowMockSMS) {
            Settings.Secure.putInt(getActivity().getContentResolver(),
                    Settings.Secure.ALLOW_MOCK_SMS,
                    mAllowMockSMS.isChecked() ? 1 : 0);
        } else if (preference == mDebugAppPref) {
            startActivityForResult(new Intent(getActivity(), AppPicker.class), RESULT_DEBUG_APP);
        } else if (preference == mWaitForDebugger) {