Skip to content

Instantly share code, notes, and snippets.

@linuxct
Last active February 9, 2016 15:16
Show Gist options
  • Save linuxct/0df059a2d8d5b4b887f2 to your computer and use it in GitHub Desktop.
Save linuxct/0df059a2d8d5b4b887f2 to your computer and use it in GitHub Desktop.
if (Build.MANUFACTURER.toLowerCase(Locale.US).contains("sony")) {
if (backup) {
os.writeBytes("echo 'backup_rom /sdcard/clockworkmod/backup/ota_" +
new SimpleDateFormat("yyyy-MM-dd_HH.mm", Locale.US).format(new Date()) +
"' >> /cache/recovery/extendedcommand\n");
}
if (wipeData) {
os.writeBytes("echo 'format(\"/data\");' >> /cache/recovery/extendedcommand\n");
}
if (wipeCache) {
os.writeBytes("echo 'format(\"/cache\");' >> /cache/recovery/extendedcommand\n");
}
for (String file : files) {
os.writeBytes("echo 'install_zip(\"" + file + "\");' >> /cache/recovery/extendedcommand\n");
}
} else {
if (backup) {
os.writeBytes("echo '--nandroid' >> /cache/recovery/command\n");
}
if (wipeData) {
os.writeBytes("echo '--wipe_data' >> /cache/recovery/command\n");
}
if (wipeCache) {
os.writeBytes("echo '--wipe_cache' >> /cache/recovery/command\n");
}
for (String file: files) {
os.writeBytes("echo '--update_package=" + file + "' >> /cache/recovery/command\n");
}
}
.line 267
sget-object v8, Landroid/os/Build;->MANUFACTURER:Ljava/lang/String;
sget-object v9, Ljava/util/Locale;->US:Ljava/util/Locale;
invoke-virtual {v8, v9}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v8
const-string v9, "nothing"
invoke-virtual {v8, v9}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v8
if-eqz v8, :cond_3
#--------------------------------------------------------------------------------------------------------
.line 285
const-string v8, "echo \'backup SDM\' >> /cache/recovery/openrecoveryscript\n"
invoke-virtual {v5, v8}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
.line 287
:cond_4
if-eqz p4, :cond_5
.line 288
const-string v8, "echo \'wipe data\' >> /cache/recovery/openrecoveryscript\n"
invoke-virtual {v5, v8}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
.line 290
:cond_5
if-eqz p3, :cond_6
.line 291
const-string v8, "echo \'wipe cache\' >> /cache/recovery/openrecoveryscript\n"
invoke-virtual {v5, v8}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
.line 294
:cond_6
move-object v0, p1
.restart local v0 # "arr$":[Ljava/lang/String;
array-length v4, v0
.restart local v4 # "len$":I
const/4 v3, 0x0
.restart local v3 # "i$":I
:goto_1
if-ge v3, v4, :cond_7
aget-object v2, v0, v3
.line 295
.restart local v2 # "file":Ljava/lang/String;
new-instance v8, Ljava/lang/StringBuilder;
invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V
const-string v9, "echo \'install "
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v8
invoke-virtual {v8, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v8
const-string v9, "\' >> /cache/recovery/openrecoveryscript\n"
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v8
invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v8
invoke-virtual {v5, v8}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment