Rabbit-R1/android (non root)/smali/smali_classes3/io/flutter/plugin/text/ProcessTextPlugin.smali

502 lines
16 KiB
Smali
Raw Normal View History

2024-05-21 21:08:36 +00:00
.class public Lio/flutter/plugin/text/ProcessTextPlugin;
.super Ljava/lang/Object;
.source "ProcessTextPlugin.java"
# interfaces
.implements Lio/flutter/embedding/engine/plugins/FlutterPlugin;
.implements Lio/flutter/embedding/engine/plugins/activity/ActivityAware;
.implements Lio/flutter/plugin/common/PluginRegistry$ActivityResultListener;
.implements Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel$ProcessTextMethodHandler;
# static fields
.field private static final TAG:Ljava/lang/String; = "ProcessTextPlugin"
# instance fields
.field private activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
.field private final packageManager:Landroid/content/pm/PackageManager;
.field private final processTextChannel:Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel;
.field private requestsByCode:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Integer;",
"Lio/flutter/plugin/common/MethodChannel$Result;",
">;"
}
.end annotation
.end field
.field private resolveInfosById:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Landroid/content/pm/ResolveInfo;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>(Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel;)V
.locals 1
.line 42
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 38
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->requestsByCode:Ljava/util/Map;
iput-object p1, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->processTextChannel:Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel;
.line 44
iget-object v0, p1, Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel;->packageManager:Landroid/content/pm/PackageManager;
iput-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->packageManager:Landroid/content/pm/PackageManager;
.line 46
invoke-virtual {p1, p0}, Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel;->setMethodHandler(Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel$ProcessTextMethodHandler;)V
return-void
.end method
.method private cacheResolveInfos()V
.locals 4
.line 106
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->resolveInfosById:Ljava/util/Map;
.line 112
new-instance v0, Landroid/content/Intent;
invoke-direct {v0}, Landroid/content/Intent;-><init>()V
const-string v1, "android.intent.action.PROCESS_TEXT"
invoke-virtual {v0, v1}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
move-result-object v0
const-string v1, "text/plain"
invoke-virtual {v0, v1}, Landroid/content/Intent;->setType(Ljava/lang/String;)Landroid/content/Intent;
move-result-object v0
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x21
if-lt v1, v2, :cond_0
iget-object v1, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->packageManager:Landroid/content/pm/PackageManager;
const-wide/16 v2, 0x0
.line 116
invoke-static {v2, v3}, Landroid/content/pm/PackageManager$ResolveInfoFlags;->of(J)Landroid/content/pm/PackageManager$ResolveInfoFlags;
move-result-object v2
invoke-virtual {v1, v0, v2}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;Landroid/content/pm/PackageManager$ResolveInfoFlags;)Ljava/util/List;
move-result-object v0
goto :goto_0
:cond_0
iget-object v1, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->packageManager:Landroid/content/pm/PackageManager;
const/4 v2, 0x0
.line 118
invoke-virtual {v1, v0, v2}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;
move-result-object v0
.line 121
:goto_0
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_1
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/content/pm/ResolveInfo;
.line 122
iget-object v2, v1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
iget-object v2, v2, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;
iget-object v3, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->packageManager:Landroid/content/pm/PackageManager;
.line 123
invoke-virtual {v1, v3}, Landroid/content/pm/ResolveInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;
move-result-object v3
invoke-interface {v3}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
iget-object v3, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->resolveInfosById:Ljava/util/Map;
.line 124
invoke-interface {v3, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_1
:cond_1
return-void
.end method
# virtual methods
.method public destroy()V
.locals 1
iget-object p0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->processTextChannel:Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel;
const/4 v0, 0x0
.line 161
invoke-virtual {p0, v0}, Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel;->setMethodHandler(Lio/flutter/embedding/engine/systemchannels/ProcessTextChannel$ProcessTextMethodHandler;)V
return-void
.end method
.method public onActivityResult(IILandroid/content/Intent;)Z
.locals 2
iget-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->requestsByCode:Ljava/util/Map;
.line 141
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_0
const/4 p0, 0x0
return p0
:cond_0
const/4 v0, -0x1
if-ne p2, v0, :cond_1
const-string p2, "android.intent.extra.PROCESS_TEXT"
.line 147
invoke-virtual {p3, p2}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;
move-result-object p2
goto :goto_0
:cond_1
const/4 p2, 0x0
:goto_0
iget-object p0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->requestsByCode:Ljava/util/Map;
.line 149
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p1
invoke-interface {p0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Lio/flutter/plugin/common/MethodChannel$Result;
invoke-interface {p0, p2}, Lio/flutter/plugin/common/MethodChannel$Result;->success(Ljava/lang/Object;)V
const/4 p0, 0x1
return p0
.end method
.method public onAttachedToActivity(Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;)V
.locals 0
iput-object p1, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
.line 180
invoke-interface {p1, p0}, Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;->addActivityResultListener(Lio/flutter/plugin/common/PluginRegistry$ActivityResultListener;)V
return-void
.end method
.method public onAttachedToEngine(Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;)V
.locals 0
return-void
.end method
.method public onDetachedFromActivity()V
.locals 1
iget-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
.line 194
invoke-interface {v0, p0}, Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;->removeActivityResultListener(Lio/flutter/plugin/common/PluginRegistry$ActivityResultListener;)V
const/4 v0, 0x0
iput-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
return-void
.end method
.method public onDetachedFromActivityForConfigChanges()V
.locals 1
iget-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
.line 184
invoke-interface {v0, p0}, Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;->removeActivityResultListener(Lio/flutter/plugin/common/PluginRegistry$ActivityResultListener;)V
const/4 v0, 0x0
iput-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
return-void
.end method
.method public onDetachedFromEngine(Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;)V
.locals 0
return-void
.end method
.method public onReattachedToActivityForConfigChanges(Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;)V
.locals 0
iput-object p1, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
.line 190
invoke-interface {p1, p0}, Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;->addActivityResultListener(Lio/flutter/plugin/common/PluginRegistry$ActivityResultListener;)V
return-void
.end method
.method public processTextAction(Ljava/lang/String;Ljava/lang/String;ZLio/flutter/plugin/common/MethodChannel$Result;)V
.locals 3
iget-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
const/4 v1, 0x0
const-string v2, "error"
if-nez v0, :cond_0
const-string p0, "Plugin not bound to an Activity"
.line 69
invoke-interface {p4, v2, p0, v1}, Lio/flutter/plugin/common/MethodChannel$Result;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
return-void
:cond_0
iget-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->resolveInfosById:Ljava/util/Map;
if-nez v0, :cond_1
const-string p0, "Can not process text actions before calling queryTextActions"
.line 79
invoke-interface {p4, v2, p0, v1}, Lio/flutter/plugin/common/MethodChannel$Result;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
return-void
.line 83
:cond_1
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroid/content/pm/ResolveInfo;
if-nez p1, :cond_2
const-string p0, "Text processing activity not found"
.line 85
invoke-interface {p4, v2, p0, v1}, Lio/flutter/plugin/common/MethodChannel$Result;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
return-void
.line 89
:cond_2
invoke-virtual {p4}, Ljava/lang/Object;->hashCode()I
move-result v0
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v0
iget-object v1, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->requestsByCode:Ljava/util/Map;
.line 90
invoke-interface {v1, v0, p4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 92
new-instance p4, Landroid/content/Intent;
invoke-direct {p4}, Landroid/content/Intent;-><init>()V
.line 93
iget-object v1, p1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
iget-object v1, v1, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;
iget-object p1, p1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
iget-object p1, p1, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;
invoke-virtual {p4, v1, p1}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
const-string p1, "android.intent.action.PROCESS_TEXT"
.line 94
invoke-virtual {p4, p1}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
const-string p1, "text/plain"
.line 95
invoke-virtual {p4, p1}, Landroid/content/Intent;->setType(Ljava/lang/String;)Landroid/content/Intent;
const-string p1, "android.intent.extra.PROCESS_TEXT"
.line 96
invoke-virtual {p4, p1, p2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
const-string p1, "android.intent.extra.PROCESS_TEXT_READONLY"
.line 97
invoke-virtual {p4, p1, p3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;
iget-object p0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->activityBinding:Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;
.line 102
invoke-interface {p0}, Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;->getActivity()Landroid/app/Activity;
move-result-object p0
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result p1
invoke-virtual {p0, p4, p1}, Landroid/app/Activity;->startActivityForResult(Landroid/content/Intent;I)V
return-void
.end method
.method public queryTextActions()Ljava/util/Map;
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/lang/String;",
">;"
}
.end annotation
iget-object v0, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->resolveInfosById:Ljava/util/Map;
if-nez v0, :cond_0
.line 52
invoke-direct {p0}, Lio/flutter/plugin/text/ProcessTextPlugin;->cacheResolveInfos()V
.line 54
:cond_0
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iget-object v1, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->resolveInfosById:Ljava/util/Map;
.line 55
invoke-interface {v1}, Ljava/util/Map;->keySet()Ljava/util/Set;
move-result-object v1
invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_1
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/String;
iget-object v3, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->resolveInfosById:Ljava/util/Map;
.line 56
invoke-interface {v3, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroid/content/pm/ResolveInfo;
iget-object v4, p0, Lio/flutter/plugin/text/ProcessTextPlugin;->packageManager:Landroid/content/pm/PackageManager;
.line 57
invoke-virtual {v3, v4}, Landroid/content/pm/ResolveInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;
move-result-object v3
invoke-interface {v3}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
move-result-object v3
invoke-interface {v0, v2, v3}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
:cond_1
return-object v0
.end method