1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * Copyright (c) 1997, 2015, 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.security; 28 29 import java.util.ArrayList; 30 import java.util.List; 31 32 import sun.security.util.Debug; 33 import sun.security.util.SecurityConstants; 34 35 36 // Android-changed: Stubbed the implementation. Android doesn't support SecurityManager. 37 // See comments in java.lang.SecurityManager for details. 38 /** 39 * Android doesn't support {@link SecurityManager}. Do not use this class. 40 */ 41 public final class AccessControlContext { 42 AccessControlContext(ProtectionDomain[] context)43 public AccessControlContext(ProtectionDomain[] context) { 44 } 45 AccessControlContext(AccessControlContext acc, DomainCombiner combiner)46 public AccessControlContext(AccessControlContext acc, 47 DomainCombiner combiner) { 48 } 49 50 /** 51 * package private to allow calls from ProtectionDomain without performing 52 * the security check for {@linkplain SecurityConstants#CREATE_ACC_PERMISSION} 53 * permission 54 */ AccessControlContext(AccessControlContext acc, DomainCombiner combiner, boolean preauthorized)55 AccessControlContext(AccessControlContext acc, 56 DomainCombiner combiner, 57 boolean preauthorized) { 58 } 59 60 /** 61 * package private for AccessController 62 * 63 * This "argument wrapper" context will be passed as the actual context 64 * parameter on an internal doPrivileged() call used in the implementation. 65 */ AccessControlContext(ProtectionDomain caller, DomainCombiner combiner, AccessControlContext parent, AccessControlContext context, Permission[] perms)66 AccessControlContext(ProtectionDomain caller, DomainCombiner combiner, 67 AccessControlContext parent, AccessControlContext context, 68 Permission[] perms) 69 { 70 } 71 72 73 /** 74 * package private constructor for AccessController.getContext() 75 */ 76 AccessControlContext(ProtectionDomain[] context, boolean isPrivileged)77 AccessControlContext(ProtectionDomain[] context, 78 boolean isPrivileged) 79 { 80 } 81 82 /** 83 * Constructor for JavaSecurityAccess.doIntersectionPrivilege() 84 */ AccessControlContext(ProtectionDomain[] context, AccessControlContext privilegedContext)85 AccessControlContext(ProtectionDomain[] context, 86 AccessControlContext privilegedContext) 87 { 88 } 89 getContext()90 ProtectionDomain[] getContext() { 91 return null; 92 } 93 isPrivileged()94 boolean isPrivileged() 95 { 96 return false; 97 } 98 99 /** 100 * get the assigned combiner from the privileged or inherited context 101 */ getAssignedCombiner()102 DomainCombiner getAssignedCombiner() { 103 return null; 104 } 105 getDomainCombiner()106 public DomainCombiner getDomainCombiner() { 107 return null; 108 } 109 checkPermission(Permission perm)110 public void checkPermission(Permission perm) 111 throws AccessControlException { 112 } 113 114 /** 115 * Take the stack-based context (this) and combine it with the 116 * privileged or inherited context, if need be. Any limited 117 * privilege scope is flagged regardless of whether the assigned 118 * context comes from an immediately enclosing limited doPrivileged(). 119 * The limited privilege scope can indirectly flow from the inherited 120 * parent thread or an assigned context previously captured by getContext(). 121 */ optimize()122 AccessControlContext optimize() { 123 return null; 124 } 125 126 } 127