package com.amitshekhar.debug.encrypt;
|
|
import android.content.ContentProvider;
|
import android.content.ContentValues;
|
import android.content.Context;
|
import android.content.pm.ProviderInfo;
|
import android.database.Cursor;
|
import android.net.Uri;
|
|
import com.amitshekhar.DebugDB;
|
import com.amitshekhar.debug.encrypt.sqlite.DebugDBEncryptFactory;
|
|
public class DebugDBEncryptInitProvider extends ContentProvider {
|
|
|
public DebugDBEncryptInitProvider() {
|
}
|
|
@Override
|
public boolean onCreate() {
|
DebugDB.initialize(getContext(), new DebugDBEncryptFactory());
|
return true;
|
}
|
|
@Override
|
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
return null;
|
}
|
|
@Override
|
public String getType(Uri uri) {
|
return null;
|
}
|
|
@Override
|
public Uri insert(Uri uri, ContentValues values) {
|
return null;
|
}
|
|
@Override
|
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
return 0;
|
}
|
|
@Override
|
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
return 0;
|
}
|
|
@Override
|
public void attachInfo(Context context, ProviderInfo providerInfo) {
|
if (providerInfo == null) {
|
throw new NullPointerException("DebugDBEncryptInitProvider ProviderInfo cannot be null.");
|
}
|
// So if the authorities equal the library internal ones, the developer forgot to set his applicationId
|
if ("com.amitshekhar.debug.encrypt.DebugDBEncryptInitProvider".equals(providerInfo.authority)) {
|
throw new IllegalStateException("Incorrect provider authority in manifest. Most likely due to a "
|
+ "missing applicationId variable in application\'s build.gradle.");
|
}
|
super.attachInfo(context, providerInfo);
|
}
|
|
}
|