[Samsung Galaxy SL i9003] LoLaTiOn:
Understanding logs and debugging

To parse what's going on there are some advice:

keywords:

search in log you got some keywords, that might be useful on debugging boot issue;

most common keywords are:

"E/" - error

"E/dalvikvm" - possibly crucial system error

"No such file or directory" - says it all

"couldn't" - android likes that, mostly shows faulty things.*

"fail"/"failed" - mostly crucial error

"W/"/"warning" - says it all, but not always warn could be a boot failure cause

"exception"(especially NullPointerException) - points you that something went wrong in framework or application work

I/ tags could be also useful at debugging, but most helpful are errors and warnings.

Most common constructs:

"couldn't find native method", the most common reason of a bootloop.*

For instance:

E/dalvikvm( *100): ERROR: couldn't find native method
E/dalvikvm( *100): Requested: Landroid/view/GLES20Canvas;.nStartTileRendering:(IIIII)V
E/JNIHelp ( *100): RegisterNatives failed for 'android/view/GLES20Canvas', aborting

Let's parse that construct to extract parts we will fix.

First of all. smali path might be extracted from that line:

E/JNIHelp ( *100): RegisterNatives failed for 'android/view/GLES20Canvas', aborting

->

android/view/GLES20Canvas

that's it, smali we are looking for is GLES20Canvas.smali. But.. android/view.. where it is? Answer comes from android source, it took some time to analyze frameworks.. Just let's assume: all that starting with "android" in path belongs to framework,jar.*

What if path doesn't contain "android" at the beginning?*

Again the answer is in source. Paths like"org/" are belong to framework.jar.*

"com/android/server" - services.jar (there is the same folder at framework.jar but most likely you don't need to touch it).

another place we could be mixed up:

"com/android/internal" - framework.jar

"com/android/internal/policy/impl/" - android.policy.jar

for framework.jar path ends up on internal, which represents telephony folder. policy/impl is the only android.policy.jar folder.

Other frameworks are actually not used in port as they contain core android functionality which is common.

Note about smali you found:

it might be not smali you are looking for, most likely when code points you to android functionality and widgets (control elements) like combobox or listview, it's a sign to think twice what have you done on your system to port it

it might be tree of smali(remember 2nd stage assumes?), to ease of use, always replace smali with its tree, and only if error becomes worse, think about single smali or about diff(2nd stage assumes again :D)

from

E/dalvikvm( *100): Requested: Landroid/view/GLES20Canvas;.nStartTileRendering:(IIIII)V

we could extract a method which is missing - nStartTileRendering. In some cases only that method should be added and nothing more.

" android.content.res.Resources$NotFoundException: Resource ID #XXX"

Example:

E/AndroidRuntime( 3047): *** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManagerPolicy
E/AndroidRuntime( 3047): android.content.res.Resources$NotFoundException: Resource ID #0x3060008
E/AndroidRuntime( 3047): at android.content.res.Resources.getValue(Resources.j ava:1022)
E/AndroidRuntime( 3047): at android.content.res.MiuiResources.getValue(MiuiRes ources.java:56)
E/AndroidRuntime( 3047): at miui.util.ResourceMapper.resolveReference(Resource Mapper.java:9)
E/AndroidRuntime( 3047): at miui.util.HapticFeedbackUtil.updateSettings(Haptic FeedbackUtil.java:109)
E/AndroidRuntime( 3047): at miui.util.HapticFeedbackUtil$SettingsObserver.obse rve(HapticFeedbackUtil.java:92)
E/AndroidRuntime( 3047): at miui.util.HapticFeedbackUtil.<init>(HapticFeedback Util.java:75)
E/AndroidRuntime( 3047): at com.android.internal.policy.impl.MiuiPhoneWindowMa nager.init(MiuiPhoneWindowManager.java:108)
E/AndroidRuntime( 3047): at com.android.server.wm.WindowManagerService$PolicyT hread.run(WindowManagerService.java:733)

Wrong MIUI base, mostly. Appear when something changed by previous porter (miui) which affects resources you won't have, banal link error.*

" Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)"

Hope all of you heared about C language. That error is a form of C "exceptional case"(in other words - exception).*

You will see if it happen:

F/libc * *( 2698): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
I/DEBUG * ( *130): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG * ( *130): Build fingerprint: 'tmous/htc_doubleshot/doubleshot:4.0.3/IML
74K/275847.101:user/release-keys'
I/DEBUG * ( *130): pid: 2698, tid: 2698 *>>> zygote <<<
I/DEBUG * ( *130): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaa
d
I/DEBUG * ( *130): *r0 deadbaad *r1 00000001 *r2 a0000000 *r3 00000000
I/DEBUG * ( *130): *r4 00000000 *r5 00000027 *r6 4086fbfd *r7 00000036
I/DEBUG * ( *130): *r8 40253f04 *r9 40233a7e *10 0000904c *fp 00009062
I/DEBUG * ( *130): *ip 4028b240 *sp befcfa60 *lr 401043c1 *pc 40100adc *cpsr 600
00030
I/DEBUG * ( *130): *d0 *2f64696f72646e61 *d1 *2f746e65746e6f63
I/DEBUG * ( *130): *d2 *657373412f736572 *d3 *726567616e614d74
I/DEBUG * ( *130): *d4 *0000d4cc0000d4b1 *d5 *0000d4e80000d4cd

yaa.. ENORMOUS code block, build fingerprint, fatal signal and stack trace.. welcome to hell :D

One little thing: error is right above that block, don't even try to parse its contents, ignore it.

WE ALL DIE!!!111

yaa, series of "died" errors:

I/ServiceManager( 1478): service 'media.audio_flinger' died
I/ServiceManager( 1478): service 'media.player' died
I/ServiceManager( 1478): service 'media.camera' died
I/ServiceManager( 1478): service 'media.audio_policy' died

IGNORE them, it's a result of exception right above(no matter C exception or java one), it's better to see it instead of posting "WE ALL DIE!!!111" :D

"Unable to extract+optimize DEX from '/system/framework/framework.jar'" and other WTF cases

examples:

D/dalvikvm( 103): DexOpt: --- BEGIN 'framework.jar' (bootstrap=1) ---
E/dalvikvm( 172): Duplicate class definition: 'Landroid/media/MediaRecorder;'
E/dalvikvm( 172): Trouble with item 2900 @ offset 0x17a86c
E/dalvikvm( 172): Cross-item verify of section type 0006 failed
E/dalvikvm( 172): ERROR: Byte swap + verify failed
E/dalvikvm( 172): Optimization failed
W/dalvikvm( 103): DexOpt: --- END 'framework.jar' --- status=0xff00, process failed
E/dalvikvm( 103): Unable to extract+optimize DEX from '/system/framework/framework.jar'
D/dalvikvm( 103): Unable to process classpath element '/system/framework/framework.jar'
E/JNIHelp ( 103): Native registration unable to find class 'android/debug/JNITest', aborting

05-30 14:15:15.970: E/NetworkLocationRealOs(2304): no android ID; can't access encrypted cache
05-30 14:15:15.970: E/NetworkLocationRealOs(2304): java.io.IOException: no android ID; can't access encrypted cache

1012:	07-03 03:28:21.350: E/System(1538): ************ Failure starting core service
07-03 03:28:21.350: E/System(1538): java.lang.NullPointerException
07-03 03:28:21.350: E/System(1538): at com.android.server.pm.PackageManagerService.grantPermissionsLPw(PackageManagerService.java:4299)
07-03 03:28:21.350: E/System(1538): at com.android.server.pm.PackageManagerService.updatePermissionsLPw(PackageManagerService.java:4247)
07-03 03:28:21.350: E/System(1538): at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:1170)
07-03 03:28:21.350: E/System(1538): at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:858)
07-03 03:28:21.350: E/System(1538): at com.android.server.ServerThread.run(SystemServer.java:167)
07-03 03:28:21.350: I/SystemServer(1538): Input Method Service
07-03 03:28:21.360: W/SystemServer(1538): ***********************************************
1021:	07-03 03:28:21.370: A/SystemServer(1538): BOOT FAILURE starting Input Manager Service
1022:	07-03 03:28:21.370: A/SystemServer(1538): java.lang.NullPointerException
1023:	07-03 03:28:21.370: A/SystemServer(1538): at android.app.PendingIntent.getBroadcast(PendingIntent.java:293)
1024:	07-03 03:28:21.370: A/SystemServer(1538): at com.android.server.InputMethodManagerService.<init>(InputMethodManagerService.java:548)
1025:	07-03 03:28:21.370: A/SystemServer(1538): at com.android.server.ServerThread.run(SystemServer.java:271)
1026:	07-03 03:28:21.400: E/AndroidRuntime(1538): Error reporting WTF
1027:	07-03 03:28:21.400: E/AndroidRuntime(1538): java.lang.NullPointerException
1028:	07-03 03:28:21.400: E/AndroidRuntime(1538): at com.android.internal.os.RuntimeInit.wtf(RuntimeInit.java:345)
1029:	07-03 03:28:21.400: E/AndroidRuntime(1538): at android.util.Log$1.onTerribleFailure(Log.java:103)
1030:	07-03 03:28:21.400: E/AndroidRuntime(1538): at android.util.Log.wtf(Log.java:278)
1031:	07-03 03:28:21.400: E/AndroidRuntime(1538): at com.android.server.ServerThread.reportWtf(SystemServer.java:77)
1032:	07-03 03:28:21.400: E/AndroidRuntime(1538): at com.android.server.ServerThread.run(SystemServer.java:274)

mostly likely is about way assembling framework files. Also some of them might be just corrupted by accident. Sometimes these errors caused by wrong smali replacement or wrong diff methodology. Or it might be just banal reason - no place in system or cache partitions.

English [:D]

Most log parts are in mere, not technician English,log might be read as little book with bright characters. Find what you are looking for and fix it..*

Source code is your best friend in porting

I'd recommend to have an android source code [from internet or on your local PC] to port something that outstands of rules I listed. For example CM frameworks source could be found here: https://github.com/CyanogenMod/android_frameworks_base .

*That mostly affect cases in which hardware that is not working/working but not perfect/working incorrect on MIUI but worked *like a charm on base.*

Any log line represents a line of code in source, that one could search and debug from there (as source is mostly common, that miui ports possibility proove). Each smali represents a java source code or its part(- subclass which signed by $), each java is in frameworks folder on source (mostly frameworks/base). Log line is a message, which formed with C rules about these rules, so you have to avoid ciphers or guess how could code represent that message. You may search guessed line in source to locate java file, or locate it manually according to smali location and my advice and search in it.*

Examples fix for MIUI for i9003 Eye care sorry

MIUI on crespo first boot

Add the missing methods very good example here

____________________________________

content\res > framework.jar

____________________________________

22:01:59.647 Error dalvikvm 3433 Requested: Landroid/content/res/AssetManager;.splitThemePackage:(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I

.method private final native splitThemePackage(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I

.end method

____________________________________

content\res > framework.jar

____________________________________

22:15:04.677 Error dalvikvm 1412 Requested: Landroid/content/res/AssetManager;.detachThemePath:(Ljava/lang/String;I)Z

.method public final native detachThemePath(Ljava/lang/String;I)Z

.end method

____________________________________

content\res > framework.jar

____________________________________

22:19:49.282 Error dalvikvm 1418 Requested: Landroid/content/res/AssetManager;.attachThemePath:(Ljava/lang/String;)I

.method public final native attachThemePath(Ljava/lang/String;)I

.end method

____________________________________

content\res > framework.jar

____________________________________

22:24:40.863 Error dalvikvm 1412 Requested: Landroid/content/res/AssetManager;.getBasePackageCount:()I

.method public final native getBasePackageCount()I

.end method

____________________________________

content\res > framework.jar

____________________________________

22:30:44.532 Error dalvikvm 1411 Requested: Landroid/content/res/AssetManager;.getBasePackageName:(I)Ljava/lang/String;

.method public final native getBasePackageName(I)Ljava/lang/String;

.end method

____________________________________

content\res > framework.jar

____________________________________

22:34:50.171 Error dalvikvm 1412 Requested: Landroid/content/res/AssetManager;.getBasePackageId:(I)I

.method public final native getBasePackageId(I)I

.end method

____________________________________

content\res > framework.jar

____________________________________

22:38:20.935 Error dalvikvm 1412 Requested: Landroid/content/res/AssetManager;.addRedirectionsNative:(I)V

.method public final native generateStyleRedirections(III)Z

.end method

.method private final native addRedirectionsNative(I)V

.end method

.method private final native clearRedirectionsNative()V

.end method

____________________________________

view > framework.jar

____________________________________

22:46:49.291 Error dalvikvm 1418 Requested: Landroid/view/GLES20Canvas;.nStartTileRendering:(IIIII)V

____________________________________

22:52:04.133 Error dalvikvm 1412 Requested: Landroid/view/GLES20Canvas;.nEndTileRendering:(I)V

.method private static native nEndTileRendering(I)V

.end method

____________________________________

hardware > framework.jar

____________________________________

22:56:09.603 Error dalvikvm 1418 Requested: Landroid/hardware/Camera;.native_setHistogramMode:(Z)V

.method private final native native_setHistogramMode(Z)V

.end method

.method private final native native_sendHistogramData()V

.end method

.method private final native native_sendMetaData()V

.end method

.method private final native native_setFaceDetectionCb(Z)V

.end method

____________________________________

media > framework.jar

____________________________________

23:05:52.251 Error AudioTrack-JNI 1412 Can't find android/media/AudioFormat.ENCODING_AMRNB

.field public static final ENCODING_AMRNB:I = 0x64

.field public static final ENCODING_AMRWB:I = 0x65

.field public static final ENCODING_EVRC:I = 0x66

.field public static final ENCODING_EVRCB:I = 0x67

.field public static final ENCODING_EVRCWB:I = 0x68

____________________________________

server > framework.jar

____________________________________

C:\Users\yan\Desktop\JB MIUI\2.9.21 JB\CM10\framework\out\android\server\BluetoothA2dpService.smali

C:\Users\yan\Desktop\JB MIUI\2.9.21 JB\CM10\framework\out\android\server\BluetoothA2dpService$1.smali

____________________________________

content\res > framework.jar

____________________________________

00:01:25.180 Error JNIHelp 1412 Native registration unable to find class 'android/content/res/PackageRedirectionMap', aborting

C:\Users\yan\Desktop\JB MIUI\2.9.21 JB\CM10\framework\out\android\content\res\PackageRedirectionMap.smali

C:\Users\yan\Desktop\JB MIUI\2.9.21 JB\CM10\framework\out\android\content\res\PackageRedirectionMap$1.smali

____________________________________

webkit > framework.jar

____________________________________

00:06:18.260 Error dalvikvm 1418 Requested: Landroid/webkit/WebViewCore;.nativeSelectText:(IIIII)V

.method private native nativeSelectText(IIIII)V

.end method

____________________________________

webkit > framework.jar

____________________________________

00:12:04.130 Error dalvikvm 1404 Class lookup Landroid/webkit/WebSettingsClassic$AutoFillProfile; attempted with exception pending

____________________________________

webkit > framework.jar

____________________________________

00:19:49.808 Error JNIHelp 1704 RegisterNatives failed for 'android/webkit/HTML5Audio', aborting

____________________________________

webkit > framework.jar

____________________________________

00:25:12.842 Error dalvikvm 1398 Requested: Landroid/webkit/HTML5VideoViewProxy;.nativeOnSizeChanged:(IIII)V

____________________________________

webkit > framework.jar

____________________________________

00:30:43.910 Error dalvikvm 1392 Requested: Landroid/webkit/HTML5VideoViewProxy;.nativeOnPlaying:(I)V

____________________________________

input > service.jar

____________________________________

00:10:14.802 Error dalvikvm 1720 Requested: Lcom/android/server/input/InputManagerService;.nativeSetStylusIconEnabled:(IZ)V

.method private static native nativeSetStylusIconEnabled(IZ)V

.end method

____________________________________

FIX SIM RILD

____________________________________

com\android\internal\telephony

file set

____________________________________

FIX USB

____________________________________

com\android\server\USB

UsbDeviceManager$UsbHandler.smali

UsbDeviceManager.smali

UsbService.smali

com\android\server

MountService.smali

MountService$4.smali

14:22:17.308 Error dalvikvm 3265 Class lookup Landroid/webkit/WebSettingsClassic$AutoFillProfile; attempted with exception pending

14:35:41.578 Error dalvikvm 1392 Requested: Landroid/webkit/HTML5Audio;.nativeOnPaused:(I)V

.method private native nativeOnPaused(I)V

14:43:10.236 Error dalvikvm 1700 Requested: Landroid/webkit/HTML5VideoViewProxy;.nativeOnSizeChanged:(IIII)V

.method private native nativeOnSizeChanged(IIII)V

.end method

19:25:28.287 Error dalvikvm 1392 Requested: Landroid/webkit/HTML5VideoViewProxy;.nativeOnPlaying:(I)V

.method private native nativeOnPlaying(I)V

.end method

19:31:07.887 Error dalvikvm 1402 Requested: Landroid/webkit/HTML5VideoViewProxy;.nativeSendSurfaceTexture:(Landroid/graphics/SurfaceTexture;IIIII)Z

.method private native nativePrepareEnterFullscreen(I)V

.end method

.method private native nativePrepareExitFullscreen(I)V

.end method

.method private static native nativeSendSurfaceTexture(Landroid/graphics/SurfaceTexture;IIIII)Z

.end method

10:44:28.641 Error AndroidRuntime 3353 java.lang.NoSuchMethodError: android.webkit.WebSettingsClassic.getNightReadModeEnabled

.end method

.method private static native nativeCpuBoost(I)V

Happy debugging ;)