Skip to content

Commit 3f8adcc

Browse files
sunnylqmclaude
andcommitted
chore: remove dead hdiffPatch exports from android and harmony (CP-11)
The in-memory hdiffPatch JNI export (android/jni/DownloadTask.c) has no Java native declaration binding it, and the harmony NAPI export has no ArkTS caller — both were legacy full-in-memory patch paths superseded by the file-based patch_core flow, yet still compiled into every ABI. Android .so rebuilt for all ABIs (exports drop from 7 to 6 Java_ symbols, required-symbol verification passes); harmony glue syntax-checked with the OHOS toolchain clang and the harmony TS strict check passes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c967168 commit 3f8adcc

9 files changed

Lines changed: 1 addition & 175 deletions

File tree

‎android/jni/Android.mk‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Hdp_Files := \
2020
lzma/C/Lzma2Dec.c
2121

2222
LOCAL_SRC_FILES := \
23-
DownloadTask.c \
2423
../../cpp/patch_core/archive_patch_core.cpp \
2524
../../cpp/patch_core/patch_core.cpp \
2625
../../cpp/patch_core/patch_core_android.cpp \

‎android/jni/DownloadTask.c‎

Lines changed: 0 additions & 56 deletions
This file was deleted.

‎android/jni/cn_reactnative_modules_update_DownloadTask.h‎

Lines changed: 0 additions & 21 deletions
This file was deleted.
-1.27 KB
Binary file not shown.
-1.08 KB
Binary file not shown.

‎android/lib/x86/librnupdate.so‎

-1.41 KB
Binary file not shown.

‎android/lib/x86_64/librnupdate.so‎

-1.27 KB
Binary file not shown.

‎harmony/pushy/src/main/cpp/pushy.cpp‎

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "state_ops.h"
1212

1313
extern "C" {
14-
#include "hpatch.h"
1514
}
1615

1716
namespace {
@@ -407,96 +406,6 @@ pushy::patch::PatchManifest BuildManifest(
407406
return manifest;
408407
}
409408

410-
napi_value HdiffPatch(napi_env env, napi_callback_info info) {
411-
napi_value args[2] = {nullptr, nullptr};
412-
size_t argc = 2;
413-
if (!GetArgCount(env, info, &argc, args) || argc < 2) {
414-
ThrowError(env, "Wrong number of arguments");
415-
return nullptr;
416-
}
417-
418-
bool is_typed_array = false;
419-
if (napi_is_typedarray(env, args[0], &is_typed_array) != napi_ok || !is_typed_array) {
420-
ThrowError(env, "First argument must be a TypedArray");
421-
return nullptr;
422-
}
423-
424-
uint8_t* origin_ptr = nullptr;
425-
size_t origin_length = 0;
426-
if (napi_get_typedarray_info(
427-
env,
428-
args[0],
429-
nullptr,
430-
&origin_length,
431-
reinterpret_cast<void**>(&origin_ptr),
432-
nullptr,
433-
nullptr) != napi_ok) {
434-
ThrowError(env, "Failed to get origin buffer");
435-
return nullptr;
436-
}
437-
438-
if (napi_is_typedarray(env, args[1], &is_typed_array) != napi_ok || !is_typed_array) {
439-
ThrowError(env, "Second argument must be a TypedArray");
440-
return nullptr;
441-
}
442-
443-
uint8_t* patch_ptr = nullptr;
444-
size_t patch_length = 0;
445-
if (napi_get_typedarray_info(
446-
env,
447-
args[1],
448-
nullptr,
449-
&patch_length,
450-
reinterpret_cast<void**>(&patch_ptr),
451-
nullptr,
452-
nullptr) != napi_ok) {
453-
ThrowError(env, "Failed to get patch buffer");
454-
return nullptr;
455-
}
456-
457-
hpatch_singleCompressedDiffInfo patch_info;
458-
if (!((origin_length == 0) || origin_ptr) || !patch_ptr || patch_length == 0) {
459-
ThrowError(env, "Corrupt patch");
460-
return nullptr;
461-
}
462-
if (kHPatch_ok != hpatch_getInfo_by_mem(&patch_info, patch_ptr, patch_length)) {
463-
ThrowError(env, "Error info in hpatch");
464-
return nullptr;
465-
}
466-
if (origin_length != patch_info.oldDataSize) {
467-
ThrowError(env, "Error oldDataSize in hpatch");
468-
return nullptr;
469-
}
470-
471-
size_t new_size = static_cast<size_t>(patch_info.newDataSize);
472-
if (sizeof(size_t) != sizeof(hpatch_StreamPos_t) &&
473-
new_size != patch_info.newDataSize) {
474-
ThrowError(env, "Error newDataSize in hpatch");
475-
return nullptr;
476-
}
477-
478-
void* output_data = nullptr;
479-
napi_value result = nullptr;
480-
if (napi_create_arraybuffer(env, new_size, &output_data, &result) != napi_ok) {
481-
ThrowError(env, "Failed to create result buffer");
482-
return nullptr;
483-
}
484-
485-
if (kHPatch_ok != hpatch_by_mem(
486-
origin_ptr,
487-
origin_length,
488-
static_cast<uint8_t*>(output_data),
489-
new_size,
490-
patch_ptr,
491-
patch_length,
492-
&patch_info)) {
493-
ThrowError(env, "hpatch");
494-
return nullptr;
495-
}
496-
497-
return result;
498-
}
499-
500409
napi_value SyncStateWithBinaryVersion(napi_env env, napi_callback_info info) {
501410
napi_value args[3] = {nullptr, nullptr, nullptr};
502411
size_t argc = 3;
@@ -968,8 +877,7 @@ bool ExportFunction(
968877
} // namespace
969878

970879
napi_value Init(napi_env env, napi_value exports) {
971-
if (!ExportFunction(env, exports, "hdiffPatch", HdiffPatch) ||
972-
!ExportFunction(env, exports, "syncStateWithBinaryVersion", SyncStateWithBinaryVersion) ||
880+
if (!ExportFunction(env, exports, "syncStateWithBinaryVersion", SyncStateWithBinaryVersion) ||
973881
!ExportFunction(env, exports, "runStateCore", RunStateCore) ||
974882
!ExportFunction(env, exports, "buildArchivePatchPlan", BuildArchivePatchPlan) ||
975883
!ExportFunction(env, exports, "buildCopyGroups", BuildCopyGroups) ||

‎harmony/pushy/src/main/ets/NativePatchCore.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ export interface FileSourcePatchRequest {
5050
}
5151

5252
interface NativePatchCoreBindings {
53-
hdiffPatch(
54-
origin: Uint8Array,
55-
patch: Uint8Array,
56-
): ArrayBuffer | Uint8Array;
5753
syncStateWithBinaryVersion(
5854
packageVersion: string,
5955
buildTime: string,

0 commit comments

Comments
 (0)