Code example for Signature

Methods: toByteArray

0
 
    private ContentValues createConsumer(String packageName, long regId, Signature sig,
            boolean isPublic) {
        ContentValues value = new ContentValues();
        value.put(Consumers.PACKAGE_NAME, packageName);
        value.put(Consumers.SIGNATURE, sig.toByteArray());
        value.put(Consumers.IS_SERVICE_PUBLIC, isPublic);
        value.put(Consumers.IS_BANNED, false);
        value.put(Consumers.OWNS_CONSUMER_KEY, true);
        value.put(Consumers.REGISTRY_ID, regId);
        return value;
    } 
 
    private void standardInsert() { 
        long[] ids = new long[6];
        ids[0] = mDB.insert("registry", "", createReg("test1"));
        ids[1] = mDB.insert("registry", "", createReg("test2"));
        ids[2] = mDB.insert("registry", "", createRegAuth("test3"));
        ids[3] = mDB.insert("registry", "", createRegAuth("test4"));
        ids[4] = mDB.insert("registry", "", createRegAuth("test5"));
        ids[5] = mDB.insert("registry", "", createRegAuth("test6"));
 
        mDB.insert("consumers", "", createConsumer(PACKAGE_UNDER_TEST, 1, new Signature(
                SIGNATURE_FOR_PACKAGE), true));
        mDB.insert("consumers", "", createConsumer(PACKAGE_UNDER_TEST, 2, new Signature(
                SIGNATURE_FOR_PACKAGE), true));
 
        mDB.insert("consumers", "", createConsumer(PACKAGE_UNDER_TEST_2, 3, new Signature(
                SIGNATURE_FOR_PACKAGE_2), true));
        mDB.insert("consumers", "", createConsumer(PACKAGE_UNDER_TEST_2, 4, new Signature(
                SIGNATURE_FOR_PACKAGE_2), false));