Skip to content

Commit

Permalink
Fix default preference for #15746
Browse files Browse the repository at this point in the history
  • Loading branch information
Chumva committed Dec 5, 2024
1 parent f2ec075 commit 6ccd699
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions OsmAnd/src/net/osmand/plus/AppInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand All @@ -22,6 +23,7 @@
import net.osmand.OnResultCallback;
import net.osmand.PlatformUtil;
import net.osmand.aidl.OsmandAidlApi;
import net.osmand.core.android.NativeCore;
import net.osmand.map.OsmandRegions;
import net.osmand.map.OsmandRegions.RegionTranslation;
import net.osmand.map.WorldRegion;
Expand Down Expand Up @@ -628,6 +630,7 @@ private void initOpenGl() {
try {
settings.OPENGL_RENDER_FAILED.set(settings.OPENGL_RENDER_FAILED.get() + 1);
NativeCoreContext.init(app);
settings.USE_OPENGL_RENDER.setDefaultValue(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && NativeCore.is64Bit());
settings.OPENGL_RENDER_FAILED.set(0);
} catch (Throwable throwable) {
LOG.error("NativeCoreContext", throwable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import net.osmand.Period.PeriodUnit;
import net.osmand.PlatformUtil;
import net.osmand.StateChangedListener;
import net.osmand.core.android.NativeCore;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.ValueHolder;
Expand Down Expand Up @@ -3172,7 +3173,9 @@ public CommonPreference<Boolean> getCustomRoutingBooleanProperty(String attrName

public final CommonPreference<Integer> LOCATION_INTERPOLATION_PERCENT = new IntPreference(this, "location_interpolation_percent", 0).makeGlobal().makeShared();

public final OsmandPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference(this, "use_opengl_render", Build.VERSION.SDK_INT >= Build.VERSION_CODES.P).makeGlobal().makeShared().cache();
public final CommonPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference(this, "use_opengl_render",
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P).makeGlobal().makeShared().cache();

public final OsmandPreference<Integer> OPENGL_RENDER_FAILED = new IntPreference(this, "opengl_render_failed_count", 0).makeGlobal().cache();

public final OsmandPreference<String> CONTRIBUTION_INSTALL_APP_DATE = new StringPreference(this, "CONTRIBUTION_INSTALL_APP_DATE", null).makeGlobal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void init(@NonNull OsmandApplication app) {
else
NativeCore.load(assets, "");
}
if (NativeCore.isLoaded()) {
if (NativeCore.isLoaded() && (NativeCore.is64Bit() || app.getSettings().USE_OPENGL_RENDER.isSet())) {
File directory = app.getAppPath("");
Logger.get().addLogSink(QIODeviceLogSink.createFileLogSink(new File(directory, LOG_FILE_NAME).getAbsolutePath()));

Expand Down

0 comments on commit 6ccd699

Please sign in to comment.