1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. Oracle designates this 9 * particular file as subject to the "Classpath" exception as provided 10 * by Oracle in the LICENSE file that accompanied this code. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 * or visit www.oracle.com if you need additional information or have any 24 * questions. 25 */ 26 27 package java.lang; 28 29 import java.security.*; 30 import java.io.FileDescriptor; 31 import java.net.InetAddress; 32 33 /** 34 * Legacy security code; do not use. 35 */ 36 public 37 class SecurityManager { 38 39 /** 40 * @deprecated Use {@link #checkPermission} instead. 41 */ 42 @Deprecated 43 protected boolean inCheck; 44 45 /** 46 * @deprecated Use {@link #checkPermission} instead. 47 */ 48 @Deprecated getInCheck()49 public boolean getInCheck() { 50 return inCheck; 51 } 52 SecurityManager()53 public SecurityManager() { 54 55 } 56 getClassContext()57 protected Class[] getClassContext() { 58 return null; 59 } 60 61 /** 62 * @deprecated Use {@link #checkPermission} instead. 63 */ 64 @Deprecated currentClassLoader()65 protected ClassLoader currentClassLoader() 66 { 67 return null; 68 } 69 70 /** 71 * @deprecated Use {@link #checkPermission} instead. 72 */ 73 @Deprecated currentLoadedClass()74 protected Class<?> currentLoadedClass() { 75 return null; 76 } 77 78 /** 79 * @deprecated Use {@link #checkPermission} instead. 80 */ 81 @Deprecated classDepth(String name)82 protected int classDepth(String name) { 83 return -1; 84 } 85 86 /** 87 * @deprecated Use {@link #checkPermission} instead. 88 */ 89 @Deprecated classLoaderDepth()90 protected int classLoaderDepth() 91 { 92 return -1; 93 } 94 95 /** 96 * @deprecated Use {@link #checkPermission} instead. 97 */ 98 @Deprecated inClass(String name)99 protected boolean inClass(String name) { 100 return false; 101 } 102 103 /** 104 * @deprecated Use {@link #checkPermission} instead. 105 */ 106 @Deprecated inClassLoader()107 protected boolean inClassLoader() { 108 return false; 109 } 110 getSecurityContext()111 public Object getSecurityContext() { 112 return null; 113 } 114 checkPermission(Permission perm)115 public void checkPermission(Permission perm) { 116 117 } 118 checkPermission(Permission perm, Object context)119 public void checkPermission(Permission perm, Object context) { 120 121 } 122 checkCreateClassLoader()123 public void checkCreateClassLoader() { 124 125 } 126 checkAccess(Thread t)127 public void checkAccess(Thread t) { } 128 checkAccess(ThreadGroup g)129 public void checkAccess(ThreadGroup g) { } 130 checkExit(int status)131 public void checkExit(int status) { } 132 checkExec(String cmd)133 public void checkExec(String cmd) { } 134 checkLink(String lib)135 public void checkLink(String lib) { } 136 checkRead(FileDescriptor fd)137 public void checkRead(FileDescriptor fd) { } 138 checkRead(String file)139 public void checkRead(String file) { } 140 checkRead(String file, Object context)141 public void checkRead(String file, Object context) { } 142 checkWrite(FileDescriptor fd)143 public void checkWrite(FileDescriptor fd) { } 144 checkWrite(String file)145 public void checkWrite(String file) { } 146 checkDelete(String file)147 public void checkDelete(String file) { } 148 checkConnect(String host, int port)149 public void checkConnect(String host, int port) { } 150 checkConnect(String host, int port, Object context)151 public void checkConnect(String host, int port, Object context) { } 152 checkListen(int port)153 public void checkListen(int port) { } 154 checkAccept(String host, int port)155 public void checkAccept(String host, int port) { } 156 checkMulticast(InetAddress maddr)157 public void checkMulticast(InetAddress maddr) { } 158 159 /** 160 * @deprecated use {@link #checkMulticast(java.net.InetAddress)} instead. 161 */ 162 @Deprecated checkMulticast(InetAddress maddr, byte ttl)163 public void checkMulticast(InetAddress maddr, byte ttl) { } 164 checkPropertiesAccess()165 public void checkPropertiesAccess() { } 166 checkPropertyAccess(String key)167 public void checkPropertyAccess(String key) { } 168 checkTopLevelWindow(Object window)169 public boolean checkTopLevelWindow(Object window) { 170 return true; 171 } 172 checkPrintJobAccess()173 public void checkPrintJobAccess() { } 174 checkSystemClipboardAccess()175 public void checkSystemClipboardAccess() { } 176 checkAwtEventQueueAccess()177 public void checkAwtEventQueueAccess() { } 178 checkPackageAccess(String pkg)179 public void checkPackageAccess(String pkg) { } 180 checkPackageDefinition(String pkg)181 public void checkPackageDefinition(String pkg) { } 182 checkSetFactory()183 public void checkSetFactory() { } 184 checkMemberAccess(Class<?> clazz, int which)185 public void checkMemberAccess(Class<?> clazz, int which) { } 186 checkSecurityAccess(String target)187 public void checkSecurityAccess(String target) { } 188 189 /** 190 * Returns the current thread's thread group. 191 */ getThreadGroup()192 public ThreadGroup getThreadGroup() { 193 return Thread.currentThread().getThreadGroup(); 194 } 195 196 } 197