Skip to content

Commit

Permalink
Ensure service initialization happens first
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Nov 3, 2023
1 parent 925e317 commit 93bb834
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
9 changes: 7 additions & 2 deletions README-CHANGES.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,19 @@
<c:change date="2023-10-25T00:00:00+00:00" summary="Fixed crash on Reader screen due to more than one Fragment instance."/>
</c:changes>
</c:release>
<c:release date="2023-10-31T11:45:34+00:00" is-open="true" ticket-system="org.lyrasis.jira" version="1.8.0">
<c:release date="2023-11-03T10:24:54+00:00" is-open="true" ticket-system="org.lyrasis.jira" version="1.8.0">
<c:changes>
<c:change date="2023-10-30T00:00:00+00:00" summary="Removed the Android 12+ devices default splash screen."/>
<c:change date="2023-10-31T11:45:34+00:00" summary="Reduce audio book related crashes.">
<c:change date="2023-10-31T00:00:00+00:00" summary="Reduce audio book related crashes.">
<c:tickets>
<c:ticket id="PP-565"/>
</c:tickets>
</c:change>
<c:change date="2023-11-03T10:24:54+00:00" summary="Fix a possible crash if an audio book fails to open.">
<c:tickets>
<c:ticket id="PP-672"/>
</c:tickets>
</c:change>
</c:changes>
</c:release>
</c:releases>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,32 @@ class AudioBookPlayerActivity :
this.log.debug("onCreate")
super.onCreate(null)

/*
* Initialize all services.
*/

val services =
Services.serviceDirectory()

this.bookmarkService =
services.requireService(BookmarkServiceType::class.java)
this.profilesController =
services.requireService(ProfilesControllerType::class.java)
this.timeTrackingService =
services.requireService(TimeTrackingServiceType::class.java)
this.uiThread =
services.requireService(UIThreadServiceType::class.java)
this.books =
services.requireService(BooksControllerType::class.java)
this.covers =
services.requireService(BookCoverProviderType::class.java)
this.networkConnectivity =
services.requireService(NetworkConnectivityType::class.java)
this.strategies =
services.requireService(AudioBookManifestStrategiesType::class.java)
this.contentProtectionProviders =
ServiceLoader.load(ContentProtectionProvider::class.java).toList()

val i = this.intent!!
val a = i.extras!!

Expand Down Expand Up @@ -208,32 +234,6 @@ class AudioBookPlayerActivity :

this.setContentView(R.layout.audio_book_player_base)

/*
* Initialize all services.
*/

val services =
Services.serviceDirectory()

this.bookmarkService =
services.requireService(BookmarkServiceType::class.java)
this.profilesController =
services.requireService(ProfilesControllerType::class.java)
this.timeTrackingService =
services.requireService(TimeTrackingServiceType::class.java)
this.uiThread =
services.requireService(UIThreadServiceType::class.java)
this.books =
services.requireService(BooksControllerType::class.java)
this.covers =
services.requireService(BookCoverProviderType::class.java)
this.networkConnectivity =
services.requireService(NetworkConnectivityType::class.java)
this.strategies =
services.requireService(AudioBookManifestStrategiesType::class.java)
this.contentProtectionProviders =
ServiceLoader.load(ContentProtectionProvider::class.java).toList()

this.playerScheduledExecutor =
Executors.newSingleThreadScheduledExecutor()
this.closeOnActivityDestroy.push {
Expand Down

0 comments on commit 93bb834

Please sign in to comment.