Code example for Context

Methods: getContentResolversleep

    public static final String PUBKEY_KEY = "pubkey_blacklist";
    public static final String SERIAL_KEY = "serial_blacklist";
    private void overrideSettings(String key, String value) throws Exception {
        Settings.Secure.putString(mContext.getContentResolver(), key, value);
    public void testClearBlacklistPubkey() throws Exception { 
        // clear the gservices setting for a clean slate 
        overrideSettings(PUBKEY_KEY, "");
        // read the contents of the pubkey blacklist 
        String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
        // Verify that it's empty 
        assertEquals("", blacklist);
    public void testSetBlacklistPubkey() throws Exception { 
        // build a new thing to blacklist