36
36
import android .content .pm .PackageManager ;
37
37
import android .content .res .Resources ;
38
38
import android .database .Cursor ;
39
- import android .database .sqlite .SQLiteDatabase ;
40
39
import android .graphics .Bitmap ;
41
40
import android .graphics .BitmapFactory ;
42
41
import android .net .Uri ;
@@ -470,8 +469,6 @@ private static void createSummaryNotification(OSNotificationGenerationJob notifi
470
469
Cursor cursor = null ;
471
470
472
471
try {
473
- SQLiteDatabase readableDb = dbHelper .getSQLiteDatabaseWithRetries ();
474
-
475
472
String [] retColumn = { NotificationTable .COLUMN_NAME_ANDROID_NOTIFICATION_ID ,
476
473
NotificationTable .COLUMN_NAME_FULL_DATA ,
477
474
NotificationTable .COLUMN_NAME_IS_SUMMARY ,
@@ -487,7 +484,7 @@ private static void createSummaryNotification(OSNotificationGenerationJob notifi
487
484
if (!updateSummary && notificationJob .getAndroidId () != -1 )
488
485
whereStr += " AND " + NotificationTable .COLUMN_NAME_ANDROID_NOTIFICATION_ID + " <> " + notificationJob .getAndroidId ();
489
486
490
- cursor = readableDb .query (
487
+ cursor = dbHelper .query (
491
488
NotificationTable .TABLE_NAME ,
492
489
retColumn ,
493
490
whereStr ,
@@ -709,28 +706,11 @@ private static Intent createBaseSummaryIntent(int summaryNotificationId, JSONObj
709
706
private static void createSummaryIdDatabaseEntry (OneSignalDbHelper dbHelper , String group , int id ) {
710
707
// There currently isn't a visible notification from for this group_id.
711
708
// Save the group summary notification id so it can be updated later.
712
- SQLiteDatabase writableDb = null ;
713
- try {
714
- writableDb = dbHelper .getSQLiteDatabaseWithRetries ();
715
- writableDb .beginTransaction ();
716
-
717
- ContentValues values = new ContentValues ();
718
- values .put (NotificationTable .COLUMN_NAME_ANDROID_NOTIFICATION_ID , id );
719
- values .put (NotificationTable .COLUMN_NAME_GROUP_ID , group );
720
- values .put (NotificationTable .COLUMN_NAME_IS_SUMMARY , 1 );
721
- writableDb .insertOrThrow (NotificationTable .TABLE_NAME , null , values );
722
- writableDb .setTransactionSuccessful ();
723
- } catch (Throwable t ) {
724
- OneSignal .Log (OneSignal .LOG_LEVEL .ERROR , "Error adding summary notification record! " , t );
725
- } finally {
726
- if (writableDb != null ) {
727
- try {
728
- writableDb .endTransaction (); // May throw if transaction was never opened or DB is full.
729
- } catch (Throwable t ) {
730
- OneSignal .Log (OneSignal .LOG_LEVEL .ERROR , "Error closing transaction! " , t );
731
- }
732
- }
733
- }
709
+ ContentValues values = new ContentValues ();
710
+ values .put (NotificationTable .COLUMN_NAME_ANDROID_NOTIFICATION_ID , id );
711
+ values .put (NotificationTable .COLUMN_NAME_GROUP_ID , group );
712
+ values .put (NotificationTable .COLUMN_NAME_IS_SUMMARY , 1 );
713
+ dbHelper .insertOrThrow (NotificationTable .TABLE_NAME , null , values );
734
714
}
735
715
736
716
// Keep 'throws Throwable' as 'onesignal_bgimage_notif_layout' may not be available
0 commit comments