Make all I/O suspendable

This commit is contained in:
topjohnwu
2024-03-12 03:24:42 -07:00
parent 21d374214f
commit 050a073771
10 changed files with 85 additions and 65 deletions

View File

@ -67,8 +67,6 @@ public final class APKInstall {
public interface Session {
// @WorkerThread
OutputStream openStream(Context context) throws IOException;
// @WorkerThread
void install(Context context, File apk) throws IOException;
// @WorkerThread @Nullable
Intent waitIntent();
}
@ -167,13 +165,5 @@ public final class APKInstall {
}
};
}
@Override
public void install(Context context, File apk) throws IOException {
try (var src = new FileInputStream(apk);
var out = openStream(context)) {
transfer(src, out);
}
}
}
}