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

Commit 0e1535a0 authored by Steve Kondik's avatar Steve Kondik
Browse files

Add ADB_NOTIFY option.

This allows the user to disable the USB debugging connection
notification. It's quite annoying.

Change-Id: I767569659050c7041e53a4bd9fb61db46e52f188
parent 4e1796d2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2039,6 +2039,10 @@ found in the list of installed applications.</string>
    <string name="enable_adb">USB debugging</string>
    <!-- Setting checkbox summary for Whether to enable USB debugging support on the phone -->
    <string name="enable_adb_summary">Debug mode when USB is connected</string>
    <!-- Setting checkbox title for displaying USB debugging notification -->
    <string name="adb_notify">USB debugging notify</string>
    <!-- Setting checkbox summary for displaying USB debugging notification -->
    <string name="adb_notify_summary">Display a notification when USB debugging is connected</string>
    <!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source -->
    <string name="keep_screen_on">Stay awake</string>
    <!-- setting Checkbox summary whether to keep the screen on when plugged in  -->
+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@
        android:title="@string/enable_adb" 
        android:summary="@string/enable_adb_summary"/>

    <CheckBoxPreference
        android:key="adb_notify"
        android:title="@string/adb_notify"
        android:summary="@string/adb_notify_summary"
        android:dependency="enable_adb" />

    <CheckBoxPreference 
        android:key="keep_screen_on" 
        android:title="@string/keep_screen_on" 
+10 −0
Original line number Diff line number Diff line
@@ -36,10 +36,12 @@ public class DevelopmentSettings extends PreferenceActivity
        implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {

    private static final String ENABLE_ADB = "enable_adb";
    private static final String ADB_NOTIFY = "adb_notify";
    private static final String KEEP_SCREEN_ON = "keep_screen_on";
    private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";

    private CheckBoxPreference mEnableAdb;
    private CheckBoxPreference mAdbNotify;
    private CheckBoxPreference mKeepScreenOn;
    private CheckBoxPreference mAllowMockLocation;

@@ -55,6 +57,7 @@ public class DevelopmentSettings extends PreferenceActivity
        addPreferencesFromResource(R.xml.development_prefs);

        mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB);
        mAdbNotify = (CheckBoxPreference) findPreference(ADB_NOTIFY);
        mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON);
        mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION);
    }
@@ -65,6 +68,10 @@ public class DevelopmentSettings extends PreferenceActivity

        mEnableAdb.setChecked(Settings.Secure.getInt(getContentResolver(),
                Settings.Secure.ADB_ENABLED, 0) != 0);
        
        mAdbNotify.setChecked(Settings.Secure.getInt(getContentResolver(),
                Settings.Secure.ADB_NOTIFY, 1) != 0);
                
        mKeepScreenOn.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
        mAllowMockLocation.setChecked(Settings.Secure.getInt(getContentResolver(),
@@ -93,6 +100,9 @@ public class DevelopmentSettings extends PreferenceActivity
            } else {
                Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
            }
        } else if (preference == mAdbNotify) {
            Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_NOTIFY,
                    mAdbNotify.isChecked() ? 1 : 0);
        } else if (preference == mKeepScreenOn) {
            Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, 
                    mKeepScreenOn.isChecked() ?