summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeff Hamilton <jham@android.com>2010-08-17 12:38:22 -0500
committerJeff Hamilton <jham@android.com>2010-08-17 12:47:37 -0500
commit69bd7077becb42438513fa80c98d0b48c8a23a41 (patch)
treeda2ea4b8cb822257911775a60d28f34a4aaed793 /src
parent8402962ef58546d3cfd48fbb211b5e36df0f118e (diff)
downloadpackages_apps_browser-69bd7077becb42438513fa80c98d0b48c8a23a41.zip
packages_apps_browser-69bd7077becb42438513fa80c98d0b48c8a23a41.tar.gz
packages_apps_browser-69bd7077becb42438513fa80c98d0b48c8a23a41.tar.bz2
Update to the new contract class location.
Change-Id: I3ebf5a9dbac4b3b6ecbc0468242dedf909c23882
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/Bookmarks.java4
-rw-r--r--src/com/android/browser/BookmarksLoader.java3
-rw-r--r--src/com/android/browser/BrowserBookmarksPage.java3
-rw-r--r--src/com/android/browser/BrowserHistoryPage.java1
-rw-r--r--src/com/android/browser/provider/BrowserContract.java367
-rw-r--r--src/com/android/browser/provider/BrowserProvider2.java11
6 files changed, 9 insertions, 380 deletions
diff --git a/src/com/android/browser/Bookmarks.java b/src/com/android/browser/Bookmarks.java
index da39799..62ed7e3 100644
--- a/src/com/android/browser/Bookmarks.java
+++ b/src/com/android/browser/Bookmarks.java
@@ -16,8 +16,6 @@
package com.android.browser;
-import com.android.browser.provider.BrowserContract;
-
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -28,12 +26,12 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.provider.Browser;
import android.provider.Browser.BookmarkColumns;
+import android.provider.BrowserContract;
import android.util.Log;
import android.webkit.WebIconDatabase;
import android.widget.Toast;
import java.io.ByteArrayOutputStream;
-import java.util.Date;
/**
* This class is purely to have a common place for adding/deleting bookmarks.
diff --git a/src/com/android/browser/BookmarksLoader.java b/src/com/android/browser/BookmarksLoader.java
index cdb0317..9d5e3ed 100644
--- a/src/com/android/browser/BookmarksLoader.java
+++ b/src/com/android/browser/BookmarksLoader.java
@@ -16,10 +16,9 @@
package com.android.browser;
-import com.android.browser.provider.BrowserContract.Bookmarks;
-
import android.content.Context;
import android.content.CursorLoader;
+import android.provider.BrowserContract.Bookmarks;
public class BookmarksLoader extends CursorLoader {
public static final String ARG_ROOT_FOLDER = "root";
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 40fd1e1..6a51b98 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -16,8 +16,6 @@
package com.android.browser;
-import com.android.browser.provider.BrowserContract;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.LoaderManager;
@@ -35,6 +33,7 @@ import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Browser;
+import android.provider.BrowserContract;
import android.util.Pair;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java
index b01f7c1..5298b9a 100644
--- a/src/com/android/browser/BrowserHistoryPage.java
+++ b/src/com/android/browser/BrowserHistoryPage.java
@@ -32,6 +32,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.ServiceManager;
import android.provider.Browser;
+import android.provider.BrowserContract.History;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Menu;
diff --git a/src/com/android/browser/provider/BrowserContract.java b/src/com/android/browser/provider/BrowserContract.java
deleted file mode 100644
index 1c31c85..0000000
--- a/src/com/android/browser/provider/BrowserContract.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.browser.provider;
-
-import android.accounts.Account;
-import android.content.ContentProviderClient;
-import android.content.ContentProviderOperation;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.RemoteException;
-import android.provider.SyncStateContract;
-import android.util.Pair;
-
-public class BrowserContract {
- /** The authority for the browser provider */
- public static final String AUTHORITY = "com.android.browser";
-
- /** A content:// style uri to the authority for the browser provider */
- public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
-
- /**
- * An optional insert, update or delete URI parameter that allows the caller
- * to specify that it is a sync adapter. The default value is false. If true
- * the dirty flag is not automatically set and the "syncToNetwork" parameter
- * is set to false when calling
- * {@link ContentResolver#notifyChange(android.net.Uri, android.database.ContentObserver, boolean)}.
- */
- public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
-
- /**
- * Generic columns for use by sync adapters. The specific functions of
- * these columns are private to the sync adapter. Other clients of the API
- * should not attempt to either read or write these columns.
- */
- interface BaseSyncColumns {
- /** Generic column for use by sync adapters. */
- public static final String SYNC1 = "sync1";
- /** Generic column for use by sync adapters. */
- public static final String SYNC2 = "sync2";
- /** Generic column for use by sync adapters. */
- public static final String SYNC3 = "sync3";
- /** Generic column for use by sync adapters. */
- public static final String SYNC4 = "sync4";
- /** Generic column for use by sync adapters. */
- public static final String SYNC5 = "sync5";
- }
-
- /**
- * Columns that appear when each row of a table belongs to a specific
- * account, including sync information that an account may need.
- */
- interface SyncColumns extends BaseSyncColumns {
- /**
- * The name of the account instance to which this row belongs, which when paired with
- * {@link #ACCOUNT_TYPE} identifies a specific account.
- * <P>Type: TEXT</P>
- */
- public static final String ACCOUNT_NAME = "account_name";
-
- /**
- * The type of account to which this row belongs, which when paired with
- * {@link #ACCOUNT_NAME} identifies a specific account.
- * <P>Type: TEXT</P>
- */
- public static final String ACCOUNT_TYPE = "account_type";
-
- /**
- * String that uniquely identifies this row to its source account.
- * <P>Type: TEXT</P>
- */
- public static final String SOURCE_ID = "sourceid";
-
- /**
- * Version number that is updated whenever this row or its related data
- * changes.
- * <P>Type: INTEGER</P>
- */
- public static final String VERSION = "version";
-
- /**
- * Flag indicating that {@link #VERSION} has changed, and this row needs
- * to be synchronized by its owning account.
- * <P>Type: INTEGER (boolean)</P>
- */
- public static final String DIRTY = "dirty";
- }
-
- interface BookmarkColumns {
- /**
- * The unique ID for a row.
- * <P>Type: INTEGER (long)</P>
- */
- public static final String _ID = "_id";
-
- /**
- * The URL of the bookmark.
- * <P>Type: TEXT (URL)</P>
- */
- public static final String URL = "url";
-
- /**
- * The user visible title of the bookmark.
- * <P>Type: TEXT</P>
- */
- public static final String TITLE = "title";
-
- /**
- * The favicon of the bookmark, may be NULL.
- * Must decode via {@link BitmapFactory#decodeByteArray}.
- * <p>Type: BLOB (image)</p>
- */
- public static final String FAVICON = "favicon";
-
- /**
- * A thumbnail of the page,may be NULL.
- * Must decode via {@link BitmapFactory#decodeByteArray}.
- * <p>Type: BLOB (image)</p>
- */
- public static final String THUMBNAIL = "thumbnail";
-
- /**
- * The touch icon for the web page, may be NULL.
- * Must decode via {@link BitmapFactory#decodeByteArray}.
- * <p>Type: BLOB (image)</p>
- * @hide
- */
- public static final String TOUCH_ICON = "touch_icon";
-
- /**
- * @hide
- */
- public static final String USER_ENTERED = "user_entered";
- }
-
- /**
- * The bookmarks table, which holds the user's browser bookmarks.
- */
- public static final class Bookmarks implements BookmarkColumns, SyncColumns {
- /**
- * This utility class cannot be instantiated.
- */
- private Bookmarks() {}
-
- /**
- * The content:// style URI for this table
- */
- public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "bookmarks");
-
- /**
- * The content:// style URI for the default folder
- */
- public static final Uri CONTENT_URI_DEFAULT_FOLDER =
- Uri.withAppendedPath(CONTENT_URI, "folder");
-
- /**
- * Builds a URI that points to a specific folder.
- * @param folderId the ID of the folder to point to
- */
- public static final Uri buildFolderUri(long folderId) {
- return ContentUris.withAppendedId(CONTENT_URI_DEFAULT_FOLDER, folderId);
- }
-
- /**
- * The MIME type of {@link #CONTENT_URI} providing a directory of bookmarks.
- */
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/bookmark";
-
- /**
- * The MIME type of a {@link #CONTENT_URI} of a single bookmark.
- */
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/bookmark";
-
- /**
- * Query parameter to use if you want to see deleted bookmarks that are still
- * around on the device and haven't been synced yet.
- * @see #IS_DELETED
- */
- public static final String QUERY_PARAMETER_SHOW_DELETED = "show_deleted";
-
- /**
- * Flag indicating if an item is a folder or bookmark. Non-zero values indicate
- * a folder and zero indicates a bookmark.
- * <P>Type: INTEGER (boolean)</P>
- */
- public static final String IS_FOLDER = "folder";
-
- /**
- * The ID of the parent folder. ID 0 is the root folder.
- * <P>Type: INTEGER (reference to item in the same table)</P>
- */
- public static final String PARENT = "parent";
-
- /**
- * The position of the bookmark in relation to it's siblings that share the same
- * {@link #PARENT}. May be negative.
- * <P>Type: INTEGER</P>
- */
- public static final String POSITION = "position";
-
- /**
- * The item that the bookmark should be inserted after.
- * May be negative.
- * <P>Type: INTEGER</P>
- */
- public static final String INSERT_AFTER = "insert_after";
-
- /**
- * A flag to indicate if an item has been deleted. Queries will not return deleted
- * entries unless you add the {@link #QUERY_PARAMETER_SHOW_DELETED} query paramter
- * to the URI when performing your query.
- * <p>Type: INTEGER (non-zero if the item has been deleted, zero if it hasn't)
- * @see #QUERY_PARAMETER_SHOW_DELETED
- */
- public static final String IS_DELETED = "deleted";
- }
-
- /**
- * The history table, which holds the browsing history.
- */
- public static final class History implements BookmarkColumns {
- /**
- * This utility class cannot be instantiated.
- */
- private History() {}
-
- /**
- * The content:// style URI for this table
- */
- public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "history");
-
- /**
- * The MIME type of {@link #CONTENT_URI} providing a directory of browser history items.
- */
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/browser-history";
-
- /**
- * The MIME type of a {@link #CONTENT_URI} of a single browser history item.
- */
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/browser-history";
-
- /**
- * The date the item was last visited, in milliseconds since the epoch.
- * <p>Type: INTEGER (date in milliseconds since January 1, 1970)</p>
- */
- public static final String DATE_LAST_VISITED = "date";
-
- /**
- * The date the item created, in milliseconds since the epoch.
- * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
- */
- public static final String DATE_CREATED = "created";
-
- /**
- * The number of times the item has been visited.
- * <p>Type: INTEGER</p>
- */
- public static final String VISITS = "visits";
- }
-
- /**
- * The search history table.
- * @hide
- */
- public static final class Searches {
- private Searches() {}
-
- /**
- * The content:// style URI for this table
- */
- public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "searches");
-
- /**
- * The MIME type of {@link #CONTENT_URI} providing a directory of browser search items.
- */
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/searches";
-
- /**
- * The MIME type of a {@link #CONTENT_URI} of a single browser search item.
- */
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/searches";
-
- /**
- * The unique ID for a row.
- * <P>Type: INTEGER (long)</P>
- */
- public static final String _ID = "_id";
-
- /**
- * The user entered search term.
- */
- public static final String SEARCH = "search";
-
- /**
- * The date the search was performed, in milliseconds since the epoch.
- * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
- */
- public static final String DATE = "date";
- }
-
- /**
- * A table provided for sync adapters to use for storing private sync state data.
- *
- * @see SyncStateContract
- */
- public static final class SyncState implements SyncStateContract.Columns {
- /**
- * This utility class cannot be instantiated
- */
- private SyncState() {}
-
- public static final String CONTENT_DIRECTORY =
- SyncStateContract.Constants.CONTENT_DIRECTORY;
-
- /**
- * The content:// style URI for this table
- */
- public static final Uri CONTENT_URI =
- Uri.withAppendedPath(AUTHORITY_URI, CONTENT_DIRECTORY);
-
- /**
- * @see android.provider.SyncStateContract.Helpers#get
- */
- public static byte[] get(ContentProviderClient provider, Account account)
- throws RemoteException {
- return SyncStateContract.Helpers.get(provider, CONTENT_URI, account);
- }
-
- /**
- * @see android.provider.SyncStateContract.Helpers#get
- */
- public static Pair<Uri, byte[]> getWithUri(ContentProviderClient provider, Account account)
- throws RemoteException {
- return SyncStateContract.Helpers.getWithUri(provider, CONTENT_URI, account);
- }
-
- /**
- * @see android.provider.SyncStateContract.Helpers#set
- */
- public static void set(ContentProviderClient provider, Account account, byte[] data)
- throws RemoteException {
- SyncStateContract.Helpers.set(provider, CONTENT_URI, account, data);
- }
-
- /**
- * @see android.provider.SyncStateContract.Helpers#newSetOperation
- */
- public static ContentProviderOperation newSetOperation(Account account, byte[] data) {
- return SyncStateContract.Helpers.newSetOperation(CONTENT_URI, account, data);
- }
- }
-}
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index 8392404..a9f9aca 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -17,10 +17,6 @@
package com.android.browser.provider;
import com.android.browser.R;
-import com.android.browser.provider.BrowserContract.Bookmarks;
-import com.android.browser.provider.BrowserContract.History;
-import com.android.browser.provider.BrowserContract.Searches;
-import com.android.browser.provider.BrowserContract.SyncState;
import com.android.internal.content.SyncStateContentProviderHelper;
import android.content.ContentResolver;
@@ -34,6 +30,11 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
+import android.provider.BrowserContract;
+import android.provider.BrowserContract.Bookmarks;
+import android.provider.BrowserContract.History;
+import android.provider.BrowserContract.Searches;
+import android.provider.BrowserContract.SyncState;
import android.provider.ContactsContract.RawContacts;
import android.provider.SyncStateContract;
import android.text.TextUtils;
@@ -100,7 +101,6 @@ public class BrowserProvider2 extends SQLiteContentProvider {
bookmarksColumns.put(Bookmarks.FAVICON, Bookmarks.FAVICON);
bookmarksColumns.put(Bookmarks.THUMBNAIL, Bookmarks.THUMBNAIL);
bookmarksColumns.put(Bookmarks.TOUCH_ICON, Bookmarks.TOUCH_ICON);
- bookmarksColumns.put(Bookmarks.USER_ENTERED, Bookmarks.USER_ENTERED);
// Bookmarks
HashMap<String, String> map = BOOKMARKS_PROJECTION_MAP;
@@ -161,7 +161,6 @@ public class BrowserProvider2 extends SQLiteContentProvider {
Bookmarks.FAVICON + " BLOB," +
Bookmarks.THUMBNAIL + " BLOB," +
Bookmarks.TOUCH_ICON + " BLOB," +
- Bookmarks.USER_ENTERED + " INTEGER," +
Bookmarks.IS_FOLDER + " INTEGER NOT NULL DEFAULT 0," +
Bookmarks.PARENT + " INTEGER NOT NULL DEFAULT 0," +
Bookmarks.POSITION + " INTEGER NOT NULL," +