Use new kernel notifications to determine if USB mass storage is available.

The usb_mass_storage switch no longer exists in our 2.6.35 kernel.
Instead we will consider mass storage to be available if both USB is connected
and the USB mass storage function is enable.

Change-Id: I730d1b3cb3cac664fc2abcdc36cd39856a08404a
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/VolumeManager.h b/VolumeManager.h
index 0693fd0..f807beb 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -38,7 +38,8 @@
 
     VolumeCollection      *mVolumes;
     AsecIdCollection      *mActiveContainers;
-    bool                   mUsbMassStorageConnected;
+    bool                   mUsbMassStorageEnabled;
+    bool                   mUsbConnected;
     bool                   mDebug;
 
 public:
@@ -49,6 +50,7 @@
 
     void handleBlockEvent(NetlinkEvent *evt);
     void handleSwitchEvent(NetlinkEvent *evt);
+    void handleUsbCompositeEvent(NetlinkEvent *evt);
 
     int addVolume(Volume *v);
 
@@ -72,8 +74,6 @@
 
     void setDebug(bool enable);
 
-    // XXX: This should be moved private once switch uevents are working
-    void notifyUmsConnected(bool connected);
     // XXX: Post froyo this should be moved and cleaned up
     int cleanupAsec(Volume *v, bool force);
 
@@ -86,7 +86,11 @@
 
 private:
     VolumeManager();
+    void readInitialState();
     Volume *lookupVolume(const char *label);
     bool isMountpointMounted(const char *mp);
+
+    inline bool massStorageAvailable() const { return mUsbMassStorageEnabled && mUsbConnected; }
+    void notifyUmsAvailable(bool available);
 };
 #endif