From 7506548ae2f34b084c7ceb1c86a3509dab5fa8f0 Mon Sep 17 00:00:00 2001 From: Igor Anic Date: Fri, 23 Apr 2010 12:12:40 +0200 Subject: [PATCH] little better database quota management, increse db size in steps of 1Mb (cherry picked from commit f5cd1fe73d6cd24ad48b36def86ead5a1f5141ea) --- framework/src/com/phonegap/DroidGap.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java index e51a6ed3..34de7c46 100644 --- a/framework/src/com/phonegap/DroidGap.java +++ b/framework/src/com/phonegap/DroidGap.java @@ -275,7 +275,7 @@ public class DroidGap extends Activity { public final class EclairClient extends GapClient { private String TAG = "PhoneGapLog"; - private long MAX_QUOTA = 2000000; + private long MAX_QUOTA = 100 * 1024 * 1024; public EclairClient(Context ctx) { super(ctx); @@ -285,10 +285,13 @@ public class DroidGap extends Activity { public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize, long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) { - + Log.d(TAG, "event raised onExceededDatabaseQuota estimatedSize: " + Long.toString(estimatedSize) + " currentQuota: " + Long.toString(currentQuota) + " totalUsedQuota: " + Long.toString(totalUsedQuota)); + if( estimatedSize < MAX_QUOTA) - { - long newQuota = estimatedSize; + { + //increase for 1Mb + long newQuota = currentQuota + 1024*1024; + Log.d(TAG, "calling quotaUpdater.updateQuota newQuota: " + Long.toString(newQuota) ); quotaUpdater.updateQuota(newQuota); } else @@ -296,7 +299,7 @@ public class DroidGap extends Activity { // Set the quota to whatever it is and force an error // TODO: get docs on how to handle this properly quotaUpdater.updateQuota(currentQuota); - } + } } // This is a test of console.log, because we don't have this in Android 2.01