Set MTP as default for USB on Android 7.1.2 / LineageOS 14.1 on SM-T280 - General Questions and Answers

Hey,
I'm running LineageOS 14.1 (Android 7.1.2) on an SM-T280. It's also rooted.
Whenever I reboot and connect USB, it only enables adb and charges. I want it to enable adb and mtp by default.
I know about the setting in the developer options, but this also is not persistent.
How do I enable MTP by default?

In Android's system file build.prop add MTP as default USB-mode
Code:
persist.sys.usb.config=mtp,adb

xXx yYy said:
In Android's system file build.prop add MTP as default USB-mode
Code:
persist.sys.usb.config=mtp,adb
Click to expand...
Click to collapse
Tried, does not work. When I reboot I get this:
Code:
gtexswifi:/ # cat /system/build.prop | grep usb
persist.sys.usb.config=mtp,adb
sys.usb.gser.count=8
sys.usb.config=mtp,adb
persist.sys.usb.config=mtp,adb
sys.usb.configfs=1
gtexswifi:/ # getprop | grep usb
[persist.sys.usb.config]: [adb]
[sys.usb.config]: [adb]
[sys.usb.configfs]: [0]
[sys.usb.ffs.ready]: [1]
[sys.usb.gser.count]: [8]
[sys.usb.state]: [adb]
gtexswifi:/ # ls /data/property/ | grep usb
persist.sys.usb.config
gtexswifi:/ # cat /data/property/persist.sys.usb.config
adb
Of course I also tried setprop persist.sys.usb.config "mtp,adb" which modifies /data/property/persist.sys.usb.config but this is reset on reboot.
I've found many websites that say it is simply not possible on Nougat :/
I also found https://forum.xda-developers.com/t/app-root-r-3-3-marshmallow-mtp-enabler.3263467/ but I don't want to install an app :/ I'm curious how it does it.
When I setprop sys.usb.config "mtp,adb" while the device is running, usb disconnects and reconnects, but there is still no MTP available.

Also tried
Bash:
echo 0 > /sys/class/android_usb/android0/enable
echo mtp,adb > /sys/class/android_usb/android0/functions
echo 1 > /sys/class/android_usb/android0/enable
The device disconnects and reconnects from USB but only with adb enabled and
Code:
gtexswifi:/ # cat /sys/class/android_usb/android0/functions
ffs
afterwards
Source: https://books.google.de/books?id=0cuQAwAAQBAJ&pg=PA64&lpg=PA64&dq="android_usb/android0/enable"+mtp

Okay, I wen't through the effort to recompile the kernel and patch the init ramdisks /default.prop with
Code:
persist.sys.usb.config=adb,mtp
sys.usb.config=adb,mtp
Didn't help...
Any other ideas?

Related

[Q] Trying to establish adb connection

Hi all.
I'm attempting to root my phone via ZergRush's one click root. However I am on linux and i do not have a usb cable.
I downloaded the android-sdk for linux and have set up ftp/ssh on my Zte score. The problem is whenever I try to adb connect 10.10.0.25 adb does not connect with the device. I can ping my phone from my computer so it's reachable. If I try adb connect 10.10.0.25:2121 (FTP PORT) or 2222 (SSH PORT) it connect but outputs: "Device offline" and I can't run any successful commands.
I heard ssh tunneling is possible and would like to know if anybody knew the exact steps. I've tried:
# ssh [email protected] -p 2222 -R 5555:localhost:5037
and
# ssh -NR 5555:localhost:5037 [email protected] -p 2222
The latter connects through ssh but adb doesn't connect through the tunnel. The former outputs "Connection closed by remote host"
I checked the open ports on my phone and noticed 5555 isn't open so that means i must open it with setprop service.adb.tcp.port 5555 which I tried but still doesn't work. The command does go through though.
Appearantly, setprop didn't work as getprop service.adb.tcp.port 5555 outputs nothing.
Is there any way I can enable adbd to listen on my phone? I got a ssh and ftp shell up and running w/o root.
/mnt/sdcard $ getprop | grep adb
[persist.service.adb.enable]: [1]
[persist.radio.adb_log_on]: [0]
[persist.adb.trace_mask]: [1]
[init.svc.adbd]: [running]
It doesn't show service.adb.tcp.port so I can't set it. Is there a way for me to create this key? Help will be much appreciated! =)
EDIT:
Is there a way for me to chmod without root or adb? I tried chmod 777 exploit but it outputs permission denied. I'm going to see if I can change permissions some other way.
Anyone?
No luck googling for an answer.
Should I just wait and get a data usb cable?

[Q] 4.3 update (touchwiz) - no codes work anymore - how do I QPST now?

original firmware had a number of hidden codes that you put into dialer and it does stuff. None of them work anymore. Particularly the ones I care about are:
*#22745927 to enable hidden menu.
*#7284# to switch the UART and USB from PDA to MODEM (so that I could program PRL with QPST)
*#0*# hardware test
Are there alternatives?..
No.
Sent from my Last Ever Samsung Device.
0331 said:
No.
Sent from my Last Ever Samsung Device.
Click to expand...
Click to collapse
On the older firmwares there was an IOTHiddenMenu activity which you could invoke using
Code:
am start com.android.hiddenmenu/com.android.hiddenmenu.IOTHiddenMenu
command, but that doesn't work on 4.3
I know in AOSP there was a notion to turn into QPST mode by writing to kernel pseudo-files...
Engineers got to somehow be able to reprogram these phones, there's no way Samsung disabled this completely
I dug out some old scripts for AOSP, which seem to work. Device was accessible in QPST-programmable mode after them:
Code:
#/system/bin/sh
# sets DIAG mode
echo 0 > /sys/class/android_usb/android0/enable
echo 04E8 > /sys/class/android_usb/android0/idVendor
echo 6860 > /sys/class/android_usb/android0/idProduct
echo diag > /sys/class/android_usb/android0/f_diag/clients
echo 1 > /sys/class/android_usb/android0/f_acm/instances
echo diag,acm,adb > /sys/class/android_usb/android0/functions
cat /sys/class/android_usb/android0/functions
echo 1 > /sys/class/android_usb/android0/enable
start adbd
setprop sys.usb.state sys.usb.config
and to go back to MTP:
Code:
#/system/bin/sh
# sets default USB mode
echo 0 > /sys/class/android_usb/android0/enable
echo 04E8 > /sys/class/android_usb/android0/idVendor
echo 6860 > /sys/class/android_usb/android0/idProduct
echo 1 > /sys/class/android_usb/android0/f_acm/instances
echo mtp,acm,adb > /sys/class/android_usb/android0/functions
echo 1 > /sys/class/android_usb/android0/enable
start adbd
setprop sys.usb.state sys.usb.config

[GUIDE][SCRIPT] rsync backup over USB + adb with Lineage 14.x

Hello together,
as Lineage 13.0+ already includes the rsync binary, backing up the phone via rsync over USB + adb is fast and convenient. The only "downside" is that you need a phone with root access.
While everything worked fine for months with Lineage 13.0, rsync gave strange error messages on the client after updating to Lineage 14.1.
Output on the PC side looked like this:
Code:
+ adb shell 'umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf' &
@RSYNCD: 31.0
Notice the "@RSYNCD: 31.0" protocol tag in the output.
To make a long story short, "rsync --daemon" on the phone side thinks it's invoked via inetd.
rsync's "inetd mode" gets activated automatically if the stdin of the rsync process is a socket. There's no way to switch that off. Probably the internal semantics how adb shell works changed a bit in Android Nougat.
Luckily there's a workaround in the adb shell command: Allocate a pty with the "-t" option.
The original invocation line
Code:
adb shell 'umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf' &
becomes
Code:
adb shell -t -t 'umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf' &
Notice the double '-t' in there: This forces the allocation of a PTY, it won't work with a single '-t' if the adb shell command is forked into background with '&'.
Here's the complete backup script for a Galaxy S5, adapt the exclusion list to your needs:
Code:
#!/bin/bash
set -u
BASEDIR=/data/MY_BACKUP_DESTINATION
TARGET=$BASEDIR/android
# generate random secret
secret=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev)
#log to logger
exec 2>&1 | logger
if ! test -d "$TARGET"; then
echo "could not find directory: $TARGET"
exit 1
fi
set -x
LOCALPORT=5000
RSYNCPORT=873
echo "Waiting for device"
adb wait-for-device
adb root
adb wait-for-device
adb shell "umask 077 && test ! -d /storage/emulated/0/rsyncd && mkdir -p /storage/emulated/0/rsyncd"
adb shell "umask 077 && printf 'backup:$secret\n' > /mnt/secure/rsyncd.secrets"
adb shell "umask 077 && printf 'address = 127.0.0.1\npid file = /mnt/secure/rsyncd.pid\nuid = root\ngid = root\n[root_all]\n\tpath = /\n\thosts allow = 127.0.0.1\n\tauth users = backup\n\tsecrets file = /mnt/secure/rsyncd.secrets\n' > /mnt/secure/rsyncd.conf"
adb shell -t -t "umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf" &
# give rsync daemon time to start
sleep 2
adb forward tcp:$LOCALPORT tcp:$RSYNCPORT
RSYNC_PASSWORD=$secret rsync -av --delete \
--exclude /dev \
--exclude /acct \
--exclude /sys \
--exclude /mnt/sdcard \
--exclude /mnt/user/0 \
--exclude /mnt/runtime \
--exclude /mnt/media_rw \
--exclude /proc \
--exclude '/data/media/0/Android/data/net.osmand.plus/files/*.obf' \
--exclude /data/media/0/Android/data/net.osmand.plus/files/wiki \
--exclude /data/data/org.cyanogenmod.gello.browser/cache/Cache \
--exclude /data/media/0/Movies \
--exclude /data/media/0/Music \
--exclude /data/dalvik-cache \
--exclude /storage/emulated \
--exclude /storage/0000-000A \
rsync://[email protected]:$LOCALPORT/root_all/ $TARGET/
: rc $?
adb forward --remove tcp:$LOCALPORT
# kill rsyncd
adb shell 'test -f /mnt/secure/rsyncd.pid && kill $(cat /mnt/secure/rsyncd.pid)'
# remove temporary files
adb shell rm -f /mnt/secure/rsyncd.conf /mnt/secure/rsyncd.pid /mnt/secure/rsyncd.secrets
The script is based on this blog post originally:
https://blog.josefsson.org/2015/11/28/automatic-android-replicant-backup-over-usb-using-rsync/
Hope this saves others some time when migrating to Lineage 14.x
Cheers,
Thomas
A real genius post. I was stuck at passing -t flag.
Thanks!
@thomasjfox are you still using this method on LineageOS 18? Has anything changed in the intervening time?
I am able to get the daemon to start, and to use rsync from within the ADB shell, but from my PC I can't get rsync to connect. adb forwarding --list reveals that my port forwarding is set up correctly. I get the error:
rsync: safe_read failed to read 1 bytes [Receiver]: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(285) [Receiver=3.1.3]

need help about rooting

i can't root Samsung galaxy a02 -- SM-A022F/DS Build No: A022FXXU2BUI3 , android 11 , i dont know what to do for rooting and i dont have firmware file (bootloader unlocked)
To get the superuser access ( AKA root ) to be able to control various aspects of Android OS means you need to perform a certain modification that will root your phone's Android. An unlocked bootloader isn't needed to root Android.
Here is what you have to do to root your device's Android:
Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5.
This e.g. can get achieved by means of a Windows command script making use of ADB coomands.
jwoegerbauer said:
To get the superuser access ( AKA root ) to be able to control various aspects of Android OS means you need to perform a certain modification that will root your phone's Android. An unlocked bootloader isn't needed to root Android.
Here is what you have to do to root your device's Android:
Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5.
This e.g. can get achieved by means of a Windows command script making use of ADB coomands.
Click to expand...
Click to collapse
hi , i dont know what is toybox or i dont know really what to do can you tell me step by step please? i have ADB already
dleaderp said:
hi , i dont know what is toybox or i dont know really what to do
Click to expand...
Click to collapse
Typically people do a Google search like "Android Toybox" ...
To save you this search: Toybox is a suite of Linux commands ported to Android.
The commands supported are
Code:
acpi arch ascii base64 basename blkid blockdev bunzip2 bzcat cal cat
catv chattr chgrp chmod chown chroot chrt chvt cksum clear cmp comm
count cp cpio crc32 cut date devmem df dirname dmesg dnsdomainname
dos2unix du echo egrep eject env expand factor fallocate false fgrep
file find flock fmt free freeramdisk fsfreeze fstype fsync ftpget
ftpput getconf grep groups gunzip halt head help hexedit hostname
hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd
insmod install ionice iorenice iotop kill killall killall5 link ln
logger login logname losetup ls lsattr lsmod lspci lsusb makedevs
mcookie md5sum microcom mix mkdir mkfifo mknod mkpasswd mkswap mktemp
modinfo mount mountpoint mv nbd-client nc netcat netstat nice nl nohup
nproc nsenter od oneit partprobe passwd paste patch pgrep pidof ping
ping6 pivot_root pkill pmap poweroff printenv printf prlimit ps pwd
pwdx readahead readlink realpath reboot renice reset rev rfkill rm
rmdir rmmod sed seq setfattr setsid sha1sum shred sleep sntp sort
split stat strings su swapoff swapon switch_root sync sysctl tac tail
tar taskset tee test time timeout top touch true truncate tty tunctl
ulimit umount uname uniq unix2dos unlink unshare uptime usleep uudecode
uuencode uuidgen vconfig vmstat w watch wc which who whoami xargs
xxd yes zcat
As you might see su is the ROOT functionality.
dleaderp said:
can you tell me step by step please? i have ADB already
Click to expand...
Click to collapse
Actually I'm working on a Windows command script that makes use of ADB what does the job. I'll publish it here when finished:
[TOOL][ADB]][Windows] A 100% Safe Non-systemless Root Tool - No Soft-bricked Adroid Guaranteed
Grant Root Privileges to Regular Users Using Devices With Android 6 and up by Simply Upgrading Android's Multi-command Applet Toybox.
forum.xda-developers.com
jwoegerbauer said:
Actually I'm working on a Windows command script that makes use of ADB what does the job. I'll publish it here when finished:
Click to expand...
Click to collapse
happy to hear that xd
i got a last question, i think my phone's storage is shrunked after i used firmware is it possible ? if yes how can i fix it. it was 32 gb now its 8gb
i fixed i used another firmware i'll be wait for your ADB

How To Guide BANKING APPS: How to modify build.Prop using recovery (and more...)

Ok, after some reading, testing and trying, my conclusion is that it is not possible to tweak a running system with not triggering SELinux.
Though, for letting banking apps work it is only needed to modify the build.prop in /system, which is in fact possible, even without TWRP.
So, this is what I am doing now:
Reboot into (LOS) recovery and then in the recovery menu:
Goto “Advanced”
Mount /system
Enable adb
From your pc with adb etc.. installed:
Code:
adb shell mount -o rw,remount /mnt/system
adb shell sed -i 's/ro.debuggable=1/ro.debuggable=0/g' /mnt/system/system/build.prop
adb shell sed -i 's/ro.build.type=userdebug/ro.build.type=user/g' /mnt/system/system/build.prop
adb reboot
That's it, banking apps working!
Okay, did some further research and in fact, found a solution for my "tweaking".
Though I have the feeling most people are not tweaking anymore, I hope it helps for the few people still interested! For me the result is a more lean system, working banking apps and HD calling (VoLTE), and it is just nice to do... ;-)
Scripts and approach can be found in the next posts.
After some boot issues I finally found out what was the issue of my problems with some tweaking around.
As we have a device with A/B, after flashing the update, the active partition is automatically switched after an update. This happens when flashing, so you have to reboot to recovery again directly after flashing the updated LOS and do the tweaking then to actually tweak the right partition...
A system update for me is now:
Code:
Reboot into recovery
CHECK WHICH IS THE ACTIVE PARTITION!!
Goto “Apply Update”
Goto “Apply from adb”
adb sideload <lineageos.zip>
Goto “Advanced”
Goto “Reboot to recovery”
CHECK WHICH IS THE ACTIVE PARTITION, SHOULD BE CHANGED!!
In recovery:
Goto “Advanced”
Goto “Mount /system”
Goto “Enable ADB”
Run tweak.bat
For the latest tweak script (a bat file) I am using now, see the next post.
Hope it helps for people with banking or VoLTE issues and the need to change some settings in build.prop or else... Use the information at your own risk
Latest tweaks.bat file (last changes 25/04/2023):
Code:
:: Moto G100 Tweak Script
:: Last modified 25-04-2023
:: Moto-J
:: ------------------------------------------------------------
:: Changelog:
::
:: 22-04-23 Added:
:: adb shell rm -rf /mnt/product/app/ApertureLensLauncher
:: adb shell rm -rf /mnt/system_ext/app/MotoActions
:: adb shell rm -rf /mnt/system_ext/app/WAPPushManager
:: adb shell rm -rf /mnt/system_ext/priv-app/LineageSetupWizard
:: ------------------------------------------------------------
@echo off
Setlocal EnableDelayedExpansion
color 0A
cls
echo MOTO G100 TWEAK SCRIPT
echo.
echo IMPORTANT:
echo - First boot into recovery
echo - Goto advanced and mount /system
echo - Goto advanced and enable adb
echo.
pause
echo.
echo ------------------------------------
echo Connecting device...................
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
adb devices
:: ------------------------------------------------------------
echo ------------------------------------
echo Mounting system partitions..........
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
:: /dev/block/dm-6 = /product
:: /dev/block/dm-7 = /system
:: /dev/block/dm-8 = /system_ext
:: /dev/block/dm-9 = /vendor
adb shell mkdir /mnt/product > nul 2>&1
adb shell mkdir /mnt/system > nul 2>&1
adb shell mkdir /mnt/system_ext > nul 2>&1
adb shell mkdir /mnt/vendor > nul 2>&1
adb shell mount -o rw,remount /mnt/system
adb shell mount /dev/block/dm-6 /mnt/product
adb shell mount /dev/block/dm-7 /mnt/system > nul 2>&1
adb shell mount /dev/block/dm-8 /mnt/system_ext
adb shell mount /dev/block/dm-9 /mnt/vendor
echo.
echo done
echo.
pause
echo.
:: ------------------------------------------------------------
echo ------------------------------------
echo Removing some packages..............
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
:: /product/app
adb shell rm -rf /mnt/product/app/Aperture
adb shell rm -rf /mnt/product/app/ApertureLensLauncher
adb shell rm -rf /mnt/product/app/Backgrounds
adb shell rm -rf /mnt/product/app/Gallery2
adb shell rm -rf /mnt/product/app/Jelly
adb shell rm -rf /mnt/product/app/PhotoTable
adb shell rm -rf /mnt/product/app/PowerOffAlarm
:: /product/priv-app
adb shell rm -rf /mnt/product/priv-app/Eleven
adb shell rm -rf /mnt/product/priv-app/OneTimeInitializer
:: /system/app
adb shell rm -rf /mnt/system/system/app/BasicDreams
adb shell rm -rf /mnt/system/system/app/BluetoothMidiService
adb shell rm -rf /mnt/system/system/app/BookmarkProvider
adb shell rm -rf /mnt/system/system/app/CaptivePortalLogin
adb shell rm -rf /mnt/system/system/app/CarrierDefaultApp
adb shell rm -rf /mnt/system/system/app/CompanionDeviceManager
adb shell rm -rf /mnt/system/system/app/EasterEgg
adb shell rm -rf /mnt/system/system/app/HTMLViewer
adb shell rm -rf /mnt/system/system/app/PrintRecommendationService
adb shell rm -rf /mnt/system/system/app/SimAppDialog
adb shell rm -rf /mnt/system/system/app/Stk
adb shell rm -rf /mnt/system/system/app/WallpaperBackup
:: /system/priv-app
adb shell rm -rf /mnt/system/system/priv-app/BackupRestoreConfirmation
adb shell rm -rf /mnt/system/system/priv-app/CallLogBackup
adb shell rm -rf /mnt/system/system/priv-app/InputDevices
adb shell rm -rf /mnt/system/system/priv-app/LiveWallpapersPicker
adb shell rm -rf /mnt/system/system/priv-app/ManagedProvisioning
adb shell rm -rf /mnt/system/system/priv-app/SharedStorageBackup
adb shell rm -rf /mnt/system/system/priv-app/StatementService
adb shell rm -rf /mnt/system/system/priv-app/Tag
adb shell rm -rf /mnt/system/system/priv-app/VpnDialogs
:: /system_ext/app
adb shell rm -rf /mnt/system_ext/app/datastatusnotification
adb shell rm -rf /mnt/system_ext/app/IfaaService
adb shell rm -rf /mnt/system_ext/app/MotoActions
adb shell rm -rf /mnt/system_ext/app/SoterService
adb shell rm -rf /mnt/system_ext/app/WAPPushManager
:: /system_ext/priv-app
adb shell rm -rf /mnt/system_ext/priv-app/LineageSetupWizard
adb shell rm -rf /mnt/system_ext/priv-app/Seedvault
adb shell rm -rf /mnt/system_ext/priv-app/Updater
:: /vendor/app
adb shell rm -rf /mnt/vendor/app/TimeService
:: For debugging purposes:
adb shell ls /mnt/product/app > _packages-product-app.txt
adb shell ls /mnt/product/priv-app > _packages-product-priv-app.txt
adb shell ls /mnt/system/system/app > _packages-system-system-app.txt
adb shell ls /mnt/system/system/priv-app > _packages-system-system-priv-app.txt
adb shell ls /mnt/system_ext/app > _packages-system_ext-app.txt
adb shell ls /mnt/system_ext/priv-app > _packages-system_ext-priv-app.txt
adb shell ls /mnt/vendor/app > _packages-vendor-app.txt
echo.
echo done
echo.
pause
echo.
:: ------------------------------------------------------------
echo ------------------------------------
echo Modifying /system/build.prop........
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
:: First remove the lines if available
adb shell sed -i '/^# Modified settings/d' /mnt/system/system/build.prop
adb shell sed -i '/^ro.debuggable/d' /mnt/system/system/build.prop
adb shell sed -i '/^ro.build.type/d' /mnt/system/system/build.prop
adb shell sed -i '/^fw.show_multiuserui/d' /mnt/system/system/build.prop
adb shell sed -i '/^fw.power_user_switcher/d' /mnt/system/system/build.prop
adb shell sed -i '/^fw.show_hidden_users/d' /mnt/system/system/build.prop
adb shell sed -i '/^ro.backup.disable/d' /mnt/system/system/build.prop
adb shell sed -i '/^ro.config.ksm.support/d' /mnt/system/system/build.prop
adb shell sed -i '/^persist.debug.wfd.enable/d' /mnt/system/system/build.prop
adb shell sed -i '/^persist.debug.wfd.appmonitoring/d' /mnt/system/system/build.prop
adb shell sed -i '/^debug.sf.enable_hwc_vds/d' /mnt/system/system/build.prop
adb shell sed -i '/^persist.adb.notify/d' /mnt/system/system/build.prop
adb shell sed -i '/^# end of file/d' /mnt/system/system/build.prop
:: And now add them at the end of the file
adb shell sed -i -e '$a# Modified settings' /mnt/system/system/build.prop
:: Let banking apps work
adb shell sed -i -e '$aro.debuggable=0' /mnt/system/system/build.prop
adb shell sed -i -e '$aro.build.type=user' /mnt/system/system/build.prop
:: Disable user switching
adb shell sed -i -e '$afw.show_multiuserui=0' /mnt/system/system/build.prop
adb shell sed -i -e '$afw.power_user_switcher=0' /mnt/system/system/build.prop
adb shell sed -i -e '$afw.show_hidden_users=0' /mnt/system/system/build.prop
:: Disable backup provider
adb shell sed -i -e '$aro.backup.disable=1' /mnt/system/system/build.prop
:: Disable Kernel Samepage Merging (KSM)
adb shell sed -i -e '$aro.config.ksm.support=false' /mnt/system/system/build.prop
:: Disable Mira Cast (Wifi Direct) eating your battery
adb shell sed -i -e '$apersist.debug.wfd.enable=0' /mnt/system/system/build.prop
adb shell sed -i -e '$apersist.debug.wfd.appmonitoring=0' /mnt/system/system/build.prop
adb shell sed -i -e '$adebug.sf.enable_hwc_vds=0' /mnt/system/system/build.prop
:: Disable notification while adb is active
adb shell sed -i -e '$apersist.adb.notify=0' /mnt/system/system/build.prop
adb shell sed -i -e '$a# end of file' /mnt/system/system/build.prop
:: For debugging purposes:
adb pull /mnt/system/system/build.prop
del /F _build.system.prop > nul 2>&1
ren build.prop _build.system.prop
echo.
echo done
echo.
pause
echo.
:: ------------------------------------------------------------
echo ------------------------------------
echo Modifying /vendor/build.prop........
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
:: First remove the lines if available
adb shell sed -i '/^# Modified settings/d' /mnt/vendor/build.prop
:: Firmware date
adb shell sed -i '/^ro.vendor.build.security_patch/d' /mnt/vendor/build.prop
:: Display
adb shell sed -i '/^debug.hwui.disable_vsync/d' /mnt/vendor/build.prop
adb shell sed -i '/^debug.hwui.render_dirty_regions/d' /mnt/vendor/build.prop
adb shell sed -i '/^persist.sys.use_dithering/d' /mnt/vendor/build.prop
adb shell sed -i '/^ro.sf.lcd_density/d' /mnt/vendor/build.prop
:: VoLTE (only what is missing)
adb shell sed -i '/^persist.dbg.ims_volte_enable/d' /mnt/vendor/build.prop
adb shell sed -i '/^persist.dbg.volte_avail_ovr/d' /mnt/vendor/build.prop
adb shell sed -i '/^persist.dbg.vt_avail_ovr/d' /mnt/vendor/build.prop
adb shell sed -i '/^persist.dbg.wfc_avail_ovr/d' /mnt/vendor/build.prop
adb shell sed -i '/^persist.vendor.radio.calls.on.ims/d' /mnt/vendor/build.prop
adb shell sed -i '/^persist.vendor.data.iwlan.enable/d' /mnt/vendor/build.prop
adb shell sed -i '/^# end of file/d' /mnt/vendor/build.prop
:: And now add them at the end of the file
adb shell sed -i -e '$a# Modified settings' /mnt/vendor/build.prop
:: Firmware date
set CUR_YYYY=%date:~9,4%
set CUR_MM=%date:~6,2%
set CUR_DD=%date:~3,2%
set SUBDATE=%CUR_YYYY%-%CUR_MM%-%CUR_DD%
adb shell sed -i -e '$aro.vendor.build.security_patch=%SUBDATE%' /mnt/vendor/build.prop
:: Display
adb shell sed -i -e '$adebug.hwui.disable_vsync=true' /mnt/vendor/build.prop
adb shell sed -i -e '$adebug.hwui.render_dirty_regions=false' /mnt/vendor/build.prop
adb shell sed -i -e '$apersist.sys.use_dithering=0' /mnt/vendor/build.prop
adb shell sed -i -e '$aro.sf.lcd_density=460' /mnt/vendor/build.prop
:: VoLTE (only what is missing)
adb shell sed -i -e '$apersist.dbg.ims_volte_enable=1' /mnt/vendor/build.prop
adb shell sed -i -e '$apersist.dbg.volte_avail_ovr=1' /mnt/vendor/build.prop
adb shell sed -i -e '$apersist.dbg.vt_avail_ovr=1' /mnt/vendor/build.prop
adb shell sed -i -e '$apersist.dbg.wfc_avail_ovr=1' /mnt/vendor/build.prop
adb shell sed -i -e '$apersist.vendor.radio.calls.on.ims=1' /mnt/vendor/build.prop
adb shell sed -i -e '$a# end of file' /mnt/vendor/build.prop
:: FOR VOLTE CHECK, DIAL *#*#4636#*#*, PHONE INFORMATION - 3DOTS MENU - IMS SERVICE STATUS
::
:: Complete VoLTE settings:
::
:: # Debug Options
:: persist.dbg.ims_volte_enable=1
:: persist.dbg.volte_avail_ovr=1
:: persist.dbg.vt_avail_ovr=1
:: persist.dbg.wfc_avail_ovr=1
::
:: # Data Options
:: # Commented this line out as it was reported to break WiFi calling on some carriers.
:: # persist.data.iwlan.enable=true
::
:: # Radio Options
:: persist.radio.rat_on=combine (OR persist.vendor.radio.rat_on=combine)
:: persist.radio.data_ltd_sys_ind=1 (OR persist.vendor.radio.data_ltd_sys_ind=1)
:: persist.radio.data_con_rprt=1 (OR persist.vendor.radio.data_con_rprt=1)
:: persist.radio.calls.on.ims=1 (OR persist.vendor.radio.calls.on.ims=1)
:: For debugging purposes:
adb pull /mnt/vendor/build.prop
del /F _build.vendor.prop > nul 2>&1
ren build.prop _build.vendor.prop
echo.
echo done
echo.
pause
echo.
:: ------------------------------------------------------------
echo ------------------------------------
echo Proper unmount partitions...........
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
adb shell umount /mnt/product
adb shell umount /mnt/system
adb shell umount /mnt/system_ext
adb shell umount /mnt/vendor
echo.
echo done
echo.
pause
echo.
:: ------------------------------------------------------------
echo ------------------------------------
echo Rebooting phone...
echo ------------------------------------
echo.
pause
adb reboot
For who wants to use some additional adb tweaks; it is possible to do this by enabling adb in your developer settings.
Here is the bat-file I am using (last changes 17/04/2023):
Code:
:: Moto G100 Tweak Script
:: Last modified 17-04-2023
:: Moto-J
:: ------------------------------------------------------------
@echo off
Setlocal EnableDelayedExpansion
color 0A
cls
echo MOTO G100 ADB TWEAK SCRIPT
echo.
echo IMPORTANT:
echo - Enable ADB in developer settings
echo - Connect phone and accept adb connection
echo.
pause
echo.
echo ------------------------------------
echo Connecting device...................
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
adb devices
:: ------------------------------------------------------------
echo ------------------------------------
echo Running tweaks......................
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
echo Enable privacy logging 7-day dashboard...
:: Enable privacy logging 7-day dashboard
adb shell device_config put privacy privacy_dashboard_7_day_toggle true
pause
echo Enable new combined safety center........
:: Enable new combined safety center
adb shell device_config put privacy safety_center_is_enabled true
pause
echo Enable DNS-over-HTTP3 support............
:: Enable DNS-over-HTTP3 support
adb shell device_config put netd_native doh 1
pause
echo Enable cached apps freezer...............
:: Enable cached apps freezer
adb shell device_config put activity_manager_native_boot use_freezer true
pause
echo Defer boot completed broadcasts..........
:: Defer boot completed broadcasts for background restricted apps
adb shell device_config put activity_manager defer_boot_completed_broadcast 2
pause
echo Enable separate notification slider......
adb shell device_config put systemui volume_separate_notification true
pause
echo.
echo Done!
echo.
:: ------------------------------------------------------------
echo ------------------------------------
echo Now reboot and disable adb again....
echo ------------------------------------
echo.
pause
adb reboot
You can enable adb and adb-root, run the script, reboot and afterwards disable adb again.
The settings will stay even after updating, so only running the script once is enough.
Also with a custom rom you want to update your firmware so now and then.
Luckily we can find the firmware for our phone here:
lolinet mirrors - firmware, software, iso etc.
lolinet mirrors - powered by h5ai
mirrors.lolinet.com
And here is the bat-file I am using with phone connected to PC in bootloader (last changes 15/04/2023):
Code:
:: Moto G100 Firmware Update Script
:: Last modified 15-04-2023
:: Moto-J
:: ------------------------------------------------------------
@echo off
Setlocal EnableDelayedExpansion
color 0A
cls
echo MOTO G100 FIRMWARE UPDATE SCRIPT
echo.
echo IMPORTANT:
echo - Connect phone to USB of PC
echo - Boot into bootloader
echo - Execute this BAT-file in directory with fastboot and latest firmware
echo.
pause
echo.
echo ------------------------------------
echo Connecting device...................
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
fastboot devices
:: ------------------------------------------------------------
echo ------------------------------------
echo Updating firmware files.............
echo ------------------------------------
echo.
echo Terminal output will be displayed here:
fastboot flash modem_a NON-HLOS.bin
fastboot flash modem_b NON-HLOS.bin
fastboot erase mdmddr
fastboot flash fsg_a fsg.mbn
fastboot flash fsg_b fsg.mbn
fastboot erase mdm1m9kefs1
fastboot erase mdm1m9kefs2
fastboot flash bluetooth_a BTFM.bin
fastboot flash bluetooth_b BTFM.bin
fastboot flash dsp_a dspso.bin
fastboot flash dsp_b dspso.bin
fastboot flash logo_a logo.bin
fastboot flash logo_b logo.bin
fastboot erase carrier
fastboot erase ddr
echo.
echo done
echo.
pause
echo.
:: ------------------------------------------------------------
echo ------------------------------------
echo Rebooting phone...
echo ------------------------------------
echo.
pause
fastboot reboot
I am only flashing the neccessary stuff as radio and bluetooth and only that is erased what is needed for the update. No data is lost after update, no other tweaking needed.
On first reboot switch off your WiFi and wait a few seconds; carrier info will be updated from your provider and everything is working again. After that you can switch on your WiFi again ;-)
Additional some things which could improve your battery life (and data usage), although this is already great because of the large battery of the Moto G100....
Restrict battery usage in background for apps which do not need it:
go to apps, show all apps, per app, go to battery usage and switch to restricted
For the apps with restricted battery usage, I also switch of background usage of mobile data and VPN.
go to apps, show all apps, per app, go to mobile data and wifi and switch off background usage and VPN
Switch off mobile data for all apps which do not need an internet connections
same approach, though switch off complete network access. You can do this for several apps which you are using without the need of an internet connection like most barcode and QR scanners, file browsers, card storage apps, galery's etc...
In network settings - SIM cards - preferred network types, only select the network types you really need and which are optimised for your usage.
for me this is NR/LTE/GSM/WCDMA as I switch off mobile data at night with profile settings and want to be available by phone (GSM/WCDMA), though for most people only NR/LTE will probably even fit when you are using the VoLTE changes from the first posts and VoLTE is working ;-)
Set peak frequency for screen refresh to 60 Herz, not 90 Herz. 90 Herz is more fluent when scrolling, though for normal reading, internet usage etc... I see no need for 90 Herz and it will save your battery
Set the time-out for your screen as short as possible. I am using 1 minute and it is okay for me.
Enable double click on status or lock screen to enable sleep and really use it.
Use dark theme and black background, although we do not have a led screen, it is still saving battery
Disable location and bluetooth when you are not using it, enable wifi (only) when available.
Disable tick to activate, screensaver and fingerprint sensor swipe
Don't use full brightness, though try to set it that low as possible
Don't charge your phone to 100% every time, though try to keep the battery level between 30-80%.
This is also why I have set battery saving planning to a percentage of 30%.
When you don't need your email updated real time, disable push and only use getting POP3 email for example every hour.
Although I am using a script to remove system apps after an update, you can also disable some system apps you not need. Either way; try to disable as much as possible which is not neccessary for a good working phone.
That's it for now. When I have some additional ideas I will let you know!
Outside of banking apps & enabling volte. What do your other removal of packages and tweaks do? Can you give a general breakdown?
Timmons said:
Outside of banking apps & enabling volte. What do your other removal of packages and tweaks do? Can you give a general breakdown?
Click to expand...
Click to collapse
Sorry but you really have to check yourself.
There are several websites where the apps of Android are explained
The same counts for the build.prop settings.
I think it would be good to check yourself so you know what you are doing.
And even better... may be you will find other tweaks you can share with us!
Moto-J said:
Sorry but you really have to check yourself.
There are several websites where the apps of Android are explained
The same counts for the build.prop settings.
I think it would be good to check yourself so you know what you are doing.
And even better... may be you will find other tweaks you can share with us!
Click to expand...
Click to collapse
Fair enough. You'd mentioned to chmod after updating. Do I have to do that if I just run your bat file to update it? Sorry for the rookie questions as I'm no expert at linux scripts.
Timmons said:
Fair enough. You'd mentioned to chmod after updating. Do I have to do that if I just run your bat file to update it? Sorry for the rookie questions as I'm no expert at linux scripts.
Click to expand...
Click to collapse
No, not neccessary when you are using the script and edit the file by using adb this way.
No rights are modified that way.
Moto-J said:
No, not neccessary when you are using the script and edit the file by using adb this way.
No rights are modified that way.
Click to expand...
Click to collapse
I've updated the script to only update the build file without removing anything but it's not working. getting this below for system & vendor
Modifying /system/build.prop........
------------------------------------
Terminal output will be displayed here:
sed: /mnt/system/system/build.prop: No such file or directory
------------------------------------
Modifying /vendor/build.prop........
------------------------------------
Terminal output will be displayed here:
sed: /mnt/vendor/build.prop: No such file or directory
Timmons said:
I've updated the script to only update the build file without removing anything but it's not working. getting this below for system & vendor
Modifying /system/build.prop........
------------------------------------
Terminal output will be displayed here:
sed: /mnt/system/system/build.prop: No such file or directory
------------------------------------
Modifying /vendor/build.prop........
------------------------------------
Terminal output will be displayed here:
sed: /mnt/vendor/build.prop: No such file or directory
Click to expand...
Click to collapse
Hi @Timmons;
Could it be that you removed the first part of the bat file where the drives are mounted?
Could you therefor share the complete bat file you are using now, so I can actually check what is or could be wrong?
Moto-J said:
Hi @Timmons;
Could it be that you removed the first part of the bat file where the drives are mounted?
Could you therefor share the complete bat file you are using now, so I can actually check what is or could be wrong?
Click to expand...
Click to collapse
And what happens when you copy the lines to the command line one by one instead of using the bat file?
Could you for example try the following lines to check:
Code:
adb devices
adb shell mkdir /mnt/vendor
adb shell mount /dev/block/dm-9 /mnt/vendor
adb shell ls /mnt/vendor
You should see a directory listing (ls) of /mnt/vendor or an error message somewhere
Moto-J said:
And what happens when you copy the lines to the command line one by one instead of using the bat file?
Could you for example try the following lines to check:
Code:
adb devices
adb shell mkdir /mnt/vendor
adb shell mount /dev/block/dm-9 /mnt/vendor
adb shell ls /mnt/vendor
You should see a directory listing (ls) of /mnt/vendor or an error message somewhere
Click to expand...
Click to collapse
C:\Users\Home\Downloads\Motorola>adb shell mkdir /mnt/vendor
mkdir: '/mnt/vendor': File exists
C:\Users\Home\Downloads\Motorola>adb shell ls /mnt/vendor
C:\Users\Home\Downloads\Motorola>adb shell mount /dev/block/dm-9 /mnt/vendor
mount: '/dev/block/dm-9'->'/mnt/vendor': No such file or directory
C:\Users\Home\Downloads\Motorola>adb devices
List of devices attached
ZY22CCJ22P recovery
C:\Users\Home\Downloads\Motorola>adb shell mount /dev/block/dm-9 /mnt/vendor
mount: '/dev/block/dm-9'->'/mnt/vendor': No such file or directory
Not having much luck entering them manually.
Timmons said:
C:\Users\Home\Downloads\Motorola>adb shell mkdir /mnt/vendor
mkdir: '/mnt/vendor': File exists
C:\Users\Home\Downloads\Motorola>adb shell ls /mnt/vendor
C:\Users\Home\Downloads\Motorola>adb shell mount /dev/block/dm-9 /mnt/vendor
mount: '/dev/block/dm-9'->'/mnt/vendor': No such file or directory
C:\Users\Home\Downloads\Motorola>adb devices
List of devices attached
ZY22CCJ22P recovery
C:\Users\Home\Downloads\Motorola>adb shell mount /dev/block/dm-9 /mnt/vendor
mount: '/dev/block/dm-9'->'/mnt/vendor': No such file or directory
Not having much luck entering them manually.
Click to expand...
Click to collapse
Hmmm... it seems that your partitions are different as dm-9 is not known... strange ;-)
Could you try:
adb devices
adb shell ls /dev/block/dm*
Moto-J said:
Hmmm... it seems that your partitions are different as dm-9 is not known... strange ;-)
Could you try:
adb devices
adb shell ls /dev/block/dm*
Click to expand...
Click to collapse
C:\Users\Home\Downloads\Motorola>adb devices
List of devices attached
ZY22CCJ22P recovery
C:\Users\Home\Downloads\Motorola>adb shell ls /dev/block/dm*
/dev/block/dm-0 /dev/block/dm-3 /dev/block/dm-6
/dev/block/dm-1 /dev/block/dm-4 /dev/block/dm-7
/dev/block/dm-2 /dev/block/dm-5 /dev/block/dm-8
Timmons said:
C:\Users\Home\Downloads\Motorola>adb devices
List of devices attached
ZY22CCJ22P recovery
C:\Users\Home\Downloads\Motorola>adb shell ls /dev/block/dm*
/dev/block/dm-0 /dev/block/dm-3 /dev/block/dm-6
/dev/block/dm-1 /dev/block/dm-4 /dev/block/dm-7
/dev/block/dm-2 /dev/block/dm-5 /dev/block/dm-8
Click to expand...
Click to collapse
Ok, it seems you do not have dm-9, so indeed partitions are different.
What I have done to find out what is what is the following:
adb shell mkdir /mnt/tmpdir
adb shell mount /dev/block/dm-0 /mnt/tmpdir
adb shell ls mnt/tmpdir
Then you see what the content is of dm-0 so you know which dir it is
After that you can do
adb shell umount /mnt/tmpdir
adb shell mount /dev/block/dm-1
adb shell ls mnt/tmpdir
etc....
It seems you have to find the right setup for mounting the drives, after that you can slightly modify the script and use it for your phone.

Categories

Resources