Fix: Choose service according to embedded module
Improve startup resilience by selecting the application service according to availability: catch Throwable from manager lookup and clear service on failure, then if service is null check hasEmbeddedModules(context) to prefer IntegrApplicationService when embedded modules exist, otherwise use NeoLocalApplicationService. Also refine logging levels/messages (info on success, warn on failure) to provide clearer diagnostics.
This commit is contained in:
parent
f2713a342b
commit
7844b99b3a
|
|
@ -115,13 +115,21 @@ public class LSPApplication {
|
|||
}
|
||||
SharedPreferences shared = context.getSharedPreferences("npatch", Context.MODE_PRIVATE);
|
||||
shared.edit().putString("modules", moduleArr.toString()).apply();
|
||||
Log.e(TAG, "Success update module scope");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to connect to manager, fallback to fixed local service");
|
||||
Log.i(TAG, "Success update module scope from Manager");
|
||||
} catch (Throwable e) {
|
||||
Log.w(TAG, "Failed to connect to manager: " + e.getMessage());
|
||||
service = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (service == null) {
|
||||
if (hasEmbeddedModules(context)) {
|
||||
Log.i(TAG, "Using Integrated Service (Embedded Modules Found)");
|
||||
service = new IntegrApplicationService(context);
|
||||
} else {
|
||||
Log.i(TAG, "Using NeoLocal Service (Cached Config)");
|
||||
service = new NeoLocalApplicationService(context);
|
||||
}
|
||||
} else {
|
||||
service = new IntegrApplicationService(context);
|
||||
}
|
||||
|
||||
disableProfile(context);
|
||||
|
|
|
|||
Loading…
Reference in New Issue