diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-11-04 02:17:27 +0000 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-25 21:49:36 -0700 |
commit | 47e1d1f59e1f35a9eacc99ecc7e638d7eeb860e8 (patch) | |
tree | f53c6bc545bc67cb013f0401707aaede07a022a4 /services/java | |
parent | cce429f5139cb423979d22e6c0ac969115538e61 (diff) | |
download | frameworks_base-47e1d1f59e1f35a9eacc99ecc7e638d7eeb860e8.zip frameworks_base-47e1d1f59e1f35a9eacc99ecc7e638d7eeb860e8.tar.gz frameworks_base-47e1d1f59e1f35a9eacc99ecc7e638d7eeb860e8.tar.bz2 |
Framework: Forward port ADB over network (Part 2 of 2)
Includes:
- ADB Over Network, integration of the adb-host mode (already present)
The feature can be used/tested without the Settings part:
setprop service.adb.tcp.port 5555
Note: This ADB setting is not persistent (for security purpose) and
require init.rc implementation event like this : http://bit.ly/AdbTcpIP
Author: Tanguy Pruvot
Id: I5c61a53948349c785356cb5aae165110d75e3074
Author: sssemil <suleymanovemil8@gmail.com>
Show notification on adb over network too
Screenshots - http://goo.gl/TgsRI6
Id: I9ddc0aa9a4f330a06ab5d97a8645d1b31bb6f299
Change-Id: I101216c5b8ddff5040d9eeaf35afefc5cd98bbf3
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 0438cd9..ab59aeb 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -28,6 +28,8 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources.Theme; +import android.database.ContentObserver; +import android.database.Cursor; import android.os.Build; import android.os.Environment; import android.os.FactoryTest; @@ -40,6 +42,7 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.os.storage.IMountService; +import android.provider.Settings; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Slog; @@ -175,6 +178,19 @@ public final class SystemServer { mFactoryTestMode = FactoryTest.getMode(); } + private class AdbPortObserver extends ContentObserver { + public AdbPortObserver() { + super(null); + } + @Override + public void onChange(boolean selfChange) { + int adbPort = Settings.Secure.getInt(mContentResolver, + Settings.Secure.ADB_PORT, 0); + // setting this will control whether ADB runs on TCP/IP or USB + SystemProperties.set("service.adb.tcp.port", Integer.toString(adbPort)); + } + } + private void run() { // If a device's clock is before 1970 (before 0), a lot of // APIs crash dealing with negative numbers, notably @@ -1012,6 +1028,15 @@ public final class SystemServer { mSystemServiceManager.startService(MediaProjectionManagerService.class); } + // make sure the ADB_ENABLED setting value matches the secure property value + Settings.Secure.putInt(mContentResolver, Settings.Secure.ADB_PORT, + Integer.parseInt(SystemProperties.get("service.adb.tcp.port", "-1"))); + + // register observer to listen for settings changes + mContentResolver.registerContentObserver( + Settings.Secure.getUriFor(Settings.Secure.ADB_PORT), + false, new AdbPortObserver()); + // Before things start rolling, be sure we have decided whether // we are in safe mode. final boolean safeMode = wm.detectSafeMode(); |