Partially fix Lockscreen controls
This commit is contained in:
parent
f5063de70f
commit
31df20ffe5
4 changed files with 13 additions and 8 deletions
|
@ -84,12 +84,11 @@ class LockScreenActivity : AbsMusicServiceActivity() {
|
|||
private fun lockScreenInit() {
|
||||
if (VersionUtils.hasOreoMR1()) {
|
||||
setShowWhenLocked(true)
|
||||
val keyguardManager = getSystemService<KeyguardManager>()
|
||||
keyguardManager?.requestDismissKeyguard(this, null)
|
||||
//setTurnScreenOn(true)
|
||||
} else {
|
||||
this.window.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||
window.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||
// or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ class MusicService : MediaBrowserServiceCompat(),
|
|||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (isLockScreen && isPlaying) {
|
||||
val lockIntent = Intent(context, LockScreenActivity::class.java)
|
||||
lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
startActivity(lockIntent)
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ class MusicService : MediaBrowserServiceCompat(),
|
|||
uiThreadHandler = Handler(Looper.getMainLooper())
|
||||
registerReceiver(widgetIntentReceiver, IntentFilter(APP_WIDGET_UPDATE))
|
||||
registerReceiver(updateFavoriteReceiver, IntentFilter(FAVORITE_STATE_CHANGED))
|
||||
registerReceiver(lockScreenReceiver, IntentFilter(Intent.ACTION_SCREEN_OFF))
|
||||
registerReceiver(lockScreenReceiver, IntentFilter(Intent.ACTION_SCREEN_ON))
|
||||
sessionToken = mediaSession?.sessionToken
|
||||
notificationManager = getSystemService()
|
||||
initNotification()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue