Fix #10148
This commit is contained in:
parent
e9be0b7327
commit
befffb6511
2 changed files with 29 additions and 20 deletions
|
@ -85,6 +85,7 @@ import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import btools.routingapp.BRouterServiceConnection;
|
import btools.routingapp.BRouterServiceConnection;
|
||||||
|
import btools.routingapp.IBRouterService;
|
||||||
|
|
||||||
import static net.osmand.plus.AppVersionUpgradeOnInit.LAST_APP_VERSION;
|
import static net.osmand.plus.AppVersionUpgradeOnInit.LAST_APP_VERSION;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
|
||||||
|
@ -422,13 +423,9 @@ public class AppInitializer implements IProgress {
|
||||||
osmandSettings.APPLICATION_MODE.set(osmandSettings.DEFAULT_APPLICATION_MODE.get());
|
osmandSettings.APPLICATION_MODE.set(osmandSettings.DEFAULT_APPLICATION_MODE.get());
|
||||||
}
|
}
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
try {
|
|
||||||
app.bRouterServiceConnection = startupInit(BRouterServiceConnection.connect(app), BRouterServiceConnection.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
getLazyRoutingConfig();
|
getLazyRoutingConfig();
|
||||||
app.applyTheme(app);
|
app.applyTheme(app);
|
||||||
|
startupInit(app.reconnectToBRouter(), IBRouterService.class);
|
||||||
app.inAppPurchaseHelper = startupInit(new InAppPurchaseHelperImpl(app), InAppPurchaseHelperImpl.class);
|
app.inAppPurchaseHelper = startupInit(new InAppPurchaseHelperImpl(app), InAppPurchaseHelperImpl.class);
|
||||||
app.poiTypes = startupInit(MapPoiTypes.getDefaultNoInit(), MapPoiTypes.class);
|
app.poiTypes = startupInit(MapPoiTypes.getDefaultNoInit(), MapPoiTypes.class);
|
||||||
app.transportRoutingHelper = startupInit(new TransportRoutingHelper(app), TransportRoutingHelper.class);
|
app.transportRoutingHelper = startupInit(new TransportRoutingHelper(app), TransportRoutingHelper.class);
|
||||||
|
|
|
@ -109,17 +109,16 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class);
|
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class);
|
||||||
|
|
||||||
final AppInitializer appInitializer = new AppInitializer(this);
|
final AppInitializer appInitializer = new AppInitializer(this);
|
||||||
OsmandSettings osmandSettings = null;
|
Handler uiHandler;
|
||||||
|
OsmandSettings osmandSettings;
|
||||||
OsmAndAppCustomization appCustomization;
|
OsmAndAppCustomization appCustomization;
|
||||||
|
NavigationService navigationService;
|
||||||
|
DownloadService downloadService;
|
||||||
|
OsmandAidlApi aidlApi;
|
||||||
|
|
||||||
private final SQLiteAPI sqliteAPI = new SQLiteAPIImpl(this);
|
private final SQLiteAPI sqliteAPI = new SQLiteAPIImpl(this);
|
||||||
private final OsmAndTaskManager taskManager = new OsmAndTaskManager(this);
|
private final OsmAndTaskManager taskManager = new OsmAndTaskManager(this);
|
||||||
private final UiUtilities iconsCache = new UiUtilities(this);
|
private final UiUtilities iconsCache = new UiUtilities(this);
|
||||||
Handler uiHandler;
|
|
||||||
|
|
||||||
NavigationService navigationService;
|
|
||||||
DownloadService downloadService;
|
|
||||||
|
|
||||||
OsmandAidlApi aidlApi;
|
|
||||||
|
|
||||||
// start variables
|
// start variables
|
||||||
ResourceManager resourceManager;
|
ResourceManager resourceManager;
|
||||||
|
@ -157,10 +156,8 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
QuickActionRegistry quickActionRegistry;
|
QuickActionRegistry quickActionRegistry;
|
||||||
|
|
||||||
private Resources localizedResources;
|
private Resources localizedResources;
|
||||||
|
|
||||||
private Map<String, Builder> customRoutingConfigs = new ConcurrentHashMap<>();
|
private Map<String, Builder> customRoutingConfigs = new ConcurrentHashMap<>();
|
||||||
|
private Locale preferredLocale;
|
||||||
private Locale preferredLocale = null;
|
|
||||||
private Locale defaultLocale;
|
private Locale defaultLocale;
|
||||||
private File externalStorageDirectory;
|
private File externalStorageDirectory;
|
||||||
private boolean externalStorageDirectoryReadOnly;
|
private boolean externalStorageDirectoryReadOnly;
|
||||||
|
@ -591,8 +588,7 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
while (getNavigationService() != null) {
|
while (getNavigationService() != null) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
}
|
} catch (InterruptedException e) {
|
||||||
catch (InterruptedException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,12 +778,28 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
setLanguage(c);
|
setLanguage(c);
|
||||||
c.setTheme(themeResId);
|
c.setTheme(themeResId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IBRouterService reconnectToBRouter() {
|
||||||
|
try {
|
||||||
|
bRouterServiceConnection = BRouterServiceConnection.connect(this);
|
||||||
|
if (bRouterServiceConnection != null) {
|
||||||
|
return bRouterServiceConnection.getBrouterService();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public IBRouterService getBRouterService() {
|
public IBRouterService getBRouterService() {
|
||||||
if(bRouterServiceConnection == null) {
|
if (bRouterServiceConnection == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return bRouterServiceConnection.getBrouterService();
|
IBRouterService s = bRouterServiceConnection.getBrouterService();
|
||||||
|
if (s != null && !s.asBinder().isBinderAlive()) {
|
||||||
|
s = reconnectToBRouter();
|
||||||
|
}
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLanguage(Context context) {
|
public void setLanguage(Context context) {
|
||||||
|
|
Loading…
Reference in a new issue