Motorola Moto G4 Play (motorola-harpia)

The Moto G4 Play is a 2016 budget smartphone by Motorola. It is the lower cost and smaller sibling to the Moto G4. The back panel (called "shell" by motorola) can be lifted off by pulling at the notch on the bottom-right corner of the phone. This exposes the removable battery, microSD and Micro-SIM slots, note that SIM cards can only be added or removed with the battery removed. It comes with a 2800mAh battery and uses the same form-factor as the Motorola Moto G5 (motorola-cedric) for replacement.
== Users owning this device ==
== Contributors ==
* Sorixelle
== How to enter flash mode ==
Hold down + while booting to enter Flash Mode.
== Installation ==
=== Things you need to do in android ===
* in the developer settings of your android installation, you need to enable "OEM unlocking". This step is necessary to enable the bootloader to be unlocked. Here is a guide that describes how you would do that: https://www.getdroidtips.com/unlock-bootloader-moto-g4-play-harpia/
* To unlock your bootloader, you need to have a motorola account (there is no way to avoid that). The reason is, the motorola website needs to generate your OEM unlock key based on the fastboot device ID you need to enter.
Do to that, follow the instructions on the Motorola Support page.
Basically, these are the steps:
* execute fastboot oem get_unlock_data
* merge this result into one large string (remove "(bootloader)" and whitespace
* paste this into the form field on the above website. 
* retrieve your oem unlock key from the email the motorola website has sent you. That is the input in the next step
* execute fastboot oem unlock YOUR_OEM_UNLOCK_KEY
=== Other Preparations ===
Install the lk2nd bootloader, as it is required to handle some quirks
with msm8916 devices on mainline kernels. Flash the lk2nd-msm8916.img image to the boot partition with fastboot flash boot /path/to/lk2nd-msm8916.img. lk2nd
also provides a fastboot interface that allows for flashing kernels without overwriting lk2nd itself. To enter it, power on the device, then hold down Vol Down as soon
as you see the boot splash. You should be presented with a menu that looks like the following:
If you're seeing a "Permission denied", you're not yet within the l2knd bootloader as shown in the photo, wait for the warning splash to occur first, then press buttons as instructed.
$ fastboot flash userdata motorola-harpia-mainline-modem.img
Sending sparse 'userdata' 1/6 (246346 KB) OKAY [ 8.684s]
Writing 'userdata' (bootloader) Permission denied
FAILED (remote: )
fastboot: error: Command failed
When you have lk2nd installed and running, follow Qualcomm_Snapdragon_410/412_(MSM8916)#Installation.
== Usage ==
=== Modem ===
Follow the directions on this wiki page to use the modem. If you have a device model other than what is listed here, please edit the list below
with the results of modem functionality testing.
* XT1602: Modem working, can send and receive text messages. Can initiate and answer phone calls. Mobile data does work only when using the modem files contained on the modem partition.
* XT1603: Modem partially working, can receive text messages. Can initiate with old simcards, always starts on 2G, you can manually change to 3g and 4g, but on newer cards(3g,4g only I suppose) modem do not initiate even with mmcli commands(modem not detected). Sound starts 0db then after a moment it comes to normal. 
* XT1604: Modem working, can send but not receive text messages. Can make phone calls and receive. The Modem doesn't always start on boot, you need to run mmcli -S for it to start working. 
* XT1607: Modem working, can send text messages. Earpiece and Mic1 work with phone calls. Had to manually load RETUS_6.0.1 NON-HLOS firmware, will document and maybe package alternate firmware.
==== Note ====
In some very rare cases the modem may crash at boot, forcing to deal with manual services restarts (like modemmanager), and also creating problems with audio.
Such situation was dealt with successfuly in issue #1973, and here's a quick recap of the problem with a fix for it: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/1973#note_1309848521
=== Touchscreen ===
synaptics s3203b: works ; others: unknown
=== WiFi ===
There used to be issues on various devices where Wi-Fi didn't work properly with certain Wi-Fi channels or the 80.211n mode, but this should no longer happen on pmOS v23.06+ (and edge). For older versions, see https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/1085#note_1220953940 for a possible workaround.
== Hardware / sensor details ==
Output from hwtest:
hwtest
Category 	Model 	Path 	Status 	Value
framebuffer 	msmdrmfb 	/sys/class/graphics/fb0 	Working	U:720x1280p-0
drm 	 	/sys/class/drm/card0-DSI-1 	Working	720x1280
accelerometer	bma253 	/sys/bus/iio/devices/iio:device1	Working	1.13, 0.11, -9.54 g
temperature 	bma253 	/sys/bus/iio/devices/iio:device1	Working	15.5 deg C
input 	msm8916 Headset Jack	/dev/input/event5 	Working	
input 	Synaptics Harpia 	/dev/input/event3 	Working	
input 	GPIO Buttons 	/dev/input/event2 	Working	
input 	pm8941_resin 	/dev/input/event1 	Working	
input 	pm8941_pwrkey 	/dev/input/event0 	Working	
Output from sensors (lm-sensors package):
sensors
max170xx_battery-virtual-0
Adapter: Virtual device
temp1: +29.9C 
max170xx_battery-i2c-0-36
Adapter: QUP I2C adapter
in0: 4.36 V (min = +3.64 V, max = +4.40 V)
 (avg = +4.36 V)
temp: +29.9C (low = -20.0C, high = +60.0C) ALARM (LOW)
curr1: 1000.00 uA (avg = +0.00 A)
For reference, the results from sensorssandbox (v1.8, f-droid). The sensor suite seems sparse, typical of "play" variant.
sensorssandbox
Name 	Vendor 	Comment
3-axis Accelerometer	Bosch 	bma25x-accel
Ambient light 	Elan 	
Proximity 	Elan 	
Flat up 	Motorola	
Flat down 	Motorola	
Stowed 	Motorola	
Glance gesture 	Motorola	
== See also ==
* 
* Development kernel tree
* A nice installation video by Linmob (does not include bootloader unlocking instructions.) 
Category:Devices with known UART pinout