[AT&T Samsung Galaxy S 5] cstayton:
[GUIDE][DEVS][SMALI]Enable "Device Status Official" - Remove SysScope[GUIDE][DEVS]

How to permenantly remove SysScope from your Samsung Touchwiz ROM

​

Tired of the constant custom padlock on startup? Want permenant device status "Official"?

​

NOTICE:

Prerequisites:

You need java installed and working at the command prompt.

You need smali and baksmali in your working directory. I used v1.4.2 of each. Here's some links: baksmali and smali.

Basic ADB skills

A good text editor, such as Notepad++. Even better, and good text comparison tool would be great to check your work (get a trial of Beyond Compare 3 maybe?).

Originally, I used a comparison tool, but in the end found myself just making the edits in Notepad++.

7zip or some other compressing/deompressing tool that can add a file into an .apk file.

Zip-Align (available in the SDK tools and other places around XDA) - technically optional, but probably a good idea

Get all these things into a working folder, open your command prompt in that folder, test ADB, and then begin.

Main Instructions:

1. Make sure you have an unmodded copy of your framework files (twframework-res.apk and framework-res.apk)

you need have these available locally for your chosen method to decompile (I'm not going to describe how

to decompile in this thread, If you don't know how then this MOD is not for you)

2. Pull a copy of the SecSettings.apk

adb pull /system/priv-app/SecSettings.apk

3. Decompile SecSettings.apk (using your favorite tools I recomend Virtuous Ten Studio)

4. Edit classes_out\com\android\settings\deviceinfo\Status .smali manually (using Notepad++).

"Remove:" means to delete a line or remove a section entirely.

"Change:" means to look at the original code, and make it look like the "to" part.

NOTE depending on your ethod of decompiling you may not see the line numbers

however, if you do delete from the appropriate code section as well.

REMOVE:

.field private isSysScopeStatus:I

REMOVE:

.field private mSysScopeReceiver:Landroid/content/BroadcastReceiver;

REMOVE:

.line 264
new-instance v0, Lcom/android/settings/deviceinfo/Status$2;

invoke-direct {v0, p0}, Lcom/android/settings/deviceinfo/Status$2;-><init>(Lcom/android/settings/deviceinfo/Status;)V

iput-object v0, p0, Lcom/android/settings/deviceinfo/Status;->mSysScopeReceiver:Landroid/content/BroadcastReceiver;

REMOVE:

.line 216
const/4 v0, -0x1

iput v0, p0, Lcom/android/settings/deviceinfo/Status;->isSysScopeStatus:I

REMOVE:

.method static synthetic access$402(Lcom/android/settings/deviceinfo/Status;I)I
.registers 2
.parameter "x0"
.parameter "x1"

.prologue
.line 102
iput p1, p0, Lcom/android/settings/deviceinfo/Status;->isSysScopeStatus:I

return p1
.end method

.method static synthetic access$500(Lcom/android/settings/deviceinfo/Status;)V
.registers 1
.parameter "x0"

.prologue
.line 102
invoke-direct {p0}, Lcom/android/settings/deviceinfo/Status;->changeSysScopeStatus()V

return-void
.end method

REMOVE:

.line 687
iget-object v0, p0, Lcom/android/settings/deviceinfo/Status;->mSysScopeReceiver:Landroid/content/BroadcastReceiver;

invoke-virtual {p0, v0}, Lcom/android/settings/deviceinfo/Status;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

REMOVE:

.line 657
iget-object v1, p0, Lcom/android/settings/deviceinfo/Status;->mSysScopeReceiver:Landroid/content/BroadcastReceiver;

new-instance v2, Landroid/content/IntentFilter;

const-string v3, "com.sec.intent.action.SYSSCOPESTATUS"

invoke-direct {v2, v3}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

invoke-virtual {p0, v1, v2}, Lcom/android/settings/deviceinfo/Status;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

CHANGE: Take note at this part you will need to locate some specific values from within /res/values/public.xml

Open /res/values/public.xml and search for "<public type="string" name="sysscope_tampered" id="0x7f0901a7" />"

and also for "<public type="string" name="sysscope_normal" id="0x7f0901a6" />" and also for

"<public type="string" name="sysscope_status" id="0x7f0901a5" />"

note the IDs you will need these values in the next section. (This is official NCE release your release

may have a different value.) Make sure you change the bolded values to match your own.

.line 952
const v1, 0x7f0901a7

TO:

.line 952
const v1, [B]0x7f0901a5[/B]

CHANGE:

.method private changeSysScopeStatus()V
.registers 8

.prologue
const-wide/16 v3, 0x3e8

const v6, 0x7f0901a7

const/4 v5, -0x1

.line 956
const-string v0, "sysscope_status"

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

move-result-object v2

.line 958
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

move-result-wide v0

div-long/2addr v0, v3

.line 959
invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

move-result-wide v0

div-long/2addr v0, v3

.line 961
const-wide/16 v3, 0x0

cmp-long v3, v0, v3

if-nez v3, :cond_1e

.line 962
const-wide/16 v0, 0x1

.line 965
:cond_1e
iget v3, p0, Lcom/android/settings/deviceinfo/Status;->isSysScopeStatus:I

if-ne v3, v5, :cond_30

const-wide/16 v3, 0x78

cmp-long v0, v0, v3

if-lez v0, :cond_30

.line 966
invoke-virtual {p0, v6}, Lcom/android/settings/deviceinfo/Status;->getString(I)Ljava/lang/String;

move-result-object v0

.line 977
:goto_2c
invoke-virtual {v2, v0}, Landroid/preference/Preference;->setSummary(Ljava/lang/CharSequence;)V

.line 978
return-void

.line 968
:cond_30
iget v0, p0, Lcom/android/settings/deviceinfo/Status;->isSysScopeStatus:I

const/4 v1, 0x2

if-ne v0, v1, :cond_3a

.line 969
invoke-virtual {p0, v6}, Lcom/android/settings/deviceinfo/Status;->getString(I)Ljava/lang/String;

move-result-object v0

goto :goto_2c

.line 970
:cond_3a
iget v0, p0, Lcom/android/settings/deviceinfo/Status;->isSysScopeStatus:I

if-ne v0, v5, :cond_46

.line 971
const v0, 0x7f09013f

invoke-virtual {p0, v0}, Lcom/android/settings/deviceinfo/Status;->getString(I)Ljava/lang/String;

move-result-object v0

goto :goto_2c

.line 973
:cond_46
const v0, 0x7f09013d

invoke-virtual {p0, v0}, Lcom/android/settings/deviceinfo/Status;->getString(I)Ljava/lang/String;

move-result-object v0

goto :goto_2c
.end method

TO:

.method private changeSysScopeStatus()V
.registers 4

.prologue
[B]const v1, 0x7f0901a6[/B]

.line 956
const-string v0, "sysscope_status"

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

move-result-object v2

.line 966
invoke-virtual {p0, v1}, Lcom/android/settings/deviceinfo/Status;->getString(I)Ljava/lang/String;

move-result-object v0

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

.line 978
return-void
.end method

Delete: /smali/com/android/settings/deviceinfo/status$2.smali

re-compile SecSettings.apk

INSTALL: