Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

On Android 12 devices, The file generated with the patch was different from the origin file; #183

@guzhonL

Description

@guzhonL

On Android 12 devices(Almost all of android 12 devices), I found in certain cases the file generated with the patch was different from the origin file;

env: android os version:android12,archive-patcher version:v1.1

my test files as flows:
old file:19onlyjar.zip
patch file:patch-onlyjar.zip
origin file:20onlyjar-ori.zip

how to reproduce:
1、unzip patch file first;
2、apply the patch with the following code:
` public static void applyPatch(File oldFile, File patchFile, File newFile, File tempDir) throws IOException {

   if(!tempDir.exists()){
       tempDir.mkdirs();
   }
    BufferedInputStream bufferedPatchIn = null;
    BufferedOutputStream bufferedNewOut = null;
    try{
        FileByFileV1DeltaApplier applier = new FileByFileV1DeltaApplier(tempDir);
        FileInputStream patchIn = new FileInputStream(patchFile);
        bufferedPatchIn = new BufferedInputStream(patchIn);
        FileOutputStream newOut = new FileOutputStream(newFile);
        bufferedNewOut = new BufferedOutputStream(newOut);
        applier.applyDelta(oldFile, bufferedPatchIn, bufferedNewOut);
        bufferedNewOut.flush();
    }finally {
        if(bufferedPatchIn != null){
            bufferedPatchIn.close();
        }
        if(bufferedPatchIn != null){
            bufferedPatchIn.close();
        }
    }
}`

3、compare the md5 between the origin file and the generated file in step2

19onlyjar.zip
patch-onlyjar.zip
20onlyjar-ori.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions