Skip to content

Commit

Permalink
Fake Signature: Fix mechanism to update database
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Sep 18, 2023
1 parent 8663e52 commit 49f739f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public void onCreate(SQLiteDatabase db) {
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
initData(db);
if (!db.isReadOnly()) {
initData(db);
}
}

private void initData(SQLiteDatabase db) {
Expand All @@ -52,10 +54,10 @@ private void initData(SQLiteDatabase db) {
return;
}
for (String app : wantFakeApps) {
db.insertWithOnConflict(TABLE_APPLIST, null, generateValues(app, true), SQLiteDatabase.CONFLICT_IGNORE);
db.insertWithOnConflict(TABLE_APPLIST, null, generateValues(app, true), SQLiteDatabase.CONFLICT_REPLACE);
}
for (String app : neverFakeApps) {
db.insertWithOnConflict(TABLE_APPLIST, null, generateValues(app, false), SQLiteDatabase.CONFLICT_IGNORE);
db.insertWithOnConflict(TABLE_APPLIST, null, generateValues(app, false), SQLiteDatabase.CONFLICT_REPLACE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SignatureService extends Service {
public void onCreate() {
super.onCreate();
this.openHelper = new AppListDatabaseOpenHelper(this);
this.database = openHelper.getReadableDatabase();
this.database = openHelper.getWritableDatabase();
this.start = System.currentTimeMillis();
}

Expand Down

0 comments on commit 49f739f

Please sign in to comment.