[Vibrant Android Development] s0niqu3:
Hey again,

So after playing with the gingerbread leak, and seeing that samsung decided (so far, at least) to show the full kernel version in the "About Phone" menu in settings, I decided to fix it on normal vibrant froyo roms.

At the same time, I also added the CM style "mod version" string. Someone else (I forget who and when, and I sincerely apologize for that) attempted this before, but I don't know if they didn't finish, or if it just never took off, but regardless, I decided to add it too, lol. For developers, all you need to add to your build.prop is:

ro.modversion=Bionix-1.2.1

Obviously replace everything after the = with your personal mod version.

Anyway, to show the full kernel version string:

Decompile Settings.apk, open /smali/com/android/settings/DeviceInfoSettings.smali and replace the entire method "getFormattedKernelVersion" with the following code:

.method private getFormattedKernelVersion()Ljava/lang/String;
.locals 11

.prologue
const/4 v8, 0x4

const-string v6, "\n"

const-string v10, "Unavailable"

const-string v9, "DeviceInfoSettings"

:try_start_0
new-instance v5, Ljava/io/BufferedReader;

new-instance v6, Ljava/io/FileReader;

const-string v7, "/proc/version"

invoke-direct {v6, v7}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V

const/16 v7, 0x100

invoke-direct {v5, v6, v7}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;I)V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

.local v5, reader:Ljava/io/BufferedReader;
:try_start_1
invoke-virtual {v5}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0

move-result-object v4

.local v4, procVersionStr:Ljava/lang/String;
:try_start_2
invoke-virtual {v5}, Ljava/io/BufferedReader;->close()V

const-string v0, "\\w+\\s+\\w+\\s+([^\\s]+)\\s+\\(([^\\s@]+(?:@[^\\s.]+)?)[^)]*\\)\\s+\\((?:[^(]*\\([^)]*\\))?[^)]*\\)\\s+([^\\s]+)\\s+(?:PREEMPT\\s+)?(.+)"

.local v0, PROC_VERSION_REGEX:Ljava/lang/String;
const-string v6, "\\w+\\s+\\w+\\s+([^\\s]+)\\s+\\(([^\\s@]+(?:@[^\\s.]+)?)[^)]*\\)\\s+\\((?:[^(]*\\([^)]*\\))?[^)]*\\)\\s+([^\\s]+)\\s+(?:PREEMPT\\s+)?(.+)"

invoke-static {v6}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;

move-result-object v3

.local v3, p:Ljava/util/regex/Pattern;
invoke-virtual {v3, v4}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;

move-result-object v2

.local v2, m:Ljava/util/regex/Matcher;
invoke-virtual {v2}, Ljava/util/regex/Matcher;->matches()Z

move-result v6

if-nez v6, :cond_0

const-string v6, "DeviceInfoSettings"

new-instance v7, Ljava/lang/StringBuilder;

invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

const-string v8, "Regex did not match on /proc/version: "

invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v7

invoke-virtual {v7, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v7

invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v7

invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

const-string v6, "Unavailable"

move-object v6, v10

.end local v0 #PROC_VERSION_REGEX:Ljava/lang/String;
.end local v2 #m:Ljava/util/regex/Matcher;
.end local v3 #p:Ljava/util/regex/Pattern;
.end local v4 #procVersionStr:Ljava/lang/String;
.end local v5 #reader:Ljava/io/BufferedReader;
:goto_0
return-object v6

.restart local v5 #reader:Ljava/io/BufferedReader;
:catchall_0
move-exception v6

invoke-virtual {v5}, Ljava/io/BufferedReader;->close()V

throw v6
:try_end_2
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

.end local v5 #reader:Ljava/io/BufferedReader;
:catch_0
move-exception v6

move-object v1, v6

.local v1, e:Ljava/io/IOException;
const-string v6, "DeviceInfoSettings"

const-string v6, "IO Exception when getting kernel version for Device Info screen"

invoke-static {v9, v6, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

const-string v6, "Unavailable"

move-object v6, v10

goto :goto_0

.end local v1 #e:Ljava/io/IOException;
.restart local v0 #PROC_VERSION_REGEX:Ljava/lang/String;
.restart local v2 #m:Ljava/util/regex/Matcher;
.restart local v3 #p:Ljava/util/regex/Pattern;
.restart local v4 #procVersionStr:Ljava/lang/String;
.restart local v5 #reader:Ljava/io/BufferedReader;
:cond_0
:try_start_3
invoke-virtual {v2}, Ljava/util/regex/Matcher;->groupCount()I

move-result v6

if-ge v6, v8, :cond_1

const-string v6, "DeviceInfoSettings"

new-instance v7, Ljava/lang/StringBuilder;

invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

const-string v8, "Regex match on /proc/version only returned "

invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v7

invoke-virtual {v2}, Ljava/util/regex/Matcher;->groupCount()I

move-result v8

invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

move-result-object v7

const-string v8, " groups"

invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v7

invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v7

invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

const-string v6, "Unavailable"

move-object v6, v10

goto :goto_0

:cond_1
new-instance v6, Ljava/lang/StringBuilder;

const/4 v7, 0x1

invoke-virtual {v2, v7}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;

move-result-object v7

invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

const-string v7, "\n"

invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v6

const/4 v7, 0x2

invoke-virtual {v2, v7}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;

move-result-object v7

invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v6

const-string v7, " "

invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v6

const/4 v7, 0x3

invoke-virtual {v2, v7}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;

move-result-object v7

invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v6

const-string v7, "\n"

invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v6

const/4 v7, 0x4

invoke-virtual {v2, v7}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;

move-result-object v7

invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v6

invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
:try_end_3
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0

move-result-object v6

goto :goto_0
.end method

Then to add "Mod version" further down in the file, search for the following lines:

.line 74
const-string v2, "kernel_version"

invoke-virtual {p0, v2}, Lcom/android/settings/DeviceInfoSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v2

invoke-direct {p0}, Lcom/android/settings/DeviceInfoSettings;->getFormattedKernelVersion()Ljava/lang/String;

move-result-object v3

invoke-virtual {v2, v3}, Landroid/preference/Preference;->setSummary(Ljava/lang/CharSequence;)V
.line 77

and before the .line 77 add the following:

const-string v2, "mod_version"

const-string v3, "ro.modversion"

invoke-direct {p0, v2, v3}, Lcom/android/settings/DeviceInfoSettings;->setValueSummary(Ljava/lang/String;Ljava/lang/String;)V

Then add or change the following to /res/xml/device_info_settings.xml

(I removed the "style="?android:preferenceInformationStyle" />" after Kernel version to ensure that it shows all three lines, since preferenceInformationStyle truncates at 2 lines by default)

<Preference android:title="@string/kernel_version" android:key="kernel_version" android:summary="@string/device_info_default" />
<Preference android:title="@string/mod_version" android:key="mod_version" android:summary="@string/mod_version_default" style="?android:preferenceInformationStyle" />

and for the mod version, add the following to /res/values/strings.xml

<string name="mod_version">Mod version</string>
<string name="mod_version_default">Unknown</string>

and finally, declare the strings in /res/values/public.xml

<public type="string" name="mod_version" id="0x7f090639" />
<public type="string" name="mod_version_default" id="0x7f09063a" />

Please note, you might need to increment/decrement the last digit or two to fit with any other mods already present in your Settings.apk.

UPDATE!

Attached to this post is Settings.apk for Bionix-v 1.3.1 already modified to show the long kernel version, and mod version. This should work on any other rom that includes my user-selectable am/pm mod, but its untested on anything other than bionix. And please note, mod version will be "unknown" unless you edit your build.prop yourself to reflect the real build number, and mod version.

Cheers everyone, =)