Skip to content

Doesn't appear to work on newer versions of Android #5

Open

Description

@tech128

Well apparently lollipop breaks this app.

I'm running the latest 5.1.1 and it runs, but when it boots and tries to change the limit, it breaks pretty hard.

I/art ( 2380): Late-enabling -Xcheck:jni
I/ActivityManager( 519): Start proc 2380:de.florian.processlimit/u0a25 for broadcast de.florian.processlimit/.BootReceiver
D/de.florian.processlimit( 2380): New limit: 4
W/System.err( 2380): java.io.IOException: Unable to open '/system/priv-app/Settings.apk' : No such file or directory
W/System.err( 2380): at dalvik.system.DexFile.openDexFileNative(Native Method)
W/System.err( 2380): at dalvik.system.DexFile.openDexFile(DexFile.java:295)
W/System.err( 2380): at dalvik.system.DexFile.(DexFile.java:80)
W/System.err( 2380): at dalvik.system.DexFile.(DexFile.java:59)
W/System.err( 2380): at de.florian.processlimit.SetProcessLimitActivity.setProcessLimit(SetProcessLimitActivity.java:57)
W/System.err( 2380): at de.florian.processlimit.BootReceiver.onReceive(BootReceiver.java:20)
W/System.err( 2380): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2631)
W/System.err( 2380): at android.app.ActivityThread.access$1700(ActivityThread.java:154)
W/System.err( 2380): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1388)
W/System.err( 2380): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 2380): at android.os.Looper.loop(Looper.java:135)
W/System.err( 2380): at android.app.ActivityThread.main(ActivityThread.java:5338)
W/System.err( 2380): at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 2380): at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err( 2380): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:917)
W/System.err( 2380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
W/System.err( 2380): Caused by: java.io.IOException: Failed to open oat file from dex location '/system/priv-app/Settings.apk'
W/System.err( 2380): ... 16 more
W/System.err( 2380): Caused by: java.io.IOException: Failed to open oat file from /system/priv-app/arm/Settings.odex (error Failed to open oat filename for reading: No such file or directory) (no dalvik_cache availible) and relocation failed.
W/System.err( 2380): ... 16 more
W/System.err( 2380): Caused by: java.io.IOException:
W/System.err( 2380): ... 16 more

I'm pretty sure it's because of the hardcoded /system/priv-app/Settings.apk

That file is now in /system/priv-app/Settings/Settings.apk

Activity

  1. tech128 commented on Nov 11, 2015

    @tech128
    Author

    Because this issue annoyed me so much, I decided to find a non-code way to set the process limit.

    It can be done with root access with a single command.

    service call activity 51 i32 x

    Where x is the number of background processes you want.

    Hopefully you can let people know on the main page here.

    If the API changes in the future, it's easy to look it up again.

    http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/app/IActivityManager.java?av=f

    Look for the line with SET_PROCESS_LIMIT_TRANSACTION

    Then just extrapolate that info to http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/DESIRED_ANDROID_VERSION/android/app/IActivityManager.java?av=f

    Replacing DESIRED_ANDROID_VERSION with the version you're interested in.

  2. flode commented on Nov 11, 2015

    @flode
    Owner

    I added the alternative way to the main page.
    I don't know why the app doesn't work, there's no hardcoded path to Settings.apk, the system chooses that automatically.

  3. tvierling commented on Nov 11, 2015

    @tvierling

    For Tasker users, another app-based mechanism to set this value is via Secure Settings, which does work for me on all of Android 2.3 ... 4.4 as of this writing (I have no 5.x devices to test):

    https://play.google.com/store/apps/details?id=com.intangibleobject.securesettings.plugin

    The function is Root Actions -> Background App Processes and offers the usual set of default/none/1/2/3/4 options. Secure Settings can be used without Tasker by creating a shortcut, but to run at boot, you need Tasker (or Locale or similar) to use Secure Settings as a plugin, or some other app capable of launching shortcuts at boot to trigger a Secure Settings shortcut action.

    (Tasker's profile context for boot-complete is Event -> System -> System Boot. The task it executes should contain an action Plugins -> Secure Settings using the above Secure Settings function.)

  4. brainvision commented on Nov 21, 2016

    @brainvision

    @flode hi there.. I have 5.1.1_r1 and I tried to use the alternative (manual) way:
    service call activity 51 i32 x
    what I don't understand is I have to use 50 or 51.. You also said in fact that we should check SET_PROCESS_LIMIT_TRANSACTION line, and that's what I did, but it reports 50 NOT 51.. I also checked it for the 4.4 and it already was 50..
    Did I miss something?

    BTW I launched two commands using both 50 both 51 from my terminal and it works great!

  5. bebo-dot-dev commented on Feb 17, 2018

    @bebo-dot-dev

    The service call activity 51 i32 x option is looking very promising here on a Sony Bravia Android TV that at the time of writing runs Android TV 7.0

    My TV is not rooted (I'm not even sure if anyone has found a way to root a Sony Android TV yet) however service call activity 51 i32 x does appear to be working as expected when executed in an adb shell.

    I'm hopeful that I can now find a way to run this in a shell script on boot. Many thanks for this project and special thanks to @tech128 for finding and mentioning this option.

  6. ProgierEugene commented on Feb 6, 2019

    @ProgierEugene

    Hi everyone! Unfortunately, "service call activity 51 i32 4" not working on Android Pie, so can anybody help me to make it working? I can't find necessary strings in android pie source code to understand how to modify the command, grepcode.com is down and I can't figure out how to find necessary strings in a new AOSP repository. I'll be very happy if anybody helps me with it, cause I want to enter this value to custom rom of my phone to make one work much smoother, clearly 2gb of RAM is not enough to run Android Pie smooth.

  7. Novosti1 commented on Oct 19, 2019

    @Novosti1

    Is it working for Android 8 ? Can anyone can confirm ?
    service call activity 51 i32 x

  8. Novosti1 commented on Oct 20, 2019

    @Novosti1

    If the API changes in the future, it's easy to look it up again.

    http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/app/IActivityManager.java?av=f

    Look for the line with SET_PROCESS_LIMIT_TRANSACTION

    Then just extrapolate that info to http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/DESIRED_ANDROID_VERSION/android/app/IActivityManager.java?av=f

    ### LINKS NOT WORKING, anyone help ?

  9. ProgierEugene commented on Oct 27, 2019

    @ProgierEugene

    I tried different numbers and found that right number for Oreo is 42 (service call activity 42 i32 x) and for pie is 47 (service call activity 42 i32 x).
    I usually use 15-18 apps values, it's optimal for both multitasking and interface smoothness

  10. bebo-dot-dev commented on Oct 27, 2019

    @bebo-dot-dev

    Thank you @ProgierEugene, I don't know how you worked this out but service call activity 42 i32 x works for me on my Oreo Android TV. Much appreciated thank you.

  11. Mitezuss commented on Sep 15, 2020

    @Mitezuss

    For Android Q is: service call activity 40 i32 x

  12. Novosti1 commented on Feb 23, 2021

    @Novosti1

    service call activity 51 i32 x - Android 7 ( good with 6 also )
    service call activity 42 i32 x - Android 8
    service call activity 47 i32 x - Android 9 ( not confirmed )

  13. atonement87 commented on May 12, 2021

    @atonement87

    Any idea what's the code for A11? Thanks.

  14. z826540272 commented on Jul 17, 2021

    @z826540272

    Any idea what's the code for A11? Thanks.

    service call activity 44 i32 x

  15. oldman20 commented on Jun 17, 2022

    @oldman20

    Because this issue annoyed me so much, I decided to find a non-code way to set the process limit.

    It can be done with root access with a single command.

    service call activity 51 i32 x

    Where x is the number of background processes you want.

    Hopefully you can let people know on the main page here.

    If the API changes in the future, it's easy to look it up again.

    http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/app/IActivityManager.java?av=f

    Look for the line with SET_PROCESS_LIMIT_TRANSACTION

    Then just extrapolate that info to http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/DESIRED_ANDROID_VERSION/android/app/IActivityManager.java?av=f

    Replacing DESIRED_ANDROID_VERSION with the version you're interested in.

    But now these links broken, Where can i found "x" number in newer android?
    Thanks

  16. oldman20 commented on Jun 17, 2022

    @oldman20

    im on android Pie!

  17. Mitezuss commented on Aug 4, 2022

    @Mitezuss

    im on android Pie!

    service call activity 47 i32 X

    X = process

  18. nor-ric commented on Feb 12, 2023

    @nor-ric

    For A11 it's actually 43.
    I've updated a script to catch the command number for future Android releases: https://stackoverflow.com/a/75424165/16725644

  19. oldman20 commented on Feb 17, 2023

    @oldman20

    For A11 it's actually 43.
    I've updated a script to catch the command number for future Android releases: https://stackoverflow.com/a/75424165/16725644

    nice to see this process still active in 2023

  20. steadfasterX commented on Feb 24, 2023

    @steadfasterX

    great stuff here. Accidentally struggled over a problem with a background process limit and wanted to increase it more then the max in developer options.. Thanks all for figuring out the id's and @flode for the initial bring-up.

    for those interested I made an Automate flow for that.
    Currently supports Android 6 - 11 and if someone would tell me the values for Android 12 and 13 I can easily extend it :)

    Have fun: https://llamalab.com/automate/community/flows/44550 (Flow name: "Set max background processes")

  21. jfaure9 commented on Jan 1, 2024

    @jfaure9

    Hi all,

    I'm on Lineage 20/Android 13 and thks to this I managed to determine that the proper code on this level is 44 (@steadfasterX) and thus was able to run the shell command described above using adb.

    However, contrary to what I was expecting, the change to the max number of bg processes is NOT persisted (i.e. : on reboot it's back to "standard"): what am I missing? Is this normal?

    Thanks in advance for your help!

  22. steadfasterX commented on Jan 1, 2024

    @steadfasterX

    Thats expected behavior and the reason why I linked the automate flow which can do that on every boot automatically

  23. jfaure9 commented on Jan 1, 2024

    @jfaure9

    Thats expected behavior and the reason why I linked the automate flow which can do that on every boot automatically

    Oh... My bad. I misunderstood the README and thought the command line method was bypassing the "reset on boot" behavior.
    Thanks for the automate flow!

  24. Marcus051333 commented on Aug 15, 2024

    @Marcus051333

    Thats expected behavior and the reason why I linked the automate flow which can do that on every boot automatically

    Your Automate flow doesn't work with A13. Could you fix that?

  25. steadfasterX commented on Sep 16, 2024

    @steadfasterX

    Thats expected behavior and the reason why I linked the automate flow which can do that on every boot automatically

    Your Automate flow doesn't work with A13. Could you fix that?

    yes. added in version6 rn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions