-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Workaround FTP tile crash on Android 14
Bug: #1238
- Loading branch information
Showing
3 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
app/src/main/java/me/zhanghai/android/files/compat/TileServiceCompat.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2024 Hai Zhang <[email protected]> | ||
* All Rights Reserved. | ||
*/ | ||
|
||
package me.zhanghai.android.files.compat | ||
|
||
import android.os.Build | ||
import android.os.IBinder | ||
import android.service.quicksettings.TileService | ||
import androidx.annotation.RequiresApi | ||
import me.zhanghai.android.files.hiddenapi.RestrictedHiddenApi | ||
import me.zhanghai.android.files.util.lazyReflectedField | ||
|
||
@delegate:RequiresApi(Build.VERSION_CODES.N) | ||
@get:RequiresApi(Build.VERSION_CODES.N) | ||
@RestrictedHiddenApi | ||
private val tokenField by lazyReflectedField(TileService::class.qualifiedName!!, "mToken") | ||
|
||
val TileService.token: IBinder? | ||
@RequiresApi(Build.VERSION_CODES.N) | ||
get() = tokenField.get(this) as IBinder? |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/me/zhanghai/android/files/compat/WindowManagerLayoutParamsCompat.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2024 Hai Zhang <[email protected]> | ||
* All Rights Reserved. | ||
*/ | ||
|
||
package me.zhanghai.android.files.compat | ||
|
||
import android.view.WindowManager | ||
|
||
object WindowManagerLayoutParamsCompat { | ||
const val TYPE_QS_DIALOG = WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + 35 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters