November 11

Android: Oem Unlock greyed out after rooted upgrade

Case:
Upgrading from Android version 6 to version 7
Bootloader is unlocked
Phone is rooted

After upgrading from v6 to v7 the OEM Unlock is greyed out as if shut off and locked.  This is apparently a security feature from the upgrade.
Note – you do not need to do anything.  Your phone is still unlocked, it just looks like it is not.

If you want to regain control of the slider, (which is not really needed), you need to relock your boot loader and then unlock it again.  This will obviously wipe your phone.

Category: Android | Comments Off on Android: Oem Unlock greyed out after rooted upgrade
November 10

Android: Getting AdAway working on Android 7 Nougant

Google is trying hard to lock people out of blocking Ads.  Here is a work around if AdAway is not able to write to your hosts file.

  1. On your rooted device: Start a local terminal application on your Android device
  2. Type: su
  3. Type: mount -o rw,remount /system
  4. Type: rm /system/etc/hosts
  5. Type: ln -s /data/data/hosts /system/etc/hosts
  6. Type: mount -o ro,remount /system

Now run AdAway and it should work properly.

By: ihw

Category: Android | Comments Off on Android: Getting AdAway working on Android 7 Nougant
June 14

Android: android.process.media – high cpu – battery

Android Jelly Bean 4.2 seems to have a problem with the android.process.media consuming a lot of cpu time.
This is normal for short durations like after a reboot as this process scans your device.
With this current issue the media scan never stops as if it is looping or stuck.

I have read pages of possible solutions.  Here is what worked for me.

Goto – Settings – Application manager – All
Select Media Storage – Press Force Stop – Press Clear data

Again under Application Manager – All
Goto the Android Keyboard (The one you use as your default keyboard)
Select Media Storage – Press Force Stop – Press Clear data
Your device will probably warn you about the fact you are clearing this data.  Press to accept it.

Reboot

Once your device has rebooted the android.process.media process will rescan your sdcard(s).  After several minutes of high cpu usage you should see this drop off.
To watch the process, open a terminal app and type: top -n 1 -m 10

After the reboot I had to go back into keyboard setting and reset my default keyboard to the one I just cleared.

Category: Android | Comments Off on Android: android.process.media – high cpu – battery
April 13

Android: Mount an image file

Sometimes you may wish to put multiple files into a single image file.
This makes moving around a large number of files more efficient.

Eg. I use an image file to hold an entire html version of technical references.
Rather than adding over 28,000 files to my Android phones file system,
I can put a single file (virtual file system) on my phone that houses all of these files.
When needed, I simply mount the single file as a drive and have full access to my technical guides.

To use this script, your Android device will need to be rooted with busybox installed.
*** I can not guarantee this will work on all devices.  It is working fine on my HTC phone.

How to:
1. On your phones SDCARD create a folder named “mnt”
mkdir /sdcard/mnt

2. Create a folder within with name of you image file.  Do not include the .img extension.
mkdir /sdcard/mnt/yourimagefilename

3. Create another folder with a name of your choice and put your .img file into this folder.
mkdir /sdcard/images

4. Create an empty file in this image folder called img.sh, copy and save the script below into this file.
touch img.sh
Use your favorite editor to paste in the script.

5. From a terminal session go to /sdcard/images
cd /sdcard/images

6. Type: su

7. Type: sh img.sh
If the script does not run type: chmod 777 img.sh and try running it again.

8. You will be prompted for the name of your image file. Enter the name without the .img extension.

9. Your image should now be mounted.  To check:
cd /sdcard /mnt/yourimagefilename

10.  To unmount your image type: sh /sdcard/images/uimg.sh

 

Copy and paste everything below this line:

echo “Before running this script create a directory for your image in /sdcard/mnt”
echo -n “Enter the image file name (Do not include .img): ”
read userdata
##########################################
#Check for root                          #
##########################################
perm=$(id|cut -b 5)
if [ “$perm” != “0” ];then echo “This script requires root! Type: su”; exit; fi
mount -o remount,rw /dev/block/mmcblk0p5 /system
##########################################
#Set up veriables                        #
##########################################
export kit=$(dirname $0)
export bin=/system/bin
export mnt=/sdcard/mnt/$userdata
if [[ ! -d $mnt ]]; then mkdir $mnt; fi
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
##########################################
#Set up loop device                      #
##########################################
if [ -b /dev/block/loop250 ]; then
echo “Loop device exists”
else
busybox mknod /dev/block/loop250 b 7 250
fi
busybox losetup /dev/block/loop250 $kit/$userdata”.img”
##########################################
#Mount all required partitions           #
##########################################
busybox mount -t ext2 /dev/block/loop250 $mnt
##########################################
#Create a script file to unmount the image          #
##########################################
echo “umount /sdcard/mnt/”$userdata > uimg.sh
echo “losetup -d /dev/block/loop250” >> uimg.sh

#By: nighthawk

 

Category: Android | Comments Off on Android: Mount an image file
October 10

Android: Linuxboot.sh – Script for booting Linux in Android

#!/data/data/com.galoula.LinuxInstall/bin/busybox sh
# Many variables
export kit=/mnt/sdcard/linux/ubuntu.img
export bin=/system/bin
export mnt=/data/data/com.galoula.LinuxInstall/mnt
export FS=ext2
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
export LOGNAME=root
export UID=0
export SHELL=bash
export BINDS=”/dev /data /proc /sys /system /cache /devlog /vendor /acct /sdcard /config /app-cache ”
export busybox=”/data/data/com.galoula.LinuxInstall/bin/busybox”

testmounted()
{
$busybox mount | $busybox grep $mnt > /dev/null || false
}

testuseloop()
{
$busybox losetup | $busybox grep “$kit” || false
}

MountBinds()
{
for i in $BINDS
do
if $busybox [ ! -d $mnt$i ]
then
mkdir $mnt$i
fi
$busybox mount -o bind $i $mnt$i
done
}

UnMountBinds()
{
for i in $BINDS
do
if $busybox [ ! -d $i ]
then
mkdir $i
fi
$busybox umount $mnt$i
done
}

testLoop()
{
if $busybox [ ! -e /dev/block/loop6$1 ]
then
$busybox mknod /dev/block/loop6$1 b 7 $1
$busybox losetup /dev/block/loop6$1 $kit || false
else
$busybox losetup /dev/block/loop6$1 $kit || false
fi
#    if [ ! -e /dev/loop$1 ]
#    then
#        mknod /dev/loop$1 b 7 $1
#        $busybox losetup /dev/loop$1 $kit || false
#    else
#        $busybox losetup /dev/loop$1 $kit || false
#    fi
}

testmounted
mounted=$?
if $busybox [ $mounted -eq 0 ]
then
echo Linux LOOP FILE ALREADY MOUNTED !
echo Starting Linux without mount anything.
echo To exit Linux, exit all thread and
echo exit the FIRST bootdeb at LAST !!!
fi

testuseloop
useloop=$?
if $busybox [ $useloop -eq 0 ]
then
echo $busybox LOOP FILE IN USE MOUNTED !
if $busybox [ ! $mounted -eq 0 ]
then
exit 3
fi
fi

if $busybox [ $useloop -eq 1 -a $useloop -eq 1 ]
then
export result=1
export loop=-1
while $busybox [ $result -eq 1 ]
do
# How many devices to look through to find a free one.  The higher the number the slower the boot.
if $busybox [ $loop -eq 32 ]
then
echo “No free loop device found !”
exit 1
fi
loop=$((loop+1))
testLoop $loop
result=$?
done
echo “I use /dev/block/loop6$loop”
$busybox mount -t $FS /dev/block/loop6$loop $mnt
fi

if $busybox [ $mounted -eq 1 ]
then
# This is for my tests for direct hardware acces.
$busybox mount -o bind /dev $mnt/dev
$busybox mount -o bind /sys $mnt/sys
$busybox mount -o bind /proc $mnt/proc

# Mount Android on Debian
MountBinds

# FIX the “stdin: is not a tty” error in direct hadware case.
$busybox mount -t devpts devpts $mnt/dev/pts

# For the network.
#sysctl -w net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward

# For a nice output for the df command !
echo -n “” >$mnt/etc/mtab
S1=”AndroidLoopType$loop $mnt ext2 rw,errors=continue 0 0″
$busybox cat /proc/mounts | while read line
do
S2=”$line”
if $busybox [ “$S1” = “$S2” ]; then
break;
else
echo “$line”>>$mnt/etc/mtab
fi
done
# Cleanup tmp folder.
$busybox rm -rf $mnt/tmp
$busybox mkdir $mnt/tmp
# Enter Linux 🙂
fi
$busybox chroot $mnt /usr/sbin/init.sh
if $busybox [ $mounted -eq 1 ]
then
# while you type “exit” the script continue here : I unmount all.
sync
UnMountBinds
$busybox umount $mnt/dev/pts
$busybox umount $mnt/dev
$busybox umount $mnt/sys
$busybox umount $mnt/proc
$busybox umount $mnt/dev/pts 2> /dev/null
$busybox umount $mnt/dev 2> /dev/null
sync
$busybox umount $mnt && sleep 1
$busybox losetup -d /dev/block/loop6$loop
# If you you have propely exit all Debian process, all are unmounted succesfully
else
echo “Do you want try force umount chroot ?”
echo “Press 1 for YES.”
read REPLY
if $busybox [ 1$REPLY -eq 11 ]
then
UnMountBinds
$busybox umount $mnt/dev/pts
$busybox umount $mnt/dev
$busybox umount $mnt/sys
$busybox umount $mnt/proc
$busybox umount $mnt/dev/pts 2> /dev/null
$busybox umount $mnt/dev 2> /dev/null
sync
$busybox umount $mnt && sleep 1
$busybox losetup -d /dev/block/loop6$loop
fi
fi

Category: Android | Comments Off on Android: Linuxboot.sh – Script for booting Linux in Android