Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
528
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
9719ce87
Commit
9719ce87
authored
5 years ago
by
Nicolas Pomepuy
Committed by
Geoffrey Métais
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Change the way we start the DebugLogService
parent
99328726
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!264
Fixes for beta
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/DebugLogService.kt
+25
-13
25 additions, 13 deletions
vlc-android/src/org/videolan/vlc/DebugLogService.kt
with
25 additions
and
13 deletions
vlc-android/src/org/videolan/vlc/DebugLogService.kt
+
25
−
13
View file @
9719ce87
...
...
@@ -20,16 +20,24 @@
package
org.videolan.vlc
import
android.annotation.TargetApi
import
android.app.PendingIntent
import
android.app.Service
import
android.content.*
import
android.content.ComponentName
import
android.content.Context
import
android.content.Intent
import
android.content.ServiceConnection
import
android.os.*
import
android.text.format.DateFormat
import
androidx.core.app.NotificationCompat
import
androidx.core.content.ContextCompat
import
org.videolan.libvlc.util.AndroidUtil
import
org.videolan.vlc.gui.DebugLogActivity
import
org.videolan.vlc.gui.helpers.NotificationHelper
import
org.videolan.vlc.util.*
import
org.videolan.vlc.util.AndroidDevices
import
org.videolan.vlc.util.Logcat
import
org.videolan.vlc.util.Util
import
org.videolan.vlc.util.getContextWithLocale
import
java.io.*
import
java.util.*
...
...
@@ -109,13 +117,10 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
sendMessage
(
MSG_ONLOG
,
log
)
}
@Synchronized
fun
start
()
{
if
(
logcat
!=
null
)
return
clear
()
logcat
=
Logcat
()
logcat
!!
.
start
(
this
)
@TargetApi
(
Build
.
VERSION_CODES
.
O
)
private
fun
forceForeground
()
{
if
(
AndroidUtil
.
isOOrLater
)
NotificationHelper
.
createDebugServcieChannel
(
applicationContext
)
val
debugLogIntent
=
Intent
(
this
,
DebugLogActivity
::
class
.
java
)
debugLogIntent
.
action
=
"android.intent.action.MAIN"
debugLogIntent
.
flags
=
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
or
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
...
...
@@ -127,9 +132,17 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
builder
.
setSmallIcon
(
R
.
drawable
.
ic_stat_vlc
)
builder
.
setContentIntent
(
pi
)
val
notification
=
builder
.
build
()
startForeground
(
R
.
string
.
log_service_title
,
notification
)
startForeground
(
3
,
notification
)
}
@Synchronized
fun
start
()
{
if
(
logcat
!=
null
)
return
clear
()
logcat
=
Logcat
()
logcat
!!
.
start
(
this
)
start
Service
(
Intent
(
this
,
DebugLogService
::
class
.
java
))
ContextCompat
.
startForeground
Service
(
this
,
Intent
(
this
,
DebugLogService
::
class
.
java
))
sendMessage
(
MSG_STARTED
,
null
)
}
...
...
@@ -198,6 +211,7 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
}
override
fun
onStartCommand
(
intent
:
Intent
,
flags
:
Int
,
startId
:
Int
):
Int
{
if
(
AndroidUtil
.
isOOrLater
)
forceForeground
()
return
START_STICKY
}
...
...
@@ -279,8 +293,6 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
synchronized
(
this
)
{
if
(
mIDebugLogService
!=
null
)
{
try
{
if
(
AndroidUtil
.
isOOrLater
)
NotificationHelper
.
createDebugServcieChannel
(
mContext
.
applicationContext
)
mIDebugLogService
!!
.
start
()
return
true
}
catch
(
e
:
RemoteException
)
{
...
...
This diff is collapsed.
Click to expand it.
Geoffrey Métais
@Dekans
mentioned in commit
dfa0b7a9
·
5 years ago
mentioned in commit
dfa0b7a9
mentioned in commit dfa0b7a9417a6984232dd0845ce925cb86b3e0ef
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment