Friday, March 8, 2013

samsung galaxy s3 mini - gtalk app crash resolving



note:
 all  tools used in this article can be downloaded in one archive from here. the archive does not include android sdk (adb tool). this will work for builds I8190XXALJL. it is european build. Android version 4.1.1


my dear wife bought samsung galaxy s3 mini for personal use about 2 month ago. the device itself is pretty well made. it's smaller than its parent one s3 and it feels comfortable  in hand,  well specially in female hands. after one week of use my wife told me that gtalk app was being crashed every time she got a message. at that time i thought resetting the device to the factory settings would be the solution to the problem, but i was wrong. so i started to dig in ...

after some time of investigation i found something useful in this forum . folk with nickname bala_gamer found the root cause of the crash. thanks to him.  the gtalk app crash was due to typo in dimens.xml file which was located in the package framework-res.apk.

part of dimens.xml
============
<dimen name="notification_large_icon_width">55.0dip</dimen>
<dimen name="notification_large_icon_height">64.0dip</dimen>

the value for both of them should have been 64.0dip.

file framework-res.apk is located  in the directory /system/framework/. to make changes in  dimens.xml  i have to download framework-res.apk from phone to my pc, extract it, make changes in dimens.xml, rebuild package and upload it back. i must have root privileges for uploading the file into the /system folder on the s3 mini, which means i have to root s3 mini.

so my todo list looked like this

  • root device
  • modify and upload framework-res.apk into the phone

1. root device (s3 mini)

the fact that samsung s3 mini does not support fastboot made me upset, but on the other hand i had never heard about alternative cross-platform open-source tool-suite to the "Odin". why cross-platform ? because i'm a linux user!!! the tool name is heimdall and it mostly used to flash roms on the devices which do not support fastboot. 

1.1 install heimdall

first i installed heimdall. you can find deb files in archive. open a shell terminal and cd to the directory you put the heimdall binaries and type following.


[/home/tmartiro/heimdall/]$  sudo dpkg -i heimdall_1.3.1_i386.deb
[/home/tmartiro/heimdall/]$  sudo dpkg -i heimdall-frontend_1.3.1_i386.deb

now we are ready to flash recovery image which you can also find in archive .

1.2 download mode

power off s3mini. after your phone is powered off put the s3mini to the "download mode" by pressing  VOLUME_DOWN + HOME + POWER buttons.

1.3 flashing image

in "download mode" connect phone to pc via usb cabel and type in the shell terminal. invoke commands using root user.


[/root/]# heimdall detect

you should get output like this "Device detected"

[/root/]# heimdall print-pit

it prints all partition tables . we are interested in the recover partition. so select recovery in the output until you find something like this

  --- Entry #20 ---
  Unused: No
  Partition Type: 2 (EXT4)
  Partition Identifier: 19
  Partition Flags: 5 (R)
  Unknown 1: 1
  Partition Block Size: 491520
  Partition Block Count: 32768
  Unknown 2: 0
  Unknown 3: 0
  Partition Name: Kernel2
  Filename: recovery.img

you need to find partition identifier for recovery partition to use in the next command. in my case the value of  partition identifier was 19. after partition table is printed the phone will boot into the system automatically. so before you will invoke next command , put your phone in "download mode" again , as i described above.

[/root/]#  heimdall flash --19 recovery-clockwork-6.0.2.7-golden.img

after flashing the image the phone will reboot automatically  using your preferred way of copying copy CWM-SuperSU-v0.87_.zip  in to the Download folder located on the phone.
my way of copy


[/home/tmartiro]$ adb push CWM-SuperSU-v0.87_.zip /sdcard/Download/

afterwards you need to reboot the phone into the recovery mode


[/home/tmartiro]$ adb reboot recovery

from the recovery menu select the "Install zip from sdcard" > "choose zip from sdcard" and point to the CWM-SuperSU-v0.87_.zip file. After install is complete hit "reboot to system" from the menu .

now we are root on the system... to make sure that you are root , type


[/home/tmartiro]$ adb shell
$ su -
# id

if you see  something like this uid=0(root) gid=0(root) then our abra-cadabra things with rooting was done.



2. modify framework-res.apk

download framework-res.apk file from phone


[/home/tmartiro]$  adb pull /system/framework/framework-res.apk

install the framework using apktool (you can find tool in archive too. it needs java and aapt. make sure that they are in the PATH)


[/home/tmartiro]$  apktool if framework-res.apk

decode it 
  
[/home/tmartiro]$  apktool d framework-res.apk

these commands will create directory "framework-res" in the directory where you run them. 
the dimens.xml is located in the framework-res/res/values/dimens.xml. open xml file with your favorite editor, change value of  "notification_large_icon_width" to  64.0dip and save.

in the other directory unzip framework-res.apk


[/tmp/frm/]$  unzip framework-res.apk

in the extracted directory you should find "AndroidManifest.xml" file and "META-INF" directory. copy into the folder created by apktool


[/tmp/frm/]$  cp -r  AndroidManifest.xml META-INF/ /home/tmartiro/framework-res/build/apk/

and build new framework-res.apk by invoking following command


[/home/tmartiro/]$  apktool b framework-res



2.1 copy process

new generated framework-res.apk is stored in the folder ./framework-res/dist/framework-res.apk
now it's time to copy file into the phone. I copied it first into the Download folder  where i had a permission to copy without having root privileges


[/home/tmartiro/]$  adb push framework-res/dist/framework-res.apk /sdcard/Download/

then we should connect to the phone shell


[/home/tmartiro/]$  adb shell

and become a root on the phone

$ su -

you will see root prompt like this

#

now copy file from Download folder to system folder
 
# cp /sdcard/Download/framework-res.apk /system/framework/framework-res.apk

and fix the permissions


# chmod 644 /system/framework/framework-res.apk

exit from phone terminal. now you should reboot the phone into the recovery mode


[/home/tmartiro/]$ adb reboot recovery

from recovery menu go to "wipe cache partition" and wipe cache. then go to "advanced" > "wipe dalvik cache" and wipe it as well. after caches are wiped go to "reboot system now".


the system will reboot with new generated framework. congrats!

p.s.
if something goes wrong during boot, you can connect to phone shell and restore the original framework-res.apk see section 2.1

p.s.s

in the archive file you will find already generated framework-res.apk by me. ( "framework_patch/framework-res/dist/framework-res.apk")

p.s.s.s

in order to debug the process of boot


[/home/tmartiro/]$ adb logcat


2 comments:

Lia said...

you are my hero:* !!

Unknown said...

she is my wife )) :*