m.smali
.class public Lcom/xiaomi/push/service/m;
.super Ljava/lang/Object;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/xiaomi/push/service/m$a;,
Lcom/xiaomi/push/service/m$b;
}
.end annotation
# direct methods
.method private static a(Landroid/content/Context;Ljava/io/InputStream;)I
.registers 6
const/4 v3, -0x1
const/4 v0, 0x1
new-instance v1, Landroid/graphics/BitmapFactory$Options;
invoke-direct {v1}, Landroid/graphics/BitmapFactory$Options;-><init>()V
iput-boolean v0, v1, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z
const/4 v2, 0x0
invoke-static {p1, v2, v1}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
iget v2, v1, Landroid/graphics/BitmapFactory$Options;->outWidth:I
if-eq v2, v3, :cond_15
iget v2, v1, Landroid/graphics/BitmapFactory$Options;->outHeight:I
if-ne v2, v3, :cond_1c
:cond_15
const-string/jumbo v1, "decode dimension failed for bitmap."
invoke-static {v1}, Lcom/xiaomi/channel/commonutils/b/c;->a(Ljava/lang/String;)V
:cond_1b
:goto_1b
return v0
:cond_1c
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
invoke-virtual {v2}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
move-result-object v2
iget v2, v2, Landroid/util/DisplayMetrics;->densityDpi:I
int-to-float v2, v2
const/high16 v3, 0x43200000 # 160.0f
div-float/2addr v2, v3
const/high16 v3, 0x42400000 # 48.0f
mul-float/2addr v2, v3
invoke-static {v2}, Ljava/lang/Math;->round(F)I
move-result v2
iget v3, v1, Landroid/graphics/BitmapFactory$Options;->outWidth:I
if-le v3, v2, :cond_1b
iget v3, v1, Landroid/graphics/BitmapFactory$Options;->outHeight:I
if-le v3, v2, :cond_1b
iget v0, v1, Landroid/graphics/BitmapFactory$Options;->outWidth:I
div-int/2addr v0, v2
iget v1, v1, Landroid/graphics/BitmapFactory$Options;->outHeight:I
div-int/2addr v1, v2
invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I
move-result v0
goto :goto_1b
.end method
.method private static a(Ljava/lang/String;)Lcom/xiaomi/push/service/m$a;
.registers 10
const v2, 0x19000
const/4 v1, 0x0
:try_start_4
new-instance v0, Ljava/net/URL;
invoke-direct {v0, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
invoke-virtual {v0}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;
move-result-object v0
check-cast v0, Ljava/net/HttpURLConnection;
:try_end_f
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_f} :catch_f6
.catchall {:try_start_4 .. :try_end_f} :catchall_de
const/16 v3, 0x1f40
:try_start_11
invoke-virtual {v0, v3}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V
const/16 v3, 0x4e20
invoke-virtual {v0, v3}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->connect()V
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getContentLength()I
move-result v3
if-le v3, v2, :cond_4e
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string/jumbo v4, "Bitmap size is too big, max size is 102400 contentLen size is "
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v2
const-string/jumbo v3, " from url "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v2}, Lcom/xiaomi/channel/commonutils/b/c;->a(Ljava/lang/String;)V
:try_end_44
.catch Ljava/io/IOException; {:try_start_11 .. :try_end_44} :catch_fa
.catchall {:try_start_11 .. :try_end_44} :catchall_e9
invoke-static {v1}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
if-eqz v0, :cond_4c
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
:cond_4c
move-object v0, v1
:goto_4d
return-object v0
:cond_4e
:try_start_4e
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getResponseCode()I
move-result v3
const/16 v4, 0xc8
if-eq v3, v4, :cond_7e
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string/jumbo v4, "Invalid Http Response Code "
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v2
const-string/jumbo v3, " received"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v2}, Lcom/xiaomi/channel/commonutils/b/c;->a(Ljava/lang/String;)V
:try_end_74
.catch Ljava/io/IOException; {:try_start_4e .. :try_end_74} :catch_fa
.catchall {:try_start_4e .. :try_end_74} :catchall_e9
invoke-static {v1}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
if-eqz v0, :cond_7c
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
:cond_7c
move-object v0, v1
goto :goto_4d
:cond_7e
:try_start_7e
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;
:try_end_81
.catch Ljava/io/IOException; {:try_start_7e .. :try_end_81} :catch_fa
.catchall {:try_start_7e .. :try_end_81} :catchall_e9
move-result-object v3
:try_start_82
new-instance v4, Ljava/io/ByteArrayOutputStream;
invoke-direct {v4}, Ljava/io/ByteArrayOutputStream;-><init>()V
const/16 v5, 0x400
new-array v5, v5, [B
:goto_8b
if-lez v2, :cond_97
const/4 v6, 0x0
const/16 v7, 0x400
invoke-virtual {v3, v5, v6, v7}, Ljava/io/InputStream;->read([BII)I
move-result v6
const/4 v7, -0x1
if-ne v6, v7, :cond_b2
:cond_97
if-gtz v2, :cond_c9
const-string/jumbo v2, "length 102400 exhausted."
invoke-static {v2}, Lcom/xiaomi/channel/commonutils/b/c;->a(Ljava/lang/String;)V
new-instance v2, Lcom/xiaomi/push/service/m$a;
const/4 v4, 0x0
const v5, 0x19000
invoke-direct {v2, v4, v5}, Lcom/xiaomi/push/service/m$a;-><init>([BI)V
:try_end_a8
.catch Ljava/io/IOException; {:try_start_82 .. :try_end_a8} :catch_b8
.catchall {:try_start_82 .. :try_end_a8} :catchall_ee
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
if-eqz v0, :cond_b0
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
:cond_b0
move-object v0, v2
goto :goto_4d
:cond_b2
sub-int/2addr v2, v6
const/4 v7, 0x0
:try_start_b4
invoke-virtual {v4, v5, v7, v6}, Ljava/io/ByteArrayOutputStream;->write([BII)V
:try_end_b7
.catch Ljava/io/IOException; {:try_start_b4 .. :try_end_b7} :catch_b8
.catchall {:try_start_b4 .. :try_end_b7} :catchall_ee
goto :goto_8b
:catch_b8
move-exception v2
move-object v8, v2
move-object v2, v0
move-object v0, v8
:goto_bc
:try_start_bc
invoke-static {v0}, Lcom/xiaomi/channel/commonutils/b/c;->a(Ljava/lang/Throwable;)V
:try_end_bf
.catchall {:try_start_bc .. :try_end_bf} :catchall_f3
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
if-eqz v2, :cond_c7
invoke-virtual {v2}, Ljava/net/HttpURLConnection;->disconnect()V
:cond_c7
move-object v0, v1
goto :goto_4d
:cond_c9
:try_start_c9
invoke-virtual {v4}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object v4
new-instance v2, Lcom/xiaomi/push/service/m$a;
array-length v5, v4
invoke-direct {v2, v4, v5}, Lcom/xiaomi/push/service/m$a;-><init>([BI)V
:try_end_d3
.catch Ljava/io/IOException; {:try_start_c9 .. :try_end_d3} :catch_b8
.catchall {:try_start_c9 .. :try_end_d3} :catchall_ee
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
if-eqz v0, :cond_db
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
:cond_db
move-object v0, v2
goto/16 :goto_4d
:catchall_de
move-exception v0
move-object v3, v1
:goto_e0
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
if-eqz v1, :cond_e8
invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V
:cond_e8
throw v0
:catchall_e9
move-exception v2
move-object v3, v1
move-object v1, v0
move-object v0, v2
goto :goto_e0
:catchall_ee
move-exception v1
move-object v8, v1
move-object v1, v0
move-object v0, v8
goto :goto_e0
:catchall_f3
move-exception v0
move-object v1, v2
goto :goto_e0
:catch_f6
move-exception v0
move-object v2, v1
move-object v3, v1
goto :goto_bc
:catch_fa
move-exception v2
move-object v3, v1
move-object v8, v0
move-object v0, v2
move-object v2, v8
goto :goto_bc
.end method
.method public static a(Landroid/content/Context;Ljava/lang/String;)Lcom/xiaomi/push/service/m$b;
.registers 8
const/4 v3, 0x0
new-instance v0, Lcom/xiaomi/push/service/m$b;
const-wide/16 v4, 0x0
invoke-direct {v0, v3, v4, v5}, Lcom/xiaomi/push/service/m$b;-><init>(Landroid/graphics/Bitmap;J)V
:try_start_8
invoke-static {p1}, Lcom/xiaomi/push/service/m;->a(Ljava/lang/String;)Lcom/xiaomi/push/service/m$a;
:try_end_b
.catch Ljava/lang/Exception; {:try_start_8 .. :try_end_b} :catch_37
.catchall {:try_start_8 .. :try_end_b} :catchall_42
move-result-object v1
if-nez v1, :cond_12
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
:goto_11
return-object v0
:cond_12
:try_start_12
iget v2, v1, Lcom/xiaomi/push/service/m$a;->b:I
int-to-long v4, v2
iput-wide v4, v0, Lcom/xiaomi/push/service/m$b;->b:J
iget-object v1, v1, Lcom/xiaomi/push/service/m$a;->a:[B
if-eqz v1, :cond_47
new-instance v2, Ljava/io/ByteArrayInputStream;
invoke-direct {v2, v1}, Ljava/io/ByteArrayInputStream;-><init>([B)V
:try_end_20
.catch Ljava/lang/Exception; {:try_start_12 .. :try_end_20} :catch_37
.catchall {:try_start_12 .. :try_end_20} :catchall_42
:try_start_20
invoke-static {p0, v2}, Lcom/xiaomi/push/service/m;->a(Landroid/content/Context;Ljava/io/InputStream;)I
move-result v3
new-instance v4, Landroid/graphics/BitmapFactory$Options;
invoke-direct {v4}, Landroid/graphics/BitmapFactory$Options;-><init>()V
iput v3, v4, Landroid/graphics/BitmapFactory$Options;->inSampleSize:I
const/4 v3, 0x0
array-length v5, v1
invoke-static {v1, v3, v5, v4}, Landroid/graphics/BitmapFactory;->decodeByteArray([BIILandroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
move-result-object v1
iput-object v1, v0, Lcom/xiaomi/push/service/m$b;->a:Landroid/graphics/Bitmap;
:try_end_33
.catch Ljava/lang/Exception; {:try_start_20 .. :try_end_33} :catch_45
.catchall {:try_start_20 .. :try_end_33} :catchall_3d
:goto_33
invoke-static {v2}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
goto :goto_11
:catch_37
move-exception v1
move-object v2, v3
:goto_39
:try_start_39
invoke-static {v1}, Lcom/xiaomi/channel/commonutils/b/c;->a(Ljava/lang/Throwable;)V
:try_end_3c
.catchall {:try_start_39 .. :try_end_3c} :catchall_3d
goto :goto_33
:catchall_3d
move-exception v0
:goto_3e
invoke-static {v2}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
throw v0
:catchall_42
move-exception v0
move-object v2, v3
goto :goto_3e
:catch_45
move-exception v1
goto :goto_39
:cond_47
move-object v2, v3
goto :goto_33
.end method
.method public static b(Landroid/content/Context;Ljava/lang/String;)Landroid/graphics/Bitmap;
.registers 7
const/4 v0, 0x0
invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
:try_start_5
invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
invoke-virtual {v2, v1}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;
:try_end_c
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_c} :catch_2c
.catchall {:try_start_5 .. :try_end_c} :catchall_36
move-result-object v2
:try_start_d
invoke-static {p0, v2}, Lcom/xiaomi/push/service/m;->a(Landroid/content/Context;Ljava/io/InputStream;)I
move-result v4
invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
invoke-virtual {v3, v1}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;
:try_end_18
.catch Ljava/io/IOException; {:try_start_d .. :try_end_18} :catch_47
.catchall {:try_start_d .. :try_end_18} :catchall_41
move-result-object v3
:try_start_19
new-instance v1, Landroid/graphics/BitmapFactory$Options;
invoke-direct {v1}, Landroid/graphics/BitmapFactory$Options;-><init>()V
iput v4, v1, Landroid/graphics/BitmapFactory$Options;->inSampleSize:I
const/4 v4, 0x0
invoke-static {v3, v4, v1}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
:try_end_24
.catch Ljava/io/IOException; {:try_start_19 .. :try_end_24} :catch_4a
.catchall {:try_start_19 .. :try_end_24} :catchall_45
move-result-object v0
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
:goto_28
invoke-static {v2}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
return-object v0
:catch_2c
move-exception v1
move-object v2, v0
move-object v3, v0
:goto_2f
:try_start_2f
invoke-static {v1}, Lcom/xiaomi/channel/commonutils/b/c;->a(Ljava/lang/Throwable;)V
:try_end_32
.catchall {:try_start_2f .. :try_end_32} :catchall_45
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
goto :goto_28
:catchall_36
move-exception v1
move-object v2, v0
move-object v3, v0
move-object v0, v1
:goto_3a
invoke-static {v3}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
invoke-static {v2}, Lcom/xiaomi/channel/commonutils/a/a;->a(Ljava/io/InputStream;)V
throw v0
:catchall_41
move-exception v1
move-object v3, v0
move-object v0, v1
goto :goto_3a
:catchall_45
move-exception v0
goto :goto_3a
:catch_47
move-exception v1
move-object v3, v0
goto :goto_2f
:catch_4a
move-exception v1
goto :goto_2f
.end method