[Android Q&A, Help & Troubleshooting] callumw:
Hi guys.

I've been registered here or a long while, but I've run into a brick wall with a customisation I'm trying to do with an old phone and I though that, if someone could help then it may also help someone else that will (no doubt) have the same issue in the future.

I'm comfortable with the basics - rooting and automation (tasker etc), but I'd still consider myself a noob compared to most on this forum.

So here's what I'm doing.

My last phone (Samsung S3) was only worth £20 on the "trade in" sites, so I decided to re-purpose it as a dedicated bluetooth media device that'll live permanently in my motorbike.

I already have a USB connector in there which is spliced into the tail light so it'll only have power when the ignition is on.

So far the build has been straightforward:

Remove SIM

Clear partition

Factory reset

Rooted with ChainFire's AutoRoot (CF-Auto-Root-m0-m0xx-gti9300)

Installed nice to haves (Secure Settings, Greenify, Xposed Installer Modules...)

Setup tasker with 4 simple profiles:

(Power Connected: Lock Screen)

(Power Disconnected: Lock Screen, wait 4 minutes then enter "disconnect" into calendar In/For: -1/2)

(Monitoring calendar for "Disconnect". When found wait 1 minute and if Power is still disconnected then shutdown)

(When BT connected, every 5 minutes max the media volume) [optional] useful if the volume buttons get nudged

So far so good. I also got my BT headset set up so it'll seamlessly switch between my main phone (S6 Calls and GPS) and the "media" S3 phone.

But ... it's this last bit where I'm struggling :(

The phone will be kept either under the seat or in the bike's trunk, so it's not the same as a car setup where you can easily start it up manually, so I'm trying to get the phone to power on when the phone detects power through the charge socket.

I saw there were 2 apps in the play store that claim to be able to do this, but they're rated pretty badly and cost money just to try out.

After a short dig around here I found posts explaining how you can modify an lpm or playlpm file (which is to my understanding the battery power/charge screen) in the /system/bin directory and overwrite it with a reboot command.

And that's where I'm stuck.

I have 2 issues:

1) I have tried to overwrite it ... but it's really awkward to do. Even though I'm rooted, the tools I've used don't seem to be able to truly edit the system folder content as r/w

In the end, I had to use a combination of Root Explorer and ES File explorer to create a new playlpm (ES) in /storage/emulated/0/Downloads, then rename the current /system/bin/playlpm to /system/bin/playlpm.ori (RE)

Then move the file I created in Downloads to the bin folder (ES) and reset the permissions to allow execute all (RE)

Aaaand .... nothing

The only difference now is that when the phone is on charge, the charging screen stays as the grey 'loading' battery and doesn't switch to the green power level battery.

2) All the advise I've seen on here and in StackOverflow is to overwrite or replace the file with ascii code, but the content of my playlpm file looks like it's compiled and if I was to overwrite it then I'm sure it would ... not be happy :)

#!/system/bin/sh
sleep 5
/system/bin/reboot

Question: Do I need to recompile or generate the file in some way so that the S3 will read it (e.g. android-studio-bundle sdk)?

Another way I tried did involve installing the android SDK studio-bundle and running some commands through a command prompt (e.g. fastboot oem-off-mode charge 0) but the Samsung doesn't have a fastboot option afaik and the SDK couldn't connect to the phone ("waiting for devices" after issuing the command) .... and at 5 am I was beginning to see double so had to gave up.

(Source: https://www.youtube.com/watch?v=Zp9G6A6EFlA )

One last way I saw (Source: http://stackoverflow.com/questions/26294258/auto-boot-when-wall-charger-is-plugged) was to remove the /system/bin/charge_only_mode file, but that doesn't exist on my phone.

So that's where I am...

Any advise welcome on how to get this reboot on connection thing working would be greatly appreciated.

Cheers

CW