Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PULL REQUEST: Android APK expansion files support #1442

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

PULL REQUEST: Android APK expansion files support #1442

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.3
Reported for operating system, platform: Android (All), All

Comments on the original bug report:

On 2014-04-14 15:15:50 +0000, Alexey wrote:

Simple patch that adds initial support for android APK expansion files. Tiny issues is that it depends on "Google Play APK Expansion Library" from Android SDK Extra. Not sure if it's ok for SDL. Anyway feel free to share any your thoughts about this patch. It can be pulled from https://bitbucket.org/stopiccot/sdl/branch/apk

Regards, Alexey

On 2014-04-18 18:18:17 +0000, Philipp Wiesemann wrote:

In SDLActivity.java openAPKExtensionInputStream() calls getHint() 2x with the same argument.

According to convention documented at the top of SDL_hints.h the string for SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION should be "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION".

Maybe getHint() could be renamed to nativeGetHint() to match the other native methods.

On 2014-04-23 00:46:00 +0000, Alexey wrote:

Thanks, Philipp for going through the code. I've fixed issues you discovered. I've also updated branch https://bitbucket.org/stopiccot/sdl/branch/apk. But the main question is still the same: How to deal with dependency on Google library?

On 2014-04-23 21:56:06 +0000, Philipp Wiesemann wrote:

(In reply to Alexey from comment # 2)

still the same: How to deal with dependency on Google library?

I have not tried this but maybe reflection could be used. This way the two classes would not need to be imported and it would still compile if the library is not installed. On the other hand this would make the implementation more complicated.

On 2014-04-27 17:31:49 +0000, Alexey wrote:

What about copying google files to SDL? Is Apache License compatible with license used by SDL?

On 2014-04-28 22:07:51 +0000, Philipp Wiesemann wrote:

I tried implement the library access using reflection. Here is a patch for SDLActivity.java from the original patch. I have not tested this implementation.

4a5

import java.lang.reflect.Method;
25,27d25
< import com.android.vending.expansion.zipfile.APKExpansionSupport;
< import com.android.vending.expansion.zipfile.ZipResourceFile;
<
505c503,506
< private ZipResourceFile expansionFile = null;


/** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */
private Object expansionFile;
/** com.android.vending.expansion.zipfile.ZipResourceFile's getInputStream() or null. */
private Method expansionFileMethod;

513c514,526
< expansionFile = APKExpansionSupport.getAPKExpansionZipFile(this, mainVersion, patchVersion);

        try {
            expansionFile = Class
                .forName("com.android.vending.expansion.zipfile.APKExpansionSupport")
                .getMethod("getAPKExpansionZipFile", int.class, int.class)
                .invoke(null, mainVersion, patchVersion);
            expansionFileMethod = expansionFile
                .getClass()
                .getMethod("getInputStream", String.class);
        } catch (Exception ex) {
            ex.printStackTrace();
            expansionFile = null;
            expansionFileMethod = null;
        }

517c530,536
< InputStream fileStream = expansionFile.getInputStream(fileName);

    InputStream fileStream;
    try {
        fileStream = (InputStream) expansionFileMethod.invoke(expansionFile, fileName);
    } catch (Exception ex) {
        ex.printStackTrace();
        fileStream = null;
    }

On 2014-04-30 19:54:58 +0000, Alexey wrote:

Patch worked almost without modifications. Seems that everything is ready to get merged into mainline. As always all changes can be pulled from https://bitbucket.org/stopiccot/sdl/branch/apk

On 2014-05-11 04:08:50 +0000, Gabriel Jacobo wrote:

How should I test this?

On 2014-05-28 23:28:29 +0000, Alexey wrote:

Sorry for such horrible late response. I've missed last e-mail.
To test this patch just move some files from APK assets folder to OBB and try to read them. You can read detailed explanation here: http://developer.android.com/google/play/expansion-files.html
Please note, that this patch does not implement downloading missing obb's. But it's really a weird case when user downloads app and then removes obb without removing app itself.

On 2014-06-22 03:38:43 +0000, Sam Lantinga wrote:

Merged, thanks!

@SDLBugzilla SDLBugzilla added the enhancement New feature or request label Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant