From 6a7d1887b8bdb63a8d567a73d6569a62f689b451 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Fri, 13 Jan 2017 15:15:41 +0200 Subject: [PATCH] SDL: settings file sohuld be non-readable by other apps for API level 25 --- project/java/Settings.java | 7 +++++-- project/jni/application/ballfield/ballfield.cpp | 1 + project/jni/application/openttd/AndroidAppSettings.cfg | 6 +++--- project/jni/application/openttd/build-pc.sh | 3 ++- project/jni/application/openttd/pack-data.sh | 2 +- project/jni/application/openttd/src | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/project/java/Settings.java b/project/java/Settings.java index df9eed248..da85b52b9 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -89,7 +89,7 @@ public class Settings static void Save(final MainActivity p) { try { - ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_WORLD_READABLE )); + ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_PRIVATE )); out.writeInt(SETTINGS_FILE_VERSION); out.writeBoolean(Globals.DownloadToSdcard); out.writeBoolean(Globals.PhoneHasArrowKeys); @@ -401,8 +401,11 @@ public class Settings return; } catch( FileNotFoundException e ) { + Log.i("SDL", "libSDL: settings file not found: " + e); } catch( SecurityException e ) { + Log.i("SDL", "libSDL: settings file cannot be opened: " + e); } catch ( IOException e ) { + Log.i("SDL", "libSDL: settings file cannot be read: " + e); DeleteFilesOnUpgrade(p); if( Globals.ResetSdlConfigForThisVersion ) { @@ -508,7 +511,7 @@ public class Settings public static void DeleteSdlConfigOnUpgradeAndRestart(final MainActivity p) { try { - ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_WORLD_READABLE )); + ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_PRIVATE )); out.writeInt(-1); out.close(); } catch( FileNotFoundException e ) { diff --git a/project/jni/application/ballfield/ballfield.cpp b/project/jni/application/ballfield/ballfield.cpp index 9735ee168..78cd94345 100644 --- a/project/jni/application/ballfield/ballfield.cpp +++ b/project/jni/application/ballfield/ballfield.cpp @@ -693,6 +693,7 @@ int main(int argc, char* argv[]) if(evt.key.keysym.sym == SDLK_1) { SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0); + SDL_ANDROID_OpenExternalWebBrowser("http:/google.com/"); } if(evt.key.keysym.sym == SDLK_2) { diff --git a/project/jni/application/openttd/AndroidAppSettings.cfg b/project/jni/application/openttd/AndroidAppSettings.cfg index 30f2056c9..e81fea1c3 100644 --- a/project/jni/application/openttd/AndroidAppSettings.cfg +++ b/project/jni/application/openttd/AndroidAppSettings.cfg @@ -7,10 +7,10 @@ AppName="OpenTTD" AppFullName=org.openttd.sdl # Application version code (integer) -AppVersionCode=16163 +AppVersionCode=16164 # Application user-visible version name (string) -AppVersionName="1.6.1.63" +AppVersionName="1.6.1.64" # Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' # If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu @@ -18,7 +18,7 @@ AppVersionName="1.6.1.63" # If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - # these files are put inside .apk package by build system # You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version, first associated with the file -AppDataDownloadUrl="!!Data files - 20 Mb|openttd-data-1.6.1-0.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!!MIDI music support (18 Mb)|timidity.zip.xz|http://sourceforge.net/projects/libsdl-android/files/timidity.zip.xz^!!Internationalization files|icudt52l.zip.xz|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip.xz^HD graphics - 220 Mb download|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/abase-0.1.2-0.zip.xz/download|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/zBase-v5588.zip.xz/download" +AppDataDownloadUrl="!!Data files - 20 Mb|openttd-data-1.6.1-1.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!!MIDI music support (18 Mb)|timidity.zip.xz|http://sourceforge.net/projects/libsdl-android/files/timidity.zip.xz^!!Internationalization files|icudt52l.zip.xz|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip.xz^HD graphics - 220 Mb download|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/abase-0.1.2-0.zip.xz/download|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/zBase-v5588.zip.xz/download" # Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=n diff --git a/project/jni/application/openttd/build-pc.sh b/project/jni/application/openttd/build-pc.sh index 750614b08..06a7aea8c 100755 --- a/project/jni/application/openttd/build-pc.sh +++ b/project/jni/application/openttd/build-pc.sh @@ -20,6 +20,7 @@ export LD_LIBRARY_PATH=/usr/local/lib if [ -z "$1" ]; then ./openttd -d 2 -r 854x480 #-g opntitle.sav else - gdb -ex run --args \ + #gdb -ex run --args \ + valgrind --track-fds=yes --log-file=valgrind.log --leak-check=full \ ./openttd -d 2 -r 854x480 #-g opntitle.sav fi diff --git a/project/jni/application/openttd/pack-data.sh b/project/jni/application/openttd/pack-data.sh index c544e94f0..a22a208b2 100755 --- a/project/jni/application/openttd/pack-data.sh +++ b/project/jni/application/openttd/pack-data.sh @@ -1,6 +1,6 @@ #!/bin/sh -VER=1.6.1-0 +VER=1.6.1-1 cd data rm -f ../AndroidData/openttd-data-*.zip.xz ../AndroidData/openttd-data-*.zip diff --git a/project/jni/application/openttd/src b/project/jni/application/openttd/src index 7701d6e41..f03484e84 160000 --- a/project/jni/application/openttd/src +++ b/project/jni/application/openttd/src @@ -1 +1 @@ -Subproject commit 7701d6e416ec4308577c7956c0fd517a19c69ff5 +Subproject commit f03484e84ba64a806d59da435d68398bda32caf9