Code example for Binder

Methods: addService

0
    @SmallTest 
	public void testAddService() { 
        try { 
            // The security in the service manager is that you can't replace 
            // a service that is already published. 
            Binder binder = new Binder();
            ServiceManager.addService("activity", binder);
            fail("ServiceManager.addService did not throw SecurityException as"
                    + " expected"); 
        } catch (SecurityException e) {
            // expected 
        } 
	} 
 
    @SmallTest 
    public void testSetPermissionController() { 
        try { 
            IPermissionController pc = new IPermissionController.Stub() {
                public boolean checkPermission(java.lang.String permission, int pid, int uid) {
                    return true; 
Contextual code suggestions in your IDE  Get Codota for Java