# help making widescreen mod



## KevlarGibs (Aug 22, 2011)

I was inspired by this thread the other day:
http://forum.xda-developers.com/showthread.php?t=1393701

Most Android tablets have 16:10 aspect ratios, but the Touchpad has a 4:3 ratio. Our screen is much more square than our widescreen brothers. There are a handful of games/apps that scale resolution well, but don't scale aspect well... things off the edge of the screen, or things smashed together and overlapping.

This mod was for CM7 Alpha 3.5 I decompiled and looked into the modded APKs and there were only very minor changes to a few files. (I don't have specifics at the moment, as I have it all on my home PC, I can update this later with what I have so far)

I made the modifications to the files in CM9, but apparently I don't know how to recompile an APK correctly, and crashed my touchpad, and couldn't boot until I put the old files back.

I feel if I could get the APK files recompiled correctly, it would work...

Ideally though, it would be nice if someone that has a better understanding of this than I do is able to take this idea and run with it... it would be nice to have a toggle back and forth, so you only really bother turning it on for the handful of games/apps that have rendering issues.


----------



## motitas (Mar 2, 2012)

I'm pretty sure that the mod your talking about just makes the status bar thicker to obscure some of the screen. This isn't going to work on cm9 because the status bar doesn't work in the same way. Anyways I honestly haven't had any issues with the aspect ratio since cm9, most games work fine.


----------



## Dubi (Jan 19, 2012)

I'm quite happy with my 4.3 but I do know some apps assume that 600 is what we all should have







.

So... here it goes, another quick "hack"

Same as the hide_bar, this only changes the android.policy.jar file
Included in the "flashable" zip is the .jar and a ultra simple tool to change the screen from 768 to 600 and back again.

Couple of pics to illustrate it 8) (you know, a picture is worth x billions trillions of words







)



















And one from a "badly written" app like Online, notice the black bar at the top while using the "correct" 1024x768










and now with the 1024x600 "mode"










So far it has worked with everything I tried.
It will look "crap" in portrait mode, I always use the TP in landscape, so I don't care too much, but if you needed "really, really needed" ask









the zip:

http://www.zen24223....een_A2_0312.zip

BTW: do not complaint about the icon







!!!!


----------



## ruthienu (Oct 18, 2011)

I wonder if this mod would help me. The time magazine app in cm9 display is distorted. The letters are too short and wide. I guess its because of the touchpad's 3:4 aspect ratio.Does this mod work in portrait? The time app only works in portrait.


----------



## Dubi (Jan 19, 2012)

I only test this for landscape, reducing the size from 768 to 600, so it doesn't work too well in portrait
I guess I will need to do it for portrait too







I assume that Time magazine will expect a width of 600 rather than 768 and that cause the "distorted" fonts.

Will try to do it tomorrow


----------



## Dubi (Jan 19, 2012)

ok, updated to support portrait.









The times mobile looked fine to before, so not sure if it's the same app you refer to










same link as before (just updated the zip)


----------



## ruthienu (Oct 18, 2011)

Not time mobile app but time magazine tablet app. Its for people who but or have print subscriptions. Thank for updating for profile! Will try


----------



## ruthienu (Oct 18, 2011)

How do you install this hack? Sorry for the noob questions! Any help would be appreciated!

Sent from my cm_tenderloin using Tapatalk


----------



## ruthienu (Oct 18, 2011)

Installed zip in cwm but alas it doesn't seem to help. It just cuts off half the screen. Here is a picture of the distorted original







and the cut off version. 








Sent from my cm_tenderloin using Tapatalk


----------



## KevlarGibs (Aug 22, 2011)

Awesome job! This is exactly what I was looking for. Unfortunately I am having issues getting it working... I keep getting "systemui has stopped responding." I get no status bar in portrait or landscape. Portrait removes a section of the right and the bottom parts of the screen when I run the app. Landscape looks like it might be right, and but it's missing the statusbar, like I mentioned before...

Thank you for your awesome work. Let me know if you have any thoughts as to what I'm doing wrong.

Sent from my cm_tenderloin using RootzWiki


----------



## Devedander (Nov 16, 2011)

nice... so this cant be used in conjunction with hide bar correct? would lobe to have both at the same time...


----------



## Dubi (Jan 19, 2012)

Devedander said:


> nice... so this cant be used in conjunction with hide bar correct? would lobe to have both at the same time...


yes, I did add both changes to the policy.jar so safe to install it if you are using the ToggleBar


----------



## Dubi (Jan 19, 2012)

KevlarGibs said:


> Awesome job! This is exactly what I was looking for. Unfortunately I am having issues getting it working... I keep getting "systemui has stopped responding." I get no status bar in portrait or landscape. Portrait removes a section of the right and the bottom parts of the screen when I run the app. Landscape looks like it might be right, and but it's missing the statusbar, like I mentioned before...
> 
> Thank you for your awesome work. Let me know if you have any thoughts as to what I'm doing wrong.
> 
> Sent from my cm_tenderloin using RootzWiki


If you are getting a FC in SystemUI it's more likely that the problem is a mismatch between versions.
The android.policy.jar was build with the code as yesterday, which I think is not quite "compatible" with A2, (only with latest nighly with HW and so on)

Which CM9 version are you running? Latest A2 or some nightly built?
(btw, the reason the status bar goes is because SystemUI has died, it shouldn't, it should keep running)


----------



## Dubi (Jan 19, 2012)

ruthienu said:


> Installed zip in cwm but alas it doesn't seem to help. It just cuts off half the screen. Here is a picture of the distorted original


ummmm, that's strange, looking at your screencapture, the interface (the Time's buttonbar) appears to be fine (new 600 width) but the picture itself is not. All my apps adjust the content size to the new resolution. Maybe that Time app does something special, shame is a paid one. Will like to try it.
Do you have any other one (free app) that behaves in the same way?


----------



## KevlarGibs (Aug 22, 2011)

Dubi said:


> If you are getting a FC in SystemUI it's more likely that the problem is a mismatch between versions.
> The android.policy.jar was build with the code as yesterday, which I think is not quite "compatible" with A2, (only with latest nighly with HW and so on)
> 
> Which CM9 version are you running? Latest A2 or some nightly built?
> (btw, the reason the status bar goes is because SystemUI has died, it shouldn't, it should keep running)


That's what I was afraid of... I'm on alpha 2, haven't switched to nightlies yet.

Sent from my cm_tenderloin using RootzWiki


----------



## Dubi (Jan 19, 2012)

KevlarGibs said:


> That's what I was afraid of... I'm on alpha 2, haven't switched to nightlies yet.
> 
> Sent from my cm_tenderloin using RootzWiki


I wouldn't mind to put the changes on the base A2, but I'm not sure how to identify the exact time in the code to do it.
When you do a "repo sync" it will update your local copy of the source, and it's not easy to go back, which means I can't do an build for A2.

Will have a look and report back


----------



## ruthienu (Oct 18, 2011)

Sorry this is the only application that is behaving this way! 
I appreciate all your help

Sent from my cm_tenderloin using Tapatalk


----------



## Dubi (Jan 19, 2012)

ruthienu said:


> Sorry this is the only application that is behaving this way!
> I appreciate all your help
> 
> Sent from my cm_tenderloin using Tapatalk


I will download it and have a look.
Maybe it will be easier to force the correct res in the app than try to find why it doesnt follow what other apps do


----------



## Dubi (Jan 19, 2012)

I was hoping that the main menu from the Time tablet version would show the problem, but it doesnt'
It looks fine here










Can you check if you get the same on the main page?


----------



## Motoki (Dec 30, 2011)

Somehow, I thought if anyone could do this, it would be Dubi so thanks much!



KevlarGibs said:


> I am having issues getting it working... I keep getting "systemui has stopped responding." I get no status bar in portrait or landscape. Portrait removes a section of the right and the bottom parts of the screen when I run the app. Landscape looks like it might be right, and but it's missing the statusbar, like I mentioned before...


When you copied the new systemui over you changed the permissions too, right? If not, you need to do that. They should be the same as the permissions on all the other files in that directory so rw-r--r--

Also check the date and file size and make sure it matches the file Dubi put up for download just to make sure the file copied over correctly.


----------



## Devedander (Nov 16, 2011)

Dubi said:


> yes, I did add both changes to the policy.jar so safe to install it if you are using the ToggleBar


Oooh nice! I will do that then! Thanks!


----------



## Dubi (Jan 19, 2012)

Motoki said:


> Somehow, I thought if anyone could do this, it would be Dubi so thanks much!
> 
> When you copied the new systemui over you changed the permissions too, right? If not, you need to do that. They should be the same as the permissions on all the other files in that directory so rw-r--r--
> 
> Also check the date and file size and make sure it matches the file Dubi put up for download just to make sure the file copied over correctly.


Hehe, I guess as soon as you saw the "dirty hack"


----------



## Dubi (Jan 19, 2012)

Ummm, I can't see to reproduce any problem with that Time tablet app (of course I'm only playing with the initial menus, I don't have (or want) and account).

While digging into the apk itself, I can see that there are two main layers, one the mainframe and another the reader (which process the magazines)
Inside the reader classes I can see code like :


```
<br />
if ((this.f != -1) && (this.e != -1) && (this.g != -1) && (this.h != -1))<br />
	{<br />
	  com.woodwing.sharedlibrary.e.a("Issue", "Using dimensions from magazine.xml for scaling.");<br />
	}<br />
	else<br />
	{<br />
	  com.woodwing.sharedlibrary.e.a("Issue", "Using derive method for scaling for the dimensions are not in magazine.xml.");<br />
	  ...<br />
	  ...<br />
	Object localObject1 = new StringBuilder().append("requested scalingmode: ");<br />
	String str;<br />
	if (paramInt != 1)<br />
	{<br />
	  if (paramInt != 0)<br />
		str = "DISPROPORTIONATE_FIT_SCREEN";<br />
	  else<br />
		str = "FIT_WIDTH";<br />
	}<br />
	...<br />
```
which makes me think that it gets the format from the magazine itself (can't see any magazine.xml in my TP)
Still, it should obey the screen dimensions because those are taken in the Mainframe class (which are returned as 1024x600/600x1024 by the hack)


```
<br />
	DisplayMetrics localDisplayMetrics = new DisplayMetrics();<br />
	((WindowManager)getSystemService("window")).getDefaultDisplay().getMetrics(localDisplayMetrics);<br />
	localHashMap.put("width", Integer.valueOf(localDisplayMetrics.widthPixels));<br />
	localHashMap.put("height", Integer.valueOf(localDisplayMetrics.heightPixels));<br />
	localHashMap.put("dpi", Integer.valueOf(localDisplayMetrics.densityDpi));<br />
```
I can change the Time apk so it will always use "FIT_WIDTH" like below and built another apk, but not sure if that will work. (it's quite annoying I can't see the problem here)


```
<br />
	if (paramInt != 1)<br />
	{<br />
	  if (paramInt != 0)<br />
		str = "FIT_WIDTH";<br />
	  else<br />
		str = "FIT_WIDTH";<br />
	}<br />
```


----------



## KevlarGibs (Aug 22, 2011)

Motoki said:


> Somehow, I thought if anyone could do this, it would be Dubi so thanks much! When you copied the new systemui over you changed the permissions too, right? If not, you need to do that. They should be the same as the permissions on all the other files in that directory so rw-r--r-- Also check the date and file size and make sure it matches the file Dubi put up for download just to make sure the file copied over correctly.


I just installed the ZIP using CWM, I assume this set the protections correctly. I assume the issue is like Dubi said, where he built this from/for the Nightlies, and not from A2. Hopefully he can get this working for A2 also, but if not, I know I'll be installing Nightlies soon.


----------



## Motoki (Dec 30, 2011)

KevlarGibs said:


> I just installed the ZIP using CWM, I assume this set the protections correctly. I assume the issue is like Dubi said, where he built this from/for the Nightlies, and not from A2. Hopefully he can get this working for A2 also, but if not, I know I'll be installing Nightlies soon.


Ah okay, I was thinking you manually moved the files over but if CWM installed it, it _should_ have set the permissions correctly. Wouldn't hurt to check but yeah you're both probably right that it's the discrepencies between the systemui from A1/2 release and the nightlies.

Most of the nightlies are pretty stable but I read some people were having issues with 3/11 3/12. Haven't checked back on it for a couple of days. I'm still running 3/10 without issue.


----------



## Dubi (Jan 19, 2012)

I'm not really running nightly, I just build with the latest code (I think my current repo was done a couple of days ago) and keep that.
I think some change since the OMX hardware tweak is causing the "incompatibles" (aka. SystemUI FCs with latest mod)

I'm trying to build based on A2 but due how git works, its quite difficult to revert back to an exact point in time.


----------



## Dubi (Jan 19, 2012)

ok, I couldn't quite go back to A2, but I think I found why SystemUI fails with any file from the nighty

It blows here:


```
<br />
D/AndroidRuntime( 2149): Shutting down VM<br />
W/dalvikvm( 2149): threadid=1: thread exiting with uncaught exception (group=0x2b4d81f8)<br />
E/AndroidRuntime( 2149): FATAL EXCEPTION: main<br />
E/AndroidRuntime( 2149): java.lang.RuntimeException: Unable to create service com.android.systemui.SystemUIService: java.lang.RuntimeException: Tablet device cannot show navigation bar and system bar<br />
E/AndroidRuntime( 2149):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2263)<br />
E/AndroidRuntime( 2149):     at android.app.ActivityThread.access$1600(ActivityThread.java:123)<br />
E/AndroidRuntime( 2149):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)<br />
E/AndroidRuntime( 2149):     at android.os.Handler.dispatchMessage(Handler.java:99)<br />
```
So, I look at that code, and just remove that throw (which was no doing much







)

Would you guys running A2 mind to test this one?
http://www.zen24223.zen.co.uk/ShrinkWithSystemUI_forA2.zip

This has the android.policy.jar and the SystemUI.apk so make a copy just to be sure









I tested on mine (putting back the official A2) and with the first ShrinkScreen.zip I got the FC but this one works fine.
I get the ShrinkScreen and the HideBar mod (two for the price of one hehehe)


----------



## gcklau (Feb 28, 2012)

Dubi said:


> Ummm, I can't see to reproduce any problem with that Time tablet app (of course I'm only playing with the initial menus, I don't have (or want) and account).
> 
> While digging into the apk itself, I can see that there are two main layers, one the mainframe and another the reader (which process the magazines)
> Inside the reader classes I can see code like :
> ...


Hey dubi I don't know if this will help but I did some digging around when I used this app. The images that are downloaded to my TP are 1366x768 in resolution and it can be seen from the xml files for the individual issues.

Hopefully this helps, since I want to get this to work properly too!

Sent from my Galaxy Nexus using Tapatalk


----------



## Dubi (Jan 19, 2012)

gcklau said:


> Hey dubi I don't know if this will help but I did some digging around when I used this app. The images that are downloaded to my TP are 1366x768 in resolution and it can be seen from the xml files for the individual issues.
> 
> Hopefully this helps, since I want to get this to work properly too!
> 
> Sent from my Galaxy Nexus using Tapatalk


Is there anything like a "magazine.xml" in those files?
Maybe it will be easy to pick one and check if they have that "DISPROPORTIONATE_FIT_SCREEN" inside?


----------



## ruthienu (Oct 18, 2011)

There is a magazine. Xml in there but there is no disproportionate fit line. 
Thanks!

Sent from my cm_tenderloin using Tapatalk


----------



## Devedander (Nov 16, 2011)

ruthienu said:


> There is a magazine. Xml in there but there is no disproportionate fit line.
> Thanks!
> 
> Sent from my cm_tenderloin using Tapatalk


have you uninstalled then reinstalled?]


----------



## mrbears (Nov 24, 2011)

Thanks so much for initiating this, KevlarGibs, and great progress on the packaging it up, Dubi. And thanks for the helpful tip, motoki.

Dubi, I have tried new ShrinkWithSystemUI_forA2.zip from post #27 since I am on CM9 Alpha 2. I do have time tablet subscription and the initial screens looks great at Dubi pointed out. It's when it gets into the magazine issue itself that problem occurs and I get exact same pictures ruthienu posted on this thread, i.e. the page gets cut off in the middle. Another App that shows similar behavior that is free is USA Today Tablet App. You will notice that the sentences in the article gets cut off or lost in between pages. I suspect if we can get USA Today Tablet to work, it should also work on Time Magazine. Dubi, if it helps, I can share with you my Time login info, so you can test it. Let me know.

I thought the icon looked pretty good. 

BTW, how do I uninstall this after I am done with it?


----------



## KevlarGibs (Aug 22, 2011)

Dubi, the new update you posted is working great! I tested it with Frontline Commando, and I can actually see the weapon stats now.

You have done an amazing job on this and I'm glad you did decide to look at it, but because I was never going to get this far.

I did want to bring the minor graphical issues I see to your attention. Not complaining, and even if you were done with the project now, I'm extremely pleased.

1. It shrunk my keyboard. I use SwiftKey, and and now it looks like this:














2. When the screen "Greys out" to prompt about something, a small amount on the right/bottom side stays fully lit. 








Keep up the good work.. I'd love to see this get integrated with the CM9 code by default. There are a lot of little situations where it could be useful.

Sent from my cm_tenderloin using RootzWiki


----------



## Dubi (Jan 19, 2012)

mrbears said:


> Thanks so much for initiating this, KevlarGibs, and great progress on the packaging it up, Dubi. And thanks for the helpful tip, motoki.
> 
> Dubi, I have tried new ShrinkWithSystemUI_forA2.zip from post #27 since I am on CM9 Alpha 2. I do have time tablet subscription and the initial screens looks great at Dubi pointed out. It's when it gets into the magazine issue itself that problem occurs and I get exact same pictures ruthienu posted on this thread, i.e. the page gets cut off in the middle. Another App that shows similar behavior that is free is USA Today Tablet App. You will notice that the sentences in the article gets cut off or lost in between pages. I suspect if we can get USA Today Tablet to work, it should also work on Time Magazine. Dubi, if it helps, I can share with you my Time login info, so you can test it. Let me know.
> 
> ...


Glad it works.
Didn't wanted to include the SystemUI because it's the normal place for UI mods, and if you use mine, you will loose any other you have installed (e.g: battery percent), but can't see other way to do it. Still, I hope it will not take too long before we get another "official" version so it won't be needed








Will check it out that "USA Today Tablet" app, if I can see the problem it make things a lot easier to work on.
Hope it doesn't need an account (or is not restricted to US, I'm in UK) to show the graphic glitch, but if it does I may ask for some app files.

Spends hours finding an ICON for the new ShrinkScreen, hehehehehe (hours trying to find the bloody rotate option in the viewer







)

EDIT:

If you made a copy of SystemUI.apk and android.policy.jar just replace the new files with those.
/system/app/SystemUI.apk
/system/framework/android.policy.jar
If not you can get your files from the big (108Mg) update.....fullofbugs.zip rom you used to install the version you have in the TP.
I guess there could be some way to automatically do a backup while doing the install script in recovery, but haven't look at that yet.
Because I can't build with the A2 code anymore, I can't really create the "unaltered" versions of those two files, otherwise I would have created an "flashble" uninstall.


----------



## Dubi (Jan 19, 2012)

KevlarGibs said:


> Dubi, the new update you posted is working great! I tested it with Frontline Commando, and I can actually see the weapon stats now.
> ...
> 1. It shrunk my keyboard. I use SwiftKey, and and now it looks like this:
> 
> ...


I will try SwiftKey and see what you mean (sorry if I'm dumb but can't see anything wrong with those two pictures, I'm not use to SwiftKey)
And yes, I think I saw somewhere else that "shadow" problem. Need to find why


----------



## Dubi (Jan 19, 2012)

I had a play with that US Today app.

That app is crap hehehehe 8)
The issue with the truncated text (and the bad position of the "Pg 1 of 20" banner) is because the app fails to adjust the content of the HTML when it first initialize the window.

Inside the apk there is a javascript file which is the one in charge of adjusting the content of the HTML (the article)


```
<br />
 public void resize()<br />
  {<br />
    Log.d("GNA", "Resize : " + this.pageWidth + ", " + this.pageHeight);<br />
    if ((this.pageWidth != 0) && (this.pageHeight != 0))<br />
	  loadUrl("javascript:articleController.resize(" + this.pageWidth + ", " + this.pageHeight + ")");<br />
  }<br />
<br />
 it calls the resize javascript inside the file "articlesController.js"<br />
```
The problem is that the apk tries to call the resize() before it's fully initialize. The logcat trace shows the error due the articleController not been there.

Anyway, in addition to that, the apk doesn't appear to use relative values for the window dimensions, it's is full of stuff like:

```
<br />
  protected void onMeasure(int paramInt1, int paramInt2)<br />
  {<br />
    Display localDisplay = ((WindowManager)this.context.getSystemService("window")).getDefaultDisplay();<br />
    if ((localDisplay.getRotation() != 0) && (localDisplay.getRotation() != 2))<br />
	  setMeasuredDimension(600, 450);<br />
    else<br />
	  setMeasuredDimension(800, 600);<br />
  }<br />
}<br />
...<br />
...<br />
<?xml version="1.0" encoding="utf-8"?><br />
<FrameLayout android:id="@id/main_activity_layout" android:layout_width="fill_parent" android:layout_height="fill_parent"<br />
  xmlns:android="http://schemas.android.com/apk/res/android"><br />
    <LinearLayout android:orientation="horizontal" android:background="#ffffffff" android:layout_width="fill_parent" android:layout_height="fill_parent"><br />
	    <LinearLayout android:orientation="vertical" android:id="@id/headlines" android:background="#ffcccccc" android:layout_width="366.0dip" android:layout_height="fill_parent"><br />
		    <fragment android:id="@id/frag_branding" android:layout_width="fill_parent" android:layout_height="154.0dip" class="com.usatoday.android.tablet.news.Branding" /><br />
		    <fragment android:id="@id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" class="com.usatoday.android.tablet.news.HeadlinesFragment" /><br />
	    </LinearLayout><br />
	    <fragment android:id="@id/frag_content" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" class="com.usatoday.android.tablet.news.ContentFragment" /><br />
    </LinearLayout><br />
    <ImageView android:id="@id/main_activity_overlay" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/main_activity_overlay" android:scaleType="fitXY" /><br />
</FrameLayout><br />
```
with hardcoded dip values, so of course it will not care about what the ActivyWindow resolution is.

I could hack the app to work properly, but to me (at least in my build) the page (web article) is correctly formatted if I switch to fullscreen and go back to the headlines.
If I do that, I will have the proper number of columns (2 in headline mode, 3 in fullscreen mode). If I switch to another tab (like from News to Tech) then it will happen again. The first article will be incorrectly formatted (3 columns) but if I go to fullscreen and back again it will look as expected.










Make sense?


----------



## mrbears (Nov 24, 2011)

Dubi said:


> If you made a copy of SystemUI.apk and android.policy.jar just replace the new files with those.
> /system/app/SystemUI.apk
> /system/framework/android.policy.jar
> If not you can get your files from the big (108Mg) update.....fullofbugs.zip rom you used to install the version you have in the TP.
> ...


Hi, Dubi.

You are absolutely right about going USA Tablet App. Making it full screen and going back solves the problem. 
So it appears that the problem with this app is different from Time Magazine. Time also publishes couple other magazines, such as Fortune and Sports Illustrated, and they use same formatted app, as the problem I have with Time app shows up with those ones. Dubi, I will PM you the login info for my Time Subscription so you can take look at the problem firsthand. Thanks so much for figuring out a work around for USA Today App. I use it frequently and I was pretty frustrated with it. It is one of the highly publicized tablet formatted app, so I am surprised they were that sloppy in the programming. Do you think patching it somehow is complicated?

Concerning getting back the SystemUI.apk and android.policy.jar, I didn't make the backup before I installed your zip. If I do full (108Mg) A2 update again, will I get back those original files again? If so, would SystemUI.apk and android.policy.jar files individualized? If not, I can just reinstall and post those two files here so people can have it as a back up plan in case something goes wrong.


----------



## Dubi (Jan 19, 2012)

as you figured out







there is no need to reinstall the whole A2,
just open the 108Mg zip file, pick the two files and put it back where it belong 8)

that's the easiest way to "uninstall" a mode (right, maybe not the easiest, but the safer)
You can use a CWM backup if you don't have/know the exact version of the full (108Mgs) zip file.


----------



## Dubi (Jan 19, 2012)

ok, so I think I got that Time app running "properly"









for now it's a hack inside the app, but I will see if is possible to do it from the outside.
The good thing about the hack, is that it doesnt need the ShrinkScreen mod, it works fine in the default 768x1024 res


----------



## Motoki (Dec 30, 2011)

Good work on getting to the bottom of that Time issue. If you could get it to work outside the app that would be awesome because I'm willing to bet there are other sloppy apps like that one out there.

Since we have an unofficial device it's not likely that we will get any help from developer support.


----------



## mrbears (Nov 24, 2011)

I guess problems like this is the reason apples chooses not to make 7 inch tablets and stick with one size 10 inch iPad.

It's hard to make developers to make apps work on different resolutions.
I just learned the other day that Samsung is launching new 11.6 inch android tablet with same resolution as iPad3.
So they now they have 4.2 inch phone, 5.0 inch note, 7.0 inch tab, 7.7 inch tab, 8.9 inch tab, and 10.1 inch tab in addition to new 11.6 inch tab. Talking about trying to saturate the market. One of them is gotta hit the sweet spot for someone. The problem is Samsung hasn't learned is that unless they lower their prices, no one will be buying their devices. But they always seem to price their tablets much higher than market prices. I guess they can afford to deal with slow sales since they have cashed in with their mobile phone business and absorb the loss.

Ice Cream Sandwich app developers will have to figure out a way to deal with this, and I suspect not all new ICS tablets that is coming out will have 16:9 size Honeycomb tablets.

iOS's solution to avoid this problem is just making a single device size for tablet. We will see how Android handles this.


----------



## ruthienu (Oct 18, 2011)

Dubi said:


> ok, so I think I got that Time app running "properly"
> 
> for now it's a hack inside the app, but I will see if is possible to do it from the outside.
> The good thing about the hack, is that it doesnt need the ShrinkScreen mod, it works fine in the default 768x1024 res


It would be amazing if we could have that hack! Are you going to post it or give instructions on how to hack it?

Sent from my cm_tenderloin using Tapatalk


----------



## Dubi (Jan 19, 2012)

PM


----------



## gcklau (Feb 28, 2012)

Dubi said:


> PM


Hey dubi I'm interested in this hack as well

Sent from my Galaxy Nexus using Tapatalk


----------



## Dubi (Jan 19, 2012)

ok, here it goes, hope I'm not breaking any rules









this should help you to fix the aspect ratio problems on all that apps (from TI Media)

basically what you will need to do is: download the apk (or directly copy it your touchpad "/data/app") to your PC
unpack it, change one file inside and repack it again.

1. Download apk to your PC (you can use Chrome browse and the APK Downloader extension to get the apk from the market.


```
<br />
	com.timeinc.si-9.apk<br />
```
2. Download the APKTool package which will allow you to unpack/pack the APK
http://code.google.c...ndroid-apktool/

(The file is a tar.bz2, so you may need something like 7-zip to uncompress it)
Get the apktool.jar and put it somewhere

3. The APKTool is a Java application so, you will need to have JDK installed in your machine to be able to use it.
Get it from here:
http://www.oracle.co...oads/index.html
And install it in the default directory

4.	After that, open a CMD and go to whatever directory you have put the android apk and the apktool.jar

This is what I have:

```
<br />
	d:\Android\t>dir<br />
	 Volume in drive D is Data<br />
	 Volume Serial Number is 5252-2A78<br />
<br />
	 Directory of d:\Android\t<br />
<br />
	15/03/2012  12:01	<DIR>		  .<br />
	15/03/2012  12:01	<DIR>		  ..<br />
	01/01/2012  15:37			   176 apktool.bat<br />
	08/12/2011  01:38		 3,090,514 apktool.jar<br />
	14/03/2012  20:48		 1,408,045 com.timeinc.si-9.apk<br />
				   3 File(s)	  4,498,735 bytes<br />
				   2 Dir(s)  29,073,973,248 bytes free<br />
<br />
	d:\Android\t>type apktool.bat<br />
	@echo off<br />
	set PATH=c:\Program Files (x86)\Java\jdk1.6.0_06\bin;%PATH%<br />
	"c:\Program Files (x86)\Java\jdk1.6.0_06\bin\java" -jar "%~dp0\apktool.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9<br />
<br />
	d:\Android\t><br />
```
 I've created a apktool.bat to set the PATH and call the apktool.

5. Now is time to unpack the android apk. Run the following command:


```
<br />
	d:\Android\t>apktool.bat d com.timeinc.si-9.apk<br />
	I: Baksmaling...<br />
	I: Loading resource table...<br />
	W: Skipping "android" package group<br />
	I: Loaded.<br />
	I: Loading resource table from file: C:\Users\Fbyte\apktool\framework\1.apk<br />
	I: Loaded.<br />
	I: Decoding file-resources...<br />
	I: Decoding values*/* XMLs...<br />
	I: Done.<br />
	I: Copying assets and libs...<br />
<br />
	d:\Android\t><br />
```
 This will create a "com.timeinc.si-9" directory with all the resources from the apk.


```
<br />
	d:\Android\t>dir com.timeinc.si-9<br />
	 Volume in drive D is Data<br />
	 Volume Serial Number is 5252-2A78<br />
<br />
	 Directory of d:\Android\t\com.timeinc.si-9<br />
<br />
	15/03/2012  12:07	<DIR>		  .<br />
	15/03/2012  12:07	<DIR>		  ..<br />
	15/03/2012  12:07			 3,157 AndroidManifest.xml<br />
	15/03/2012  12:07				99 apktool.yml<br />
	15/03/2012  12:07	<DIR>		  assets<br />
	15/03/2012  12:07	<DIR>		  res<br />
	15/03/2012  12:07	<DIR>		  smali<br />
				   2 File(s)		  3,256 bytes<br />
				   5 Dir(s)  29,062,762,496 bytes free<br />
<br />
	d:\Android\t><br />
```
6. To address the problem with the aspect ratio, we have to edit one of the smali files:

. Open the MainFrame.smali in notepad:

```
<br />
		d:\Android\t>notepad com.timeinc.si-9\smali\com\woodwing\mainframe\MainFrame.smali<br />
```
 . Search for the word "width":

```
<br />
		.....<br />
		invoke-virtual {v2, v1}, Landroid/view/Display;->getMetrics(Landroid/util/DisplayMetrics;)V<br />
<br />
		const-string v2, "width"<br />
<br />
		iget v3, v1, Landroid/util/DisplayMetrics;->widthPixels:I<br />
		.....<br />
```
 . Replace the line:

```
<br />
	    iget v3, v1, Landroid/util/DisplayMetrics;->widthPixels:I<br />
```
 for:

```
<br />
	    const/16 v3,600<br />
```
 . Save the file and go back to the cmd shell

7.	Now, time to repack the apk, run the following command.

```
<br />
	d:\Android\t>apktool.bat b com.timeinc.si-9 si_mine.apk<br />
	I: Checking whether sources has changed...<br />
	I: Smaling...<br />
	I: Checking whether resources has changed...<br />
	I: Building resources...<br />
	I: Building apk file...<br />
<br />
	d:\Android\t><br />
```
 This will create a new "time_mine.apk" android package.

8.	You need to sign the package so it can be installed anywhere, for that you need to generate a certificate with some JDK tool:

. Create a certificate (you only need to do this once)

```
<br />
		d:\Android\t>keytool -genkey -v -keystore my-release-key.keystore -alias myowncert -keyalg RSA -keysize 2048 -validity 1000<br />
		Enter keystore password:<br />
		Re-enter new password:<br />
		What is your first and last name?<br />
		  [Unknown]:  who<br />
		What is the name of your organizational unit?<br />
		  [Unknown]:  cares<br />
		What is the name of your organization?<br />
		  [Unknown]:  asd<br />
		What is the name of your City or Locality?<br />
		  [Unknown]:  asd<br />
		What is the name of your State or Province?<br />
		  [Unknown]:  asd<br />
		What is the two-letter country code for this unit?<br />
		  [Unknown]:  asd<br />
		Is CN=who, OU=cares, O=asd, L=asd, ST=asd, C=asd correct?<br />
		  [no]:  yes<br />
<br />
		Generating 2,048 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 1,000 days<br />
				for: CN=who, OU=cares, O=asd, L=asd, ST=asd, C=asd<br />
		Enter key password for <myowncert><br />
				(RETURN if same as keystore password):<br />
		[Storing my-release-key.keystore]<br />
<br />
		d:\Android\t><br />
```
 . Sign the "time_mine.apk"


```
<br />
		d:\Android\t>jarsigner -keystore ./my-release-key.keystore si_mine.apk myowncert<br />
		Enter Passphrase for keystore:<br />
<br />
		d:\Android\t><br />
```
9.	That's it. Move apk to the TP, uninstall the previous one and install this one. It should show the pictures correctly.

It should work with most of the apps from those guys (Time-Warner)


----------



## ale (Mar 9, 2012)

Dubi, thanks for the great tutorial

i have done everything like you wrote (for me it is the swimsuit 2012 app)

but i can't install the patched app on android

it always says: Application not installed (Cyangenmod CM9 ALpha2 on my HP Touchpad)

any suggestions?


----------



## Dubi (Jan 19, 2012)

ale said:


> Dubi, thanks for the great tutorial
> 
> i have done everything like you wrote (for me it is the swimsuit 2012 app)
> 
> ...


Did you signed it (step 9) and uninstall the original one first?


----------



## ale (Mar 9, 2012)

Dubi said:


> Did you signed it (step 9) and uninstall the original one first?


yes, i did this

thanks to Dubi it now works
you have to use JDK version 1.6 / i used 1.7.03 and couldn't install the patched apk

thanks Dubi


----------



## KevlarGibs (Aug 22, 2011)

So, I have noticed another thing. My chrome beta looks like the phone version, without the tabs on top:






this happens in both landscape and portrait. 
This makes me wonder if there is something in the modern that might be convincing some apps they are running on a phone? I or is there maybe some part of the mod that always "shows" the 1024x600 resolution?

Sent from my cm_tenderloin using RootzWiki


----------



## ruthienu (Oct 18, 2011)

Dubi said:


> ok, here it goes, hope I'm not breaking any rules
> 
> this should help you to fix the aspect ratio problems on all that apps (from TI Media)
> 
> ...


Sorry but these instructions are not for noobs like me. Is there any way to get idiot proof instructions for people like me? 
Thanks again for all the trouble!

Sent from my cm_tenderloin using Tapatalk


----------



## Dubi (Jan 19, 2012)

That's not for noobs?









Give it a try and if you find stuck in some step, send me a CM

btw, if anyone is using the latest nighltybuild, the android.policy.jar has changed a little, so it needs a new version:

http://www.zen24223.zen.co.uk/HideBar_ShrinkScreen_1903.zip


----------



## KevlarGibs (Aug 22, 2011)

UPDATE
Dubi, I'm almost positive that there is something causing certain applications to not register the Touchpad as a tablet anymore when running this mod.

I installed the Humble Bundle android app, and with your mod installed, it tells me the tablet-only apps are incompatible. When I replace the default SystemUI.apk
and android.policy.jar, it says they are compatible, and lets me download them. 
If anyone else knows of an app or way of testing the different areas that an app will check to see if it's on a tablet or a phone, please update this thread.


----------



## Dubi (Jan 19, 2012)

The framework uses the resolution and density to "detect" if its running on a phone or a tablet. That's in the Google code, and it's even in the original CM9
Most apps do the same.
The changes for the WideScreen mode return 600 rather than 768 based on the setting (which is toggle with the ShrinkScreen app)
If is off, it will behave in the same way as if it will do it without the mod.

Now, I don't quite remember what I put in that SystemUI.apk, but I think that was created just to get the mod working on a A2 system.
Anything newer than A2 (nightly build) doesnt need the SystemUI.apk and the change is really minimal.

Why not to update to some of the nighltys? That will allow you to put just the android.policy.jar and the changes there are "on/off" nothing more.
If they are "Off" it will behave exactly the same as the originals


----------



## Motoki (Dec 30, 2011)

KevlarGibs said:


> UPDATE
> Dubi, I'm almost positive that there is something causing certain applications to not register the Touchpad as a tablet anymore when running this mod.
> 
> I installed the Humble Bundle android app, and with your mod installed, it tells me the tablet-only apps are incompatible. When I replace the default SystemUI.apk
> ...


I think that there is some funkiness with that Humble app's detection scheme anyhow. From what others have told me, it doesn't detect the Kindle Fire as a Tablet and I'm not sure whether that is due to the resolution (it's 1024x600 so it shouldn't be) or the OS or what. Anyhow, according to Avadon's developer the app should run on a min resolution of 1024x600 so if you download the apk straight from the url they send you in your Humble order confirmation email and not from the app it should, in theory, work.


----------



## KevlarGibs (Aug 22, 2011)

Dubi said:


> Why not to update to some of the nighltys? That will allow you to put just the android.policy.jar and the changes there are "on/off" nothing more.
> If they are "Off" it will behave exactly the same as the originals


Well, I updated to the latest Nightly... and it fixed ALL of the stupid issues i was seeing with your mod. sorry I was such a pain... this is working awesomely now. Keep up the good work!!


----------



## Dubi (Jan 19, 2012)

glad it works, I know putting a nigtlhy could be risky, but there are some nice features quite worth the risk


----------



## Cregor (Jul 22, 2011)

Does this work with AKOP? Been using it with alpha 2. Works great for zenga games


----------



## adodb (Jan 22, 2012)

Hi Dubi, thanks for the instructions to rebuild the time magazine app, now the text is lot better than before. One question with this. On the WebOS the text on the Time magazine app occupied the whole screen. With the Android version, there are black bars on either side - http://www.box.com/s/74170902842c167083ca Is that expected? Thanks.


----------



## Dubi (Jan 19, 2012)

haven't look at the webos version (I don't use/have a Time subscription) but I believe the black bars at each edge is to mantain the aspect ratio, otherwise it will look strdched


----------



## Dubi (Jan 19, 2012)

Cregor said:


> Does this work with AKOP? Been using it with alpha 2. Works great for zenga games


This one should work with AOKP M4 (At least that's what I used to built it)
Haven't test it, but it should









http://www.zen24223.zen.co.uk/ShrinkScreen_HideBar_AOKPM4.zip


----------

