Hi All, Kindly look for below patch for device with PM( power management feature). This is a very classic problem which we have faced and analyzed root cause.
First read the inline thread - Log database used by media scanner to keep the logs of activity which will be useful incase of bug report, I do not see any other usage - This database use TIME as primary key - which will be produce using function datetime('now') -> which in turn uses gettimeofday. gettimeofday returns float value, which has very minute difference if we call successively and it is not recommended to use this function for time measure for successive calls. ref links# http://books.google.co.in/books?id=tdsZHyH9bQEC&pg=PA307&lpg=PA307&dq=gettimeofday+is+return+same+value+on+successive+call&source=bl&ots=rtZk9_l_l8&sig=xbx0iDmpCho9tkTevKDaW9iL99w&hl=en&sa=X&ei=NYtiULDgL8jQrQel0YDABA&ved=0CB4Q6AEwAA http://www.ning.com/code/2012/02/ - For mentioned scenario - on first boot, value of datetime('now') is same for successive call ( if we do not have any media on device), so it will not allow system to go in suspend. BR, satish ---------- Forwarded message ---------- From: Umakanta Patro <umasi...@gmail.com> Date: Tue, Sep 25, 2012 at 5:13 PM Subject: [rowboat] [RFC] [PATCH] JB: PM: Fix delayed suspend issue (PARTIAL_WAKE_LOCK held by MediaScannerService) To: rowb...@googlegroups.com Dear All, Inline is the patch to fix the the delayed suspend issue caused by the "PARTIAL_WAKE_LOCK held by MediaScannerService" on Jellybean. For the system without RTC, in some scenarios the timestamp for each entry in the SQL database is not unique. So, Android throws an exception: "android.database.sqlite.SQLiteConstraintException: column time is not unique" So, the device waits for around 10 minutes on the fresh boot to go to suspend. This patch removes the check for uniqueness of each table entry. And thus allowing the device to go to suspend instantly on display time-out. Please review this patch. And provide us your valuable suggestions. Signed-off-by: satish <satish.pa...@ti.com> Signed-off-by: Umakanta Patro <umakanta.pa...@ti.com> --- src/com/android/providers/media/MediaProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java index bb21e80..b594970 100644 --- a/src/com/android/providers/media/MediaProvider.java +++ b/src/com/android/providers/media/MediaProvider.java @@ -1721,7 +1721,7 @@ public class MediaProvider extends ContentProvider { } if (fromVersion < 509) { - db.execSQL("CREATE TABLE IF NOT EXISTS log (time DATETIME PRIMARY KEY, message TEXT);"); + db.execSQL("CREATE TABLE IF NOT EXISTS log (time DATETIME, message TEXT);"); } sanityCheck(db, fromVersion); long elapsedSeconds = (SystemClock.currentTimeMicro() - startTime) / 1000000; -- 1.7.9.5 -- You received this message because you are subscribed to the Google Groups "rowboat" group. To view this discussion on the web visit https://groups.google.com/d/msg/rowboat/-/ggJkNRY8PHYJ. To post to this group, send email to rowb...@googlegroups.com. To unsubscribe from this group, send email to rowboat+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rowboat?hl=en. -- Regards, satish patel -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting