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

Commit fc6cbd51 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "ADB Over Network, integration of the adb-host mode (already present)" into ics

parents 3189d011 2811c923
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2675,6 +2675,12 @@ public final class Settings {
         */
        public static final String ADB_ENABLED = "adb_enabled";

        /**
         * The TCP/IP port to run ADB on, or -1 for USB
         * @hide
         */
        public static final String ADB_PORT = "adb_port";

        /**
         * Setting to allow mock locations and location provider status to be injected into the
         * LocationManager service for testing purposes during application development.  These
+2 −2
Original line number Diff line number Diff line
@@ -1027,8 +1027,8 @@
    <string name="extmedia_format_message" product="nosdcard" msgid="8296908079722897772">"Formater la mémoire de stockage USB en effaçant tous les fichiers ? Cette action est irréversible."</string>
    <string name="extmedia_format_message" product="default" msgid="3621369962433523619">"Voulez-vous vraiment formater la carte SD ? Toutes les données de cette carte seront perdues."</string>
    <string name="extmedia_format_button_format" msgid="4131064560127478695">"Format"</string>
    <string name="adb_active_notification_title" msgid="6729044778949189918">"Débogage USB activé"</string>
    <string name="adb_active_notification_message" msgid="8470296818270110396">"Sélectionnez cette option pour désactiver le débogage USB."</string>
    <string name="adb_active_notification_title">Débogage android activé</string>
    <string name="adb_active_notification_message">Désactiver le débogage android (adb).</string>
    <string name="select_input_method" msgid="6865512749462072765">"Sélectionner un mode de saisie"</string>
    <string name="configure_input_methods" msgid="6324843080254191535">"Configurer les modes de saisie"</string>
    <string name="fast_scroll_alphabet" msgid="5433275485499039199">" ABCDEFGHIJKLMNOPQRSTUVWXYZ"</string>
+2 −2
Original line number Diff line number Diff line
@@ -2903,9 +2903,9 @@
    <string name="extmedia_format_button_format">Format</string>

    <!-- Title of notification shown when ADB is actively connected to the phone. -->
    <string name="adb_active_notification_title">USB debugging connected</string>
    <string name="adb_active_notification_title">Android debugging enabled</string>
    <!-- Message of notification shown when ADB is actively connected to the phone. -->
    <string name="adb_active_notification_message">Select to disable USB debugging.</string>
    <string name="adb_active_notification_message">Select to disable debugging.</string>

    <!-- Used to replace %s in urls retreived from the signin server with locales.  For Some        -->
    <!-- devices we don't support all the locales we ship to and need to replace the '%s' with a    -->
+44 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.IPackageManager;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.database.Cursor;
import android.media.AudioService;
import android.net.wifi.p2p.WifiP2pService;
import android.os.Looper;
@@ -74,6 +76,32 @@ class ServerThread extends Thread {
        Log.wtf(TAG, "BOOT FAILURE " + msg, e);
    }

    private class AdbSettingsObserver extends ContentObserver {
        public AdbSettingsObserver() {
            super(null);
        }
        @Override
        public void onChange(boolean selfChange) {
            boolean enableAdb = (Settings.Secure.getInt(mContentResolver,
                Settings.Secure.ADB_ENABLED, 0) > 0);
            // setting this secure property will start or stop adbd
            SystemProperties.set("persist.service.adb.enable", enableAdb ? "1" : "0");
        }
    }

    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));
        }
    }

    @Override
    public void run() {
        EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN,
@@ -566,6 +594,22 @@ class ServerThread extends Thread {
            }
        }

        // 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")));

        Settings.Secure.putInt(mContentResolver, Settings.Secure.ADB_ENABLED,
                "1".equals(SystemProperties.get("persist.service.adb.enable")) ? 1 : 0);

        // register observer to listen for settings changes
        mContentResolver.registerContentObserver(
            Settings.Secure.getUriFor(Settings.Secure.ADB_PORT),
            false, new AdbPortObserver());

        mContentResolver.registerContentObserver(
            Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED),
            false, new AdbSettingsObserver());

        // Before things start rolling, be sure we have decided whether
        // we are in safe mode.
        final boolean safeMode = wm.detectSafeMode();
+4 −0
Original line number Diff line number Diff line
@@ -297,6 +297,10 @@ public class UsbDeviceManager {
                        Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED),
                                false, new AdbSettingsObserver());

                mContentResolver.registerContentObserver(
                        Settings.Secure.getUriFor(Settings.Secure.ADB_PORT),
                                false, new AdbSettingsObserver());

                // Watch for USB configuration changes
                mUEventObserver.startObserving(USB_STATE_MATCH);
                mUEventObserver.startObserving(ACCESSORY_START_MATCH);