Discussion on SysScope

dwitherell

Retired Forum Moderator
May 2, 2011
4,061
9,252
0
Well I don't know if I would quite consider myself a developer - as such I am a bit anomalous and am much more comfortable in the land of smali lol - dex2jar is a pretty handy tool though, thanks!
 

Aou

Senior Member
Aug 4, 2008
794
777
0
Arizona

Aou

Senior Member
Aug 4, 2008
794
777
0
Arizona
@Aou
That means your files are not deodexed. Grab them from a deodexed stock alike rom.
Thanks. I was beginning to gather that on my own, after pulling a few other SecSettings.apk's from other deodex'd ROMs. Now I'm just trying to find one which hasn't been molested too badly from its original state. I'd like to remain as stock as possible for the time being. ;)
 

bahtsiz_bedevi

Senior Member
Dec 12, 2011
405
183
0
izmir, Turkey
plus.google.com
Thanks. I was beginning to gather that on my own, after pulling a few other SecSettings.apk's from other deodex'd ROMs. Now I'm just trying to find one which hasn't been molested too badly from its original state. I'd like to remain as stock as possible for the time being. ;)
I suggest you to use a good comparing tool like http://www.diffnow.com/ or winmerge. Compare our modified ones and your original file. It'll help you a lot
 

Aou

Senior Member
Aug 4, 2008
794
777
0
Arizona
I suggest you to use a good comparing tool like http://www.diffnow.com/ or winmerge. Compare our modified ones and your original file. It'll help you a lot
Yeah, the changes are pretty fricken' scary inside Status.smali. "Holy crap, what did I get myself into?" were my first thoughts. I'm no programmer, just a jack-of-all-trades IT guy.

From what I can tell, all I really needed to edit in SecSettings.apk was this:
Code:
.method private changeSysScopeStatus()V
    .registers 8

    .prologue
    const-wide/16 v3, 0x3e8

    const v6, 0x7f09013e

    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
changing it to:
Code:
.method private changeSysScopeStatus()V
    .registers 8

    .prologue
    const v6, 0x7f09013e

    .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, v6}, 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
After much trouble, and my first experience (ever) deodexing my own apk, decompiling/recompiling with smali/baksmali, and then re-odexing my apk... I think I've done it. The "Device Status" still shows "Custom" but the padlock/custom bootloader image is GONE.

I've run out of time for today, but I'll be looking into this a bit more to figure out what the other changes you made were, so that I can remove the "custom" status inside the About Phone. Also, I've taken some notes, so I might be able to make a write-up on how to do this for us S4 people, and perhaps provide my re-compiled work.

It's exciting. It really is.

EDIT (followup): Uh, never mind about it working. Sure, I have no custom boot logo anymore, but I also have no phone service, I just realized. >_< ... I might have failed on the re-odexing part, methinks.
 
Last edited:

bahtsiz_bedevi

Senior Member
Dec 12, 2011
405
183
0
izmir, Turkey
plus.google.com
Yeah, the changes are pretty fricken' scary inside Status.smali. "Holy crap, what did I get myself into?" were my first thoughts. I'm no programmer, just a jack-of-all-trades IT guy.

From what I can tell, all I really needed to edit in SecSettings.apk was this:
Code:
.method private changeSysScopeStatus()V
    .registers 8

    .prologue
    const-wide/16 v3, 0x3e8

    const v6, 0x7f09013e

    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
changing it to:
Code:
.method private changeSysScopeStatus()V
    .registers 8

    .prologue
    const v6, 0x7f09013e

    .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, v6}, 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
After much trouble, and my first experience (ever) deodexing my own apk, decompiling/recompiling with smali/baksmali, and then re-odexing my apk... I think I've done it. The "Device Status" still shows "Custom" but the padlock/custom bootloader image is GONE.

I've run out of time for today, but I'll be looking into this a bit more to figure out what the other changes you made were, so that I can remove the "custom" status inside the About Phone. Also, I've taken some notes, so I might be able to make a write-up on how to do this for us S4 people, and perhaps provide my re-compiled work.

It's exciting. It really is.

EDIT (followup): Uh, never mind about it working. Sure, I have no custom boot logo anymore, but I also have no phone service, I just realized. >_< ... I might have failed on the re-odexing part, methinks.
You don't have re-odex it, copy it as-is. Just don't forget to remove SecSettings.odex.
From your original code All I can say, it's pretty much the same to ours. That's a good news for you :)
 

Aou

Senior Member
Aug 4, 2008
794
777
0
Arizona
You don't have re-odex it, copy it as-is. Just don't forget to remove SecSettings.odex.
From your original code All I can say, it's pretty much the same to ours. That's a good news for you :)
Okay, got it this time. I refined my notes and did not re-odex it this time (yet... still planning to!). I know of deleting the .odex file whenever you deodex something, that wasn't the problem at all.

As for the code, it seems to work great! My device status shows "custom" but I have the original boot logo. All is well. Next up, I need to review your notes through this thread and on GitHub to determine what exactly I need to edit to get the Device Status to show Official always.

I haven't tried deleting SysScope.apk yet - I'm going to wait until I get this next step completed. ;)

EDIT: Also, if anyone else is following along, I am planning to post all my notes as a guide here on XDA, but over in the S4 forums. Apart from code changes, the notes should apply to most Galaxy devices with SysScope...
 

bahtsiz_bedevi

Senior Member
Dec 12, 2011
405
183
0
izmir, Turkey
plus.google.com
Okay, got it this time. I refined my notes and did not re-odex it this time (yet... still planning to!). I know of deleting the .odex file whenever you deodex something, that wasn't the problem at all.

As for the code, it seems to work great! My device status shows "custom" but I have the original boot logo. All is well. Next up, I need to review your notes through this thread and on GitHub to determine what exactly I need to edit to get the Device Status to show Official always.

I haven't tried deleting SysScope.apk yet - I'm going to wait until I get this next step completed. ;)

EDIT: Also, if anyone else is following along, I am planning to post all my notes as a guide here on XDA, but over in the S4 forums. Apart from code changes, the notes should apply to most Galaxy devices with SysScope...
Well done ;)

Actually that part of the modification belongs to dwitherell
At first I tried to change changeSysScopeStatus() to show device status always as "Normal" but I couldn't succeed
Whenever I tried to get into "Status" section, SecSettings was crashing. Therefore I removed that code completely.
At that time thankfully dwitherell came up with a solution :) (he has more experience with smali than I do.)
I wasn't deleting an intent listener (Status$2.smali) that were causing error.

This modification he made hopefully will give you a clue ;) https://github.com/sinancetinkaya/D.../com/android/settings/deviceinfo/Status.smali
Just focus on lines 509-533 and 1709-1731. Ignore other lines because they are just the reverts of my modification

You have to delete SysScope because it triggers "Custom" system status on the bootloader screen.
If you have "Custom" system status there, you have to make it "Official" manually.
This mod doesn't convert "Custom" to "Official" on the bootloader screen but prevents it to be "Custom" again.
 
Last edited:

Aou

Senior Member
Aug 4, 2008
794
777
0
Arizona
Well done ;)

Actually that part of the modification belongs to dwitherell
At first I tried to change changeSysScopeStatus() to show device status always as "Normal" but I couldn't succeed
Whenever I tried to get into "Status" section, SecSettings was crashing. Therefore I removed that code completely.
At that time thankfully dwitherell came up with a solution :) (he has more experience with smali than I do.)
I wasn't deleting an intent listener (Status$2.smali) that were causing error.

This modification he made hopefully will give you a clue ;) https://github.com/sinancetinkaya/D.../com/android/settings/deviceinfo/Status.smali
Just focus on lines 509-533 and 1709-1731. Ignore other lines because they are just the reverts of my modification

You have to delete SysScope because it triggers "Custom" system status on the bootloader screen.
If you have "Custom" system status there, you have to make it "Official" manually.
This mod doesn't convert "Custom" to "Official" on the bootloader screen but prevents it to be "Custom" again.
Actually, I picked up on both those edits. I went through Status.smali and looked through all the differences between my files and the one that's in the github, and made several changes. The good news: it no longer shows "Custom" in the Device Status. The bad news: it now shows "Unsuccessful". hehe

I still didn't get the custom logo/padlock on boot, even with SysScope.apk still installed and functional. Interestingly enough, as soon as I uninstall it, I lose my 3G/4G (no signal) and everything goes nuts. Even restoring it from a TiBu backup doesn't work - I'm forced to restore from a nandroid backup.

Here are my edits:

Remove:
Code:
.field private isSysScopeStatus:I
Remove:
Code:
.field private mSysScopeReceiver:Landroid/content/BroadcastReceiver;
Remove:
Code:
    .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:
Code:
    .line 216
    const/4 v0, -0x1

    iput v0, p0, Lcom/android/settings/deviceinfo/Status;->isSysScopeStatus:I
Remove:
Code:
.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:
Code:
   .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:
Code:
   .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:
Code:
    .line 952
    const v1, 0x7f09013f
to
Code:
    .line 952
    const v1, 0x7f090123
Change:
Code:
.method private changeSysScopeStatus()V
    .registers 8

    .prologue
    const-wide/16 v3, 0x3e8

    const v6, 0x7f09013e

    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
Code:
.method private changeSysScopeStatus()V
    .registers 4

    .prologue
    const v1, 0x7f090123

    .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


I guess something is still calling SysScope.apk?

EDIT/UPDATE:

It appears that SysScope.apk (and its counterpart on the S4 EdmSysScopeService.apk with its odex file) must both be removed together, while the device is stopped, and at the same time as applying the modified SecSettings.apk. If you fail to do all of this within the same "stop", the system freaks out and kills your cell signal somehow. Very strange. I've added this to my notes.

It still shows "Unsuccessful" though. Not a huge deal, though... At least SysScope is gone!


EDIT AGAIN:

0x7f090123 is obviously the status that we're returning. But where is this kept? What are the other options? Originally, mine said 0x7f09013e.
 
Last edited:

bahtsiz_bedevi

Senior Member
Dec 12, 2011
405
183
0
izmir, Turkey
plus.google.com
First of all 0x7f090123 code is "Normal" status for XXDME1 N7100.
Your original code is saying it's 0x7f09013d but you have check it in public.xml

Please read https://github.com/sinancetinkaya/DeviceStatus#for-those-on-other-variants-of-the-note-ii
Once you are to that point you can use the information here to see where things were changed and use that as a means to replicate the changes in your own files. Things may not match exactly (they may though as well), so you will have to be mindful of what you are changing and why. IN PARTICULAR - there are a few places where methods were altered and resource ids were changed (not many places, but a few). These may be the same for you, but you should not assume so.
 
  • Like
Reactions: Aou

dwitherell

Retired Forum Moderator
May 2, 2011
4,061
9,252
0
...0x7f090123 is obviously the status that we're returning. But where is this kept? What are the other options? Originally, mine said 0x7f09013e.
You need to decompile fully (using apktool) SecSettings and look for the resource id (in /res/values/public.xml) of the string that reports back the status Normal (found in /res/values/strings.xml) to find the correct resource id to use instead of 0x7f090123.
 
  • Like
Reactions: Aou

Aou

Senior Member
Aug 4, 2008
794
777
0
Arizona
First of all 0x7f090123 code is "Normal" status for XXDME1 N7100.
Your original code is saying it's 0x7f09013d but you have check it in public.xml

Please read https://github.com/sinancetinkaya/DeviceStatus#for-those-on-other-variants-of-the-note-ii
Oh, awesome. I feel a tad bit stupid now, because I read through that once (not knowing what you were talking about), and then promptly forgot about it until now.

S4 is a very popular device. Can't you ask someone for help who has more experience with smali?
It is indeed popular, but it seems that the devs for the S4 really don't care about SysScope. Otherwise, people are just using the Xposed Mod that deals with this. Personally, once I found out about SysScope, I wanted to eradicate it.

You need to decompile fully (using apktool) SecSettings and look for the resource id (in /res/values/public.xml) of the string that reports back the status Normal (found in /res/values/strings.xml) to find the correct resource id to use instead of 0x7f090123.
"decompile fully" are the words I needed, thank you! I had decompiled it before, but not fully ("option 9"). I've used this option with other stuff, but didn't think to use it here. Thank you. I found the string I was looking for. I couldn't find any sort of hex numbers for the strings, but I did find that the "Official" string was exactly two strings prior to "Scanning...", so I simply adjusted the number accordingly.

Just as [email protected] suggested: 0x7f09013d

I think I'm good-to-go. I'm updating my notes and cleaning them up further. I should have a write-up ready soon!