This paste expires on 2023-05-05 08:01:51.428432. Repaste, or download this paste. . Pasted through web.

@echo off
set whitelist_file=%userprofile%\Desktop\whitelist_initial.txt
if not exist "%whitelist_file%" (
  type nul > "%whitelist_file%"
  echo Whitelist file created: %whitelist_file%
) else (
  echo Whitelist file already exists: %whitelist_file%
)
set adb_path=C:\path\to\adb.exe
set package_name=com.example.app
set logcat_file=%userprofile%\Desktop\logcat.txt
echo Starting logcat...
"%adb_path%" logcat -v time -s "Unity", "MyApp" > "%logcat_file%" 2>&1 &
echo Logcat started. Press any key to stop.
pause >nul
taskkill /f /im adb.exe
echo Logcat stopped. Checking for errors...
if not exist "%logcat_file%" (
  echo Error: logcat file not found.
) else (
  findstr /c:"E/Unity" /c:"E/MyApp" "%logcat_file%" >nul
  if errorlevel 1 (
    echo No errors found in logcat.
  ) else (
    echo Errors found in logcat. Please check %logcat_file% for details.
  )
)
pause
bash version:
#!/bin/bash
# Script to monitor what app is turning your phone's screen on, android (run from a linux PC, requires the android-tools-adb app (the batch script above is the Windows equivallent, I hope).
if [ ! -d "/tmp" ]; then
  mkdir /tmp
fi
if [ ! -f "/tmp/whitelist_initial.txt" ]; then
  touch /tmp/whitelist_initial.txt
fi
# Start listening for changes in the whitelist
adb shell dumpsys deviceidle whitelist > /tmp/whitelist_initial.txt
while true
do
    adb shell dumpsys deviceidle whitelist > /tmp/whitelist_new.txt
    if ! cmp -s /tmp/whitelist_initial.txt /tmp/whitelist_new.txt; then
        echo "Whitelist has changed!"
        diff /tmp/whitelist_initial.txt /tmp/whitelist_new.txt
        # Add your code to determine which item is turning the screen on
        # For example, you can use the following command to check the screen state:
        # adb shell dumpsys power | grep mScreenOn=true
        # You can then use the output of this command to determine which item is causing the screen to turn on
        cp /tmp/whitelist_new.txt /tmp/whitelist_initial.txt
    fi
    sleep 1
done
Filename: monitorWhitelist. Size: 2kb. View raw, , hex, or download this file.