[Galaxy Tab Pro 12.2, 10.1, 8.4 Android Development] robert1968:
Shutdown when screen is off.

Hi Thompatry.

Glory days! : I resolved the shutdown issue when screen is off. :)

Problem: TAB Pro shutting down after a few second - minutes when screen is off.

I was total clueless for month and ask help everywhere, but not got answer until i read this Post: forum.xda

Based on His advice shortly:

Other devices also suffer from the issue, battery temp was falsely reported by the android system as "high" and that is triggering a shutdown. (while in reality the battery and device is cold! )

You can record it in logcat:

ActivityManager: START u0 {act=android.intent.action.ACTION_REQUEST_SHUTDOWN flg=0x10000000 cmp=android/com.android.internal.app.ShutdownActivity (has extras)} from uid 1000 on display 0

Solution was to modify one line in classes.dex file -from the services.jar :

"android.intent.action.ACTION_REQUEST_SHUTDOWN" to replace to "ACTION_BATTERY_OKAY"

Based on his advise I

1. download /system/framework/services.jar to pc.

(Set ADB Wifi in Developper Settings - (trick to have it - 7 times click on build number (under Settings - About device) )

adb connect 192.168.178.22:5555

adb pull /system/framework/services.jar*

2. extract classes.dex from services.jar

3. download baksmali-2.2.6.jar and smali-2.2.6.jar from https://bitbucket.org/JesusFreke/smali/downloads/

3. decompile classes.dex with this:

java -Xmx1024m -jar baksmali.jar d classes.dex

it will create ./out directory

4 then you will find four "ACTION_REQUEST_SHUTDOWN" occurrence in 3 files under ./out directory:

BatteryService.smali
BatteryService.smali
BatteryService$4.smali
BatteryService$5.smali

5. Replace "ACTION_REQUEST_SHUTDOWN" with "ACTION_BATTERY_OKAY"

only in BatteryService$4.smali and BatteryService$5.smali files.

(only this 2 lines.)

6. delete original classes.dex

6. Then compile back classes.dex based on (from) the out directory

java -jar smali.jar a -o classes.dex out/

7. put back the new modified classes.dex to the services.jar with zip

8. move back services.jar to tablet

adb push services.jar /sdcard/Download

9. copy modified service.jar to /system/framework set file property to -rw-r-r

4. reboot your tablet and enjoy. :)

Now i have this logcat :)

02-04 19:34:33.783 2763 2763 I ActivityManager: START u0 {act=android.intent.action.ACTION_BATTERY_OKAY flg=0x10000000 (has extras)} from uid 1000 on display 0
02-04 19:34:33.798 2763 2763 I ActivityManager: START u0 {act=android.intent.action.ACTION_BATTERY_OKAY flg=0x10000000 (has extras)} from uid 1000 on display 0
.
.
.
02-04 19:34:53.038 2763 2763 I ActivityManager: START u0 {act=android.intent.action.ACTION_BATTERY_OKAY flg=0x10000000 (has extras)} from uid 1000 on display 0

NO Shutdown At All!!!!! :)

If anyone had the same issue and would like use my work because not want to do decompile/compile thing then follow this instruction:

0. Upgrade to lineage-14.1-20190126-UNOFFICIAL-v2awifi

1. Download View attachment services.jar - this is modified by me. Only the two lines are modified. trust me.

2. with any root explorer (i prefer ES File Explorer (settings- root explorer - enabled) delete /system/framework/services.jar

3. copy modified service.jar to /system/framework set file property to -rw-r-r

4. reboot your tablet and enjoy. :)

Best regards,

Robert