• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Q] Edit system/framework/services.jar ?

Search This thread

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
I got tired of waiting for a nice custom ROM or Xposed to drop, so I decided to look into doing my own mods. I've been wanting to learn for the longest time.
My Googling suggests things I mostly want (such as the five-way-reboot and disabling of screen-on when plugged/unplugged) are options that can be change in services.jar.

But I'm not finding the classes.dex in my services.jar file.
Can anyone point me in the right direction to get started?
Maybe toss a link my way to read?

I got brain tired after 20 minutes of Googling only led me to how-to guides that aren't working out because I don't have this classes.dex thing?
 
  • Like
Reactions: Yogesh1969

mostyle

Senior Member
Nov 13, 2006
489
234
Langley, SC
I got tired of waiting for a nice custom ROM or Xposed to drop, so I decided to look into doing my own mods. I've been wanting to learn for the longest time.
My Googling suggests things I mostly want (such as the five-way-reboot and disabling of screen-on when plugged/unplugged) are options that can be change in services.jar.

But I'm not finding the classes.dex in my services.jar file.
Can anyone point me in the right direction to get started?
Maybe toss a link my way to read?

Pull the .jar file to your local machine and open it in an archiver that supports .zip compression. Many files including 'classes.dex' are inside the .jar file. Simplest way is to extract the classes.dex then decompile it using backsmali.
 

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
Pull the .jar file to your local machine and open it in an archiver that supports .zip compression.

Right, but there is only one file inside the services.jar and it's not classes.dex. It's just the META-INF folder wiht MANIFEST.MF inside.
As well, the services.jar is only 318 Bytes.

I use 7zip on my computer or Root Explorer on the phone.
 

Attachments

  • serv.jpg
    serv.jpg
    95.3 KB · Views: 950

mostyle

Senior Member
Nov 13, 2006
489
234
Langley, SC
Right, but there is only one file inside the services.jar and it's not classes.dex. It's just the META-INF folder wiht MANIFEST.MF inside.
As well, the services.jar is only 318 Bytes.

I use 7zip on my computer or Root Explorer on the phone.

Same here. I suspect the dex code you are looking for has moved either to an APK or a different JAR.

Have you looked at the classes.dex in framework-res.apk?

There are a LOT of 318 byte files in /system/framework. This tells me most definitely that the code has been offloaded elsewhere and that these files were likely left as legacy reference. Apologies for not looking at the files before replying.
 
  • Like
Reactions: CZ Eddie

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
Now that you mention it, I did try all the other jar's in /system/framework.
The only one that had a classes.dex was embmslibrary.jar.
But I got errors when trying to unpack it.
Wish I'd saved the errors to post here.

Figured I'd give some of the ROM building utilities a go but have not had success yet. I'm only still just starting out though.

I'm thinking we'll probably need an all new ROM Kitchen for 7.1 due to many significant changes.
Which are probably what's holding up ROM development so far.
I got the Nexu.... uh, Pixel because I figured we'd have a bunch of cool AOSP ROM's within a week or two. doh.
 

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
Good to know, thank you!

It's a bummer about all these Android Kitchen variations out there.
None work with the Pixel yet.

I'm not having warm & fuzzy feelings about development for this phone.
 

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
disable screen on when plugged in can be disabled by editing "bools.xml" in the framework-res.apk

i can do it for you if you want

Thank you!

Holy moly, I've already found 18 bools.xml's in framework-res.apk and there are still about two hundred folders to manually open to see what's in there.
Do you know which one to edit? I'd like to learn all this myself.
I'm using APK Studio and really wish it had a better search function. :eek:
 

Scott

Retired Recognized Developer
Thank you!

Holy moly, I've already found 18 bools.xml's in framework-res.apk and there are still about two hundred folders to manually open to see what's in there.
Do you know which one to edit? I'd like to learn all this myself.
I'm using APK Studio and really wish it had a better search function. :eek:

And you thought this was going to be easy why??? LOL ;)
 
  • Like
Reactions: Yogesh1969

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
You're not kidding.
Just one roadblock after another.
And all my Googling leads to old research/faq's that just don't seem to work on the Pixel.
I need to go buy an old Nexus running Gingerbread just to get some of this stuff to work.

My current roadblock is trying to write to /system via ADB.
It pretends to let me write.
But after a reboot, all my changes are gone and it's gone back to the original files again.

adb root
adb remount
adb push filename /system/folder/filename.

It's like yeahhhh, 100% write complete.
PSYCH! Then you reboot and it's like you never wrote anything.
 

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
I even tried replacing the framework file using Root Explorer but it just immediately reboots and bootloops.
I did sign the apk succesfully before trying that.
 

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
FINALLY I have success.
I'm now able to unplug my phone without the screen turning on.
This was a huge frustration when car-docked.

Now I can work on a few other things and come back and play with some more mods later. :good:

So my stumbling blocks were permissions (duh) and being unable to decompile, recompile and then sign the apk and get it onto the phone without bootlooping.

I still don't have a good way of dcompiling/recompiling without doing some 7zip magic afterwards. But at least I have some success and a footprint to move forward with learning some further mods. :good:
And I had to get this done using Root Explorer, so I still need to figure out a proper way to mount the system and push system files with ADB and get them to stick.
 

CZ Eddie

Senior Member
Sep 27, 2011
6,097
2,302
Austin, TX
Well, so my ultimate goal was to do a bunch of mods and then release a custom stock-based ROM to the community.
But holy moly, more stumbling blocks.
Couldn't figure out how to create a simple flashable ROM zip.

So I just released my mods in the Themes & Apps subforum:
http://forum.xda-developers.com/pixel-xl/themes/framework-mods-disable-screen-off-usb-t3508322

Thanks for the help, guys. :good:
I'll get back at the custom ROM thing another time.

I'll tell you what though.
I have tons more respect for devs after trying all this on my own.
Even if it's something you know how to do, there is a LOT of time and work spent on modding.
And then figuring out something new for the first time is incredibly frustrating. :eek:
 
  • Like
Reactions: guaneet

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    The reason you're not seeing the classes.dex file in any of the jar files is because the system is odexed. The classes.dex file is actually services.odex in /system/framework/oat/arm64.
    1
    I got tired of waiting for a nice custom ROM or Xposed to drop, so I decided to look into doing my own mods. I've been wanting to learn for the longest time.
    My Googling suggests things I mostly want (such as the five-way-reboot and disabling of screen-on when plugged/unplugged) are options that can be change in services.jar.

    But I'm not finding the classes.dex in my services.jar file.
    Can anyone point me in the right direction to get started?
    Maybe toss a link my way to read?

    I got brain tired after 20 minutes of Googling only led me to how-to guides that aren't working out because I don't have this classes.dex thing?
    1
    Right, but there is only one file inside the services.jar and it's not classes.dex. It's just the META-INF folder wiht MANIFEST.MF inside.
    As well, the services.jar is only 318 Bytes.

    I use 7zip on my computer or Root Explorer on the phone.

    Same here. I suspect the dex code you are looking for has moved either to an APK or a different JAR.

    Have you looked at the classes.dex in framework-res.apk?

    There are a LOT of 318 byte files in /system/framework. This tells me most definitely that the code has been offloaded elsewhere and that these files were likely left as legacy reference. Apologies for not looking at the files before replying.
    1
    Good Job Eddie!

    While you are learning can you incorporate a dark background in the app drawer.

    Keep up the good work.

    There are already mods out there for the Pixel Launcher.

    I use Nova Launcher though, which has color and transparency options built right into it.
    1
    disable screen on when plugged in can be disabled by editing "bools.xml" in the framework-res.apk

    i can do it for you if you want