.class public final Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin; .super Ljava/lang/Object; .source "PackageInfoPlugin.kt" # interfaces .implements Lio/flutter/plugin/common/MethodChannel$MethodCallHandler; .implements Lio/flutter/embedding/engine/plugins/FlutterPlugin; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin$Companion; } .end annotation .annotation runtime Lkotlin/Metadata; d1 = { "\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0012\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0004\u0018\u0000 2\u00020\u00012\u00020\u0002:\u0001 B\u0005\u00a2\u0006\u0002\u0010\u0003J\u0010\u0010\u0008\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bH\u0002J\u0012\u0010\u000c\u001a\u0004\u0018\u00010\t2\u0006\u0010\r\u001a\u00020\u000eH\u0002J\n\u0010\u000f\u001a\u0004\u0018\u00010\tH\u0002J\u0010\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013H\u0002J\u0010\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0017H\u0016J\u0010\u0010\u0018\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0017H\u0016J\u0018\u0010\u0019\u001a\u00020\u00152\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\u001dH\u0016J\u0010\u0010\u001e\u001a\u00020\t2\u0006\u0010\u001f\u001a\u00020\u000bH\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u000e\u00a2\u0006\u0002\n\u0000\u00a8\u0006!" } d2 = { "Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;", "Lio/flutter/plugin/common/MethodChannel$MethodCallHandler;", "Lio/flutter/embedding/engine/plugins/FlutterPlugin;", "()V", "applicationContext", "Landroid/content/Context;", "methodChannel", "Lio/flutter/plugin/common/MethodChannel;", "bytesToHex", "", "bytes", "", "getBuildSignature", "pm", "Landroid/content/pm/PackageManager;", "getInstallerPackageName", "getLongVersionCode", "", "info", "Landroid/content/pm/PackageInfo;", "onAttachedToEngine", "", "binding", "Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;", "onDetachedFromEngine", "onMethodCall", "call", "Lio/flutter/plugin/common/MethodCall;", "result", "Lio/flutter/plugin/common/MethodChannel$Result;", "signatureToSha1", "sig", "Companion", "package_info_plus_release" } k = 0x1 mv = { 0x1, 0x9, 0x0 } xi = 0x30 .end annotation # static fields .field private static final CHANNEL_NAME:Ljava/lang/String; = "dev.fluttercommunity.plus/package_info" .field public static final Companion:Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin$Companion; # instance fields .field private applicationContext:Landroid/content/Context; .field private methodChannel:Lio/flutter/plugin/common/MethodChannel; # direct methods .method static constructor ()V .locals 2 new-instance v0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin$Companion; const/4 v1, 0x0 invoke-direct {v0, v1}, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V sput-object v0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->Companion:Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin$Companion; return-void .end method .method public constructor ()V .locals 0 .line 16 invoke-direct {p0}, Ljava/lang/Object;->()V return-void .end method .method private final bytesToHex([B)Ljava/lang/String; .locals 6 const/16 p0, 0x10 new-array p0, p0, [C fill-array-data p0, :array_0 .line 135 array-length v0, p1 mul-int/lit8 v0, v0, 0x2 new-array v0, v0, [C .line 137 array-length v1, p1 const/4 v2, 0x0 :goto_0 if-ge v2, v1, :cond_0 .line 138 aget-byte v3, p1, v2 and-int/lit16 v4, v3, 0xff mul-int/lit8 v5, v2, 0x2 ushr-int/lit8 v4, v4, 0x4 .line 139 aget-char v4, p0, v4 aput-char v4, v0, v5 add-int/lit8 v5, v5, 0x1 and-int/lit8 v3, v3, 0xf .line 140 aget-char v3, p0, v3 aput-char v3, v0, v5 add-int/lit8 v2, v2, 0x1 goto :goto_0 .line 142 :cond_0 new-instance p0, Ljava/lang/String; invoke-direct {p0, v0}, Ljava/lang/String;->([C)V return-object p0 nop :array_0 .array-data 2 0x30s 0x31s 0x32s 0x33s 0x34s 0x35s 0x36s 0x37s 0x38s 0x39s 0x41s 0x42s 0x43s 0x44s 0x45s 0x46s .end array-data .end method .method private final getBuildSignature(Landroid/content/pm/PackageManager;)Ljava/lang/String; .locals 3 const/4 v0, 0x0 :try_start_0 iget-object v1, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; .line 91 invoke-static {v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {v1}, Landroid/content/Context;->getPackageName()Ljava/lang/String; move-result-object v1 const/high16 v2, 0x8000000 .line 90 invoke-virtual {p1, v1, v2}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo; move-result-object p1 .line 94 iget-object p1, p1, Landroid/content/pm/PackageInfo;->signingInfo:Landroid/content/pm/SigningInfo; if-nez p1, :cond_0 return-object v0 .line 96 :cond_0 invoke-virtual {p1}, Landroid/content/pm/SigningInfo;->hasMultipleSigners()Z move-result v1 :try_end_0 .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0 .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0 const-string v2, "toByteArray(...)" if-eqz v1, :cond_1 .line 97 :try_start_1 invoke-virtual {p1}, Landroid/content/pm/SigningInfo;->getApkContentsSigners()[Landroid/content/pm/Signature; move-result-object p1 const-string v1, "getApkContentsSigners(...)" invoke-static {p1, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V check-cast p1, [Ljava/lang/Object; invoke-static {p1}, Lkotlin/collections/ArraysKt;->first([Ljava/lang/Object;)Ljava/lang/Object; move-result-object p1 check-cast p1, Landroid/content/pm/Signature; invoke-virtual {p1}, Landroid/content/pm/Signature;->toByteArray()[B move-result-object p1 invoke-static {p1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-direct {p0, p1}, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->signatureToSha1([B)Ljava/lang/String; move-result-object p0 goto :goto_0 .line 99 :cond_1 invoke-virtual {p1}, Landroid/content/pm/SigningInfo;->getSigningCertificateHistory()[Landroid/content/pm/Signature; move-result-object p1 const-string v1, "getSigningCertificateHistory(...)" invoke-static {p1, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V check-cast p1, [Ljava/lang/Object; invoke-static {p1}, Lkotlin/collections/ArraysKt;->first([Ljava/lang/Object;)Ljava/lang/Object; move-result-object p1 check-cast p1, Landroid/content/pm/Signature; invoke-virtual {p1}, Landroid/content/pm/Signature;->toByteArray()[B move-result-object p1 invoke-static {p1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-direct {p0, p1}, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->signatureToSha1([B)Ljava/lang/String; move-result-object p0 :try_end_1 .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_1 .. :try_end_1} :catch_0 .catch Ljava/security/NoSuchAlgorithmException; {:try_start_1 .. :try_end_1} :catch_0 :goto_0 move-object v0, p0 :catch_0 return-object v0 .end method .method private final getInstallerPackageName()Ljava/lang/String; .locals 1 iget-object v0, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; .line 67 invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager; move-result-object v0 iget-object p0, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; .line 68 invoke-static {p0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String; move-result-object p0 .line 70 invoke-virtual {v0, p0}, Landroid/content/pm/PackageManager;->getInstallSourceInfo(Ljava/lang/String;)Landroid/content/pm/InstallSourceInfo; move-result-object p0 invoke-virtual {p0}, Landroid/content/pm/InstallSourceInfo;->getInitiatingPackageName()Ljava/lang/String; move-result-object p0 return-object p0 .end method .method private final getLongVersionCode(Landroid/content/pm/PackageInfo;)J .locals 0 .line 80 invoke-virtual {p1}, Landroid/content/pm/PackageInfo;->getLongVersionCode()J move-result-wide p0 return-wide p0 .end method .method private final signatureToSha1([B)Ljava/lang/String; .locals 1 .annotation system Ldalvik/annotation/Throws; value = { Ljava/security/NoSuchAlgorithmException; } .end annotation const-string v0, "SHA1" .line 124 invoke-static {v0}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest; move-result-object v0 .line 125 invoke-virtual {v0, p1}, Ljava/security/MessageDigest;->update([B)V .line 126 invoke-virtual {v0}, Ljava/security/MessageDigest;->digest()[B move-result-object p1 .line 127 invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-direct {p0, p1}, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->bytesToHex([B)Ljava/lang/String; move-result-object p0 return-object p0 .end method # virtual methods .method public onAttachedToEngine(Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;)V .locals 2 const-string v0, "binding" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 22 invoke-virtual {p1}, Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;->getApplicationContext()Landroid/content/Context; move-result-object v0 iput-object v0, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; .line 23 new-instance v0, Lio/flutter/plugin/common/MethodChannel; invoke-virtual {p1}, Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;->getBinaryMessenger()Lio/flutter/plugin/common/BinaryMessenger; move-result-object p1 const-string v1, "dev.fluttercommunity.plus/package_info" invoke-direct {v0, p1, v1}, Lio/flutter/plugin/common/MethodChannel;->(Lio/flutter/plugin/common/BinaryMessenger;Ljava/lang/String;)V iput-object v0, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->methodChannel:Lio/flutter/plugin/common/MethodChannel; .line 24 invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V check-cast p0, Lio/flutter/plugin/common/MethodChannel$MethodCallHandler; invoke-virtual {v0, p0}, Lio/flutter/plugin/common/MethodChannel;->setMethodCallHandler(Lio/flutter/plugin/common/MethodChannel$MethodCallHandler;)V return-void .end method .method public onDetachedFromEngine(Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;)V .locals 1 const-string v0, "binding" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const/4 p1, 0x0 iput-object p1, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; iget-object v0, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->methodChannel:Lio/flutter/plugin/common/MethodChannel; .line 29 invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {v0, p1}, Lio/flutter/plugin/common/MethodChannel;->setMethodCallHandler(Lio/flutter/plugin/common/MethodChannel$MethodCallHandler;)V iput-object p1, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->methodChannel:Lio/flutter/plugin/common/MethodChannel; return-void .end method .method public onMethodCall(Lio/flutter/plugin/common/MethodCall;Lio/flutter/plugin/common/MethodChannel$Result;)V .locals 6 const-string v0, "call" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "result" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 35 :try_start_0 iget-object p1, p1, Lio/flutter/plugin/common/MethodCall;->method:Ljava/lang/String; const-string v0, "getAll" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result p1 if-eqz p1, :cond_2 iget-object p1, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; .line 36 invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager; move-result-object p1 iget-object v0, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; .line 37 invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {v0}, Landroid/content/Context;->getPackageName()Ljava/lang/String; move-result-object v0 const/4 v1, 0x0 invoke-virtual {p1, v0, v1}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo; move-result-object v0 .line 39 invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-direct {p0, p1}, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->getBuildSignature(Landroid/content/pm/PackageManager;)Ljava/lang/String; move-result-object v1 .line 41 invoke-direct {p0}, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->getInstallerPackageName()Ljava/lang/String; move-result-object v2 .line 43 new-instance v3, Ljava/util/HashMap; invoke-direct {v3}, Ljava/util/HashMap;->()V const-string v4, "appName" .line 45 iget-object v5, v0, Landroid/content/pm/PackageInfo;->applicationInfo:Landroid/content/pm/ApplicationInfo; invoke-virtual {v5, p1}, Landroid/content/pm/ApplicationInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence; move-result-object p1 invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p1 invoke-virtual {v3, v4, p1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; const-string p1, "packageName" iget-object v4, p0, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->applicationContext:Landroid/content/Context; .line 46 invoke-static {v4}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {v4}, Landroid/content/Context;->getPackageName()Ljava/lang/String; move-result-object v4 invoke-virtual {v3, p1, v4}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; const-string p1, "version" .line 47 iget-object v4, v0, Landroid/content/pm/PackageInfo;->versionName:Ljava/lang/String; invoke-virtual {v3, p1, v4}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; const-string p1, "buildNumber" .line 48 invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-direct {p0, v0}, Ldev/fluttercommunity/plus/packageinfo/PackageInfoPlugin;->getLongVersionCode(Landroid/content/pm/PackageInfo;)J move-result-wide v4 invoke-static {v4, v5}, Ljava/lang/String;->valueOf(J)Ljava/lang/String; move-result-object p0 invoke-virtual {v3, p1, p0}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; if-eqz v1, :cond_0 const-string p0, "buildSignature" .line 49 invoke-virtual {v3, p0, v1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; :cond_0 if-eqz v2, :cond_1 const-string p0, "installerStore" .line 50 invoke-virtual {v3, p0, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 52 :cond_1 invoke-interface {p2, v3}, Lio/flutter/plugin/common/MethodChannel$Result;->success(Ljava/lang/Object;)V goto :goto_0 .line 55 :cond_2 invoke-interface {p2}, Lio/flutter/plugin/common/MethodChannel$Result;->notImplemented()V :try_end_0 .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_0 :catch_0 move-exception p0 .line 58 invoke-virtual {p0}, Landroid/content/pm/PackageManager$NameNotFoundException;->getMessage()Ljava/lang/String; move-result-object p0 const/4 p1, 0x0 const-string v0, "Name not found" invoke-interface {p2, v0, p0, p1}, Lio/flutter/plugin/common/MethodChannel$Result;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V :goto_0 return-void .end method