Search in sources :

Example 1 with IPermissionController

use of android.os.IPermissionController in project android_frameworks_base by ParanoidAndroid.

the class ServiceManagerPermissionTests method testSetPermissionController.

@SmallTest
public void testSetPermissionController() {
    try {
        IPermissionController pc = new IPermissionController.Stub() {

            public boolean checkPermission(java.lang.String permission, int pid, int uid) {
                return true;
            }
        };
        ServiceManagerNative.asInterface(BinderInternal.getContextObject()).setPermissionController(pc);
        fail("IServiceManager.setPermissionController did not throw SecurityException as" + " expected");
    } catch (SecurityException e) {
    // expected
    } catch (RemoteException e) {
        fail("Unexpected remote exception");
    }
}
Also used : IPermissionController(android.os.IPermissionController) RemoteException(android.os.RemoteException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with IPermissionController

use of android.os.IPermissionController in project android_frameworks_base by ResurrectionRemix.

the class ServiceManagerPermissionTests method testSetPermissionController.

@SmallTest
public void testSetPermissionController() {
    try {
        IPermissionController pc = new IPermissionController.Stub() {

            public boolean checkPermission(java.lang.String permission, int pid, int uid) {
                return true;
            }

            @Override
            public String[] getPackagesForUid(int uid) {
                return new String[0];
            }

            @Override
            public boolean isRuntimePermission(String permission) {
                return false;
            }
        };
        ServiceManagerNative.asInterface(BinderInternal.getContextObject()).setPermissionController(pc);
        fail("IServiceManager.setPermissionController did not throw SecurityException as" + " expected");
    } catch (SecurityException e) {
    // expected
    } catch (RemoteException e) {
        fail("Unexpected remote exception");
    }
}
Also used : IPermissionController(android.os.IPermissionController) RemoteException(android.os.RemoteException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with IPermissionController

use of android.os.IPermissionController in project android_frameworks_base by DirtyUnicorns.

the class ServiceManagerPermissionTests method testSetPermissionController.

@SmallTest
public void testSetPermissionController() {
    try {
        IPermissionController pc = new IPermissionController.Stub() {

            public boolean checkPermission(java.lang.String permission, int pid, int uid) {
                return true;
            }

            @Override
            public String[] getPackagesForUid(int uid) {
                return new String[0];
            }

            @Override
            public boolean isRuntimePermission(String permission) {
                return false;
            }
        };
        ServiceManagerNative.asInterface(BinderInternal.getContextObject()).setPermissionController(pc);
        fail("IServiceManager.setPermissionController did not throw SecurityException as" + " expected");
    } catch (SecurityException e) {
    // expected
    } catch (RemoteException e) {
        fail("Unexpected remote exception");
    }
}
Also used : IPermissionController(android.os.IPermissionController) RemoteException(android.os.RemoteException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with IPermissionController

use of android.os.IPermissionController in project android_frameworks_base by crdroidandroid.

the class ServiceManagerPermissionTests method testSetPermissionController.

@SmallTest
public void testSetPermissionController() {
    try {
        IPermissionController pc = new IPermissionController.Stub() {

            public boolean checkPermission(java.lang.String permission, int pid, int uid) {
                return true;
            }

            @Override
            public String[] getPackagesForUid(int uid) {
                return new String[0];
            }

            @Override
            public boolean isRuntimePermission(String permission) {
                return false;
            }
        };
        ServiceManagerNative.asInterface(BinderInternal.getContextObject()).setPermissionController(pc);
        fail("IServiceManager.setPermissionController did not throw SecurityException as" + " expected");
    } catch (SecurityException e) {
    // expected
    } catch (RemoteException e) {
        fail("Unexpected remote exception");
    }
}
Also used : IPermissionController(android.os.IPermissionController) RemoteException(android.os.RemoteException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 5 with IPermissionController

use of android.os.IPermissionController in project platform_frameworks_base by android.

the class ServiceManagerPermissionTests method testSetPermissionController.

@SmallTest
public void testSetPermissionController() {
    try {
        IPermissionController pc = new IPermissionController.Stub() {

            public boolean checkPermission(java.lang.String permission, int pid, int uid) {
                return true;
            }

            @Override
            public String[] getPackagesForUid(int uid) {
                return new String[0];
            }

            @Override
            public boolean isRuntimePermission(String permission) {
                return false;
            }
        };
        ServiceManagerNative.asInterface(BinderInternal.getContextObject()).setPermissionController(pc);
        fail("IServiceManager.setPermissionController did not throw SecurityException as" + " expected");
    } catch (SecurityException e) {
    // expected
    } catch (RemoteException e) {
        fail("Unexpected remote exception");
    }
}
Also used : IPermissionController(android.os.IPermissionController) RemoteException(android.os.RemoteException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

IPermissionController (android.os.IPermissionController)5 RemoteException (android.os.RemoteException)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)5