Categoriearchief: Smartphone

Backup your phone with zero keypresses

I created some scripts to backup my Samsung Galaxy S2 to my Fedora 16 system without pressing any keys or even touching the mouse. It works like this:

To backup a SGS2, you go to settings > applications > usb tools on the phone, and click the button. You then connect it to a usb cable. At that moment, two removable devices become visible to the Linux system: one for the SD card, one for the built-in memory. But they still contain no media. Only when you press another button on the phone, the "media are inserted in the devices", triggering a "change" action with the udev daemon.

Configuration of the udev daemon

Create a file /etc/udev/rules.d/71-android-backup.rules:

SUBSYSTEM=="block", ACTION=="change", ENV{ID_SERIAL}=="Android_UMS_Composite_XXXXXXXXXXXXXXXX-0:0", ENV{DISK_MEDIA_CHANGE}=="1", ENV{ID_FS_TYPE}=="vfat", RUN+="/usr/local/bin/androidbackup"

Whenever a (virtual) medium is inserted, a udev change action is triggered. Actually, it gets triggered multiple times, but we only need the one that has the environment variable DISK_MEDIA_CHANGE=1 set.

Action to perform

The action triggered is /usr/local/bin/androidbackup and all parameters are in the environment. So let's create that file. I use a rsnapshot-like operation to backup my data, but without actually using rsnapshot.

#!/bin/bash
 
function msg {
        /usr/bin/logger -t android "$1"
        DISPLAY=:0 qdbus $dbusRef setLabelText "$1"
        DISPLAY=:0 qdbus $dbusRef Set "" value $2
}
 
if [ "$1" != "FORKED" ]; then
        $0 FORKED &
        exit 0
fi
 
if [ -f /etc/sysconfig/androidbackup ]; then
        . /etc/sysconfig/androidbackup
else
        echo /etc/sysconfig/androidbackup does not exist
        exit 0
fi
 
#debug disabled:
#set > /tmp/android/`date +%s`.$RANDOM
 
dbusRef=`kdialog --display :0 --progressbar "Backup android..." 100`
 
msg "Attach $DEVNAME $ACTION $ID_SERIAL" 0
 
if [ ! -e $DESTINATION ]; then
        # I could mkdir -p, but sometimes $DESTINATION could just be a network location that's offline
        msg "Android will not be backed up: $DESTINATION is not okay" 0
        exit 0
fi
 
mkdir -p /mnt/android
 
mount $DEVNAME /mnt/android 
rc=$?
if [ $rc -ne 0 ]; then
        msg "Problem mounting $DEVNAME to /mnt/android: $rc " 0
        mount | grep android 2>&1 | logger -t androidbackup
        exit 0
fi
 
if [ "`mount |grep -i /mnt/android`" == "" ]; then
        msg "Cannot find /mnt/android in mount table" 0
        exit 0
fi
 
msg "Remove old backup" 8
[ -e $DESTINATION/backup.30 ] && rm -rf $DESTINATION/backup.30
 
msg "Start backup" 10
for i in `/usr/bin/seq 30 -1 2`; do 
        if [ -e $DESTINATION/backup.$((i-1)) ]; then
                msg "mv $DESTINATION/backup.$((i-1)) $DESTINATION/backup.$i" 11
                mv $DESTINATION/backup.$((i-1)) $DESTINATION/backup.$i
        fi
done
 
msg "Copy" 40
[ -e $DESTINATION/backup.0 ] && /bin/cp -al $DESTINATION/backup.0 $DESTINATION/backup.1
mkdir -p $DESTINATION/backup.0/
 
msg "Start rsync" 40
/usr/bin/rsync -az --numeric-ids --delete --hard-links /mnt/android/ $DESTINATION/backup.0/
touch $DESTINATION/backup.0/
 
chown -R $CHOWN $DESTINATION/backup.0
 
umount /mnt/android
 
msg "Done" 100
exit 0

Since that file refers to /etc/sysconfig/androidbackup, let's also make that file:

#next line defines the location of all backups
DESTINATION=/home/geeklab/.androidbackup
 
#next line defines the owner of all files copied
CHOWN=geeklab
© GeekLabInfo Backup your phone with zero keypresses is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Laden...

SGS2: Silence the camera

  • Root your phone
  • Login through ssh, terminal or some other shell
  • Open the file /data/local.prop - this file may or may not exist
  • Add the following line to the file:
    ro.camera.sound.forced=0
  • Reboot the phone

Now, if the phone is silent, the camera will be silent. But if the phone's volume is not turned down, you will still hear the camera. You can silence the camera even more by removing the sound files. Login through some kind of shell and type:

mount /system -o remount,rw
cd /system/media/audio/ui
mv Shutter_01.ogg Shutter_01.ogg-original
mv camera_click.ogg camera_click.ogg-original
mv camera_click_short.ogg camera_click_short.ogg-original
cd /
mount /system -o remount,ro

On my phone, the camera used to do a focus-beep, followed by a shutter-click. I got it to shut up the shutter, but I couldn't disable the focus. So if I really don't want the subject of the photo to hear me, I'll just turn down the volume.

© GeekLabInfo SGS2: Silence the camera is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Laden...

SGS2: Removing Bol.com app

Samsung has preinstalled several applications on the Samsung Galaxy S2 that cannot be uninstalled, such as the boekenbol application from bol.com. Now this wouldn't be a problem, if only it would stay in the background. But sometimes it doesn't.

In the last few days, a new version of boekenbol was released, and Android keeps nagging to upgrade the app. I don't want to upgrade, I don't want this app to have any permissions on my phone, but I can't remove the app.

My steps to remove boekenbol

First, I upgraded my phone using Samsung Kies to be running the latest Android version currently available. After the upgrade, I was running GINGERBREAD.XWKK2 on a 2.6.35.7-i9100XWKK2-CL726411 kernel.

Then I rooted the phone, using the CF-Root 5.0 version CF-Root-SGS2_XW_XEN_KK2-v5.0-CWM5. That was actually pretty easy to do.

I installed a few tools for easy access and convenience:

SuperUser Grant and manage Superuser rights for your phone. Don't know if this is required, but I do use it.
SSHDroid SSH Server for Android. Actually a dropbear implementation.

After starting SSHDroid, I start the Wi-Fi hotspot and connect my laptop to it. I logged on using ssh -l root. Then I performed the following commands.

mount /system -o remount,rw                      # mount read-write
mkdir /system/app-disabled
 
# move the (cr)app out of sight (i'm not totally removing the file from the disk, just in case)
mv /system/app/Bol.com_version_1.0.3.3.apk /system/app-disabled  
 
mount /system -o remount,ro                      # mount read-only

Other apps I've removed, include: MMM_Smartphone_1.5.1_final.apk MusicHub_10.apk ReadersHub.apk ReadersHub.odex SamsungIM.apk SocialHub.apk SocialHub.odex

My message to Bol.com

Nobody likes to be forced to have software installed that you don't want. I understand you want to promote your webshop, and pre-installing isn't a problem. But make it removable.

Also, mister Maurice Nieuwland, pointing to Samsung for complaints is a very very childish reaction. Sure, Samsung is to blame for installing the crap. But they wouldn't have, if bol.com didn't make them, you've signed the contract.

For forcing your software upon customers and people that aren't even your customers, I'll be boycotting bol.com until this app is removable by non-root users.

© GeekLabInfo SGS2: Removing Bol.com app is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 5,00 out of 5)
Laden...