Android 如何使用程序包名称删除频道?

Android 如何使用程序包名称删除频道?,android,android-tv,Android,Android Tv,我正在尝试使用ContentResolver使用应用程序包名称从android.media.tv的数据库中删除所有频道,如下所示 applicationContext.contentResolver.delete( TvContractCompat.Channels.CONTENT_URI, “${TvContractCompat.Channels.COLUMN_PACKAGE_NAME}=?”, 阵列(当前应用程序包名称) ) 但是我越来越 java.util.concurrent.Exec

我正在尝试使用
ContentResolver
使用应用程序包名称从
android.media.tv
的数据库中删除所有频道,如下所示

applicationContext.contentResolver.delete(
TvContractCompat.Channels.CONTENT_URI,
“${TvContractCompat.Channels.COLUMN_PACKAGE_NAME}=?”,
阵列(当前应用程序包名称)
)
但是我越来越

java.util.concurrent.ExecutionException: java.lang.SecurityException: Selection not allowed for content://android.media.tv/channel
    at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:516)
    at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475)
    at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:298)
    at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)
 Caused by: java.lang.SecurityException: Selection not allowed for content://android.media.tv/channel
    at android.os.Parcel.createException(Parcel.java:1950)
    at android.os.Parcel.readException(Parcel.java:1918)
    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
    at android.content.ContentProviderProxy.delete(ContentProviderNative.java:547)
    at android.content.ContentResolver.delete(ContentResolver.java:1684)
我知道我们可以通过
channelId
删除频道,但就我而言,我没有频道ID。我只想删除应用程序创建的所有频道

  • 我错过了什么

请求应一次一个。您是否在utils类中使用了synchronized或查找任何其他请求。或者尝试更改包名,有时Java/android保留的包名会导致SecurityException。

这是对contentResolver的单个请求。给定的包名称有效。另外,
select
查询也会出现
SecurityException