FORUMS
Remove All Ads from XDA

[Think Tank] Getting Google Market (vending.apk) to work without google apps.

1,264 posts
Thanks Meter: 20
 
By jubeh, Senior Member on 2nd December 2009, 05:52 PM
Post Reply Email Thread
In adding google apps support to my last 2.0 rom, I experimented a lot of things and, of all the google apps programs, Vending was the one that was the most interesting to me because I noticed that the program would not force-close like the others with other missing google apps, the program just exits, so it's safe to assume that it's looking for a login somewhere. Even after GoogleApps.apk is removed, the market will still work, something it won't do if you don't sign in before removing GoogleApps. All it seems to require are the two permissions in etc (com.google.android.gtalkservice.xml and com.google.android.datamessaging.xml).
Now, here's what I think, if we're able to look what Vending is looking for and create a small app to generate the necessary login information and put it where needed as best-case goal. A more realistic goal, though, would be to look at the smali code and see where the login information is being requested and causes the program to shut off if it's not available. If we find it, we can just bypass it and have the program start without a login, and I believe the only thing that would be affected would be the cloud storage of the apps we've downloaded, but we'd still have full access to market.
Trying to start the app alone gives me this error:
Code:
12-02 10:42:11.522: INFO/ActivityManager(72): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.vending/.AssetBrowserActivity }
12-02 10:42:11.633: WARN/AudioFlinger(375): write blocked for 95 msecs, 68 delayed writes, thread 0xcd90
12-02 10:42:11.982: DEBUG/AccountManagerService(72): bind attempt failed for Session: expectLaunch false, connected false, stats (0/0/0), lifetime 0.003, getAccountsByTypeAndFeatures, legacy_hosted_or_google
12-02 10:42:12.022: DEBUG/vending(2893): com.android.vending.BaseActivity.completeGetAuthToken(): auth result is RESULT_CANCELED
12-02 10:42:12.033: DEBUG/vending(2893): com.android.vending.BaseActivity.onAuthTokenComplete(): null auth token.
12-02 10:42:12.042: WARN/InputManagerService(72): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@43ae63f8 (uid=10006 pid=2893)
12-02 10:42:12.052: WARN/InputManagerService(72): Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43b83070
12-02 10:42:12.222: WARN/InputManagerService(72): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43bbe378
12-02 10:42:41.273: WARN/AudioFlinger(375): write blocked for 95 msecs, 69 delayed writes, thread 0xcd90
so, theoretically, if we have onAuthTokenComplete() ignore the result from completeGetAuthToken() of if we modify completeGetAuthToken() to pass something to onAuthTokenComplete() something to allow the program to start, we should be good to go.
Testers, ideas, experiences?.
 
 
2nd December 2009, 06:18 PM |#2  
jubeh's Avatar
OP Senior Member
Thanks Meter: 20
 
More
I guess this is where we start com.android.vending.BaseActivity.smali:

Code:
.method private completeGetAuthToken(ILandroid/content/Intent;)Ljava/lang/String;
    .registers 6
    .parameter "resultCode"
    .parameter "data"

    .prologue
    const/4 v2, 0x0

    .line 1328
    const/4 v1, -0x1

    if-ne p1, v1, :cond_11

    .line 1329
    invoke-virtual {p2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 1330
    .local v0, extras:Landroid/os/Bundle;
    if-eqz v0, :cond_20

    .line 1331
    const-string v1, "authtoken"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 1338
    .end local v0       #extras:Landroid/os/Bundle;,
    :goto_10
    return-object v1

    .line 1333
    :cond_11
    if-nez p1, :cond_20

    .line 1334
    invoke-virtual {p0, v2}, Lcom/android/vending/BaseActivity;->setResult(I)V

    .line 1335
    const-string v1, "auth result is RESULT_CANCELED"

    new-array v2, v2, [Ljava/lang/Object;

    invoke-static {v1, v2}, Lcom/android/vending/util/Log;->d(Ljava/lang/String;[Ljava/lang/Object;)V

    .line 1336
    invoke-virtual {p0}, Lcom/android/vending/BaseActivity;->finish()V

    .line 1338
    :cond_20
    const/4 v1, 0x0

    goto :goto_10
.end method
2nd December 2009, 06:19 PM |#3  
maxisma's Avatar
Senior Member
Flag Dorsten, Germany
Thanks Meter: 43
 
More
Try the youtube app, it will insert login data when you log in with your gmail account.
2nd December 2009, 06:28 PM |#4  
jubeh's Avatar
OP Senior Member
Thanks Meter: 20
 
More
I think this is it, again, at com.android.vending.BaseActivity.smali:

Code:
.method protected final onAuthTokenComplete(Lcom/android/vending/BaseActivity$AuthService;Ljava/lang/String;Z)V
    .registers 6
    .parameter "service"
    .parameter "authToken"
    .parameter "performRetry"

    .prologue
    .line 1083
    if-eqz p2, :cond_d

    .line 1084
    iget-object v0, p0, Lcom/android/vending/BaseActivity;->mApplication:Lcom/android/vending/VendingApplication;

    invoke-virtual {v0, p1, p2}, Lcom/android/vending/VendingApplication;->setCachedAuthToken(Lcom/android/vending/BaseActivity$AuthService;Ljava/lang/String;)V

    .line 1085
    if-eqz p3, :cond_c

    invoke-virtual {p0}, Lcom/android/vending/BaseActivity;->doRetry()V

    .line 1089
    :cond_c
    :goto_c
    return-void

    .line 1087
    :cond_d
    const-string v0, "null auth token."

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/android/vending/util/Log;->d(Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_c
.end method
p3 takes you to cond_c which is an auth login retry
p2 looks like it loads the vending app and then tries to get pass AuthService() to setCachedAuthToken(), and if that fails takes you to "null auth token" tossed into log.
2nd December 2009, 07:07 PM |#5  
jubeh's Avatar
OP Senior Member
Thanks Meter: 20
 
More
Progress!!!!
I got the app to load without closing by removing all calls to onAuthTokenComplete, completeGetAuthToken, and onActivityResult.
Now I'm stuck at the ToS page, it won't load anything, so I'll try to bypass that.
2nd December 2009, 07:24 PM |#6  
jubeh's Avatar
OP Senior Member
Thanks Meter: 20
 
More
past the ToS and stuck at market "Loading" screen.
removed the call to forwardIfNeededToTosActivity in BaseActivity.
Here's where I'm at right now, all necessary files inside, should work on a vanilla build of master. Either update.zip flash it or adb push it, whatever.
I'm tired, need sleep
Hope somebody else works on this too.
Attached Files
File Type: zip Market.zip - [Click for QR Code] (665.7 KB, 1786 views)
2nd December 2009, 07:30 PM |#7  
jubeh's Avatar
OP Senior Member
Thanks Meter: 20
 
More
Cant sleep without this suggestion. Hopefully somebody is reading and can make it work.
At this point, I think we're just requiring a login so we can browse market. Search never completes, browse never completes, and I think it's because we're not logged in. If we pull whatever necessary bit from /data/data/com.android.vending from a working market build and toss it in, it should, theoretically again, work. If we remove the personal logins and pass it something generic, it should work too.
I'm still bothered by something, though, what happens with paid apps? Probably a force-close.
Anyway, I hope google at least releases a "free market" app that's standalone and we can toss into generic builds without anything else needed so we can at least download free apps.
2nd December 2009, 07:57 PM |#8  
jubeh's Avatar
OP Senior Member
Thanks Meter: 20
 
More
it's a database problem.
I know nothing of sqlite so this is as far as I get
2nd December 2009, 08:10 PM |#9  
maxisma's Avatar
Senior Member
Flag Dorsten, Germany
Thanks Meter: 43
 
More
use youtube app to login.
2nd December 2009, 09:25 PM |#10  
jubeh's Avatar
OP Senior Member
Thanks Meter: 20
 
More
either you already have it working or you're just suggesting that I use youtube app to login. I tried it but doesn't work with my hacked market. Is there another way that you know of?
2nd December 2009, 09:53 PM |#11  
maxisma's Avatar
Senior Member
Flag Dorsten, Germany
Thanks Meter: 43
 
More
Quote:
Originally Posted by jubeh

either you already have it working or you're just suggesting that I use youtube app to login. I tried it but doesn't work with my hacked market. Is there another way that you know of?

Have you logged in with your Google or with your YouTube account?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes