remove Pan service which is not used anymore.

because we replaced bluez bluetooth stack with bluedroid bluetooth stack.
This is multiple project check-in for ISSUE 6849488 Bluedroid stack, remove system/bluetooth.
Pan service depend on system/bluetooth. So both Pan service and system/bluetooth should be removed.

bug 6849488

Change-Id: I7a5a828b9b4327dbd6b6a13ec7ff4a9129ba0ca5
diff --git a/Android.mk b/Android.mk
index 582f0a6..8b7acf0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,7 +15,6 @@
                   NetdConstants.cpp                    \
                   NetlinkHandler.cpp                   \
                   NetlinkManager.cpp                   \
-                  PanController.cpp                    \
                   PppController.cpp                    \
                   ResolverController.cpp               \
                   SecondaryTableController.cpp         \
@@ -30,8 +29,6 @@
 LOCAL_MODULE:= netd
 
 LOCAL_C_INCLUDES := $(KERNEL_HEADERS) \
-                    $(LOCAL_PATH)/../bluetooth/bluedroid/include \
-                    $(LOCAL_PATH)/../bluetooth/bluez-clean-headers \
                     external/mdnsresponder/mDNSShared \
                     external/openssl/include \
                     external/stlport/stlport \
@@ -44,11 +41,6 @@
 LOCAL_SHARED_LIBRARIES := libstlport libsysutils libcutils libnetutils \
                           libcrypto libhardware_legacy libmdnssd libdl
 
-ifeq ($(BOARD_HAVE_BLUETOOTH),true)
-  LOCAL_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES) libbluedroid
-  LOCAL_CFLAGS := $(LOCAL_CFLAGS) -DHAVE_BLUETOOTH
-endif
-
 include $(BUILD_EXECUTABLE)
 
 include $(CLEAR_VARS)
diff --git a/CommandListener.cpp b/CommandListener.cpp
index 969fa65..7b82682 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -46,7 +46,6 @@
 TetherController *CommandListener::sTetherCtrl = NULL;
 NatController *CommandListener::sNatCtrl = NULL;
 PppController *CommandListener::sPppCtrl = NULL;
-PanController *CommandListener::sPanCtrl = NULL;
 SoftapController *CommandListener::sSoftapCtrl = NULL;
 BandwidthController * CommandListener::sBandwidthCtrl = NULL;
 IdletimerController * CommandListener::sIdletimerCtrl = NULL;
@@ -132,7 +131,6 @@
     registerCmd(new NatCmd());
     registerCmd(new ListTtysCmd());
     registerCmd(new PppdCmd());
-    registerCmd(new PanCmd());
     registerCmd(new SoftapCmd());
     registerCmd(new BandwidthControlCmd());
     registerCmd(new IdletimerControlCmd());
@@ -147,8 +145,6 @@
         sNatCtrl = new NatController(sSecondaryTableCtrl);
     if (!sPppCtrl)
         sPppCtrl = new PppController();
-    if (!sPanCtrl)
-        sPanCtrl = new PanController();
     if (!sSoftapCtrl)
         sSoftapCtrl = new SoftapController();
     if (!sBandwidthCtrl)
@@ -821,45 +817,6 @@
     return 0;
 }
 
-CommandListener::PanCmd::PanCmd() :
-                 NetdCommand("pan") {
-}
-
-int CommandListener::PanCmd::runCommand(SocketClient *cli,
-                                        int argc, char **argv) {
-    int rc = 0;
-
-    if (argc < 2) {
-        cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
-        return 0;
-    }
-
-    if (!strcmp(argv[1], "start")) {
-        rc = sPanCtrl->startPan();
-    } else if (!strcmp(argv[1], "stop")) {
-        rc = sPanCtrl->stopPan();
-    } else if (!strcmp(argv[1], "status")) {
-        char *tmp = NULL;
-
-        asprintf(&tmp, "Pan services %s",
-                 (sPanCtrl->isPanStarted() ? "started" : "stopped"));
-        cli->sendMsg(ResponseCode::PanStatusResult, tmp, false);
-        free(tmp);
-        return 0;
-    } else {
-        cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown pan cmd", false);
-        return 0;
-    }
-
-    if (!rc) {
-        cli->sendMsg(ResponseCode::CommandOkay, "Pan operation succeeded", false);
-    } else {
-        cli->sendMsg(ResponseCode::OperationFailed, "Pan operation failed", true);
-    }
-
-    return 0;
-}
-
 CommandListener::SoftapCmd::SoftapCmd() :
                  NetdCommand("softap") {
 }
diff --git a/CommandListener.h b/CommandListener.h
index faf0c21..6cae13e 100644
--- a/CommandListener.h
+++ b/CommandListener.h
@@ -23,7 +23,6 @@
 #include "TetherController.h"
 #include "NatController.h"
 #include "PppController.h"
-#include "PanController.h"
 #include "SoftapController.h"
 #include "BandwidthController.h"
 #include "IdletimerController.h"
@@ -36,7 +35,6 @@
     static TetherController *sTetherCtrl;
     static NatController *sNatCtrl;
     static PppController *sPppCtrl;
-    static PanController *sPanCtrl;
     static SoftapController *sSoftapCtrl;
     static BandwidthController *sBandwidthCtrl;
     static IdletimerController *sIdletimerCtrl;
@@ -104,13 +102,6 @@
         int runCommand(SocketClient *c, int argc, char ** argv);
     };
 
-    class PanCmd : public NetdCommand {
-    public:
-        PanCmd();
-        virtual ~PanCmd() {}
-        int runCommand(SocketClient *c, int argc, char ** argv);
-    };
-
     class BandwidthControlCmd : public NetdCommand {
     public:
         BandwidthControlCmd();
diff --git a/PanController.cpp b/PanController.cpp
deleted file mode 100644
index 164b01a..0000000
--- a/PanController.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#ifdef HAVE_BLUETOOTH
-#include <bluedroid/bluetooth.h>
-#endif
-
-#define LOG_TAG "PanController"
-#include <cutils/log.h>
-
-#include "PanController.h"
-
-#ifdef HAVE_BLUETOOTH
-extern "C" int bt_is_enabled();
-#endif
-
-PanController::PanController() {
-    mPid = 0;
-}
-
-PanController::~PanController() {
-}
-
-int PanController::startPan() {
-    pid_t pid;
-
-#ifdef HAVE_BLUETOOTH
-    if (!bt_is_enabled()) {
-        ALOGE("Cannot start PAN services - Bluetooth not running");
-        errno = ENODEV;
-        return -1;
-    }
-#else
-    ALOGE("Cannot start PAN services - No Bluetooth support");
-    errno = ENODEV;
-    return -1;
-#endif
-
-    if (mPid) {
-        ALOGE("PAN already started");
-        errno = EBUSY;
-        return -1;
-    }
-
-   if ((pid = fork()) < 0) {
-        ALOGE("fork failed (%s)", strerror(errno));
-        return -1;
-    }
-
-    if (!pid) {
-        if (execl("/system/bin/pand", "/system/bin/pand", "--nodetach", "--listen",
-                  "--role", "NAP", (char *) NULL)) {
-            ALOGE("execl failed (%s)", strerror(errno));
-        }
-        ALOGE("Should never get here!");
-        return 0;
-    } else {
-        mPid = pid;
-    }
-    return 0;
-
-}
-
-int PanController::stopPan() {
-    if (mPid == 0) {
-        ALOGE("PAN already stopped");
-        return 0;
-    }
-
-    ALOGD("Stopping PAN services");
-    kill(mPid, SIGTERM);
-    waitpid(mPid, NULL, 0);
-    mPid = 0;
-    ALOGD("PAN services stopped");
-    return 0;
-}
-
-bool PanController::isPanStarted() {
-    return (mPid != 0 ? true : false);
-}
diff --git a/PanController.h b/PanController.h
deleted file mode 100644
index a97e039..0000000
--- a/PanController.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _PAN_CONTROLLER_H
-#define _PAN_CONTROLLER_H
-
-#include <linux/in.h>
-
-class PanController {
-    pid_t mPid;
-
-public:
-    PanController();
-    virtual ~PanController();
-
-    int startPan();
-    int stopPan();
-    bool isPanStarted();
-};
-
-#endif
diff --git a/ResponseCode.h b/ResponseCode.h
index 807f91a..c6f5c2d 100644
--- a/ResponseCode.h
+++ b/ResponseCode.h
@@ -34,7 +34,6 @@
     static const int CommandOkay               = 200;
     static const int TetherStatusResult        = 210;
     static const int IpFwdStatusResult         = 211;
-    static const int PanStatusResult           = 212;
     static const int InterfaceGetCfgResult     = 213;
     static const int SoftapStatusResult        = 214;
     static const int UsbRNDISStatusResult      = 215;