0

现在 Android 10 及更高版本具有此功能,我正在尝试添加它。将其包含在清单中:

        <action android:name="android.intent.action.ASSIST"/>

这是代码:

mRM = (RoleManager) mAppContext.getSystemService(Context.ROLE_SERVICE); 
bAvailable = mRM.isRoleAvailable(RoleManager.ROLE_ASSISTANT);

    if (bAvailable) {
        roleIntent = mRM.createRequestRoleIntent(RoleManager.ROLE_ASSISTANT);
        
        startActivityForResult (roleIntent, REQUEST_CODE);
    }

但是,我不断收到此错误:

RequestRoleActivity: Role is not requestable: android.app.role.ASSISTANT
RequestRoleFragment: Role request result requestingUid=10021 requestingPackageName=com.broadcom.BcmMicCapture roleName=android.app.role.ASSISTANT qualifyingCount=-1 currentUid=-1 currentPackageName=null grantedAnotherUid=-1 grantedAnotherPackageName=null result=1

知道这里有什么问题吗?这是一个sepolicy问题吗?还是应用程序需要添加一些其他权限?

4

1 回答 1

0

不幸的是,这已经不可能了。

谷歌使这个角色不可请求:

https://cs.android.com/android/_/android/platform/packages/modules/Permission/+/3512ea1e5dd8b91f0017dfdb523b3421f7b165e2

于 2021-10-29T11:45:49.210 回答