Skip to content

Instantly share code, notes, and snippets.

@wodim wodim/gist:6535656
Created Sep 12, 2013

Embed
What would you like to do?
.class public final Ljp/r246/twicca/billing/a/b;
.super Landroid/os/AsyncTask;
# instance fields
.field private a:Ljp/r246/twicca/billing/a/c;
.field private b:J
.field private c:Ljava/lang/String;
.field private d:J
# direct methods
.method public constructor <init>(Ljp/r246/twicca/billing/a/c;JLjava/lang/String;)V
.locals 0
invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V
iput-object p1, p0, Ljp/r246/twicca/billing/a/b;->a:Ljp/r246/twicca/billing/a/c;
iput-wide p2, p0, Ljp/r246/twicca/billing/a/b;->b:J
iput-object p4, p0, Ljp/r246/twicca/billing/a/b;->c:Ljava/lang/String;
return-void
.end method
.method private varargs a()Ljp/r246/twicca/billing/a/a;
.locals 12
const/16 v11, 0x1f6
const/4 v2, 0x1
const/4 v3, 0x0
const/4 v1, 0x0
iget-object v0, p0, Ljp/r246/twicca/billing/a/b;->a:Ljp/r246/twicca/billing/a/c;
check-cast v0, Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v4
:try_start_0
iget-object v0, p0, Ljp/r246/twicca/billing/a/b;->a:Ljp/r246/twicca/billing/a/c;
check-cast v0, Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v0
const/16 v5, 0x40
invoke-virtual {v4, v0, v5}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object v0
iget-object v0, v0, Landroid/content/pm/PackageInfo;->signatures:[Landroid/content/pm/Signature;
const/4 v4, 0x0
aget-object v0, v0, v4
invoke-virtual {v0}, Landroid/content/pm/Signature;->toCharsString()Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Ljp/r246/twicca/l/i;->a(Ljava/lang/String;)Ljava/lang/String;
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v0
new-instance v4, Ljava/lang/StringBuilder;
iget-wide v5, p0, Ljp/r246/twicca/billing/a/b;->b:J
invoke-static {v5, v6}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;
move-result-object v5
invoke-static {v5}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v5
invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
const-string v5, "&"
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
iget-object v5, p0, Ljp/r246/twicca/billing/a/b;->c:Ljava/lang/String;
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, "&"
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Ljp/r246/twicca/l/i;->a(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
new-instance v4, Lorg/apache/http/impl/client/DefaultHttpClient;
invoke-direct {v4}, Lorg/apache/http/impl/client/DefaultHttpClient;-><init>()V
new-instance v5, Lorg/apache/http/client/methods/HttpPost;
const-string v6, "https://secure1141.sakura.ne.jp/twicca.r246.jp/_backend/_status/"
invoke-direct {v5, v6}, Lorg/apache/http/client/methods/HttpPost;-><init>(Ljava/lang/String;)V
new-instance v6, Ljava/util/ArrayList;
invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V
new-instance v7, Lorg/apache/http/message/BasicNameValuePair;
const-string v8, "id"
iget-wide v9, p0, Ljp/r246/twicca/billing/a/b;->b:J
invoke-static {v9, v10}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;
move-result-object v9
invoke-direct {v7, v8, v9}, Lorg/apache/http/message/BasicNameValuePair;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v6, v7}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
new-instance v7, Lorg/apache/http/message/BasicNameValuePair;
const-string v8, "screen_name"
iget-object v9, p0, Ljp/r246/twicca/billing/a/b;->c:Ljava/lang/String;
invoke-direct {v7, v8, v9}, Lorg/apache/http/message/BasicNameValuePair;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v6, v7}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
new-instance v7, Lorg/apache/http/message/BasicNameValuePair;
const-string v8, "signature"
invoke-direct {v7, v8, v0}, Lorg/apache/http/message/BasicNameValuePair;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v6, v7}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:try_start_1
new-instance v0, Lorg/apache/http/client/entity/UrlEncodedFormEntity;
const-string v7, "UTF-8"
invoke-direct {v0, v6, v7}, Lorg/apache/http/client/entity/UrlEncodedFormEntity;-><init>(Ljava/util/List;Ljava/lang/String;)V
invoke-virtual {v5, v0}, Lorg/apache/http/client/methods/HttpPost;->setEntity(Lorg/apache/http/HttpEntity;)V
:try_end_1
.catch Ljava/io/UnsupportedEncodingException; {:try_start_1 .. :try_end_1} :catch_3
:goto_0
invoke-virtual {v4}, Lorg/apache/http/impl/client/DefaultHttpClient;->getParams()Lorg/apache/http/params/HttpParams;
move-result-object v0
const-string v6, "http.connection.timeout"
new-instance v7, Ljava/lang/Integer;
const/16 v8, 0x3a98
invoke-direct {v7, v8}, Ljava/lang/Integer;-><init>(I)V
invoke-interface {v0, v6, v7}, Lorg/apache/http/params/HttpParams;->setParameter(Ljava/lang/String;Ljava/lang/Object;)Lorg/apache/http/params/HttpParams;
invoke-virtual {v4}, Lorg/apache/http/impl/client/DefaultHttpClient;->getParams()Lorg/apache/http/params/HttpParams;
move-result-object v0
const-string v6, "http.protocol.expect-continue"
invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v7
invoke-interface {v0, v6, v7}, Lorg/apache/http/params/HttpParams;->setParameter(Ljava/lang/String;Ljava/lang/Object;)Lorg/apache/http/params/HttpParams;
:try_start_2
invoke-virtual {v4, v5}, Lorg/apache/http/impl/client/DefaultHttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;
move-result-object v0
invoke-interface {v0}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;
move-result-object v4
invoke-interface {v4}, Lorg/apache/http/StatusLine;->getStatusCode()I
move-result v5
invoke-interface {v0}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;
move-result-object v0
invoke-interface {v0}, Lorg/apache/http/HttpEntity;->getContent()Ljava/io/InputStream;
move-result-object v4
invoke-interface {v0}, Lorg/apache/http/HttpEntity;->getContentLength()J
move-result-wide v6
long-to-int v0, v6
if-gez v0, :cond_0
const/16 v0, 0x1000
:cond_0
new-instance v6, Ljava/io/InputStreamReader;
const-string v7, "UTF-8"
invoke-direct {v6, v4, v7}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;Ljava/lang/String;)V
new-instance v4, Lorg/apache/http/util/CharArrayBuffer;
invoke-direct {v4, v0}, Lorg/apache/http/util/CharArrayBuffer;-><init>(I)V
:try_end_2
.catch Lorg/json/JSONException; {:try_start_2 .. :try_end_2} :catch_1
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_2
const/16 v0, 0x400
:try_start_3
new-array v0, v0, [C
:goto_1
invoke-virtual {v6, v0}, Ljava/io/Reader;->read([C)I
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0
move-result v7
const/4 v8, -0x1
if-ne v7, v8, :cond_1
:try_start_4
invoke-virtual {v6}, Ljava/io/Reader;->close()V
new-instance v6, Lorg/json/JSONObject;
invoke-virtual {v4}, Lorg/apache/http/util/CharArrayBuffer;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {v6, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
const/16 v0, 0xc8
if-ne v5, v0, :cond_2
move v4, v2
:goto_2
const/16 v0, 0xc9
if-ne v5, v0, :cond_3
move v0, v2
:goto_3
or-int/2addr v0, v4
if-eqz v0, :cond_4
const-string v0, "expire"
invoke-virtual {v6, v0}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
move-result v0
int-to-long v2, v0
const-wide/16 v4, 0x3e8
mul-long/2addr v2, v4
iput-wide v2, p0, Ljp/r246/twicca/billing/a/b;->d:J
:try_end_4
.catch Lorg/json/JSONException; {:try_start_4 .. :try_end_4} :catch_1
.catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_2
move-object v0, v1
:goto_4
return-object v0
:catch_0
move-exception v0
new-instance v0, Ljp/r246/twicca/billing/a/a;
invoke-direct {v0}, Ljp/r246/twicca/billing/a/a;-><init>()V
iput v11, v0, Ljp/r246/twicca/billing/a/a;->a:I
const-string v1, "Package not found(Who am I)"
iput-object v1, v0, Ljp/r246/twicca/billing/a/a;->b:Ljava/lang/String;
goto :goto_4
:cond_1
const/4 v8, 0x0
:try_start_5
invoke-virtual {v4, v0, v8, v7}, Lorg/apache/http/util/CharArrayBuffer;->append([CII)V
:try_end_5
.catchall {:try_start_5 .. :try_end_5} :catchall_0
goto :goto_1
:catchall_0
move-exception v0
:try_start_6
invoke-virtual {v6}, Ljava/io/Reader;->close()V
throw v0
:try_end_6
.catch Lorg/json/JSONException; {:try_start_6 .. :try_end_6} :catch_1
.catch Ljava/lang/Exception; {:try_start_6 .. :try_end_6} :catch_2
:catch_1
move-exception v0
new-instance v0, Ljp/r246/twicca/billing/a/a;
invoke-direct {v0}, Ljp/r246/twicca/billing/a/a;-><init>()V
iput v11, v0, Ljp/r246/twicca/billing/a/a;->a:I
const-string v1, "Server down"
iput-object v1, v0, Ljp/r246/twicca/billing/a/a;->b:Ljava/lang/String;
goto :goto_4
:cond_2
move v4, v3
goto :goto_2
:cond_3
move v0, v3
goto :goto_3
:cond_4
:try_start_7
new-instance v0, Ljp/r246/twicca/billing/a/a;
invoke-direct {v0}, Ljp/r246/twicca/billing/a/a;-><init>()V
iput v5, v0, Ljp/r246/twicca/billing/a/a;->a:I
const-string v1, "error"
invoke-virtual {v6, v1}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;
move-result-object v1
const-string v2, "message"
invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
iput-object v1, v0, Ljp/r246/twicca/billing/a/a;->b:Ljava/lang/String;
:try_end_7
.catch Lorg/json/JSONException; {:try_start_7 .. :try_end_7} :catch_1
.catch Ljava/lang/Exception; {:try_start_7 .. :try_end_7} :catch_2
goto :goto_4
:catch_2
move-exception v0
move-object v1, v0
new-instance v0, Ljp/r246/twicca/billing/a/a;
invoke-direct {v0}, Ljp/r246/twicca/billing/a/a;-><init>()V
const/16 v2, 0x3e7
iput v2, v0, Ljp/r246/twicca/billing/a/a;->a:I
invoke-virtual {v1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;
move-result-object v1
iput-object v1, v0, Ljp/r246/twicca/billing/a/a;->b:Ljava/lang/String;
goto :goto_4
:catch_3
move-exception v0
goto/16 :goto_0
.end method
# virtual methods
.method protected final varargs synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
.locals 1
invoke-direct {p0}, Ljp/r246/twicca/billing/a/b;->a()Ljp/r246/twicca/billing/a/a;
move-result-object v0
return-object v0
.end method
.method protected final synthetic onPostExecute(Ljava/lang/Object;)V
.locals 3
check-cast p1, Ljp/r246/twicca/billing/a/a;
invoke-virtual {p0}, Ljp/r246/twicca/billing/a/b;->isCancelled()Z
move-result v0
if-nez v0, :cond_0
if-nez p1, :cond_1
iget-object v0, p0, Ljp/r246/twicca/billing/a/b;->a:Ljp/r246/twicca/billing/a/c;
iget-wide v1, p0, Ljp/r246/twicca/billing/a/b;->d:J
invoke-interface {v0, v1, v2}, Ljp/r246/twicca/billing/a/c;->a(J)V
:cond_0
:goto_0
return-void
:cond_1
iget-object v0, p0, Ljp/r246/twicca/billing/a/b;->a:Ljp/r246/twicca/billing/a/c;
invoke-interface {v0, p1}, Ljp/r246/twicca/billing/a/c;->a(Ljp/r246/twicca/billing/a/a;)V
goto :goto_0
.end method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.