Android: Renamed SDLActivity's Java method used for APK expansion files.

The name was not correct.
This commit is contained in:
Philipp Wiesemann 2015-09-17 22:24:54 +02:00
parent 5e5936822f
commit 92ca42d940
2 changed files with 14 additions and 5 deletions

View File

@ -669,7 +669,7 @@ public class SDLActivity extends Activity {
} }
} }
// APK extension files support // APK expansion files support
/** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */ /** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */
private Object expansionFile; private Object expansionFile;
@ -677,17 +677,26 @@ public class SDLActivity extends Activity {
/** com.android.vending.expansion.zipfile.ZipResourceFile's getInputStream() or null. */ /** com.android.vending.expansion.zipfile.ZipResourceFile's getInputStream() or null. */
private Method expansionFileMethod; private Method expansionFileMethod;
/**
* This method was called by SDL using JNI.
* @deprecated because of an incorrect name
*/
@Deprecated
public InputStream openAPKExtensionInputStream(String fileName) throws IOException {
return openAPKExpansionInputStream(fileName);
}
/** /**
* This method is called by SDL using JNI. * This method is called by SDL using JNI.
*/ */
public InputStream openAPKExtensionInputStream(String fileName) throws IOException { public InputStream openAPKExpansionInputStream(String fileName) throws IOException {
// Get a ZipResourceFile representing a merger of both the main and patch files // Get a ZipResourceFile representing a merger of both the main and patch files
if (expansionFile == null) { if (expansionFile == null) {
Integer mainVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION")); Integer mainVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"));
Integer patchVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION")); Integer patchVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"));
try { try {
// To avoid direct dependency on Google APK extension library that is // To avoid direct dependency on Google APK expansion library that is
// not a part of Android SDK we access it using reflection // not a part of Android SDK we access it using reflection
expansionFile = Class.forName("com.android.vending.expansion.zipfile.APKExpansionSupport") expansionFile = Class.forName("com.android.vending.expansion.zipfile.APKExpansionSupport")
.getMethod("getAPKExpansionZipFile", Context.class, int.class, int.class) .getMethod("getAPKExpansionZipFile", Context.class, int.class, int.class)

View File

@ -785,9 +785,9 @@ fallback:
"open", "(Ljava/lang/String;I)Ljava/io/InputStream;"); "open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */); inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
// Try fallback to APK Extension files /* Try fallback to APK expansion files */
mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
"openAPKExtensionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString); inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString);
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {