以下smali代码从字符串中获取一个url然后我们可以将该链接共享给其他应用程序。但我想发送一些永久性文本而不是url或从字符串返回的文本。例如,我想分享"你好,你好吗"而不是从字符串中提取的临时文本。那么我应该在下面的smali代码中做些什么来改变呢?
.line 512
const-string v2, "android.intent.action.SEND"
invoke-virtual {v1, v2}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
.line 513
const-string v2, "android.intent.extra.SUBJECT"
iget-object v3, p0, Lcom/myapp/c/b/q;->t:Lcom/myapp/a/b/c;
iget-object v3, v3, Lcom/myapp/a/b/c;->d:Ljava/lang/String;
invoke-virtual {v1, v2, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
.line 514
const-string v2, "android.intent.extra.TEXT"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
iget-object v4, p0, Lcom/myapp/c/b/q;->t:Lcom/myapp/a/b/c;
iget-object v4, v4, Lcom/myapp/a/b/c;->d:Ljava/lang/String;
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
const-string v4, "\n\n"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v3, "\n\n"
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget-object v3, v6, Lcom/myapp/a/a/n;->c:Ljava/lang/String;
invoke-static {v3}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;
move-result-object v3
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v1, v2, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
.line 515
const-string v0, "text/plain"
invoke-virtual {v1, v0}, Landroid/content/Intent;->setType(Ljava/lang/String;)Landroid/content/Intent;
.line 516
const v0, 0x7f020126
.line 517
invoke-virtual {p0, v0}, Lcom/myapp/c/b/q;->getString(I)Ljava/lang/String;
move-result-object v0
.line 518
invoke-static {v1, v0}, Landroid/content/Intent;->createChooser(Landroid/content/Intent;Ljava/lang/CharSequence;)Landroid/content/Intent;
move-result-object v0
invoke-virtual {p0, v0}, Lcom/myapp/c/b/q;->startActivity(Landroid/content/Intent;)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.catch Ljava/lang/Error; {:try_start_0 .. :try_end_0} :catch_1
goto :goto_0
.line 519
:catch_0
move-exception v0
invoke-static {v0}, Lcom/myapp/d/e;->a(Ljava/lang/Exception;)V
goto :goto_0
.line 520
:catch_1
move-exception v0
答案 0 :(得分:1)
你的代码的某些类是混淆的,但有点猜测我们可以发现连接html文本的部分在这里:
iget-object v3, v6, Lcom/myapp/a/a/n;->c:Ljava/lang/String;
invoke-static {v3}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;
move-result-object v3
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
如果我没错,那么在v0中有一个字符串将与另一个应用程序共享:
invoke-virtual {v1, v2, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;