@ Implementation ( minSdk = P ) @ HiddenApi @ SystemApi @ RequiresPermission ( android . Manifest . permission . MANAGE_APP_OPS_MODES ) public void setMode ( String op , int uid , String packageName , int mode ) { setMode ( AppOpsManager . strOpToOp ( op ) , uid , packageName , mode ) ; }
Change the operating mode for the given op in the given app package . You must pass in both the uid and name of the application whose mode is being modified ; if these do not match the modification will not be applied .