Skip to content

Commit d493d77

Browse files
Create debug-db-encrypt
1 parent e6afc01 commit d493d77

File tree

10 files changed

+168
-8
lines changed

10 files changed

+168
-8
lines changed

debug-db-encrypt/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

debug-db-encrypt/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
minSdkVersion 14
7+
targetSdkVersion 28
8+
versionCode 1
9+
versionName "1.0"
10+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
11+
}
12+
buildTypes {
13+
release {
14+
minifyEnabled false
15+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
16+
}
17+
}
18+
}
19+
20+
dependencies {
21+
implementation project(':debug-db-base')
22+
testImplementation 'junit:junit:4.12'
23+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
24+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.amitshekhar.debug.encrypt;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.amitshekhar.debug.encrypt.test", appContext.getPackageName());
25+
}
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.amitshekhar.debug.encrypt">
3+
4+
<application>
5+
<provider
6+
android:name=".DebugDBEncryptInitProvider"
7+
android:authorities="${applicationId}.DebugDBEncryptInitProvider"
8+
android:enabled="true"
9+
android:exported="false" />
10+
</application>
11+
12+
</manifest>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.amitshekhar.debug.encrypt;
2+
3+
import android.content.ContentProvider;
4+
import android.content.ContentValues;
5+
import android.content.Context;
6+
import android.content.pm.ProviderInfo;
7+
import android.database.Cursor;
8+
import android.net.Uri;
9+
10+
import com.amitshekhar.DebugDB;
11+
12+
public class DebugDBEncryptInitProvider extends ContentProvider {
13+
14+
15+
public DebugDBEncryptInitProvider() {
16+
}
17+
18+
@Override
19+
public boolean onCreate() {
20+
DebugDB.initialize(getContext());
21+
return true;
22+
}
23+
24+
@Override
25+
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
26+
return null;
27+
}
28+
29+
@Override
30+
public String getType(Uri uri) {
31+
return null;
32+
}
33+
34+
@Override
35+
public Uri insert(Uri uri, ContentValues values) {
36+
return null;
37+
}
38+
39+
@Override
40+
public int delete(Uri uri, String selection, String[] selectionArgs) {
41+
return 0;
42+
}
43+
44+
@Override
45+
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
46+
return 0;
47+
}
48+
49+
@Override
50+
public void attachInfo(Context context, ProviderInfo providerInfo) {
51+
if (providerInfo == null) {
52+
throw new NullPointerException("DebugDBEncryptInitProvider ProviderInfo cannot be null.");
53+
}
54+
// So if the authorities equal the library internal ones, the developer forgot to set his applicationId
55+
if ("com.amitshekhar.debug.encrypt.DebugDBEncryptInitProvider".equals(providerInfo.authority)) {
56+
throw new IllegalStateException("Incorrect provider authority in manifest. Most likely due to a "
57+
+ "missing applicationId variable in application\'s build.gradle.");
58+
}
59+
super.attachInfo(context, providerInfo);
60+
}
61+
62+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">debug-db-encrypt</string>
3+
</resources>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.amitshekhar.debug.encrypt;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

debug-db/build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,19 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 28
5-
6-
7-
85
defaultConfig {
96
minSdkVersion 14
107
targetSdkVersion 28
118
versionCode 1
129
versionName "1.0"
13-
1410
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15-
1611
}
17-
1812
buildTypes {
1913
release {
2014
minifyEnabled false
2115
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2216
}
2317
}
24-
2518
}
2619

2720
dependencies {

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
*
1818
*/
1919

20-
include ':app', ':debug-db-base', ':debug-db'
20+
include ':app', ':debug-db-base', ':debug-db', ':debug-db-encrypt'

0 commit comments

Comments
 (0)