// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.olio.communication.notifications; import android.content.ContentProviderOperation; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.OperationApplicationException; import android.database.Cursor; import android.net.Uri; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import android.provider.BaseColumns; import android.text.TextUtils; import com.olio.communication.messages.MessagePayload; import com.olio.communication.notifications.new_notifications.StreamItem; import com.olio.util.ALog; import com.olio.util.RecoveryTimer; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; // Referenced classes of package com.olio.communication.notifications: // NotificationContract, DatabaseInsertable public static final class _cls2.val.cr implements BaseColumns { public static final String ALL_COLUMNS[] = { "notificationID", "read", "created", "type", "functionality", "stream", "vibrationType", "displayType", "package", "priority", "overviewTopText", "overviewBottomTest", "data" }; public static final String COLUMN_NAME_DATA = "data"; public static final String COLUMN_NAME_DATE_CREATED = "created"; public static final String COLUMN_NAME_DISPLAY_TYPE = "displayType"; public static final String COLUMN_NAME_FUNCTIONALITY = "functionality"; public static final String COLUMN_NAME_NOTIFICATION_ID = "notificationID"; public static final String COLUMN_NAME_OVERVIEW_BOTTOM_TEXT = "overviewBottomTest"; public static final String COLUMN_NAME_OVERVIEW_TOP_TEXT = "overviewTopText"; public static final String COLUMN_NAME_PACKAGE = "package"; public static final String COLUMN_NAME_PRIORITY = "priority"; public static final String COLUMN_NAME_READ = "read"; public static final String COLUMN_NAME_STREAM = "stream"; public static final String COLUMN_NAME_TYPE = "type"; public static final String COLUMN_NAME_VIBRATION_TYPE = "vibrationType"; public static final Uri CONTENT_ID_URI_BASE = Uri.parse("content://com.olio.provider.Notifications/notifications/"); public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse("content://com.olio.provider.Notifications/notifications//#"); public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.olio.notification"; public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.olio.notification"; public static final Uri CONTENT_URI = Uri.parse("content://com.olio.provider.Notifications/notifications"); public static final String DEFAULT_SORT_ORDER = "created DESC"; public static final int NOTIFICATION_ID_PATH_POSITION = 1; private static final String PATH_NOTIFICATION = "/notifications"; private static final String PATH_NOTIFICATION_ID = "/notifications/"; private static final String SCHEME = "content://"; private static int SUBMIT_TIMEOUT = 0; public static final String TABLE_NAME = "notifications"; private static final RecoveryTimer mBulkTimer = new RecoveryTimer("Notification.bulkInsert"); private static Runnable mInsertRunnable; private static final ArrayList mQueuedInserts = new ArrayList(1); private static final Object mTimerLock = new Object(); private static ExecutorService sExecutor = Executors.newSingleThreadExecutor(); public static transient void batchSetInvisible(ContentResolver contentresolver, String as[]) { sExecutor.execute(new Runnable(as, contentresolver) { final ContentResolver val$cr; final String val$notificationIds[]; public void run() { ArrayList arraylist; ALog.d("SetInvisible=START, Count=%s", new Object[] { Integer.valueOf(notificationIds.length) }); String as1[] = new String[1]; String s = com.olio.communication.notifications.new_notifications.StreamItem.DisplayType.NONE.toString(); arraylist = new ArrayList(notificationIds.length); String as2[] = notificationIds; int j = as2.length; for (int i = 0; i < j; i++) { as1[0] = as2[i]; arraylist.add(ContentProviderOperation.newUpdate(NotificationContract.Notifications.CONTENT_URI).withSelection("notificationID = ?", as1).withValue("displayType", s).build()); } cr.applyBatch("com.olio.provider.Notifications", arraylist); _L2: ALog.d("SetInvisible=END", new Object[0]); return; Object obj; obj; _L3: ALog.e("SetInvisible=ERROR, ErrorClass='%s', Ids=['%s']", ((Throwable) (obj)), new Object[] { obj.getClass().getName(), TextUtils.join("', '", notificationIds) }); if (true) goto _L2; else goto _L1 _L1: obj; goto _L3 } { notificationIds = as; cr = contentresolver; super(); } }); } public static void bulkInsert(ContentResolver contentresolver, List list) { ContentValues acontentvalues[] = new ContentValues[list.size()]; for (int i = 0; i < list.size(); i++) { acontentvalues[i] = getNotificationContentValues((DatabaseInsertable)list.get(i)); } contentresolver.bulkInsert(CONTENT_URI, acontentvalues); } public static int clearDatabase(ContentResolver contentresolver) { int i; try { i = contentresolver.delete(CONTENT_URI, "1", null); } // Misplaced declaration of an exception variable catch (ContentResolver contentresolver) { ALog.e("Error deleting all stream items", new Object[0]); return 0; } return i; } public static List contentValuesForURI(ContentResolver contentresolver, Uri uri) { ContentResolver contentresolver1; ContentResolver contentresolver2; LinkedList linkedlist; contentresolver2 = null; contentresolver1 = null; linkedlist = new LinkedList(); contentresolver = contentresolver.query(uri, ALL_COLUMNS, null, null, null); if (contentresolver == null) goto _L2; else goto _L1 _L1: contentresolver1 = contentresolver; contentresolver2 = contentresolver; if (!contentresolver.moveToNext()) goto _L2; else goto _L3 _L3: contentresolver1 = contentresolver; contentresolver2 = contentresolver; linkedlist.add(contentValuesFromCursor(contentresolver)); if (true) goto _L1; else goto _L4 _L4: contentresolver; contentresolver2 = contentresolver1; ALog.e("Could not extract notifications from the database. Uri %s", new Object[] { uri.toString() }); if (contentresolver1 != null) { contentresolver1.close(); } _L6: return linkedlist; _L2: if (contentresolver == null) goto _L6; else goto _L5 _L5: contentresolver.close(); return linkedlist; contentresolver; if (contentresolver2 != null) { contentresolver2.close(); } throw contentresolver; } public static ContentValues contentValuesFromCursor(Cursor cursor) { ContentValues contentvalues = new ContentValues(); contentvalues.put("notificationID", cursor.getString(0)); contentvalues.put("read", Integer.valueOf(cursor.getInt(1))); contentvalues.put("created", Long.valueOf(cursor.getLong(2))); contentvalues.put("type", cursor.getString(3)); contentvalues.put("functionality", cursor.getString(4)); contentvalues.put("stream", cursor.getString(5)); contentvalues.put("vibrationType", cursor.getString(6)); contentvalues.put("displayType", cursor.getString(7)); contentvalues.put("package", cursor.getString(8)); contentvalues.put("priority", Integer.valueOf(cursor.getInt(9))); contentvalues.put("overviewTopText", cursor.getString(10)); contentvalues.put("overviewBottomTest", cursor.getString(11)); contentvalues.put("data", cursor.getBlob(12)); return contentvalues; } public static int count(ContentResolver contentresolver, Uri uri, String s, String as[]) { ContentResolver contentresolver1; ContentResolver contentresolver2; contentresolver2 = null; contentresolver1 = null; contentresolver = contentresolver.query(uri, new String[] { "data" }, s, as, null); if (contentresolver == null) { break MISSING_BLOCK_LABEL_55; } contentresolver1 = contentresolver; contentresolver2 = contentresolver; int i = contentresolver.getCount(); if (contentresolver != null) { contentresolver.close(); } return i; contentresolver1 = contentresolver; contentresolver2 = contentresolver; ALog.e("Could not extract notification from the database. Uri %s", new Object[] { uri.toString() }); if (contentresolver != null) { contentresolver.close(); } _L2: return 0; contentresolver; contentresolver2 = contentresolver1; ALog.e("Exception in querying notification database.", contentresolver, new Object[0]); if (contentresolver1 != null) { contentresolver1.close(); } if (true) goto _L2; else goto _L1 _L1: contentresolver; if (contentresolver2 != null) { contentresolver2.close(); } throw contentresolver; } private static Runnable createInsertTask(ContentResolver contentresolver) { return new Runnable(contentresolver) { final ContentResolver val$contentResolver; public void run() { synchronized (NotificationContract.Notifications.mTimerLock) { ALog.d("Inserting %d notifications", new Object[] { Integer.valueOf(NotificationContract.Notifications.mQueuedInserts.size()) }); NotificationContract.Notifications.bulkInsert(contentResolver, NotificationContract.Notifications.mQueuedInserts); NotificationContract.Notifications.mQueuedInserts.clear(); NotificationContract.Notifications.mBulkTimer.dispose(); NotificationContract.Notifications.mInsertRunnable = null; } return; exception; obj; JVM INSTR monitorexit ; throw exception; } { contentResolver = contentresolver; super(); } }; } public static Map databaseDump(ContentResolver contentresolver, String s) { ContentResolver contentresolver1; ContentResolver contentresolver2; HashMap hashmap; contentresolver2 = null; contentresolver1 = null; hashmap = new HashMap(); contentresolver = contentresolver.query(CONTENT_URI, ALL_COLUMNS, null, null, s); _L4: contentresolver1 = contentresolver; contentresolver2 = contentresolver; if (!contentresolver.moveToNext()) goto _L2; else goto _L1 _L1: contentresolver1 = contentresolver; contentresolver2 = contentresolver; s = contentValuesFromCursor(contentresolver); contentresolver1 = contentresolver; contentresolver2 = contentresolver; hashmap.put(s.getAsString("notificationID"), s); if (true) goto _L4; else goto _L3 _L3: contentresolver; contentresolver2 = contentresolver1; ALog.e("Exception in getting the database dump.", contentresolver, new Object[0]); if (contentresolver1 != null) { contentresolver1.close(); } _L6: return hashmap; _L2: if (contentresolver == null) goto _L6; else goto _L5 _L5: contentresolver.close(); return hashmap; contentresolver; if (contentresolver2 != null) { contentresolver2.close(); } throw contentresolver; } public static void delete(ContentResolver contentresolver, String s) { try { contentresolver.delete(CONTENT_URI, "notificationID = ?", new String[] { s }); return; } // Misplaced declaration of an exception variable catch (ContentResolver contentresolver) { ALog.e("Notification: %s could not be deleted.", new Object[] { s }); } } public static boolean getContainsMessageId(ContentResolver contentresolver, Uri uri, String s) { boolean flag = true; contentresolver = contentresolver.query(uri, new String[] { "notificationID" }, "notificationID = ?", new String[] { s }, null); if (contentresolver.getCount() <= 0) { flag = false; } contentresolver.close(); return flag; } public static ContentValues getNotificationContentValues(DatabaseInsertable databaseinsertable) { ContentValues contentvalues = new ContentValues(); contentvalues.put("notificationID", databaseinsertable.getNotificationId()); contentvalues.put("read", Integer.valueOf(0)); Object obj = databaseinsertable.getDateCreated(); CONTENT_URI content_uri; long l; if (obj == null) { l = Calendar.getInstance().getTimeInMillis(); } else { l = ((Date) (obj)).getTime(); } contentvalues.put("created", Long.valueOf(l)); contentvalues.put("type", databaseinsertable.getClass().getSimpleName()); content_uri = databaseinsertable.getNotificationCategory(); obj = content_uri; if (content_uri == null) { obj = ategory; } contentvalues.put("functionality", ((ategory) (obj)).ng()); if (databaseinsertable.getVibrationType() != null) { contentvalues.put("vibrationType", databaseinsertable.getVibrationType().ursor()); } else { contentvalues.put("vibrationType", com.olio.communication.notifications.new_notifications.ursor.ursor()); } if (databaseinsertable.getDisplayType() != null) { contentvalues.put("displayType", databaseinsertable.getDisplayType().ursor()); } if (databaseinsertable.getPackage() != null) { contentvalues.put("package", databaseinsertable.getPackage()); } contentvalues.put("priority", Integer.valueOf(databaseinsertable.getPriority())); if (databaseinsertable instanceof StreamItem) { obj = (StreamItem)databaseinsertable; contentvalues.put("overviewTopText", ((StreamItem) (obj)).getOverviewTopText()); contentvalues.put("overviewBottomTest", ((StreamItem) (obj)).getOverviewBottomText()); if (((StreamItem) (obj)).getStreamType() == null) { if (eamType.(databaseinsertable.getNotificationCategory())) { contentvalues.put("stream", com.olio.communication.notifications.new_notifications.ursor.ursor()); } else { contentvalues.put("stream", com.olio.communication.notifications.new_notifications.ursor.ursor()); } } else { contentvalues.put("stream", ((StreamItem) (obj)).getStreamType().ursor()); } if (((StreamItem) (obj)).getPriority() == -1 && ((StreamItem) (obj)).getNotificationCategory() != null) { ((StreamItem) (obj)).setPriority(((StreamItem) (obj)).getNotificationCategory().l()); contentvalues.put("priority", Integer.valueOf(((StreamItem) (obj)).getPriority())); } } contentvalues.put("data", databaseinsertable.encodeWithSerialization()); return contentvalues; } public static void insert(ContentResolver contentresolver, DatabaseInsertable databaseinsertable) { contentresolver.insert(CONTENT_URI, getNotificationContentValues(databaseinsertable)); ALog.d("Inserted new notification: %s", new Object[] { databaseinsertable.getNotificationId() }); } public static void markRead(ContentResolver contentresolver, String s, boolean flag) { ContentValues contentvalues = new ContentValues(); int i; if (flag) { i = 1; } else { i = 0; } try { contentvalues.put("read", Integer.valueOf(i)); contentresolver.update(CONTENT_URI, contentvalues, "notificationID = ?", new String[] { s }); ALog.d("Notification: %s marked as read.", new Object[] { s }); return; } // Misplaced declaration of an exception variable catch (ContentResolver contentresolver) { ALog.e("Notification: %s could not be marked read.", new Object[] { s }); } return; } public static MessagePayload originalNotificationForId(ContentResolver contentresolver, String s) { contentresolver = contentresolver.query(CONTENT_URI, new String[] { "data" }, "notificationID = ?", new String[] { s }, null); if (contentresolver.moveToNext()) { s = originalNotificationFromCursor(contentresolver); contentresolver.close(); return s; } else { contentresolver.close(); ALog.w("Could not find notification with id: %s", new Object[] { s }); return null; } } public static List originalNotificationForURI(ContentResolver contentresolver, Uri uri) { ContentResolver contentresolver1; ContentResolver contentresolver2; LinkedList linkedlist; contentresolver2 = null; contentresolver1 = null; linkedlist = new LinkedList(); contentresolver = contentresolver.query(uri, new String[] { "data" }, null, null, null); if (contentresolver == null) goto _L2; else goto _L1 _L1: contentresolver1 = contentresolver; contentresolver2 = contentresolver; int i = contentresolver.getColumnIndex("data"); contentresolver1 = contentresolver; contentresolver2 = contentresolver; if (contentresolver.getCount() <= 1) { break MISSING_BLOCK_LABEL_77; } contentresolver1 = contentresolver; contentresolver2 = contentresolver; ALog.w("Notification cursor received more than one notification", new Object[0]); _L6: contentresolver1 = contentresolver; contentresolver2 = contentresolver; if (!contentresolver.moveToNext()) goto _L4; else goto _L3 _L3: contentresolver1 = contentresolver; contentresolver2 = contentresolver; linkedlist.add(MessagePayload.decode(contentresolver.getBlob(i))); if (true) goto _L6; else goto _L5 _L5: contentresolver; contentresolver2 = contentresolver1; ALog.e("Exception in querying notification database.", contentresolver, new Object[0]); if (contentresolver1 != null) { contentresolver1.close(); } _L8: return linkedlist; _L2: contentresolver1 = contentresolver; contentresolver2 = contentresolver; ALog.e("Could not extract notification from the database. Uri %s", new Object[] { uri.toString() }); _L4: if (contentresolver == null) goto _L8; else goto _L7 _L7: contentresolver.close(); return linkedlist; contentresolver; if (contentresolver2 != null) { contentresolver2.close(); } throw contentresolver; } public static MessagePayload originalNotificationFromCursor(Cursor cursor) { try { cursor = MessagePayload.decode(cursor.getBlob(cursor.getColumnIndex("data"))); } // Misplaced declaration of an exception variable catch (Cursor cursor) { ALog.w("Could not extract blob from cursor.", new Object[0]); return null; } // Misplaced declaration of an exception variable catch (Cursor cursor) { ALog.w("Could not cast blob into message payload.", new Object[0]); return null; } return cursor; } public static List payloadsForQuery(ContentResolver contentresolver, Uri uri, String s, String as[]) { ContentResolver contentresolver1; ContentResolver contentresolver2; LinkedList linkedlist; contentresolver2 = null; contentresolver1 = null; linkedlist = new LinkedList(); contentresolver = contentresolver.query(uri, new String[] { "data" }, s, as, null); if (contentresolver == null) goto _L2; else goto _L1 _L1: contentresolver1 = contentresolver; contentresolver2 = contentresolver; int i = contentresolver.getColumnIndex("data"); contentresolver1 = contentresolver; contentresolver2 = contentresolver; if (contentresolver.getCount() <= 1) { break MISSING_BLOCK_LABEL_85; } contentresolver1 = contentresolver; contentresolver2 = contentresolver; ALog.w("Notification cursor received more than one notification", new Object[0]); _L6: contentresolver1 = contentresolver; contentresolver2 = contentresolver; if (!contentresolver.moveToNext()) goto _L4; else goto _L3 _L3: contentresolver1 = contentresolver; contentresolver2 = contentresolver; linkedlist.add(MessagePayload.decode(contentresolver.getBlob(i))); if (true) goto _L6; else goto _L5 _L5: contentresolver; contentresolver2 = contentresolver1; ALog.e("Exception in querying notification database.", contentresolver, new Object[0]); if (contentresolver1 != null) { contentresolver1.close(); } _L8: return linkedlist; _L2: contentresolver1 = contentresolver; contentresolver2 = contentresolver; ALog.e("Could not extract notification from the database. Uri %s", new Object[] { uri.toString() }); _L4: if (contentresolver == null) goto _L8; else goto _L7 _L7: contentresolver.close(); return linkedlist; contentresolver; if (contentresolver2 != null) { contentresolver2.close(); } throw contentresolver; } public static void queuedBulkInsert(Context context, DatabaseInsertable databaseinsertable) { synchronized (mTimerLock) { mQueuedInserts.add(databaseinsertable); if (mInsertRunnable == null) { mInsertRunnable = createInsertTask(context.getContentResolver()); mBulkTimer.init(context, new Handler(Looper.getMainLooper())); } mBulkTimer.startOrRestart(SUBMIT_TIMEOUT, mInsertRunnable); } return; context; obj; JVM INSTR monitorexit ; throw context; } public static void setInvisible(ContentResolver contentresolver, String s) { try { ContentValues contentvalues = new ContentValues(); contentvalues.put("displayType", com.olio.communication.notifications.new_notifications.onFromCursor.onFromCursor()); contentresolver.update(CONTENT_URI, contentvalues, "notificationID = ?", new String[] { s }); ALog.d("Notification: %s set invisible.", new Object[] { s }); return; } // Misplaced declaration of an exception variable catch (ContentResolver contentresolver) { ALog.e("Notification: %s could not be set invisible.", new Object[] { s }); } } static { SUBMIT_TIMEOUT = 700; } /* static Runnable access$302(Runnable runnable) { mInsertRunnable = runnable; return runnable; } */ private _cls2.val.cr() { } }