mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 743153 - Use ContentUris.parseId instead of RepoUtils.getAndroidIdFromUri. r=rnewman, a=blocking-fennec (dependency)
This commit is contained in:
parent
4a36ec35ac
commit
ede1c29a96
@ -16,6 +16,7 @@ import org.mozilla.gecko.sync.repositories.NullCursorException;
|
||||
import org.mozilla.gecko.sync.repositories.domain.BookmarkRecord;
|
||||
import org.mozilla.gecko.sync.repositories.domain.Record;
|
||||
|
||||
import android.content.ContentUris;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
@ -249,7 +250,7 @@ public class AndroidBrowserBookmarksDataAccessor extends AndroidBrowserRepositor
|
||||
record.title = AndroidBrowserBookmarksRepositorySession.SPECIAL_GUIDS_MAP.get(guid);
|
||||
record.type = "folder";
|
||||
record.androidParentID = parentId;
|
||||
return(RepoUtils.getAndroidIdFromUri(insert(record)));
|
||||
return ContentUris.parseId(insert(record));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,6 +26,7 @@ import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionGuidsSince
|
||||
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionWipeDelegate;
|
||||
import org.mozilla.gecko.sync.repositories.domain.Record;
|
||||
|
||||
import android.content.ContentUris;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
|
||||
@ -533,7 +534,7 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
||||
protected Record insert(Record record) throws NoGuidForIdException, NullCursorException, ParentNotFoundException {
|
||||
Record toStore = prepareRecord(record);
|
||||
Uri recordURI = dbHelper.insert(toStore);
|
||||
long id = RepoUtils.getAndroidIdFromUri(recordURI);
|
||||
long id = ContentUris.parseId(recordURI);
|
||||
Logger.debug(LOG_TAG, "Inserted as " + id);
|
||||
|
||||
toStore.androidID = id;
|
||||
|
@ -28,6 +28,7 @@ import org.mozilla.gecko.sync.repositories.domain.PasswordRecord;
|
||||
import org.mozilla.gecko.sync.repositories.domain.Record;
|
||||
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentUris;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
@ -445,7 +446,10 @@ public class PasswordsRepositorySession extends
|
||||
// record.timeLastUsed = now();
|
||||
ContentValues cv = getContentValues(record);
|
||||
Uri insertedUri = passwordsProvider.insert(BrowserContractHelpers.PASSWORDS_CONTENT_URI, cv);
|
||||
record.androidID = RepoUtils.getAndroidIdFromUri(insertedUri);
|
||||
if (insertedUri == null) {
|
||||
throw new RemoteException(); // Not much to be done here, save throw.
|
||||
}
|
||||
record.androidID = ContentUris.parseId(insertedUri);
|
||||
return record;
|
||||
}
|
||||
|
||||
|
@ -119,14 +119,6 @@ public class RepoUtils {
|
||||
}
|
||||
}
|
||||
|
||||
// Returns android id from the URI that we get after inserting a
|
||||
// bookmark into the local Android store.
|
||||
public static long getAndroidIdFromUri(Uri uri) {
|
||||
String path = uri.getPath();
|
||||
int lastSlash = path.lastIndexOf('/');
|
||||
return Long.parseLong(path.substring(lastSlash + 1));
|
||||
}
|
||||
|
||||
//Create a HistoryRecord object from a cursor on a row with a Moz History record in it
|
||||
public static HistoryRecord historyFromMirrorCursor(Cursor cur) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user