Skip to content

Commit 840db0b

Browse files
committed
Provide raw file name
* Some kernels are using this to check framerate override
1 parent 914d5da commit 840db0b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88

99
defaultConfig {
1010
applicationId "xzr.hkf"
11-
minSdkVersion 11
11+
minSdkVersion 14
1212
targetSdkVersion 31
1313
versionCode 3
1414
versionName "1.2"
@@ -24,4 +24,8 @@ android {
2424
sourceCompatibility JavaVersion.VERSION_1_8
2525
targetCompatibility JavaVersion.VERSION_1_8
2626
}
27+
}
28+
29+
dependencies {
30+
implementation 'androidx.documentfile:documentfile:1.0.1'
2731
}

app/src/main/java/xzr/hkf/Worker.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.app.AlertDialog;
55
import android.widget.Toast;
66

7+
import androidx.documentfile.provider.DocumentFile;
8+
79
import java.io.BufferedReader;
810
import java.io.File;
911
import java.io.FileOutputStream;
@@ -28,7 +30,7 @@ public void run() {
2830
MainActivity.cur_status = MainActivity.status.flashing;
2931
((MainActivity) activity).update_title();
3032
is_error = false;
31-
file_path = activity.getFilesDir().getAbsolutePath() + "/anykernel.zip";
33+
file_path = activity.getFilesDir().getAbsolutePath() + "/" + DocumentFile.fromSingleUri(activity, uri).getName();
3234
binary_path = activity.getFilesDir().getAbsolutePath() + "/META-INF/com/google/android/update-binary";
3335

3436
try {
@@ -118,7 +120,7 @@ void copy() throws IOException {
118120
}
119121

120122
void getBinary() throws IOException {
121-
runWithNewProcessNoReturn(false, "unzip " + file_path + " \"*/update-binary\" -d " + activity.getFilesDir().getAbsolutePath());
123+
runWithNewProcessNoReturn(false, "unzip \"" + file_path + "\" \"*/update-binary\" -d " + activity.getFilesDir().getAbsolutePath());
122124
if (!new File(binary_path).exists())
123125
throw new IOException();
124126
}
@@ -135,7 +137,7 @@ void flash(Activity activity) throws IOException {
135137
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(process.getOutputStream());
136138
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
137139
outputStreamWriter.write("export POSTINSTALL=" + activity.getFilesDir().getAbsolutePath() + "\n");
138-
outputStreamWriter.write("sh " + (MainActivity.DEBUG ? "-x " : "") + binary_path + " 3 1 " + file_path + "&& touch " + activity.getFilesDir().getAbsolutePath() + "/done\nexit\n");
140+
outputStreamWriter.write("sh " + (MainActivity.DEBUG ? "-x " : "") + binary_path + " 3 1 \"" + file_path + "\"&& touch " + activity.getFilesDir().getAbsolutePath() + "/done\nexit\n");
139141
outputStreamWriter.flush();
140142
String line;
141143
while ((line = bufferedReader.readLine()) != null)

0 commit comments

Comments
 (0)