@echo off
setlocal EnableExtensions
if "%~1"=="" (
  echo Usage: oneplus8t-push-settings-safe.bat SERIAL
  exit /b 1
)
set "SERIAL=%~1"
set "ADB=adb"
set "APK=Settings-kebab-uvc-20261002.apk"
echo %SERIAL%| findstr /C:":" >nul && "%ADB%" connect %SERIAL%
"%ADB%" -s "%SERIAL%" root
"%ADB%" -s "%SERIAL%" remount
if errorlevel 1 exit /b 1
if not exist "%APK%" exit /b 1
"%ADB%" -s "%SERIAL%" push "%APK%" /system_ext/priv-app/Settings/Settings.apk
"%ADB%" -s "%SERIAL%" shell chmod 644 /system_ext/priv-app/Settings/Settings.apk
"%ADB%" -s "%SERIAL%" shell rm -rf /system_ext/priv-app/Settings/oat
"%ADB%" -s "%SERIAL%" shell restorecon -RF /system_ext/priv-app/Settings
"%ADB%" -s "%SERIAL%" reboot
echo Done.
endlocal
