[APP][7.0+][ROOT] Split Screen DPI Changer

Search This thread

kawaiiDango

Senior Member
Jul 12, 2011
486
190
This is a dumb simple app, which allows you to set a different DPI for split screen mode (and another DPI for normal mode)

DOWNLOAD: https://github.com/kawaiiDango/SSScripts/blob/master/apk/app-debug.apk
UuquDfq.png
kDa5qc7.png
VvUmukz.png


Q: Why though?
A: Useful for phones with small displays, or when u intentionally use a large DPI for comfortable reading (like me), but split screen makes the apps tiny and unusable, and you can't manually keep changing the dpi.

Q: What does it do?
A: On every window change event, from the AccesibilityService, it checks if one of the windows is TYPE_SPLIT_SCREEN_DIVIDER And runs "wm density someDPI" accordingly.
It needs Accessibility and root for the above operations.

Q: Marshmallow has split screen too
A: MM doesn't have TYPE_SPLIT_SCREEN_DIVIDER

Q: This thing is stealing my passwords through Accessibility and root
A: Source: https://github.com/kawaiiDango/SSScripts
 

Huebabbel

Member
Aug 12, 2015
13
6
Anyone test this yet?

Better late than never, I guess @MishaalRahman. I have tested this, because I have not found any other app/tweak that gives me the functionality that I need. It works just fine. However I needed to disable the super-user toasts for this app, as SU seems to get used on every single app switch, instead of just applying it when there is a need for DPI change.

I often use two apps in split-screen mode together under Android 11. My problem is, that most apps do not simply scale down nicely, but sometimes get cropped to the point at which they become unusable.

This app does exactly what’s shown in the screenshots in the original posting. You can set the DPI for split-screen independent of the DPI for single-window mode. I have set my split-screen DPI to exactly half of my regular DPI. In consequence most apps look perfectly normal in split-screen mode, as everything is scaled down to exactly half the original size.

There are some inconsistencies with some apps, as not everything always scales down perfectly, or maybe they just do not like the reduced screen size. In general it works well enough. What I would find really useful would be a setting like in the density section of the Android display options, but per app and per mode (normal, split-screen). That way not the whole phone, including quick settings, would scale down, but only the selected apps in split-screen mode.
 

Huebabbel

Member
Aug 12, 2015
13
6
So I have found the reason for the toast spam, which potentially also comes with some CPU overhead. Can someone who has a working Android build environment with Kotlin set up plase create a new APK with this simple change? The original author does not seem to be active here anymore.

In app\src\main\java\com\arn\scripts\Main.java line 41+ there is a check that then sets the DPI. This gets executed on every single accessibility event, and there are lots of those.
Original:
Java:
            if (!shouldIgnore && isSplitVisible)
                setDPI(pref.getInt("split_dpi", 0))
            else if (!shouldIgnore && !isSplitVisible)
                setDPI(pref.getInt("normal_dpi", 0))
Modified:
Java:
            if (!shouldIgnore && isSplitVisible != prevSplitVisible)
            {
                prevSplitVisible = isSplitVisible
                if (isSplitVisible)
                    setDPI(pref.getInt("split_dpi", 0))
                else
                    setDPI(pref.getInt("normal_dpi", 0))
            }
Of course prevSplitVisible needs to be declared as class member and initialized to false in addition. This should only fire up the SU wm density command when there is a change needed.