Partially fix Lockscreen controls

This commit is contained in:
Prathamesh More 2022-07-06 14:43:06 +05:30
parent f5063de70f
commit 31df20ffe5
4 changed files with 13 additions and 8 deletions

View file

@ -22,6 +22,7 @@
android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission
android:name="android.permission.BLUETOOTH_CONNECT"
android:usesPermissionFlags="neverForLocation"
@ -125,7 +126,8 @@
<activity android:name=".activities.PermissionActivity" />
<activity
android:name=".activities.LockScreenActivity"
android:launchMode="singleTop"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:showOnLockScreen="true" />
<activity
android:name=".fragments.backup.RestoreActivity"

View file

@ -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
window.addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
// or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
}
}

View file

@ -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()

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="download_policy">always</string>
</resources>