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

Commit e072d5ca authored by Tanguy Pruvot's avatar Tanguy Pruvot Committed by Gerrit Code Review
Browse files

Option to hide Adb notification icon (framework)

Change-Id: Ie5325b3c6cde64be8d36f6afc4e747addb5ce8df
parent 8f03009e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3270,6 +3270,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
@@ -312,6 +312,14 @@ public class LegacyUsbDeviceManager extends UsbDeviceManager {
                    Settings.Secure.getUriFor(Settings.Secure.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
                if (mLegacy) {
                    mUEventObserver.startObserving(USB_LEGACY_MATCH);
@@ -591,7 +599,10 @@ public class LegacyUsbDeviceManager extends 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();
+12 −2
Original line number Diff line number Diff line
@@ -347,10 +347,17 @@ public class UsbDeviceManager {
                mContentResolver.registerContentObserver(
                        Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED),
                                false, new AdbSettingsObserver());

                mContentResolver.registerContentObserver(
                        Settings.Secure.getUriFor(Settings.Secure.ADB_PORT),
                                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);
@@ -679,7 +686,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();