How-To on Inverting Vending.apk

thebowers

Premium Member
Premium Member
Theme Developer
Joined
Nov 24, 2009
Messages
2,545
Reaction score
1
Location
Iowa
These are the specific steps and files that I have done when inverting Market. Reason for doing this is so that it can continue on.

Tools needed

Apk Manager - Can be found in my toolbox thread.
SDK - Going to be using ADB to pull Vending.apk
7zip - To open update.zip files and .apk files.

Files needed

Vending.apk - This is the file for Market


Getting started


Copy the Vending.apk from your phone to your computer. You can do this with Root Explorer, Terminal Emulator or ADB. I am going to use ADB since it will transfer the file directly to my computer.

Go to your directory for ADB in a command prompt.

Type in these commands

Code:
adb root
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
exit

Should now be back at the directory for ADB

Now type this command

Code:
adb pull /system/app/Vending.apk D:\users\thebowers\desktop

This command will pull the Vending.apk and put it on my desktop in this case. You may have Vending.apk in /data/app instead.

Now you will want to put the Vending.apk in the place-apk-here-for-modding folder of Apk Manager.

Run the script.bat of Apk Manager to open it.

Do option 9 to decompile and then go to the out folder in Apk Manager.


Now to edit the files


First file is going to be out/AndroidManifest.xml . It should look like this when you open it up

Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="3002012" android:versionName="2.12" package="com.android.vending"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
    <permission android:label="@string/perm_check_license_label" android:name="com.android.vending.CHECK_LICENSE" android:protectionLevel="normal" android:permissionGroup="android.permission-group.NETWORK" android:description="@string/perm_check_license_desc" />
    <permission android:name="com.android.vending.permission.UPDATE_MARKET_FAILURE" android:protectionLevel="signature" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
    <uses-permission android:name="android.permission.DELETE_PACKAGES" />
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED" />
    <uses-permission android:name="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.SEND" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="com.android.vending.INTENT_VENDING_ONLY" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.android" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.androidsecure" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.sierra" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.sierraqa" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.sierrasandbox" />
    <uses-permission android:name="com.google.android.gtalkservice.permission.GTALK_SERVICE" />
    <uses-permission android:name="com.google.android.gtalkservice.permission.SEND_HEARTBEAT" />
    <uses-permission android:name="com.android.vending.permission.UPDATE_MARKET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="com.google.android.providers.settings.permission.WRITE_GSETTINGS" />
   [COLOR="Red"] <application android:theme="@android:style/Theme.Light" [/COLOR]android:label="@string/application_name" android:icon="@drawable/ic_launcher_androidmarket" android:name=".VendingApplication" android:allowClearUserData="false" android:backupAgent=".VendingBackupAgent" android:killAfterRestore="false" android:restoreNeedsApplication="true" android:restoreAnyVersion="true">
        <activity android:theme="@style/TallTitleBarTheme" android:name=".TabbedAppBrowser" android:configChanges="orientation" />
        <activity android:theme="@style/TallTitleBarTheme" android:name=".CarrierChannelActivity" android:configChanges="orientation" />
        <activity android:theme="@style/TallTitleBarTheme" android:name=".CategoriesWithAppsListActivity" android:configChanges="orientation" />
        <activity android:theme="@style/TallTitleBarTheme" android:label="@string/homepage_activity_name" android:name=".AssetBrowserActivity" android:launchMode="singleTop" android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".FilteredAppListActivity" android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.TAB" />
            </intent-filter>
        </activity>
        <activity android:label="@string/search_results_activity_name" android:name=".QsbSearchActivity" android:launchMode="singleTop" android:configChanges="orientation">
            <intent-filter android:priority="50">
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="android.app.searchable" android:resource="@xml/qsb_suggest_searchable" />
        </activity>
        <activity android:label="@string/search_results_activity_name" android:name=".SearchAssetListActivity" android:launchMode="singleTop" android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" android:host="market.android.com" android:path="/search" />
                <data android:scheme="market" android:host="search" android:path="" />
            </intent-filter>
            <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
        </activity>
        <activity android:theme="@style/TallTitleBarTheme" android:label="@string/details_activity_name" android:name=".TabbedAssetInfoActivity" android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vending_application" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" android:host="market.android.com" android:path="/details" />
                <data android:scheme="market" android:host="details" android:path="" />
            </intent-filter>
        </activity>
        <activity android:label="@string/details_activity_name" android:name=".AssetInfoActivity" android:configChanges="orientation" />
        <activity android:label="@string/comments_activity_name" android:name=".CommentsActivity" android:configChanges="orientation" />
        <activity android:label="@string/similar_activity_name" android:name="SimilarAssetListActivity" android:configChanges="orientation" />
        <activity android:theme="@style/TallTitleBarTheme" android:label="@string/security_permissions_activity_name" android:name=".AssetPermissionsSubActivity" android:configChanges="orientation" />
        <activity android:theme="@style/TallTitleBarTheme" android:label="@string/uninstall_activity_name" android:name=".UninstallActivity" android:configChanges="orientation" />
        <activity android:label="@string/flag_content_activity_name" android:name=".FlagContentActivity" android:configChanges="orientation" />
        <activity android:theme="@style/TallTitleBarTheme" android:label="@string/my_downloads_activity_name" android:name=".MyDownloadsActivity" android:configChanges="orientation" />
        <activity android:theme="@style/TallTitleBarTheme" android:label="@string/purchase_application_activity_name" android:name=".billing.BuyPageActivity" android:configChanges="orientation" />
        <activity android:name=".billing.AddCreditCardActivity" android:configChanges="orientation" />
        <activity android:label="@string/tos_title" android:name=".TosActivity" android:configChanges="orientation" />
        <activity android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="@string/carrier_tos_title" android:name=".billing.CarrierTosAndAddressActivity" android:configChanges="orientation" />
        <activity android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="@string/enter_your_address_title" android:name=".billing.CarrierBillingAddressEditActivity" android:configChanges="orientation" />
        <activity android:name=".billing.GermanDirectDebitActivity" android:configChanges="orientation" />
        <activity android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:label="@string/screenshot_dialog_header" android:name=".FullImageGalleryActivity" android:configChanges="orientation" />
        <receiver android:name=".AssetDownloader$DownloadManagerBroadcastReceiver" android:permission="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS" android:exported="true" />
        <receiver android:name=".InitializeMarketAction$DownloadBroadcastReceiver" android:permission="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS" android:exported="true" />
        <receiver android:name=".PackageMonitorReceiver">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_ADDED" />
                <data android:scheme="package" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REMOVED" />
                <data android:scheme="package" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE" />
            </intent-filter>
        </receiver>
        <receiver android:name=".InstallAssetReceiver" android:permission="com.android.vending.INTENT_VENDING_ONLY">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="INSTALL_ASSET" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.REMOTE_INTENT" />
                <category android:name="INSTALL_ASSET" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.GTALK_DATA_MESSAGE_RECEIVED" />
                <category android:name="INSTALL_ASSET" />
            </intent-filter>
        </receiver>
        <receiver android:name=".RemoveAssetReceiver" android:permission="com.android.vending.INTENT_VENDING_ONLY">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="REMOVE_ASSET" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.REMOTE_INTENT" />
                <category android:name="REMOVE_ASSET" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.GTALK_DATA_MESSAGE_RECEIVED" />
                <category android:name="REMOVE_ASSET" />
            </intent-filter>
        </receiver>
        <receiver android:name=".ServerNotificationReceiver" android:permission="com.android.vending.INTENT_VENDING_ONLY">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="SERVER_NOTIFICATION" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.REMOTE_INTENT" />
                <category android:name="SERVER_NOTIFICATION" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.GTALK_DATA_MESSAGE_RECEIVED" />
                <category android:name="SERVER_NOTIFICATION" />
            </intent-filter>
        </receiver>
        <receiver android:name=".UpdatesAvailableReceiver" android:permission="com.android.vending.INTENT_VENDING_ONLY">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="UPDATES_AVAILABLE" />
                <action android:name="com.android.vending.UPDATES_AVAILABLE" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.android.vending.UPDATES_AVAILABLE" />
            </intent-filter>
        </receiver>
        <receiver android:name=".DeclineAssetReceiver" android:permission="com.android.vending.INTENT_VENDING_ONLY">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="DECLINE_ASSET" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.REMOTE_INTENT" />
                <category android:name="DECLINE_ASSET" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.GTALK_DATA_MESSAGE_RECEIVED" />
                <category android:name="DECLINE_ASSET" />
            </intent-filter>
        </receiver>
        <receiver android:name=".InvalidateAuthTokenReceiver" android:permission="com.android.vending.INTENT_VENDING_ONLY">
            <intent-filter>
                <action android:name="com.android.vending.INVALIDATE_AUTH_TOKEN" />
            </intent-filter>
        </receiver>
        <receiver android:name=".DeviceConfigurationReceiver">
            <intent-filter>
                <action android:name="android.intent.action.LOCALE_CHANGED" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SIM_STATE_CHANGED" />
            </intent-filter>
        </receiver>
        <receiver android:name=".VendingDoctorReceiver" android:permission="com.android.vending.INTENT_VENDING_ONLY">
            <intent-filter>
                <action android:name="com.android.vending.DOCTOR_FIX_DOWNLOAD_COMPLETES" />
            </intent-filter>
        </receiver>
        <receiver android:label="@string/application_name" android:name=".MarketWidgetProvider">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                <action android:name="com.android.vending.WIDGET_UPDATE" />
                <action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_provider" />
        </receiver>
        <service android:label="@string/downloader_service_name" android:name=".util.ServiceBroadcastReceiver$EmptyService" />
        <service android:label="@string/update_checkin_db_service_name" android:name=".UpdateCheckinService" />
        <service android:label="@string/local_db_sync_service_name" android:name=".LocalDbSyncService" />
        <service android:name=".licensing.LicensingService" android:permission="com.android.vending.CHECK_LICENSE">
            <intent-filter>
                <action android:name="com.android.vending.licensing.ILicensingService" />
            </intent-filter>
        </service>
        <meta-data android:name="android.app.default_searchable" android:value=".SearchAssetListActivity" />
        <provider android:name="SuggestionsProvider" android:authorities="com.android.vending.SuggestionsProvider" />
    </application>
</manifest>

I highlighted in red what needs to be changed. Changed the Theme.Light to Theme.Black and save this file.

Also you will notice that it points to another control for theme in the file as well (<activity android:theme="@style/TallTitleBarTheme"). This is being pulled from the Style.xml in out/res/values folder. So we are headed there next.

The styles.xml file should look like this when you open it

Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
    [COLOR="Red"]<style name="TallTitleBarTheme" parent="@android:style/Theme.Light.NoTitleBar">[/COLOR]
        <item name="android:windowContentOverlay">@null</item>
    </style>
</resources>

I highlighted in red what needs to be changed. Change Theme.Light.NoTitleBar to Theme.Black.NoTitleBar. Save this file and close it.

These two file you just did control about everything as far as text and backgrounds. Thats what I like about this .apk!!!


Now to clean up things that need changed.


First is the entry text to the comments field after entering a rating for an app. This can be found in file out/res/layout/write_review.xml

It should look like this.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout android:paddingLeft="6.0dip" android:paddingTop="4.0dip" android:paddingRight="6.0dip" android:paddingBottom="0.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <EditText android:textColor=[COLOR="red"]"?android:textColorPrimary"[/COLOR] android:gravity="top" android:id="@id/comment_box" android:layout_width="fill_parent" android:layout_height="fill_parent" android:maxLines="4" android:minLines="4" android:maxLength="150" android:freezesText="true" android:inputType="textLongMessage|textCapSentences|textMultiLine" />
</FrameLayout>

I highlighted in red again what needs to be changed. Changed textColorPrimary to textColorPrimaryInverse. tCP is white and tCPI is black, so it depends on what color your text box is.

I am going to combine these other files as you are doing the samething for each of them. Go to out/res/layout and look for title.xml, title_category.xml, title_my_downloads.xml, title_subcategory.xml.

In these files anywhere it says <TextView add or change the android:textColor value to android:textColor="#ffffffff". This insures that it makes the text white. These are the text on the top bar in the Market.

Those are the ones that I know of there may have been a few others but really can't think of them right now. I also didn't mess with the widget text cause who really uses that thing!!

I hope this helps people for future reference. If I missed something (sure I probably did) just let me know.
 
Last edited:
Once again Thanks for your Great Guides - you should sticky them all for ease of access :)
 
Thanks

Nice writeup. Thanks for all you do.:clap:
 
When mucking around with decompiled text that you will be recompiling, it's good practice to avoid using Notepad. Notepad likes to append characters that shouldn't be there which can screw the compiled application up. Depending on the change, it could cause your app to force close.

You should get into the habit of using a text editor that doesn't add any of it's own crap. Textpad is a very nice one, plus it's free (for non commercial use). Now I'm not sure if Notepad would cause errors in the recompiled xml, but I knsow for a fact that it when used to edit other decompiled filetypes...so it's good to be safe.
 
I use Notepad ++ and it has worked perfectly.... and its a free download...
 
This is very cool. So if I wanted to change the green background to blue, where is that change done?

-Mike
 
I'm slow sometimes.. :)

If you want to change that background, once you have the apk decompiled, go into the res/values folder and open up colors.xml and edit these...

<color name="header_background_light1">#ff7a7a7a</color>
<color name="header_background_medium1">#ff000000</color>
<color name="header_background_medium2">#ff0a0a0a</color>
<color name="header_background_medium3">#ff000000</color>
<color name="header_background_dark1">#ff808080</color>
<color name="header_background_dark2">#ff000000</color>
<color name="header_background_highlight1">#ff878787</color>
<color name="header_background_highlightTransparent1">#00a3a3a3</color>
<color name="header_background_highlight2">#ffa3a3a3</color>
<color name="header_background_highdark1">#ff969696</color>
<color name="header_background_highdarkTransparent1">#00a0a0a0</color>
<color name="header_background_highdark2">#ff0a0a0a</color>


That above is from "darkside" So, mostly black. The highlight's and highdarks are for the little slivers and such. The others control various sections of that "green" background you are wanting to change.



Lastly, in that code up there, there are NO SPACES.. for some reason, even though they are not there when I type this, they appear when I post it.

My suggestion to you, do what I did. Grab a piece of paper, write down the code for each one and make each one really different from each other. Like one code make purple, make one red, one black, one pink, etc... Then recompile and install and note which header changes what. Then, go back in and change them so they look like you want them to with the color(s) you want. No real need to mess with the two transparent ones.
 
Last edited:
Ditto to post above. Super helpful!
Out of curiosity, is it possible to use the SDK emulator to test out the apks before pushing back to your device?

___________________________
&bull;Sent from the future&bull;
 
Last edited:
haha.. I didn't even know their was an SDK emulator. :) So, on that, I dunno man. However.. if you can do that, please let me know because you don't even know how much time that would save not having to put on phone, reboot, install, check, repeat. Assuming it didn't bootloop my phone or lock it or nything else. SDK emulator.. man I will have to look into that!!!
 
Back
Top