[Miscellaneous Android Development] minotauri:
[IMG="XDP-300R TWRP"]https://3.bp.blogspot.com/-7zqvy5m9pVo/XG1qI9KqreI/AAAAAAABOcY/iUsyuFA6SEUwhC9rVGwLOwDwFjRkwqElQCLcBGAs/s1600/52595803_2243285599069280_1572752195558834176_n.jpg[/IMG]

I've been successful at porting over TWRP (Team Win Recovery Project) Recovery to the Pioneer XDP-300R Digital Audio Player! The recovery can be flashed directly over the stock recovery using Fastboot, or you can temporarily boot into it using fastboot.

First off, TWRP, replaces the stock recovery and allows users to backup and restore system, data, boot and other partitions on their player onto their storage or sdcards. It also can install superuser (root) access if you want that feature to allow editing and modifying of the system folder. That opens the door for additional mods.

You can also install Magisk, which is a systemless root feature that is a little safer since it does not touch your system folder, but instead patches the bootloader and then creates a layer above system that stores the mods and changes within the Magisk system in.

First off, I made system image, bootloader and recovery images of the stock 300R prior to going into this full swing. I had already rooted my device using Kingoroot but this is no longer needed and is much more safe now.

So you'll want to get the recovery first.

https://drive.google.com/open?id=1diqQ8LE-yG4b-WZFB_OPcQp2rDUp9BbV

The link in my google drive will take you to a folder where I have backups of my images. The TWRP recovery is located in the Recovery folder, along with the stock Recovery image.

Tools Needed:

Android USB drivers for ADB and Fastboot

ADB and Fastboot

Terminal or Command Prompt

Some basic knowledge on how to use these tools

Pre-Installation:

In android, go to Settings, and turn on Developer Mode. To do this, click Settings, then Device Information, then scroll to Build Number. Tap this several times until you unlock Developer Options.

Now, go back to the Settings Menu and go to the new Developer Options menu. Check the OEM Unlocking option to allow the bootloader to be unlocked.

Installation of TWRP:

1. Download the TWRP image and place it in the same folder as ADB/Fastboot tools.

2. Open a terminal or cmd prompt window and go to the folder in (1)

EXAMPLE: cd /android

3. Turn off the 300R. Then hold next track (the button closest to SD slots) and press power and let go while holding the next track button. A Penguin will appear on screen. Then let go, and plug device into computer.

4. In terminal, check to see if fastboot works.

fastboot devices

5. If it does not show a device, check your drivers! If you see a device, let's go forward!

6. Now we will install the recovery.

First we need to unlock bootloader:

fastboot oem unlock

If you are nervous, and want to verify it works, you can do a temporary test by typing the command:

fastboot boot TWRP-XDP-300R.img

This will boot directly into the TWRP recovery and will go away when you restart. But you can see if it works this way and mounts each folder correctly.

If you're ready to take the plunge, use this command:

fastboot flash recovery TWRP-XDP-300R.img

7. Once it flashes, you can always reboot into recovery by powering off. Then holding PREV TRACK (button closest to power) and power on. It'll show the penguin, and then load recovery soon after.

8. Once you see the TWRP screen youre good to go! I recommend making a System, Data, and Boot backup immediately so you have it ready. I also have the stock recovery in the folder for backup purposes too!

Root Access

When you exit TWRP, you have the option of installing SuperUser (root) access. You're welcome to install or decline it. I recommend using Magisk at this point, by looking up Magisk Manager and loading that onto your device. It'll also provide root access along with other goodies like Xposed, some adblocking stuff, and if you like, Viper4Android, and other mods.

To first start the process of Magisk, you need to unlock the bootloader. Go into Fastboot mode again on the phone, as described above, and go to command prompt:

fastboot oem unlock

This command will unlock the bootloader. In the future, you can lock it by replacing unlock with lock: fastboot oem lock

Magisk only installs correctly when you use the magisk zip file that can be downloading through Magisk Manager. This zip file needs to be flashed in TWRP Recovery. Once you do that, it'll patch the bootloader and allow Magisk to work correctly. You can verify by opening Magisk Manager in Android, and seeing if it is activated.

Once activate, you can click the menu on the left side of the Manager app, and click DOWNLOADS to find a list of modules available for use. Not all are compatible with the older Android Lollipop that is on XDP-300R, so be careful of that.

Magisk Modules

Some modules I use are:

Xposed Framework - another modding system - see below

LKT - tweaks to the kernel for battery management

Magisk Manager for Recovery Mode - Recovery command line manager (seems buggy)

SafeMode4Magisk - Boots into safe mode for disabling bad modules

Swap Torpedo - Optimizes Swap files for RAM management

Youtube Vanced - Themes and removes ads from Youtube

Greenify - adds additional features to Greenify app

Xposed Framework (now systemless using Magisk!)

Some modules I use are:

Amplify - Standalone app that needs Xposed for disabling or reducing amount of system wakelocks and alarms which greatly save battery life

Greenify - Standalone app that hibernates unused apps to save battery life and uses Xposed for additional features

Youtube AdAway - Removes ads from Youtube

BUILD.PROP MODS

The Drive Link at the top of this page has my modified build.prop in it. You can replace your existing build.prop with this if you want. Make sure you make a backup just in case!

Diverting sound away from Android OS to the DAC:

Open up BUILD.PROP in /System in your android device and look for PCM Offload

There are two lines there, that start with audio.offload...

Remove the Hash in front of each of them if they are present and that's it!

it should read:

#PCM offload
audio.offload.pcm.16bit.enable=true
audio.offload.pcm.24bit.enable=true

Also verify that this is enabled:

av.offload.enable=true