mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 726194 - Sync pairing succeeds, but is OFF.
This commit is contained in:
parent
34e53e353e
commit
85abf16249
@ -54,6 +54,7 @@ import org.mozilla.gecko.sync.repositories.domain.PasswordRecord;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.net.Uri;
|
||||
|
||||
public class RepoUtils {
|
||||
@ -165,6 +166,7 @@ public class RepoUtils {
|
||||
return this.query(null, projection, selection, selectionArgs, sortOrder);
|
||||
}
|
||||
|
||||
// For ContentProvider queries.
|
||||
public Cursor query(String label, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
String logLabel = (label == null) ? this.tag : this.tag + label;
|
||||
long queryStart = android.os.SystemClock.uptimeMillis();
|
||||
@ -174,6 +176,17 @@ public class RepoUtils {
|
||||
return c;
|
||||
}
|
||||
|
||||
// For SQLiteOpenHelper queries.
|
||||
public Cursor query(SQLiteDatabase db, String label, String table, String[] columns,
|
||||
String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) {
|
||||
String logLabel = (label == null) ? this.tag : this.tag + label;
|
||||
long queryStart = android.os.SystemClock.uptimeMillis();
|
||||
Cursor c = db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy, limit);
|
||||
long queryEnd = android.os.SystemClock.uptimeMillis();
|
||||
RepoUtils.queryTimeLogger(logLabel, queryStart, queryEnd);
|
||||
return c;
|
||||
}
|
||||
|
||||
public Cursor safeQuery(String label, String[] projection, String selection, String[] selectionArgs, String sortOrder) throws NullCursorException {
|
||||
Cursor c = this.query(label, projection, selection, selectionArgs, sortOrder);
|
||||
if (c == null) {
|
||||
@ -182,6 +195,17 @@ public class RepoUtils {
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
public Cursor safeQuery(SQLiteDatabase db, String label, String table, String[] columns,
|
||||
String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) throws NullCursorException {
|
||||
Cursor c = this.query(db, label, table, columns, selection, selectionArgs,
|
||||
groupBy, having, orderBy, limit);
|
||||
if (c == null) {
|
||||
Logger.error(tag, "Got null cursor exception in " + tag + ((label == null) ? "" : label));
|
||||
throw new NullCursorException(null);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getStringFromCursor(Cursor cur, String colId) {
|
||||
|
@ -230,7 +230,8 @@ public class AccountActivity extends AccountAuthenticatorActivity {
|
||||
AccountManager accountManager,
|
||||
String username,
|
||||
String syncKey,
|
||||
String password, String serverURL) {
|
||||
String password,
|
||||
String serverURL) {
|
||||
|
||||
final Account account = new Account(username, Constants.ACCOUNTTYPE_SYNC);
|
||||
final Bundle userbundle = new Bundle();
|
||||
@ -246,7 +247,7 @@ public class AccountActivity extends AccountAuthenticatorActivity {
|
||||
Log.d(LOG_TAG, "Adding account for " + Constants.ACCOUNTTYPE_SYNC);
|
||||
boolean result = accountManager.addAccountExplicitly(account, password, userbundle);
|
||||
|
||||
Log.d(LOG_TAG, "Account: " + account.toString() + " added successfully? " + result);
|
||||
Log.d(LOG_TAG, "Account: " + account + " added successfully? " + result);
|
||||
if (!result) {
|
||||
Log.e(LOG_TAG, "Error adding account!");
|
||||
}
|
||||
@ -254,6 +255,7 @@ public class AccountActivity extends AccountAuthenticatorActivity {
|
||||
// Set components to sync (default: all).
|
||||
ContentResolver.setMasterSyncAutomatically(true);
|
||||
ContentResolver.setSyncAutomatically(account, Authorities.BROWSER_AUTHORITY, true);
|
||||
ContentResolver.setIsSyncable(account, Authorities.BROWSER_AUTHORITY, 1);
|
||||
|
||||
// TODO: add other ContentProviders as needed (e.g. passwords)
|
||||
// TODO: for each, also add to res/xml to make visible in account settings
|
||||
|
Loading…
Reference in New Issue
Block a user