Update target sdk to 26 to test further

This commit is contained in:
Victor Shcherb 2018-05-02 20:13:55 +02:00
parent 57a411052b
commit bbc14193c5
5 changed files with 14 additions and 10 deletions

View file

@ -40,7 +40,7 @@
<uses-feature android:name="com.sec.feature.spen_usp" android:required="false"/>
<!-- com.getkeepsafe.taptargetview, studio.carbonylgroup.textfieldboxes, android.support.customtabs -->
<uses-sdk android:targetSdkVersion="23" android:minSdkVersion="15"
<uses-sdk android:targetSdkVersion="26" android:minSdkVersion="15"
tools:overrideLibrary=""/>
<supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"

View file

@ -58,7 +58,7 @@ android {
defaultConfig {
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 15
targetSdkVersion 23
targetSdkVersion 26
versionCode 300
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
multiDexEnabled true

View file

@ -150,7 +150,7 @@ public class AppInitializer implements IProgress {
}
startPrefs = app.getSharedPreferences(
getLocalClassName(app.getAppCustomization().getMapActivity().getName()),
Context.MODE_WORLD_WRITEABLE);
Context.MODE_PRIVATE);
if(!startPrefs.contains(NUMBER_OF_STARTS)) {
startPrefs.edit().putInt(NUMBER_OF_STARTS, 1).commit();
} else {
@ -241,18 +241,18 @@ public class AppInitializer implements IProgress {
public boolean checkPreviousRunsForExceptions(Activity activity, boolean writeFileSize) {
initVariables();
long size = activity.getPreferences(Context.MODE_WORLD_READABLE).getLong(EXCEPTION_FILE_SIZE, 0);
long size = activity.getPreferences(Context.MODE_PRIVATE).getLong(EXCEPTION_FILE_SIZE, 0);
final File file = app.getAppPath(OsmandApplication.EXCEPTION_PATH);
if (file.exists() && file.length() > 0) {
if (size != file.length() && !firstTime) {
if (writeFileSize) {
activity.getPreferences(Context.MODE_WORLD_WRITEABLE).edit().putLong(EXCEPTION_FILE_SIZE, file.length()).commit();
activity.getPreferences(Context.MODE_PRIVATE).edit().putLong(EXCEPTION_FILE_SIZE, file.length()).commit();
}
return true;
}
} else {
if (size > 0) {
activity.getPreferences(Context.MODE_WORLD_WRITEABLE).edit().putLong(EXCEPTION_FILE_SIZE, 0).commit();
activity.getPreferences(Context.MODE_PRIVATE).edit().putLong(EXCEPTION_FILE_SIZE, 0).commit();
}
}
return false;
@ -262,7 +262,7 @@ public class AppInitializer implements IProgress {
public void checkVectorIndexesDownloaded(final Activity ctx) {
OsmandApplication app = (OsmandApplication)ctx.getApplication();
MapRenderRepositories maps = app.getResourceManager().getRenderer();
SharedPreferences pref = ctx.getPreferences(Context.MODE_WORLD_WRITEABLE);
SharedPreferences pref = ctx.getPreferences(Context.MODE_PRIVATE);
boolean check = pref.getBoolean(VECTOR_INDEXES_CHECK, true);
// do not show each time
if (check && new Random().nextInt() % 5 == 1) {
@ -285,7 +285,7 @@ public class AppInitializer implements IProgress {
builder.setNeutralButton(R.string.shared_string_no_thanks, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ctx.getPreferences(Context.MODE_WORLD_WRITEABLE).edit().putBoolean(VECTOR_INDEXES_CHECK, false).commit();
ctx.getPreferences(Context.MODE_PRIVATE).edit().putBoolean(VECTOR_INDEXES_CHECK, false).commit();
}
});
builder.setNegativeButton(R.string.first_time_continue, null);

View file

@ -1,6 +1,8 @@
package net.osmand.plus.api;
import net.osmand.plus.OsmandApplication;
import android.annotation.SuppressLint;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@ -12,10 +14,12 @@ public class SQLiteAPIImpl implements SQLiteAPI {
this.app = app;
}
@SuppressLint("InlinedApi")
@Override
public SQLiteConnection getOrCreateDatabase(String name, boolean readOnly) {
android.database.sqlite.SQLiteDatabase db = app.openOrCreateDatabase(name,
readOnly ? SQLiteDatabase.OPEN_READONLY : (SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING), null);
Context.MODE_PRIVATE |
(readOnly ? 0 : Context.MODE_ENABLE_WRITE_AHEAD_LOGGING), null);
if(db == null) {
return null;
}

View file

@ -15,7 +15,7 @@ public class SettingsAPIImpl implements SettingsAPI {
@Override
public Object getPreferenceObject(String key) {
return app.getSharedPreferences(key, Context.MODE_WORLD_READABLE);
return app.getSharedPreferences(key, Context.MODE_PRIVATE);
}
@Override