/** Device properties. */
private final Map<String, String> mProperties = new HashMap<String, String>();
+ private final Map<String, String> mMountPoints = new HashMap<String, String>();
private final ArrayList<Client> mClients = new ArrayList<Client>();
private DeviceMonitor mMonitor;
return mProperties.get(name);
}
+ public String getMountPoint(String name) {
+ return mMountPoints.get(name);
+ }
+
@Override
public String toString() {
mProperties.put(label, value);
}
+ void setMountingPoint(String name, String value) {
+ mMountPoints.put(name, value);
+ }
+
/**
* {@inheritDoc}
*/
device.executeShellCommand(GetPropReceiver.GETPROP_COMMAND,
new GetPropReceiver(device));
+ queryNewDeviceForMountingPoint(device, IDevice.MNT_EXTERNAL_STORAGE);
+ queryNewDeviceForMountingPoint(device, IDevice.MNT_DATA);
+ queryNewDeviceForMountingPoint(device, IDevice.MNT_ROOT);
+
// now get the emulator Virtual Device name (if applicable).
if (device.isEmulator()) {
EmulatorConsole console = EmulatorConsole.getConsole(device);
}
}
+ private void queryNewDeviceForMountingPoint(final Device device, final String name)
+ throws IOException {
+ device.executeShellCommand("echo $" + name, new MultiLineReceiver() { //$NON-NLS-1$
+ public boolean isCancelled() {
+ return false;
+ }
+
+ @Override
+ public void processNewLines(String[] lines) {
+ for (String line : lines) {
+ if (line.length() > 0) {
+ // this should be the only one.
+ device.setMountingPoint(name, line);
+ }
+ }
+ }
+ });
+ }
+
/**
* Starts a monitoring service for a device.
* @param device the device to monitor.
public final static String DIRECTORY_DATA = "data"; //$NON-NLS-1$
/** Top level sdcard folder. */
public final static String DIRECTORY_SDCARD = "sdcard"; //$NON-NLS-1$
+ /** Top level mount folder. */
+ public final static String DIRECTORY_MNT = "mnt"; //$NON-NLS-1$
/** Top level system folder. */
public final static String DIRECTORY_SYSTEM = "system"; //$NON-NLS-1$
/** Top level temp folder. */
DIRECTORY_DATA,
DIRECTORY_SDCARD,
DIRECTORY_SYSTEM,
- DIRECTORY_TEMP
+ DIRECTORY_TEMP,
+ DIRECTORY_MNT,
};
public static final long REFRESH_RATE = 5000L;
* Returns the extra info for the entry.
* <p/>For a link, it will be a description of the link.
* <p/>For an application apk file it will be the application package as returned
- * by the Package Manager.
+ * by the Package Manager.
*/
public String getInfo() {
return info;
/** @deprecated Use {@link #PROP_BUILD_API_LEVEL}. */
public final static String PROP_BUILD_VERSION_NUMBER = PROP_BUILD_API_LEVEL;
+ public final static String MNT_EXTERNAL_STORAGE = "EXTERNAL_STORAGE"; //$NON-NLS-1$
+ public final static String MNT_ROOT = "ANDROID_ROOT"; //$NON-NLS-1$
+ public final static String MNT_DATA = "ANDROID_DATA"; //$NON-NLS-1$
+
/**
* The state of a device.
*/
public String getProperty(String name);
/**
+ * Returns a mount point.
+ * @param name the name of the mount point to return
+ *
+ * @see #MNT_EXTERNAL_STORAGE
+ * @see #MNT_ROOT
+ * @see #MNT_DATA
+ */
+ public String getMountPoint(String name);
+
+ /**
* Returns if the device is ready.
* @return <code>true</code> if {@link #getState()} returns {@link DeviceState#ONLINE}.
*/
throw new UnsupportedOperationException();
}
+ public String getMountPoint(String name) {
+ throw new UnsupportedOperationException();
+ }
+
public RawImage getScreenshot() throws IOException {
throw new UnsupportedOperationException();
}