BlacklistViewModel: Move label check to extension
Let other classes take benefit of this check as well Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package com.aurora.extensions
|
||||
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Process
|
||||
|
||||
fun PackageInfo.isValidApp(): Boolean {
|
||||
fun PackageInfo.isValidApp(packageManager: PackageManager): Boolean {
|
||||
if (this.applicationInfo == null || this.packageName.isEmpty()) return false
|
||||
|
||||
// Most core AOSP system apps use their package name as label
|
||||
if (this.applicationInfo!!.loadLabel(packageManager).startsWith(this.packageName)) return false
|
||||
|
||||
return when {
|
||||
isQAndAbove() -> {
|
||||
Process.isApplicationUid(this.applicationInfo!!.uid) &&
|
||||
|
||||
Reference in New Issue
Block a user