<commit_before># Bailiff

An Android library for taking action at run-time based on device security settings when DevicePolicyManager Just Don't Quite Fit Your Use Case™

## Installation
[Referencing an Android Library Project in Eclipse](http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject)

## Usage

### Configuring Your Policy Set

`BailiffBuilder` is provided to help you build your policy set and set the appropriate success and error callbacks.

Here is an example:
```
  new BailiffBuilder(context)
      .addPolicy(new EncryptionPolicy())
      .setCallbacks(new BailiffCallback() {
          public void onPass(context) {
              Log.i("BAILIFF", "Yay!");
          }
      
          public void onFail(context) {
              Log.e("BAILIFF", "Boo!");
          }
      })
      .enforcePolicy();
```

### Current BailiffPolicies

Currently, the only BailiffPolicy is EncryptionPolicy, which ensures the device is encrypted.

### Adding A Custom BailiffPolicy

You can create a custom policy to use by implementing the BailiffPolicy interface.  Just implement the `passes(Context)` method, and pass back true if the current device conforms to your custom policy. 

```
public class ExamplePolicy implements BailiffPolicy {

    @Override
    public boolean passes(Context context) {
       return true; 
    }
}
```

You may find this useful: [DevicePolicyManager](http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html)

## Contributing<commit_msg>Add reminder to add new policy to BailiffBuilder<commit_after># Bailiff

An Android library for taking action at run-time based on device security settings when DevicePolicyManager Just Don't Quite Fit Your Use Case™

## Installation
[Referencing an Android Library Project in Eclipse](http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject)

## Usage

### Configuring Your Policy Set

`BailiffBuilder` is provided to help you build your policy set and set the appropriate success and error callbacks.

Here is an example:
```
  new BailiffBuilder(context)
      .addPolicy(new EncryptionPolicy())
      .setCallbacks(new BailiffCallback() {
          public void onPass(context) {
              Log.i("BAILIFF", "Yay!");
          }
      
          public void onFail(context) {
              Log.e("BAILIFF", "Boo!");
          }
      })
      .enforcePolicy();
```

### Current BailiffPolicies

Currently, the only BailiffPolicy is EncryptionPolicy, which ensures the device is encrypted.

### Adding A Custom BailiffPolicy

You can create a custom policy to use by implementing the BailiffPolicy interface.  Just implement the `passes(Context)` method, and pass back true if the current device conforms to your custom policy. 

```
public class ExamplePolicy implements BailiffPolicy {

    @Override
    public boolean passes(Context context) {
       return true; 
    }
}
```

After creating your policy, be sure to add it to your BailiffBuilder.

You may find this useful: [DevicePolicyManager](http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html)

## Contributing
{'fraction_non_alphanumeric': 0.08438287153652393, 'fraction_numerical': 0.0, 'mean_word_length': 3.6720588235294116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1808808', 'n_tokens_mistral': 872, 'n_tokens_neox': 833, 'n_words': 306}