SecurityManager

public class SecurityManager
extends Object

java.lang.Object
   ↳ java.lang.SecurityManager


Legacy security code; do not use.

Security managers do not provide a secure environment for executing untrusted code and are unsupported on Android. Untrusted code cannot be safely isolated within a single VM on Android. Application developers can assume that there's no SecurityManager installed, i.e. System.getSecurityManager() will return null.

Summary

Fields

protected boolean inCheck

This field was deprecated in API level 15. Use checkPermission(Permission) instead.

Public constructors

SecurityManager()

Public methods

void checkAccept(String host, int port)
void checkAccess(Thread t)
void checkAccess(ThreadGroup g)
void checkAwtEventQueueAccess()
void checkConnect(String host, int port)
void checkConnect(String host, int port, Object context)
void checkCreateClassLoader()
void checkDelete(String file)
void checkExec(String cmd)
void checkExit(int status)
void checkLink(String lib)
void checkListen(int port)
void checkMemberAccess(Class<?> clazz, int which)

This method was deprecated in API level 33. this method is deprecated.

void checkMulticast(InetAddress maddr)
void checkMulticast(InetAddress maddr, byte ttl)

This method was deprecated in API level 15. use checkMulticast(java.net.InetAddress) instead.

void checkPackageAccess(String pkg)
void checkPackageDefinition(String pkg)
void checkPermission(Permission perm, Object context)
void checkPermission(Permission perm)
void checkPrintJobAccess()
void checkPropertiesAccess()
void checkPropertyAccess(String key)
void checkRead(FileDescriptor fd)
void checkRead(String file)
void checkRead(String file, Object context)
void checkSecurityAccess(String target)
void checkSetFactory()
void checkSystemClipboardAccess()
boolean checkTopLevelWindow(Object window)

This method was deprecated in API level 33. this method is deprecated.

void checkWrite(FileDescriptor fd)
void checkWrite(String file)
boolean getInCheck()

This method was deprecated in API level 15. Use checkPermission(Permission) instead.

Object getSecurityContext()
ThreadGroup getThreadGroup()

Returns the current thread's thread group.

Protected methods

int classDepth(String name)

This method was deprecated in API level 15. Use checkPermission(Permission) instead.

int classLoaderDepth()

This method was deprecated in API level 15. Use checkPermission(Permission) instead.

ClassLoader currentClassLoader()

This method was deprecated in API level 15. Use checkPermission(Permission) instead.

Class<?> currentLoadedClass()

This method was deprecated in API level 15. Use checkPermission(Permission) instead.

Class[] getClassContext()
boolean inClass(String name)

This method was deprecated in API level 15. Use checkPermission(Permission) instead.

boolean inClassLoader()

This method was deprecated in API level 15. Use checkPermission(Permission) instead.

Inherited methods

Fields

inCheck

Added in API level 1
Deprecated in API level 15
protected boolean inCheck

This field was deprecated in API level 15.
Use checkPermission(Permission) instead.

Public constructors

SecurityManager

Added in API level 1
public SecurityManager ()

Public methods

checkAccept

Added in API level 1
public void checkAccept (String host, 
                int port)

Parameters
host String

port int

checkAccess

Added in API level 1
public void checkAccess (Thread t)

Parameters
t Thread

checkAccess

Added in API level 1
public void checkAccess (ThreadGroup g)

Parameters
g ThreadGroup

checkAwtEventQueueAccess

Added in API level 1
public void checkAwtEventQueueAccess ()

checkConnect

Added in API level 1
public void checkConnect (String host, 
                int port)

Parameters
host String

port int

checkConnect

Added in API level 1
public void checkConnect (String host, 
                int port, 
                Object context)

Parameters
host String

port int

context Object

checkCreateClassLoader

Added in API level 1
public void checkCreateClassLoader ()

checkDelete

Added in API level 1
public void checkDelete (String file)

Parameters
file String

checkExec

Added in API level 1
public void checkExec (String cmd)

Parameters
cmd String

checkExit

Added in API level 1
public void checkExit (int status)

Parameters
status int

checkLink

Added in API level 1
public void checkLink (String lib)

Parameters
lib String

checkListen

Added in API level 1
public void checkListen (int port)

Parameters
port int

checkMemberAccess

Added in API level 1
Deprecated in API level 33
public void checkMemberAccess (Class<?> clazz, 
                int which)

This method was deprecated in API level 33.
this method is deprecated.

Parameters
clazz Class

which int

checkMulticast

Added in API level 1
public void checkMulticast (InetAddress maddr)

Parameters
maddr InetAddress

checkMulticast

Added in API level 1
Deprecated in API level 15
public void checkMulticast (InetAddress maddr, 
                byte ttl)

This method was deprecated in API level 15.
use checkMulticast(java.net.InetAddress) instead.

Parameters
maddr InetAddress

ttl byte

checkPackageAccess

Added in API level 1
public void checkPackageAccess (String pkg)

Parameters
pkg String

checkPackageDefinition

Added in API level 1
public void checkPackageDefinition (String pkg)

Parameters
pkg String

checkPermission

Added in API level 1
public void checkPermission (Permission perm, 
                Object context)

Parameters
perm Permission

context Object

checkPermission

Added in API level 1
public void checkPermission (Permission perm)

Parameters
perm Permission

checkPrintJobAccess

Added in API level 1
public void checkPrintJobAccess ()

checkPropertiesAccess

Added in API level 1
public void checkPropertiesAccess ()

checkPropertyAccess

Added in API level 1
public void checkPropertyAccess (String key)

Parameters
key String

checkRead

Added in API level 1
public void checkRead (FileDescriptor fd)

Parameters
fd FileDescriptor

checkRead

Added in API level 1
public void checkRead (String file)

Parameters
file String

checkRead

Added in API level 1
public void checkRead (String file, 
                Object context)

Parameters
file String

context Object

checkSecurityAccess

Added in API level 1
public void checkSecurityAccess (String target)

Parameters
target String

checkSetFactory

Added in API level 1
public void checkSetFactory ()

checkSystemClipboardAccess

Added in API level 1
public void checkSystemClipboardAccess ()

checkTopLevelWindow

Added in API level 1
Deprecated in API level 33
public boolean checkTopLevelWindow (Object window)

This method was deprecated in API level 33.
this method is deprecated.

Parameters
window Object

Returns
boolean

checkWrite

Added in API level 1
public void checkWrite (FileDescriptor fd)

Parameters
fd FileDescriptor

checkWrite

Added in API level 1
public void checkWrite (String file)

Parameters
file String

getInCheck

Added in API level 1
Deprecated in API level 15
public boolean getInCheck ()

This method was deprecated in API level 15.
Use checkPermission(Permission) instead.

Returns
boolean

getSecurityContext

Added in API level 1
public Object getSecurityContext ()

Returns
Object

getThreadGroup

Added in API level 1
public ThreadGroup getThreadGroup ()

Returns the current thread's thread group.

Returns
ThreadGroup

Protected methods

classDepth

Added in API level 1
Deprecated in API level 15
protected int classDepth (String name)

This method was deprecated in API level 15.
Use checkPermission(Permission) instead.

Parameters
name String

Returns
int

classLoaderDepth

Added in API level 1
Deprecated in API level 15
protected int classLoaderDepth ()

This method was deprecated in API level 15.
Use checkPermission(Permission) instead.

Returns
int

currentClassLoader

Added in API level 1
Deprecated in API level 15
protected ClassLoader currentClassLoader ()

This method was deprecated in API level 15.
Use checkPermission(Permission) instead.

Returns
ClassLoader

currentLoadedClass

Added in API level 1
Deprecated in API level 15
protected Class<?> currentLoadedClass ()

This method was deprecated in API level 15.
Use checkPermission(Permission) instead.

Returns
Class<?>

getClassContext

Added in API level 1
protected Class[] getClassContext ()

Returns
Class[]

inClass

Added in API level 1
Deprecated in API level 15
protected boolean inClass (String name)

This method was deprecated in API level 15.
Use checkPermission(Permission) instead.

Parameters
name String

Returns
boolean

inClassLoader

Added in API level 1
Deprecated in API level 15
protected boolean inClassLoader ()

This method was deprecated in API level 15.
Use checkPermission(Permission) instead.

Returns
boolean