1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  * Copyright (c) 1997, 2011, 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 
28 package java.security;
29 
30 import java.util.Enumeration;
31 
32 // Android-changed: Stubbed the implementation.  Android doesn't support SecurityManager.
33 // See comments in java.lang.SecurityManager for details.
34 /**
35  * Legacy security code; do not use.
36  */
37 public abstract class Policy {
38 
39     public static final PermissionCollection UNSUPPORTED_EMPTY_COLLECTION =
40                         new UnsupportedEmptyCollection();
41 
getPolicy()42     public static Policy getPolicy()
43     {
44       return null;
45     }
46 
setPolicy(Policy p)47     public static void setPolicy(Policy p)
48     {
49     }
50 
getInstance(String type, Policy.Parameters params)51     public static Policy getInstance(String type, Policy.Parameters params)
52                 throws NoSuchAlgorithmException {
53       return null;
54     }
55 
getInstance(String type, Policy.Parameters params, String provider)56     public static Policy getInstance(String type,
57                                 Policy.Parameters params,
58                                 String provider)
59                 throws NoSuchProviderException, NoSuchAlgorithmException {
60       return null;
61     }
62 
63 
getInstance(String type, Policy.Parameters params, Provider provider)64     public static Policy getInstance(String type,
65                                 Policy.Parameters params,
66                                 Provider provider)
67                 throws NoSuchAlgorithmException {
68       return null;
69     }
70 
getProvider()71     public Provider getProvider() {
72         return null;
73     }
74 
getType()75     public String getType() {
76         return null;
77     }
78 
getParameters()79     public Policy.Parameters getParameters() {
80         return null;
81     }
82 
getPermissions(CodeSource codesource)83     public PermissionCollection getPermissions(CodeSource codesource) {
84         return null;
85     }
86 
getPermissions(ProtectionDomain domain)87     public PermissionCollection getPermissions(ProtectionDomain domain) {
88         return null;
89     }
90 
implies(ProtectionDomain domain, Permission permission)91     public boolean implies(ProtectionDomain domain, Permission permission) {
92         return true;
93     }
94 
refresh()95     public void refresh() { }
96 
97     public static interface Parameters { }
98 
99     private static class UnsupportedEmptyCollection
100         extends PermissionCollection {
101 
UnsupportedEmptyCollection()102         public UnsupportedEmptyCollection() {
103         }
104 
add(Permission permission)105         @Override public void add(Permission permission) {
106         }
107 
implies(Permission permission)108         @Override public boolean implies(Permission permission) {
109             return true;
110         }
111 
elements()112         @Override public Enumeration<Permission> elements() {
113             return null;
114         }
115     }
116 
117 }
118