Or Continue to Thread: [MOD] TABLET/HYBRID MODE UBER …
Find Your Device:
15th April 2012, 02:56 AM   |  #608  
molesarecoming's Avatar
OP Recognized Developer
Flag Berlin
Thanks Meter: 27,401
 
7,530 posts
Join Date:Joined: Feb 2012
Donate to Me
you are right, the market is something else, i didn't think of it. the market needs to read that value locally for restriction purposes. all apps on the other hand, as i have read, simply hand out their ressources and ics does with it what i wants. low-res, high-res, its for the os to decide. if that is really true, then i think here we'd have a nice leverage point. with that breaching strategy an app could drop up into standard dpi, even though the system is running in tablet mode, simply because the apk loader is dishing out "wrong" layouts based on a hooked displaymetrics result.

i studied the source a little bit, actually google themselves implemented such hooks. for instance right in the function which determines the system dpi they have an emulator prop (emu.sf.lcd_density) overriding ro.sf.lcd_density. i tried that one out by softbooting and it works nicely. we'd need something fast in there, something that can make a quick sanity check if to intervene or not. i don't think that this would slow down the system at all.

something like that:

File: DisplayMetrics.java, changes are in red
Quote:

private static int getDeviceDensity() {
return SystemProperties.getInt("qemu.sf.lcd_density.THIS_APPS_NAME", SystemProperties.getInt("qemu.sf.lcd_density",
SystemProperties.getInt("ro.sf.lcd_density", DENSITY_DEFAULT)));
}

all thats missing is a way to know which app is using displaymetrics at that moment. im lacking a deeper android knowledge right now to know if that can be retrieved easily. but if it could that would probably be it. if at that point we cannot know the apps name we'd need to go higher, at some point the package loader must know for whom to dish out what. we now could define per app dpi's at boot time by a simple build.prop edit: qemu.sf.lcd_density.com.skype.raider-1 = 320, BAM, skype runs in default dpi. with this in check tablet mode ain't no problem anymore. well, except for the damned marked.
Last edited by molesarecoming; 15th April 2012 at 03:49 AM.