Executing pm setInstallLocation on boot - Android Software/Hacking General [Developers Only]

If someone ever needs the answer:
Code:
#!/system/bin/sh
# set 0 = auto, 1 = internal, 2 = SD-Card
(
while : ; do
COMPLETED=$(logcat -d *:I *:D | grep -c android.intent.action.BOOT_COMPLETED)
if [ $COMPLETED -ne 0 ] ; then
echo "BOOT_COMPLETED: setting setInstallLocation"
pm set-install-location 1
exit 0
fi
sleep 1
done
) &

Thread closed.

Related

multi touch and JNI (native c code)

Here is what I had to do to get both JNI code and multi-touch events to live together.
NDK could not compile better than android-4 in default.properties
and SDK could not compile multi touch with less than android-5 in default.properties
Please let me know if anyone has found a cleaner way of doing this.
Code:
#
# remove installed apk
#
adb shell rm /data/app/org.giovino.*
#
# cross compile native code
#
cd ~/efb/src/umfd
make
ret=$?
echo "**** make returned "$ret
if [ $ret != 0 ]; then
echo failed
exit 1
fi
#
# compile JNI interface
#
cd ~/android/ndk
tail -1 apps/Try/project/default.properties
sed -i "s/android-5/android-4/g" apps/Try/project/default.properties
tail -1 apps/Try/project/default.properties
rm `find . -name libTry.so -print`
make APP=Try V=1
ret=$?
echo "**** make returned "$?
if [ $ret != 0 ]; then
echo failed
exit 1
fi
#
# compile apk android framework
#
cd apps/Try/project
tail -1 default.properties
sed -i "s/android-4/android-5/g" default.properties
tail -1 default.properties
ant debug
ret=$?
echo "**** ANT returned "$ret
if [ $ret != 0 ]; then
echo failed
exit 1
fi
#
# install apk application framework
#
adb install bin/Try-debug.apk
ret=$?
echo "**** adb returned "$ret

Unroot for linux

Heres a modded linux script based on the defyroot script to unroot your defy
Code:
#!/bin/bash
# execute as bash root_Defy.v2
# Following Bin4ry instructions
# Using http://c-skills.blogspot.com/2010/07/android-trickery.html exploit
# See http://intrepidusgroup.com/insight/2010/09/android-root-source-code-looking-at-the-c-skills/ for an explanation of the exploit
ADB="./adblinux"
if [ ! -e $ADB ] ; then
echo "adb not found! Cannot continue." ;
exit 1 ;
fi
chmod +x $ADB
if [ $(grep -ic 22b8 /etc/udev/rules.d/51-android.rules) -eq 0 ] ; then
echo "SUBSYSTEM=="usb", ATTRS{idVendor}==\"22b8\", MODE=\"0666\"" >> /etc/udev/rules.d/51-android.rules ;
fi
if [ $($ADB devices | grep -c device$) -ne 1 ] ; then
echo "Too many devices attached: exiting!" ;
exit 1;
fi
SERIALNO=`$ADB devices | grep device$ | cut -f1`
if [ $? -eq 0 ] ; then
echo "Found device $SERIALNO" ;
else
echo "Error searching device number!" ;
exit 1;
fi
for file in rageagainstthecage su Superuser.apk ; do
echo -n "Pushing $file: " ;
$ADB -s $SERIALNO push $file /data/local/tmp/$file ;
echo "done" ;
done
#$ADB -s $SERIALNO push rageagainstthecage /data/local/tmp/rageagainstthecage
#$ADB -s $SERIALNO push su /data/local/tmp/su
#$ADB -s $SERIALNO push Superuser.apk /data/local/tmp/Superuser.apk
echo -n "Making rageagainstthecage executable and executing it: "
$ADB -s $SERIALNO shell chmod 755 /data/local/tmp/rageagainstthecage
$ADB -s $SERIALNO shell /data/local/tmp/rageagainstthecage
echo "done"
echo "Waiting 15 sec for phone adbd to restart before continuing"
sleep 15
echo -n "Remounting filesystem in read-write mode: "
$ADB -s $SERIALNO shell mount -o remount,rw -t ext3 /dev/block/mmcblk1p21 /system
echo "done"
echo -n "Removing su command: "
$ADB -s $SERIALNO shell rm /system/bin/su
echo "done"
echo -n "Removing Superuser apk: "
$ADB -s $SERIALNO shell rm /system/app/Superuser.apk
echo "done"
exit 0
added to linux tools, thanks!
By editing the original I could ensure that only what was created in the original, was altered, although in theory you should be able to strip or add anyfiles you want in the same way.
Works for sure on fedora 15 and opensuse11.4 and any the original script works on.

[ROM] I9001XXKPU_XXKPH_OXAKP1 Oryginal Open

I9001XXKPU XXKPH OXAKP1
Flash + Odin :
hotfile.com/dl/140028931/367f5c4/i9001XXKPU_XXKPH_OXAKP1.rar.html
Regards!
Wish there was any change log available for stock rom updates...
Sent from my GT-I9001 using XDA App
Make them yourself, like I did:
1. Unzip/rar the file (just ignore the error)
2. Unpack system with Diskinternal Linux Reader
3. Compare the two with whatever file/dir compare tool you like (I use copyto for binary folder compare and ultracompare for file compare)
Good luck!
Regards,
Nika.
Sorry, first link have damaged MD5 checksums inside.
new one tested :
hotfile.com/dl/140028931/367f5c4/i9001XXKPU_XXKPH_OXAKP1.rar.html
I also edited first.
Lol, and I was trying to figure out why unpacking the smd did not work... thanks!
For whomever wants to know, you can extract an smd using this script (Linux or Cygwin):
Code:
#!/bin/bash
base=0
length=1
while (( length > 0 ))
do
# calculate Length
let "skip = base + 18"
length=`hexdump -e '"%d"' -s ${skip} -n 2 ${1}`
let "length = length * 65536"
let "skip = base + 16"
length2=`hexdump -e '"%d"' -s ${skip} -n 2 ${1}`
let "length += length2"
let "length = length / 512" # Number of 512-Byte blocks
# calculate offset
let "skip = base + 22"
offset=`hexdump -e '"%d"' -s ${skip} -n 2 ${1}`
let "offset = offset * 65536"
let "skip = base + 20"
offset2=`hexdump -e '"%d"' -s ${skip} -n 2 ${1}`
let "offset += offset2"
let "offset = offset / 512" # Number of 512-Byte blocks
# save header in case of first loop
if (( base == 0 ))
then
dd if=${1} bs=512 of=header count=${offset}
fi
# extract filename
let "skip = base + 32"
filename=`dd if=${1} skip=${skip} count=16 bs=1 2>/dev/null`
# and finally: extract image
if (( length > 0 ))
then
echo "Length: ${length}"
echo "Offset: ${offset}"
echo "Filename: ${filename}"
dd if=${1} bs=512 of=${filename} skip=${offset} count=${length} 2>/dev/null
fi
# next header
let "base += 64"
done

LG WebOS undocumented API

Hi Team,
i am trying to find out all about the LG WebOS undocumented API
here is what i have found so far
please feel free to share with me if you have any additions
#get broadcastID
Code:
ls-monitor | grep -a -m 4 -h "broadcastId" | grep -oE "\b[0-9, a-z]{8}\-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{12}\b" | tail -1
#get current channelID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/getCurrentChannel '{"broadcastId": "'$broadcastid'", "subscribe": false}'| grep -a -h "channelId" | grep -oE "\b[0-9, a-z]{1}_[0-9, a-z]{3}_[0-9, a-z]{1}_[0-9, a-z]{1}_[0-9, a-z]{2}_[0-9, a-z]{3}_[0-9, a-z]{3}\b"
#show recording dialog
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "com.webos.app.dvrpopup", "noSplash": true, "params": {"activateType": "instantRecord", "broadcastId": "'$broadcastid'", "channelId": "'$channelid'", "inputType": "TV", "isDelayed": false, "isDvb": true}}'
#start recording and show recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/startProgramRecord '{ "camPinCode": "", "channelId": "'$channelid'", "duration": 2880, "endTime": { "day": 12, "hour": 20, "minute": 0, "month": 6, "second": 28, "year": 2021 }, "programId": "2048_59_10_46306", "quality": "record_quality_high", "recordingMode": "recording_direct", "storagePath": "/tmp/usb/sdb/sdb1/LG Smart TV" } '| grep recordingId | awk '{print substr ($2, 2, length ($2) -3) }'
#stop recording by recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/stopRecord '{"needSave": true, "recordingId": "'$recordingid'" } '
#close application by ID
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/closeByAppId ' {"id":"netflix"} '
#Mute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":true, "soundOutput":"tv_external_speaker"} '
#UnMute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":false, "soundOutput":"tv_external_speaker"} '
#changechannel you must get the current broadcastID and the new channelID, old is irrelevent
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/changeChannel ' {"channelId":"7_124_2_0_47_4712_2048", "broadcastId":"00000011-1dd3-acb4-84f7-41b645a4a528", "currentChannelId":"7_208_3_0_59_10_2048"} '
#to take a screenshot
Code:
luna-send -n 1 -f luna://com.webos.surfacemanager/captureCompositorOutput '{"output":"/tmp/usb/sda/sda1/NAS/shares/screenshot-temp.jpg", "format":"JPG"}'
#get current foregound application
Code:
luna-send -n 1 luna://com.webos.applicationManager/getForegroundAppInfo '{}'
#set master volume to 30
Code:
luna-send -f -n 1 luna://com.webos.service.audio/master/setVolume '{"volume":30}'
below is a link to my Github where I have a list of bash scripts that can be used for varies applications on LG based on the above function
Volume.sh
automatic control the volume based on the running application
Click to expand...
Click to collapse
recording.sh
start recording of the current channel and stop after 20 Seconds
Click to expand...
Click to collapse
my Github reposatory
https://github.com/diaahussein/WebOS_LG_TV_Scripts
hey there
can you show me how to connect to the tv and automatically renew the development-timer? this way I could setup a crontask on my RPI and don't need to root/modify my TV.
diaahussein said:
Hi Team,
i am trying to find out all about the LG WebOS undocumented API
here is what i have found so far
please feel free to share with me if you have any additions
#get broadcastID
Code:
ls-monitor | grep -a -m 4 -h "broadcastId" | grep -oE "\b[0-9, a-z]{8}\-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{12}\b" | tail -1
#get current channelID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/getCurrentChannel '{"broadcastId": "'$broadcastid'", "subscribe": false}'| grep -a -h "channelId" | grep -oE "\b[0-9, a-z]{1}_[0-9, a-z]{3}_[0-9, a-z]{1}_[0-9, a-z]{1}_[0-9, a-z]{2}_[0-9, a-z]{3}_[0-9, a-z]{3}\b"
#show recording dialog
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "com.webos.app.dvrpopup", "noSplash": true, "params": {"activateType": "instantRecord", "broadcastId": "'$broadcastid'", "channelId": "'$channelid'", "inputType": "TV", "isDelayed": false, "isDvb": true}}'
#start recording and show recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/startProgramRecord '{ "camPinCode": "", "channelId": "'$channelid'", "duration": 2880, "endTime": { "day": 12, "hour": 20, "minute": 0, "month": 6, "second": 28, "year": 2021 }, "programId": "2048_59_10_46306", "quality": "record_quality_high", "recordingMode": "recording_direct", "storagePath": "/tmp/usb/sdb/sdb1/LG Smart TV" } '| grep recordingId | awk '{print substr ($2, 2, length ($2) -3) }'
#stop recording by recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/stopRecord '{"needSave": true, "recordingId": "'$recordingid'" } '
#close application by ID
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/closeByAppId ' {"id":"netflix"} '
#Mute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":true, "soundOutput":"tv_external_speaker"} '
#UnMute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":false, "soundOutput":"tv_external_speaker"} '
#changechannel you must get the current broadcastID and the new channelID, old is irrelevent
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/changeChannel ' {"channelId":"7_124_2_0_47_4712_2048", "broadcastId":"00000011-1dd3-acb4-84f7-41b645a4a528", "currentChannelId":"7_208_3_0_59_10_2048"} '
#to take a screenshot
Code:
luna-send -n 1 -f luna://com.webos.surfacemanager/captureCompositorOutput '{"output":"/tmp/usb/sda/sda1/NAS/shares/screenshot-temp.jpg", "format":"JPG"}'
#get current foregound application
Code:
luna-send -n 1 luna://com.webos.applicationManager/getForegroundAppInfo '{}'
#set master volume to 30
Code:
luna-send -f -n 1 luna://com.webos.service.audio/master/setVolume '{"volume":30}'
below is a link to my Github where I have a list of bash scripts that can be used for varies applications on LG based on the above function
Volume.sh
recording.sh
my Github reposatory
https://github.com/diaahussein/WebOS_LG_TV_Scripts
Click to expand...
Click to collapse
Might this be of any help to you?
I have created an Homey WebOS plus app using the undocumented API and I have already gathered some endpoints. And very nice to see you found a few I haven't seen before. How did you find those?
homey-webos-plus/drivers/webos_plus/webos/utils/constants.js at master · MaxvandeLaar/homey-webos-plus
Improved LG WebOS integration for Homey. Contribute to MaxvandeLaar/homey-webos-plus development by creating an account on GitHub.
github.com

Can somebody help me with this shell script?

Basically what I want to do is convert this into batch script for windows and by using Linux Binaries from Sourceforge create a script that basically does the same thing except it doesnt have to be pushed into my Phone's system it works directly in windows using ADB commands!
The script in question looks like this
Spoiler: THIS Script
Bash:
#adb shell mkdir /data/media/0/PartitionImages
#adb push .\backupPartitions.sh /data/media/0/PartitionImages/backupPartitions.sh
#adb shell chmod 0755 /data/media/0/PartitionImages/backupPartitions.sh
#adb shell /data/media/0/PartitionImages/backupPartitions.sh
#adb pull /data/media/0/PartitionImages .\PartitionImages
max_blocks=102400
names=""
compress=0
while getopts "h?bzn:" opt; do
case "$opt" in
h|\?)
echo "Usage $0 [-z] [-b MaxBlocks] [-n partition1 ] [-n partition2 ]"
echo " options:"
echo "-z optional to tar.gz the output folder default=false"
echo "-b 102400 optional maximum number of blocks of the partition - 0 will dump all partitions default=$max_blocks"
echo "-n partitionName... optional - one or more partitions to dump"
exit 0
;;
z) compress=1
;;
b) max_blocks=$OPTARG
;;
n) names+=" $OPTARG"
;;
esac
done
script=$(readlink -f "$0")
script_path=$(dirname "$script")
serial=$(cat /sys/class/android_usb/f_accessory/device/iSerial)
serial_date=$serial/$(date +"%Y_%m_%d_%H_%M_%S")
output_path=$script_path/$serial_date
echo "********************************"
echo "Backup partitions TO $output_path"
echo "********************************"
mkdir -p $output_path
part_dir=$(find /dev/block/platform -name by-name)
partitions=$(ls -la $part_dir | awk '{if ( $10 == "->") print $9 ">" $11 }')
getprop > $output_path/build.prop
echo "Id Name Size MD5" > $output_path/partitions.txt
for f in $partitions
do
part_id=$(echo $f | sed 's/^[^>]*>\/dev\/block\///')
part_name=$(echo $f | sed 's/>.*//')
size=$(cat /proc/partitions | awk -v p=$part_id '{if ( $4 == p ) print $3}')
checksum="0"
skip=0
if [ $max_blocks -gt 0 -a $size -gt $max_blocks ]
then
skip=1
echo "Skipping $part_name Id $part_id due to size"
else
if [ "$names" -ne "" ]
then
if echo $names | grep -w $part_name > /dev/null; then
skip=0
else
skip=1
echo "Skipping $part_name Id $part_id"
fi
fi
fi
if [ "$skip" -eq "0" ]
then
echo "Processing $part_name Id $part_id Size $size";
dd if=/dev/block/$part_id of=$output_path/$part_name.img
checksum=$(md5sum -b $output_path/$part_name.img | sed 's/ .*//')
fi
echo "$part_id $part_name $size $checksum" >> $output_path/partitions.txt
done
if [ "$compress" -eq "1" ]
then
cd $script_path
tar cz $serial_date > $output_path.tar.gz
rm -rf $output_path
fi
its from an old Xda Dev thread original post and author
givitago​​
I tried by guidelines from an "Appendix N. Converting DOS Batch Files to Shell Scripts" from another site to turn the shell script variables into batch script ones but since I got no experience with either of them my attempt turned into an amalgamation of the two's code in one..
Spoiler: it turned Into THIS
Code:
::adb shell mkdir /data/media/0/PartitionImages
::adb push .\backupPartitions.sh /data/media/0/PartitionImages/backupPartitions.sh
::adb shell chmod 0755 /data/media/0/PartitionImages/backupPartitions.sh
::adb shell /data/media/0/PartitionImages/backupPartitions.sh
::adb pull /data/media/0/PartitionImages .\PartitionImages
%max_blocks==102400
%names==""
%compress==0
while getopts "h?bzn:" opt; do
case "$opt" in
h|\?)
echo "Usage $0 [-z] [-b MaxBlocks] [-n partition1 ] [-n partition2 ]"
echo " options:"
echo "-z optional to tar.gz the output folder default=false"
echo "-b 102400 optional maximum number of blocks of the partition - 0 will dump all partitions default=$max_blocks"
echo "-n partitionName... optional - one or more partitions to dump"
exit 0
;;
z) compress=1
;;
b) max_blocks=$OPTARG
;;
n) names+=" $OPTARG"
;;
esac
done
%script%==%(echo %CD% "%0")
%script_path%==(dirname "%script")
%serial%==%(adb shell cat /sys/class/android_usb/f_accessory/device/iSerial)
%serial_date%==%serial% /%(date +"%Y_%m_%d_%H_%M_%S")
%output_path%==%script_path%/%serial_date%
echo "********************************"
echo "Backup partitions TO $output_path"
echo "********************************"
mkdir -p %output_path%
%part_dir%==%(adb shell find /dev/block/platform -name by-name)
%partitions%==%(ls -la %part_dir% | awk '{if ( %10 == "->") print %9 ">" %11 }')
adb shell getprop > %output_path%/build.prop
echo "Id Name Size MD5" > %output_path%/partitions.txt
for %%i in %partitions do
%part_id=%(echo %f | sed 's/^[^>]*>\/dev\/block\///')
%part_name=%(echo %f | sed 's/>.*//')
%size=%(adb shell cat /proc/partitions | awk -v p==%part_id% '{if ( %4 == p ) print %3}')
checksum="0"
skip==0
if [ %max_blocks -gt 0 -a %size -gt %max_blocks ]
then
skip=1
echo "Skipping %part_name% Id %part_id% due to size"
else
if [ "%names" -ne "" ]
then
if echo %names | grep -w %part_name% > /dev/null; then
skip==0
else
skip==1
echo "Skipping %part_name% Id %part_id%"
fi
fi
fi
if [ "$skip" -eq "0" ]
then
echo "Processing %part_name% Id %part_id% Size %size";
'adb shell pull' /dev/block/%part_id% %output_path%/%part_name%.img
checksum==%(md5sum -b %output_path%/%part_name%.img | sed 's/ .*//')
fi
echo "%part_id% %part_name% %size %checksum" >> %output_path%/partitions.txt
done
if [ "%compress" -eq "1" ]
then
cd %script_path%
tar cz %serial_date% > %output_path%.tar.gz
rm -rf %output_path%
fi
additionally I have pretty much all linux commands's binaries on the same folder as the .bat script so as long as the syntax is correct and nothing finniky going on it should work technically but since I got no experience I can't do this on my own...
You may use the DOS script used here
[TOOL][ADB][WIN]Android Partitions Backupper / Cloner
Hi all, wrote a Windows CMD script that backups / clones partitions of an Android device via ADB because I wasn't content with any 3rd-party APK what claims to do this job. The backups /clones are stored on Windows computer as...
forum.xda-developers.com
as a template.
jwoegerbauer said:
You may use the DOS script used here
[TOOL][ADB][WIN]Android Partitions Backupper / Cloner
Hi all, wrote a Windows CMD script that backups / clones partitions of an Android device via ADB because I wasn't content with any 3rd-party APK what claims to do this job. The backups /clones are stored on Windows computer as...
forum.xda-developers.com
as a template.
Click to expand...
Click to collapse
I have tried that script itself and it failed at "DM-Verity" and SELinux enforcement also for some reason no logs at all in temp folder

Categories

Resources