vold: allow to store key in a file on another partition

Add support for keeping the keys in a separate file on another partition,
for devices with no space reserved for a footer after the userdata filesystem.

Add support for encrypting the volumes managed by vold, if they meet certain
criteria, namely being marked as nonremovable and encryptable in vold.fstab.
A bit of trickiness is required to keep vold happy.

Change-Id: Idf0611f74b56c1026c45742ca82e0c26e58828fe
diff --git a/DirectVolume.h b/DirectVolume.h
index 4bf14ff..ad1b386 100644
--- a/DirectVolume.h
+++ b/DirectVolume.h
@@ -35,6 +35,8 @@
     int            mPartMinors[MAX_PARTITIONS];
     int            mDiskNumParts;
     unsigned char  mPendingPartMap;
+    int            mIsDecrypted;
+    int            mFlags;
 
 public:
     DirectVolume(VolumeManager *vm, const char *label, const char *mount_point, int partIdx);
@@ -47,9 +49,14 @@
     dev_t getShareDevice();
     void handleVolumeShared();
     void handleVolumeUnshared();
+    int getVolInfo(struct volume_info *v);
+    void setFlags(int flags);
 
 protected:
     int getDeviceNodes(dev_t *devs, int max);
+    int updateDeviceInfo(char *new_path, int new_major, int new_minor);
+    int isDecrypted() { return mIsDecrypted; }
+    int getFlags() { return mFlags; }
 
 private:
     void handleDiskAdded(const char *devpath, NetlinkEvent *evt);