[Sony Xperia XZ1 Compact Guides, News, & Discussion] 痴呆儿童欢乐多:
This post documents a method of enabling Adoptable Storage with adb commands on sony phones where previously similar solutions seem hard to find. Please link similar methods if they exist somewhere else, I am curious to read.

Personal success on SO-02K (NTT DoCoMo XZ1c ) fw version 47.2.B.5.38 Android Pie, 128G A2 card.

The method results in a fraction of the microSD Card being recognised by the system to be able to transfer apps to, and another fraction where the sd card remains external storage.

The Stock Camera will only be able to save to the mentioned external storage partition after this process, and it will fail to save to internal storage.

Some apps may not work when transferred to the sd card and have to stay in onboard storage.

Premise

I carried out the process with a freshly flashed phone, with a minimal amount of apps present in the system. I cannot guarantee same success with an almost-full phone, although in principle it should be the same. If anyone has success on a more full system please let me and others know.

ADB Debugging should be turned on in developer options and authorization of PC given in advance; root or bl unlock not necessary.

SD Card will be WIPED in the process. For your data's safety do backup everything on your phone, both internal memory and external memory before proceeding! Don't yell at me if in the end it'll have to be restored.

Process

adb shell

sm list-disks this should return two integers such as 179,0

sm partition disk:179,0 mixed xx where the 179,0 should be your result in step 2 and xx be the amount of space reserved for /sdcard ; wait until command finishes. For the mixed xx see Miscellaneous#2 for explanation. Please also reply if you know the command to revert the changes made in this step, because I'd expect it be useful in the future and I don't know what it is.

Turn on force allow apps on external in bottom of developer settings if haven't done so.

Open camera app, click on OK until warnings go away, then set save directory in SD Card. Test if it saves successfully, if not, see Miscellaneous#1.

Reboot, then try moving some apps to your sd card! Some core function apps are not movable; that is to be expected.

Miscellaneous

If your camera won't allow you to open up settings (keeps saying cannot save), then you have run into a problem I have never seen before. If you can go into camera settings but the SD Card option is greyed out, that means either you have not reserved enough space in mixed xx or the command may have gone wrong. Or the card may not be in perfect condition for Adoptable Storage. You can unplug the sd card to see if the camera works fine after that, but I haven't tried that. If anyone knows the corresponding command to revert the changes made in Process#3, please let everyone know!

The mixed xx part allows a part of the sd card to remain.... an sd card. xx% of the space in your card will be recognised as external(portable) storage by your phone, and is readable by a PC. This portion will be the place where your future photos and videos are saved in, as the camera will fail saving to internal space. Thus you may want to use the fastest card you have and set xx based on your use patterns. The other part, the (100-xx) % of space is recognised by the phone as internal storage that it can put apps in, although some apps (especially some games) will still save assets in the phone's on board storage no matter where you move the main app.

This post is re-written from original post(chinese)