[Android Q&A, Help & Troubleshooting] kpirnie:
I could really use a hand here, maybe with the right help, this can turn into a nice How To thread...

Here's the situation...

NOTE: I am on a Note 3 with Touchwiz Rom

I'd like to add a customization to my Settings.apk (this part's not the problem), and have it fire off a bash script on selection (whether it's a simple tap-the-setting, checkbox, list item, etc...)

Here is what I have thus far for my smali

.class public Lcom/android/settings/ExecSH;
.super Lcom/android/settings/SettingsPreferenceFragment;
.source "ExecSH.java"

.implements Landroid/preference/Preference$OnPreferenceChangeListener;
.implements Landroid/preference/Preference$OnPreferenceClickListener;

# direct methods
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z

:try_start_0
const-string v2, Landroid/preference/Preference;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference; # String of command to fire off

invoke-static {v2}, Lcom/android/settings/ExecSH;->execRootCmdSilent(Ljava/lang/String;)I
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

.end method

.method public static execRootCmdSilent(Ljava/lang/String;)I
.locals 6
.parameter "paramString"

.prologue
.line 40
:try_start_0
const-string v4, "RootCmd"

invoke-static {v4, p0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

.line 41
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

move-result-object v4

const-string v5, "su"

invoke-virtual {v4, v5}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;

move-result-object v2

.line 42
.local v2, localProcess:Ljava/lang/Process;
new-instance v0, Ljava/io/DataOutputStream;

invoke-virtual {v2}, Ljava/lang/Process;->getOutputStream()Ljava/io/OutputStream;

move-result-object v4

invoke-direct {v0, v4}, Ljava/io/DataOutputStream;-><init>(Ljava/io/OutputStream;)V

.line 44
.local v0, localDataOutputStream:Ljava/io/DataOutputStream;
new-instance v4, Ljava/lang/StringBuilder;

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

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

move-result-object v4

const-string v5, "\n"

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

move-result-object v4

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

move-result-object v3

.line 45
.local v3, str:Ljava/lang/String;
invoke-virtual {v0, v3}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

.line 46
invoke-virtual {v0}, Ljava/io/DataOutputStream;->flush()V

.line 47
const-string v4, "exit\n"

invoke-virtual {v0, v4}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

.line 48
invoke-virtual {v0}, Ljava/io/DataOutputStream;->flush()V

.line 49
invoke-virtual {v2}, Ljava/lang/Process;->waitFor()I

.line 50
invoke-virtual {v2}, Ljava/lang/Process;->exitValue()I
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

move-result v4

.line 55
.end local v0 #localDataOutputStream:Ljava/io/DataOutputStream;
.end local v2 #localProcess:Ljava/lang/Process;
.end local v3 #str:Ljava/lang/String;
:goto_0
return v4

.line 52
:catch_0
move-exception v1

.line 53
.local v1, localException:Ljava/lang/Exception;
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V

.line 55
const/4 v4, 0x1

goto :goto_0
.end method

Will this do what I think it'll do? (I think it's grab the preference key and fire it off as a root command...