1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.lang; 19 20 import java.io.FileDescriptor; 21 import java.net.InetAddress; 22 import java.security.Permission; 23 24 /** 25 * Legacy security code; do not use. 26 * 27 * <p>Security managers do <strong>not</strong> provide a 28 * secure environment for executing untrusted code. Untrusted code cannot be 29 * safely isolated within the Dalvik VM. 30 */ 31 public class SecurityManager { 32 /** 33 * @deprecated Use {@link #checkPermission} 34 */ 35 @Deprecated 36 protected boolean inCheck; 37 SecurityManager()38 public SecurityManager() { } 39 checkAccept(String host, int port)40 public void checkAccept(String host, int port) { } 41 checkAccess(Thread thread)42 public void checkAccess(Thread thread) { } 43 checkAccess(ThreadGroup group)44 public void checkAccess(ThreadGroup group) { } 45 checkConnect(String host, int port)46 public void checkConnect(String host, int port) { } 47 checkConnect(String host, int port, Object context)48 public void checkConnect(String host, int port, Object context) { } 49 checkCreateClassLoader()50 public void checkCreateClassLoader() { } 51 checkDelete(String file)52 public void checkDelete(String file) { } 53 checkExec(String cmd)54 public void checkExec(String cmd) { } 55 checkExit(int status)56 public void checkExit(int status) { } 57 checkLink(String libName)58 public void checkLink(String libName) { } 59 checkListen(int port)60 public void checkListen(int port) { } 61 checkMemberAccess(Class<?> cls, int type)62 public void checkMemberAccess(Class<?> cls, int type) { } 63 checkMulticast(InetAddress maddr)64 public void checkMulticast(InetAddress maddr) { } 65 66 /** 67 * @deprecated use {@link #checkMulticast(java.net.InetAddress)} 68 */ checkMulticast(InetAddress maddr, byte ttl)69 @Deprecated public void checkMulticast(InetAddress maddr, byte ttl) { } 70 checkPackageAccess(String packageName)71 public void checkPackageAccess(String packageName) { } 72 checkPackageDefinition(String packageName)73 public void checkPackageDefinition(String packageName) { } 74 checkPropertiesAccess()75 public void checkPropertiesAccess() { } 76 checkPropertyAccess(String key)77 public void checkPropertyAccess(String key) { } 78 checkRead(FileDescriptor fd)79 public void checkRead(FileDescriptor fd) { } 80 checkRead(String file)81 public void checkRead(String file) { } 82 checkRead(String file, Object context)83 public void checkRead(String file, Object context) { } 84 checkSecurityAccess(String target)85 public void checkSecurityAccess(String target) { } 86 checkSetFactory()87 public void checkSetFactory() { } 88 checkTopLevelWindow(Object window)89 public boolean checkTopLevelWindow(Object window) { return true; } 90 checkSystemClipboardAccess()91 public void checkSystemClipboardAccess() { } 92 checkAwtEventQueueAccess()93 public void checkAwtEventQueueAccess() { } 94 checkPrintJobAccess()95 public void checkPrintJobAccess() { } 96 checkWrite(FileDescriptor fd)97 public void checkWrite(FileDescriptor fd) { } 98 checkWrite(String file)99 public void checkWrite(String file) { } 100 101 /** 102 * @deprecated Use {@link #checkPermission}. 103 */ getInCheck()104 @Deprecated public boolean getInCheck() { return inCheck; } 105 getClassContext()106 protected Class[] getClassContext() { return null; } 107 108 /** 109 * @deprecated Use {@link #checkPermission}. 110 */ currentClassLoader()111 @Deprecated protected ClassLoader currentClassLoader() { return null; } 112 113 /** 114 * @deprecated Use {@link #checkPermission}. 115 */ classLoaderDepth()116 @Deprecated protected int classLoaderDepth() { 117 return -1; 118 } 119 120 /** 121 * @deprecated Use {@link #checkPermission}. 122 */ currentLoadedClass()123 @Deprecated protected Class<?> currentLoadedClass() { return null; } 124 125 /** 126 * @deprecated Use {@link #checkPermission}. 127 */ classDepth(String name)128 @Deprecated protected int classDepth(String name) { return -1; } 129 130 /** 131 * @deprecated Use {@link #checkPermission}. 132 */ inClass(String name)133 @Deprecated protected boolean inClass(String name) { return false; } 134 135 /** 136 * @deprecated Use {@link #checkPermission} 137 */ inClassLoader()138 @Deprecated protected boolean inClassLoader() { return false; } 139 140 /** 141 * Returns the current thread's thread group. 142 */ getThreadGroup()143 public ThreadGroup getThreadGroup() { 144 return Thread.currentThread().getThreadGroup(); 145 } 146 getSecurityContext()147 public Object getSecurityContext() { return null; } 148 checkPermission(Permission permission)149 public void checkPermission(Permission permission) { } 150 checkPermission(Permission permission, Object context)151 public void checkPermission(Permission permission, Object context) { } 152 } 153