[Click Android Development] ravelo:
General solution

As the Vending.apk from first post did not work on Motorola flipout I tried a few days to find a solution. I want to share here a general solution for the 240x320 android market problem (step by step "for dummies").

1.) Search for "Video" and write down the number of results.

2.) Root your phone (recommended if possible: current version of Universal Androot)

2.) Buy root explorer for Android (or download some similiar tool)

3.) Download baksmali and smali on your PC (code.google.com/p/smali/)

4.) Install market enabler (code.google.com/p/market-enabler/).

5.) investigate file structure with root explorer:

/sdcard/ -> Files that can be accessed from MS Windows through network drive ("Webfolder").

/system/app/ -> File Vending.apk

/data/app/ -> File com.android.vending.apk

/data/data/com.android.vending/ -> Cache files or data files.

6.) backup both com.android.vending.apk and Vending.apk

7.) Extract classes.dex from Vending.apk on your PC (This is a simple .zip File). I do this by copying Vending.apk into folder /sdcard/ (Android) and then copying from webfolder to PC.

8.) Search for a working Vending.apk in Google that works for qvga for your version of Android.

9.) Extrakt classes.dex from both Vending.apk files.

10.) Disassemble both classes.dex files (don't worry, this is very easy):

java -jar path/to/baksmali(version).jar classes.dex

Result: a directory named out that includes a lot of text files.

Rename each out directory immediately after creation (e.g. outOrig, outHacked).

11.) Compare both resulting out folders with a diff tool (e.g. Winmerge) and change disassembled files from original classes.dex file:

Take your time on this task. Go through all the files step by step and apply changes that look as if they are necessary for screen solution to the original disassembled files.

For reference I put here my diff for Android 2.1:

diff -r out\com\android\vending\model\DeviceConfiguration$ScreenLayoutSize.smali

outOrig_ToBeHacked\com\android\vending\model\DeviceConfiguration$ScreenLayoutSize.smali

51c51

< const/4 v3, 0x1

---

> const/4 v3, 0x2

diff -r out\com\android\vending\model\DeviceConfiguration.smali outOrig_ToBeHacked\com\android\vending\model\DeviceConfiguration.smali

1178c1178

< const-string v3, ", GlEsVersion="

---

> const-string v3, ", ScreenWidth=320, ScreenHeight=480, GlEsVersion="

diff -r out\com\android\vending\model\DeviceConfigurationProto.smali outOrig_ToBeHacked\com\android\vending\model\DeviceConfigurationProto.smali

45c45

< .field public static final SCREEN_LAYOUT_SMALL:I = 0x1

---

> .field public static final SCREEN_LAYOUT_SMALL:I = 0x2

12.) Reassemble changed original files:

java -jar path/to/smali(version).jar outOrig/* -o classes.dex

13.) Put new classes.dex back in original Vending.apk (choose your favourite zip application to do that).

14.) Copy Vending.apk to /system/app/ (overwrite existing file, you should have made a backup before)

15.) Copy Vending.apk to /data/app/com.android.vending.apk (Overwrite existing file, rename it accordingly).

16.) Set permissions (compare with other existing applications in this folder, you should choose the same. User should have rw.).

17.) delete folder /data/data/com.android.vending/

18.) reboot

19.) Run market enabler: in "Setting list" long press on [us] T-Mobile (T-Mobile) -> Fake this provider now.

20.) Now Run Market Application (you should find it in the list of all installed applications if you set permissions correctly).

21.) Accept TOS

22.) Search for "Video" - you should notice a difference... (1925 here)

23.) Test: Install a free app, and uninstall it immediately.

24.) Be careful with autoupdate of your market (that will overwrite your changes).

If anything goes wrong: place your original Vending.apk files, set permissions, delete cache. It should be as before.