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
28package java.security;
29
30import 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 */
37public abstract class Policy {
38
39    public static final PermissionCollection UNSUPPORTED_EMPTY_COLLECTION =
40                        new UnsupportedEmptyCollection();
41
42    public static Policy getPolicy()
43    {
44      return null;
45    }
46
47    public static void setPolicy(Policy p)
48    {
49    }
50
51    public static Policy getInstance(String type, Policy.Parameters params)
52                throws NoSuchAlgorithmException {
53      return null;
54    }
55
56    public static Policy getInstance(String type,
57                                Policy.Parameters params,
58                                String provider)
59                throws NoSuchProviderException, NoSuchAlgorithmException {
60      return null;
61    }
62
63
64    public static Policy getInstance(String type,
65                                Policy.Parameters params,
66                                Provider provider)
67                throws NoSuchAlgorithmException {
68      return null;
69    }
70
71    public Provider getProvider() {
72        return null;
73    }
74
75    public String getType() {
76        return null;
77    }
78
79    public Policy.Parameters getParameters() {
80        return null;
81    }
82
83    public PermissionCollection getPermissions(CodeSource codesource) {
84        return null;
85    }
86
87    public PermissionCollection getPermissions(ProtectionDomain domain) {
88        return null;
89    }
90
91    public boolean implies(ProtectionDomain domain, Permission permission) {
92        return true;
93    }
94
95    public void refresh() { }
96
97    public static interface Parameters { }
98
99    private static class UnsupportedEmptyCollection
100        extends PermissionCollection {
101
102        public UnsupportedEmptyCollection() {
103        }
104
105        @Override public void add(Permission permission) {
106        }
107
108        @Override public boolean implies(Permission permission) {
109            return true;
110        }
111
112        @Override public Enumeration<Permission> elements() {
113            return null;
114        }
115    }
116
117}
118