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 18package java.lang; 19 20import java.io.FileDescriptor; 21import java.net.InetAddress; 22import 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 */ 31public class SecurityManager { 32 /** 33 * @deprecated Use {@link #checkPermission} instead. 34 */ 35 @Deprecated 36 protected boolean inCheck; 37 38 public SecurityManager() { } 39 40 public void checkAccept(String host, int port) { } 41 42 public void checkAccess(Thread thread) { } 43 44 public void checkAccess(ThreadGroup group) { } 45 46 public void checkConnect(String host, int port) { } 47 48 public void checkConnect(String host, int port, Object context) { } 49 50 public void checkCreateClassLoader() { } 51 52 public void checkDelete(String file) { } 53 54 public void checkExec(String cmd) { } 55 56 public void checkExit(int status) { } 57 58 public void checkLink(String libName) { } 59 60 public void checkListen(int port) { } 61 62 public void checkMemberAccess(Class<?> cls, int type) { } 63 64 public void checkMulticast(InetAddress maddr) { } 65 66 /** 67 * @deprecated use {@link #checkMulticast(java.net.InetAddress)} instead. 68 */ 69 @Deprecated public void checkMulticast(InetAddress maddr, byte ttl) { } 70 71 public void checkPackageAccess(String packageName) { } 72 73 public void checkPackageDefinition(String packageName) { } 74 75 public void checkPropertiesAccess() { } 76 77 public void checkPropertyAccess(String key) { } 78 79 public void checkRead(FileDescriptor fd) { } 80 81 public void checkRead(String file) { } 82 83 public void checkRead(String file, Object context) { } 84 85 public void checkSecurityAccess(String target) { } 86 87 public void checkSetFactory() { } 88 89 public boolean checkTopLevelWindow(Object window) { return true; } 90 91 public void checkSystemClipboardAccess() { } 92 93 public void checkAwtEventQueueAccess() { } 94 95 public void checkPrintJobAccess() { } 96 97 public void checkWrite(FileDescriptor fd) { } 98 99 public void checkWrite(String file) { } 100 101 /** 102 * @deprecated Use {@link #checkPermission} instead. 103 */ 104 @Deprecated public boolean getInCheck() { return inCheck; } 105 106 protected Class[] getClassContext() { return null; } 107 108 /** 109 * @deprecated Use {@link #checkPermission} instead. 110 */ 111 @Deprecated protected ClassLoader currentClassLoader() { return null; } 112 113 /** 114 * @deprecated Use {@link #checkPermission} instead. 115 */ 116 @Deprecated protected int classLoaderDepth() { 117 return -1; 118 } 119 120 /** 121 * @deprecated Use {@link #checkPermission} instead. 122 */ 123 @Deprecated protected Class<?> currentLoadedClass() { return null; } 124 125 /** 126 * @deprecated Use {@link #checkPermission} instead. 127 */ 128 @Deprecated protected int classDepth(String name) { return -1; } 129 130 /** 131 * @deprecated Use {@link #checkPermission} instead. 132 */ 133 @Deprecated protected boolean inClass(String name) { return false; } 134 135 /** 136 * @deprecated Use {@link #checkPermission} instead. 137 */ 138 @Deprecated protected boolean inClassLoader() { return false; } 139 140 /** 141 * Returns the current thread's thread group. 142 */ 143 public ThreadGroup getThreadGroup() { 144 return Thread.currentThread().getThreadGroup(); 145 } 146 147 public Object getSecurityContext() { return null; } 148 149 public void checkPermission(Permission permission) { } 150 151 public void checkPermission(Permission permission, Object context) { } 152} 153