Supress deprecation warning for compat methods

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-03-18 15:32:54 +05:30
parent e126848880
commit c72b860b4d
3 changed files with 5 additions and 1 deletions

View File

@@ -43,13 +43,14 @@ class NativeInstaller(context: Context) : InstallerBase(context) {
val intent: Intent
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@Suppress("DEPRECATION")
intent = Intent(Intent.ACTION_INSTALL_PACKAGE)
intent.data = getUri(file)
intent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK
} else {
intent = Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true)

View File

@@ -89,6 +89,7 @@ object CertUtil {
packageInfo.signingInfo.signingCertificateHistory.map { it.generateX509Certificate() }
}
} else {
@Suppress("DEPRECATION")
packageInfo.signatures.map { it.generateX509Certificate() }
}
} catch (exception: Exception) {
@@ -101,6 +102,7 @@ object CertUtil {
return if (isPAndAbove()) {
getPackageInfo(context, packageName, PackageManager.GET_SIGNING_CERTIFICATES)
} else {
@Suppress("DEPRECATION")
getPackageInfo(context, packageName, PackageManager.GET_SIGNATURES)
}
}

View File

@@ -215,6 +215,7 @@ object PackageUtil {
fun getFilter(): IntentFilter {
val filter = IntentFilter()
filter.addDataScheme("package")
@Suppress("DEPRECATION")
filter.addAction(Intent.ACTION_PACKAGE_INSTALL)
filter.addAction(Intent.ACTION_PACKAGE_ADDED)
filter.addAction(Intent.ACTION_PACKAGE_REMOVED)