Sync Autofill profile data native side
When the user adds or edits the AutoFill profile, sync that
data to the native WebKit code through the BrowserSettings
object. Also sync the profile data on startup if it is
available.
Change-Id: I6146a842cb765f8ed91c109537038baad6b547fb
diff --git a/src/com/android/browser/AutoFillProfileDatabase.java b/src/com/android/browser/AutoFillProfileDatabase.java
index e3d6ea2..5557aaf 100644
--- a/src/com/android/browser/AutoFillProfileDatabase.java
+++ b/src/com/android/browser/AutoFillProfileDatabase.java
@@ -22,6 +22,7 @@
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.BaseColumns;
import android.util.Log;
+import android.webkit.WebSettings.AutoFillProfile;
public class AutoFillProfileDatabase {
@@ -78,13 +79,13 @@
return writable ? mOpenHelper.getWritableDatabase() : mOpenHelper.getReadableDatabase();
}
- public void addOrUpdateProfile(final int id, final String fullName, final String email) {
+ public void addOrUpdateProfile(final int id, AutoFillProfile profile) {
final String SQL = "INSERT OR REPLACE INTO " + PROFILES_TABLE_NAME + " ("
+ Profiles._ID + ","
+ Profiles.FULL_NAME + ","
+ Profiles.EMAIL_ADDRESS
+ ") VALUES (?,?,?);";
- final Object[] PARAMS = {id, fullName, email};
+ final Object[] PARAMS = { id, profile.getFullName(), profile.getEmailAddress() };
getDatabase(true).execSQL(SQL, PARAMS);
}