Created Device Protected Storage Context

This commit is contained in:
merkost 2023-05-25 21:45:10 +10:00
parent 474512955c
commit 1b15a52fcb
3 changed files with 5 additions and 2 deletions

View File

@ -25,6 +25,7 @@
<activity <activity
android:name=".activities.SplashActivity" android:name=".activities.SplashActivity"
android:directBootAware="true"
android:exported="false" android:exported="false"
android:theme="@style/SplashTheme" /> android:theme="@style/SplashTheme" />
@ -42,6 +43,7 @@
<service <service
android:name=".services.SimpleKeyboardIME" android:name=".services.SimpleKeyboardIME"
android:directBootAware="true"
android:exported="true" android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
android:permission="android.permission.BIND_INPUT_METHOD"> android:permission="android.permission.BIND_INPUT_METHOD">

View File

@ -4,6 +4,7 @@ import android.content.Context
import androidx.room.Database import androidx.room.Database
import androidx.room.Room import androidx.room.Room
import androidx.room.RoomDatabase import androidx.room.RoomDatabase
import com.simplemobiletools.commons.extensions.safeStorageContext
import com.simplemobiletools.keyboard.interfaces.ClipsDao import com.simplemobiletools.keyboard.interfaces.ClipsDao
import com.simplemobiletools.keyboard.models.Clip import com.simplemobiletools.keyboard.models.Clip
@ -19,7 +20,7 @@ abstract class ClipsDatabase : RoomDatabase() {
if (db == null) { if (db == null) {
synchronized(ClipsDatabase::class) { synchronized(ClipsDatabase::class) {
if (db == null) { if (db == null) {
db = Room.databaseBuilder(context.applicationContext, ClipsDatabase::class.java, "clips.db").build() db = Room.databaseBuilder(context.applicationContext.safeStorageContext, ClipsDatabase::class.java, "clips.db").build()
db!!.openHelper.setWriteAheadLoggingEnabled(true) db!!.openHelper.setWriteAheadLoggingEnabled(true)
} }
} }

View File

@ -21,7 +21,7 @@ import com.simplemobiletools.keyboard.databases.ClipsDatabase
import com.simplemobiletools.keyboard.helpers.* import com.simplemobiletools.keyboard.helpers.*
import com.simplemobiletools.keyboard.interfaces.ClipsDao import com.simplemobiletools.keyboard.interfaces.ClipsDao
val Context.config: Config get() = Config.newInstance(applicationContext) val Context.config: Config get() = Config.newInstance(applicationContext.safeStorageContext)
val Context.clipsDB: ClipsDao get() = ClipsDatabase.getInstance(applicationContext).ClipsDao() val Context.clipsDB: ClipsDao get() = ClipsDatabase.getInstance(applicationContext).ClipsDao()