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

Commit 8b33f828 authored by Tanguy Pruvot's avatar Tanguy Pruvot Committed by Rick C
Browse files

Port "Option to hide Adb notification icon (2/2)"

Change-Id: I63bfb7e4b4f0ac4d4d4c3da68ea767e8a37babdd
parent 544ca85d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3718,6 +3718,12 @@ public final class Settings {
         */
        public static final String ADB_PORT = "adb_port";

        /**
         * Whether to display the ADB notification.
         * @hide
         */
        public static final String ADB_NOTIFY = "adb_notify";

        /**
         * The hostname for this device
         * @hide
+12 −1
Original line number Diff line number Diff line
@@ -362,6 +362,14 @@ public class UsbDeviceManager {
                mContentResolver.registerContentObserver(
                        Settings.Global.getUriFor(Settings.Global.ADB_ENABLED),
                                false, new AdbSettingsObserver());
                mContentResolver.registerContentObserver(
                        Settings.Secure.getUriFor(Settings.Secure.ADB_NOTIFY),
                                false, new ContentObserver(null) {
                            public void onChange(boolean selfChange) {
                                updateAdbNotification();
                            }
                        }
                );

                // Watch for USB configuration changes
                mUEventObserver.startObserving(USB_STATE_MATCH);
@@ -712,7 +720,10 @@ public class UsbDeviceManager {
            if (mNotificationManager == null) return;
            final int id = com.android.internal.R.string.adb_active_notification_title;
            if (mAdbEnabled && mConnected) {
                if ("0".equals(SystemProperties.get("persist.adb.notify"))) return;
                if ("0".equals(SystemProperties.get("persist.adb.notify"))
                 || Settings.Secure.getInt(mContext.getContentResolver(),
                    Settings.Secure.ADB_NOTIFY, 1) == 0)
                    return;

                if (!mAdbNotificationShown) {
                    Resources r = mContext.getResources();