Bug 737153 - Enable mounting storage through USB from a host machine - Hook up VolumeManager and AutoMounter, sr=cjones r=qDot
authorDave Hylands <dhylands@mozilla.com>
Thu, 24 May 2012 21:04:32 -0700
changeset 96414 cff8079f23256006ab0a53e071f83170aeea78b4
parent 96413 815d53fb27e0cd0d18638d59338d710dc9f988ac
child 96415 e76794008819a92eb0f88f530f166176c6a236f6
push idunknown
push userunknown
push dateunknown
reviewerscjones, qDot
bugs737153
milestone15.0a1
Bug 737153 - Enable mounting storage through USB from a host machine - Hook up VolumeManager and AutoMounter, sr=cjones r=qDot
configure.in
dom/system/gonk/Makefile.in
dom/system/gonk/SystemWorkerManager.cpp
--- a/configure.in
+++ b/configure.in
@@ -234,17 +234,17 @@ if test -n "$gonkdir" ; then
     arm)
         ARCH_DIR=arch-arm
         ;;
     i?86)
         ARCH_DIR=arch-x86
         ;;
     esac
 
-    CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
+    CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
     LIBS="$LIBS $STLPORT_LIBS"
 
     dnl Add -llog by default, since we use it all over the place.
     LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
 
     dnl prevent cross compile section from using these flags as host flags
--- a/dom/system/gonk/Makefile.in
+++ b/dom/system/gonk/Makefile.in
@@ -37,17 +37,22 @@ LOCAL_INCLUDES = \
   -I$(topsrcdir)/dom/wifi \
   -I$(topsrcdir)/dom/bluetooth \
   -I$(topsrcdir)/content/events/src \
   $(NULL)
 
 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
   AudioManager.cpp \
+  AutoMounter.cpp \
+  AutoMounterSetting.cpp \
   GonkGPSGeolocationProvider.cpp \
+  Volume.cpp \
+  VolumeCommand.cpp \
+  VolumeManager.cpp \
   $(NULL)
 # for our local copy of AudioSystem.h
 LOCAL_INCLUDES += -I$(topsrcdir)/media/libsydneyaudio/src
 endif
 
 EXTRA_COMPONENTS = \
   NetworkManager.manifest \
   NetworkManager.js \
--- a/dom/system/gonk/SystemWorkerManager.cpp
+++ b/dom/system/gonk/SystemWorkerManager.cpp
@@ -10,16 +10,19 @@
 #include "nsIJSContextStack.h"
 #include "nsIRadioInterfaceLayer.h"
 #include "nsIWifi.h"
 #include "nsIWorkerHolder.h"
 #include "nsIXPConnect.h"
 
 #include "jsfriendapi.h"
 #include "mozilla/dom/workers/Workers.h"
+#ifdef MOZ_WIDGET_GONK
+#include "AutoMounter.h"
+#endif
 #include "mozilla/ipc/Ril.h"
 #ifdef MOZ_B2G_BT
 #include "mozilla/ipc/DBusThread.h"
 #include "BluetoothFirmware.h"
 #endif
 #include "nsContentUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
@@ -34,16 +37,19 @@
 #define BTDEBUG true
 #define LOG(args...) if(BTDEBUG) printf(args);
 #endif
 
 
 USING_WORKERS_NAMESPACE
 using namespace mozilla::dom::gonk;
 using namespace mozilla::ipc;
+#ifdef MOZ_WIDGET_GONK
+using namespace mozilla::system;
+#endif
 #ifdef MOZ_B2G_BT
 using namespace mozilla::dom::bluetooth;
 #endif
 
 namespace {
 
 NS_DEFINE_CID(kRadioInterfaceLayerCID, NS_RADIOINTERFACELAYER_CID);
 NS_DEFINE_CID(kWifiWorkerCID, NS_WIFIWORKER_CID);
@@ -225,16 +231,20 @@ SystemWorkerManager::Init()
 #ifdef MOZ_B2G_BT
   rv = InitBluetooth(cx);
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to initialize Bluetooth!");
     return rv;
   }
 #endif
 
+#ifdef MOZ_WIDGET_GONK
+  InitAutoMounter();
+#endif
+
   nsCOMPtr<nsIObserverService> obs =
     do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
   if (!obs) {
     NS_WARNING("Failed to get observer service!");
     return NS_ERROR_FAILURE;
   }
 
   rv = obs->AddObserver(this, WORKERS_SHUTDOWN_TOPIC, false);
@@ -248,16 +258,20 @@ SystemWorkerManager::Init()
 
 void
 SystemWorkerManager::Shutdown()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   mShutdown = true;
 
+#ifdef MOZ_WIDGET_GONK
+  ShutdownAutoMounter();
+#endif
+
   StopRil();
 #ifdef MOZ_B2G_BT
   StopDBus();
 #endif
   mRILWorker = nsnull;
   nsCOMPtr<nsIWifi> wifi(do_QueryInterface(mWifiWorker));
   if (wifi) {
     wifi->Shutdown();