Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sound/sampled/AudioPermission.java
38918 views
/*1* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sound.sampled;2627import java.security.BasicPermission;282930/**31* The <code>AudioPermission</code> class represents access rights to the audio32* system resources. An <code>AudioPermission</code> contains a target name33* but no actions list; you either have the named permission or you don't.34* <p>35* The target name is the name of the audio permission (see the table below).36* The names follow the hierarchical property-naming convention. Also, an asterisk37* can be used to represent all the audio permissions.38* <p>39* The following table lists the possible <code>AudioPermission</code> target names.40* For each name, the table provides a description of exactly what that permission41* allows, as well as a discussion of the risks of granting code the permission.42* <p>43*44* <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">45* <tr>46* <th>Permission Target Name</th>47* <th>What the Permission Allows</th>48* <th>Risks of Allowing this Permission</th>49* </tr>50*51* <tr>52* <td>play</td>53* <td>Audio playback through the audio device or devices on the system.54* Allows the application to obtain and manipulate lines and mixers for55* audio playback (rendering).</td>56* <td>In some cases use of this permission may affect other57* applications because the audio from one line may be mixed with other audio58* being played on the system, or because manipulation of a mixer affects the59* audio for all lines using that mixer.</td>60*</tr>61*62* <tr>63* <td>record</td>64* <td>Audio recording through the audio device or devices on the system.65* Allows the application to obtain and manipulate lines and mixers for66* audio recording (capture).</td>67* <td>In some cases use of this permission may affect other68* applications because manipulation of a mixer affects the audio for all lines69* using that mixer.70* This permission can enable an applet or application to eavesdrop on a user.</td>71*</tr>72*</table>73*<p>74*75* @author Kara Kytle76* @since 1.377*/78/*79* (OLD PERMISSIONS TAKEN OUT FOR 1.2 BETA)80*81* <tr>82* <td>playback device access</td>83* <td>Direct access to the audio playback device(s), including configuration of the84* playback format, volume, and balance, explicit opening and closing of the device,85* etc.</td>86* <td>Changes the properties of a shared system device and therefore87* can affect other applications.</td>88* </tr>89*90* <tr>91* <td>playback device override</td>92* <td>Manipulation of the audio playback device(s) in a way that directly conflicts93* with use by other applications. This includes closing the device while it is in94* use by another application, changing the device format while another application95* is using it, etc. </td>96* <td>Changes the properties of a shared system device and therefore97* can affect other applications.</td>98* </tr>99*100* <tr>101* <td>record device access</td>102* <td>Direct access to the audio recording device(s), including configuration of the103* the record format, volume, and balance, explicit opening and closing of the device,104* etc.</td>105* <td>Changes the properties of a shared system device and therefore106* can affect other applications.</td>107* </tr>108*109* <tr>110* <td>record device override</td>111* <td>Manipulation of the audio recording device(s) in a way that directly conflicts112* with use by other applications. This includes closing the device while it is in113* use by another application, changing the device format while another application114* is using it, etc. </td>115* <td>Changes the properties of a shared system device and therefore116* can affect other applications.</td>117* </tr>118*119* </table>120*<p>121*122* @author Kara Kytle123* @since 1.3124*/125126/*127* The <code>AudioPermission</code> class represents access rights to the audio128* system resources. An <code>AudioPermission</code> contains a target name129* but no actions list; you either have the named permission or you don't.130* <p>131* The target name is the name of the audio permission (see the table below).132* The names follow the hierarchical property-naming convention. Also, an asterisk133* can be used to represent all the audio permissions.134* <p>135* The following table lists all the possible AudioPermission target names.136* For each name, the table provides a description of exactly what that permission137* allows, as well as a discussion of the risks of granting code the permission.138* <p>139*140* <table border=1 cellpadding=5>141* <tr>142* <th>Permission Target Name</th>143* <th>What the Permission Allows</th>144* <th>Risks of Allowing this Permission</th>145* </tr>146*147* <tr>148* <td>play</td>149* <td>Audio playback through the audio device or devices on the system.</td>150* <td>Allows the application to use a system device. Can affect other applications,151* because the result will be mixed with other audio being played on the system.</td>152*</tr>153*154* <tr>155* <td>record</td>156* <td>Recording audio from the audio device or devices on the system,157* commonly through a microphone.</td>158* <td>Can enable an applet or application to eavesdrop on a user.</td>159* </tr>160*161* <tr>162* <td>playback device access</td>163* <td>Direct access to the audio playback device(s), including configuration of the164* playback format, volume, and balance, explicit opening and closing of the device,165* etc.</td>166* <td>Changes the properties of a shared system device and therefore167* can affect other applications.</td>168* </tr>169*170* <tr>171* <td>playback device override</td>172* <td>Manipulation of the audio playback device(s) in a way that directly conflicts173* with use by other applications. This includes closing the device while it is in174* use by another application, changing the device format while another application175* is using it, etc. </td>176* <td>Changes the properties of a shared system device and therefore177* can affect other applications.</td>178* </tr>179*180* <tr>181* <td>record device access</td>182* <td>Direct access to the audio recording device(s), including configuration of the183* the record format, volume, and balance, explicit opening and closing of the device,184* etc.</td>185* <td>Changes the properties of a shared system device and therefore186* can affect other applications.</td>187* </tr>188*189* <tr>190* <td>record device override</td>191* <td>Manipulation of the audio recording device(s) in a way that directly conflicts192* with use by other applications. This includes closing the device while it is in193* use by another application, changing the device format while another application194* is using it, etc. </td>195* <td>Changes the properties of a shared system device and therefore196* can affect other applications.</td>197* </tr>198*199* </table>200*<p>201*202* @author Kara Kytle203*/204205public class AudioPermission extends BasicPermission {206207/**208* Creates a new <code>AudioPermission</code> object that has the specified209* symbolic name, such as "play" or "record". An asterisk can be used to indicate210* all audio permissions.211* @param name the name of the new <code>AudioPermission</code>212*213* @throws NullPointerException if <code>name</code> is <code>null</code>.214* @throws IllegalArgumentException if <code>name</code> is empty.215*/216public AudioPermission(String name) {217218super(name);219}220221/**222* Creates a new <code>AudioPermission</code> object that has the specified223* symbolic name, such as "play" or "record". The <code>actions</code>224* parameter is currently unused and should be <code>null</code>.225* @param name the name of the new <code>AudioPermission</code>226* @param actions (unused; should be <code>null</code>)227*228* @throws NullPointerException if <code>name</code> is <code>null</code>.229* @throws IllegalArgumentException if <code>name</code> is empty.230*/231public AudioPermission(String name, String actions) {232233super(name, actions);234}235}236237238