Android Oreo is shaping up to be a developer and enthusiast friendly iteration of our favorite mobile operating system. We have discovered new commands added for theming the device (which has led to non-root Substratum support) and editing battery saver, and the findings didn't stop there. Now we have found a command which allows developers to test how their applications will work on devices with a physical SD card without needing such a device themselves! This is useful for a number of reasons, such as making sure an app can run with the slower speeds of an SD card, or to see what happens when its data is moved to the SD card. The reason this addition is necessary is because many flagship phones (used for development) do not possess an SD card slot.


Enable a Virtual SD Card on Android Oreo

The commit on the AOSP source code for Android Oreo states that a 512-megabyte file is created and mounted as a virtual disk for the system to use as an SD card. This command is accessed via adb. If you haven't yet set up adb, first follow this tutorial.

Once you've got adb up and running, the commands you need are as follows. Note the command takes either "true" or "false", as it is a boolean value.

        adb shell
    
        sm set-virtual-disk true/false
    

Your device will then create and mount a virtual SD card of size 512-megabytes. This virtual SD card is not designed to be used for normal operations, so do not store files inside of it. The virtual disk is strictly for an application developer's testing purposes, used for situations in which one wants to test how their app would function on a real SD card partition. If you are a developer whose only testing device is a Google Nexus or Pixel device (none of which have access to an SD card slot), then you might find this command useful.