Browser.java revision 52881c8631118d5af46a2ffa538b76ce1ea61547
1/* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.provider; 18 19import android.annotation.RequiresPermission; 20import android.content.ContentResolver; 21import android.content.ContentUris; 22import android.content.ContentValues; 23import android.content.Context; 24import android.content.Intent; 25import android.database.Cursor; 26import android.database.DatabaseUtils; 27import android.graphics.BitmapFactory; 28import android.net.Uri; 29import android.provider.BrowserContract.Bookmarks; 30import android.provider.BrowserContract.Combined; 31import android.provider.BrowserContract.History; 32import android.provider.BrowserContract.Searches; 33import android.util.Log; 34import android.webkit.WebIconDatabase; 35 36import static android.Manifest.permission.READ_HISTORY_BOOKMARKS; 37import static android.Manifest.permission.WRITE_HISTORY_BOOKMARKS; 38 39public class Browser { 40 private static final String LOGTAG = "browser"; 41 42 /** 43 * A table containing both bookmarks and history items. The columns of the table are defined in 44 * {@link BookmarkColumns}. Reading this table requires the 45 * {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} permission and writing to it 46 * requires the {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} permission. 47 */ 48 @RequiresPermission.Read(@RequiresPermission(READ_HISTORY_BOOKMARKS)) 49 @RequiresPermission.Write(@RequiresPermission(WRITE_HISTORY_BOOKMARKS)) 50 public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks"); 51 52 /** 53 * The name of extra data when starting Browser with ACTION_VIEW or 54 * ACTION_SEARCH intent. 55 * <p> 56 * The value should be an integer between 0 and 1000. If not set or set to 57 * 0, the Browser will use default. If set to 100, the Browser will start 58 * with 100%. 59 */ 60 public static final String INITIAL_ZOOM_LEVEL = "browser.initialZoomLevel"; 61 62 /** 63 * The name of the extra data when starting the Browser from another 64 * application. 65 * <p> 66 * The value is a unique identification string that will be used to 67 * identify the calling application. The Browser will attempt to reuse the 68 * same window each time the application launches the Browser with the same 69 * identifier. 70 */ 71 public static final String EXTRA_APPLICATION_ID = "com.android.browser.application_id"; 72 73 /** 74 * The name of the extra data in the VIEW intent. The data are key/value 75 * pairs in the format of Bundle. They will be sent in the HTTP request 76 * headers for the provided url. The keys can't be the standard HTTP headers 77 * as they are set by the WebView. The url's schema must be http(s). 78 * <p> 79 */ 80 public static final String EXTRA_HEADERS = "com.android.browser.headers"; 81 82 /* if you change column order you must also change indices 83 below */ 84 public static final String[] HISTORY_PROJECTION = new String[] { 85 BookmarkColumns._ID, // 0 86 BookmarkColumns.URL, // 1 87 BookmarkColumns.VISITS, // 2 88 BookmarkColumns.DATE, // 3 89 BookmarkColumns.BOOKMARK, // 4 90 BookmarkColumns.TITLE, // 5 91 BookmarkColumns.FAVICON, // 6 92 BookmarkColumns.THUMBNAIL, // 7 93 BookmarkColumns.TOUCH_ICON, // 8 94 BookmarkColumns.USER_ENTERED, // 9 95 }; 96 97 /* these indices dependent on HISTORY_PROJECTION */ 98 public static final int HISTORY_PROJECTION_ID_INDEX = 0; 99 public static final int HISTORY_PROJECTION_URL_INDEX = 1; 100 public static final int HISTORY_PROJECTION_VISITS_INDEX = 2; 101 public static final int HISTORY_PROJECTION_DATE_INDEX = 3; 102 public static final int HISTORY_PROJECTION_BOOKMARK_INDEX = 4; 103 public static final int HISTORY_PROJECTION_TITLE_INDEX = 5; 104 public static final int HISTORY_PROJECTION_FAVICON_INDEX = 6; 105 /** 106 * @hide 107 */ 108 public static final int HISTORY_PROJECTION_THUMBNAIL_INDEX = 7; 109 /** 110 * @hide 111 */ 112 public static final int HISTORY_PROJECTION_TOUCH_ICON_INDEX = 8; 113 114 /* columns needed to determine whether to truncate history */ 115 public static final String[] TRUNCATE_HISTORY_PROJECTION = new String[] { 116 BookmarkColumns._ID, 117 BookmarkColumns.DATE, 118 }; 119 120 public static final int TRUNCATE_HISTORY_PROJECTION_ID_INDEX = 0; 121 122 /* truncate this many history items at a time */ 123 public static final int TRUNCATE_N_OLDEST = 5; 124 125 /** 126 * A table containing a log of browser searches. The columns of the table are defined in 127 * {@link SearchColumns}. Reading this table requires the 128 * {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} permission and writing to it 129 * requires the {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} permission. 130 */ 131 @RequiresPermission.Read(@RequiresPermission(READ_HISTORY_BOOKMARKS)) 132 @RequiresPermission.Write(@RequiresPermission(WRITE_HISTORY_BOOKMARKS)) 133 public static final Uri SEARCHES_URI = Uri.parse("content://browser/searches"); 134 135 /** 136 * A projection of {@link #SEARCHES_URI} that contains {@link SearchColumns#_ID}, 137 * {@link SearchColumns#SEARCH}, and {@link SearchColumns#DATE}. 138 */ 139 public static final String[] SEARCHES_PROJECTION = new String[] { 140 // if you change column order you must also change indices below 141 SearchColumns._ID, // 0 142 SearchColumns.SEARCH, // 1 143 SearchColumns.DATE, // 2 144 }; 145 146 /* these indices dependent on SEARCHES_PROJECTION */ 147 public static final int SEARCHES_PROJECTION_SEARCH_INDEX = 1; 148 public static final int SEARCHES_PROJECTION_DATE_INDEX = 2; 149 150 /* Set a cap on the count of history items in the history/bookmark 151 table, to prevent db and layout operations from dragging to a 152 crawl. Revisit this cap when/if db/layout performance 153 improvements are made. Note: this does not affect bookmark 154 entries -- if the user wants more bookmarks than the cap, they 155 get them. */ 156 private static final int MAX_HISTORY_COUNT = 250; 157 158 /** 159 * Open an activity to save a bookmark. Launch with a title 160 * and/or a url, both of which can be edited by the user before saving. 161 * 162 * @param c Context used to launch the activity to add a bookmark. 163 * @param title Title for the bookmark. Can be null or empty string. 164 * @param url Url for the bookmark. Can be null or empty string. 165 */ 166 public static final void saveBookmark(Context c, 167 String title, 168 String url) { 169 Intent i = new Intent(Intent.ACTION_INSERT, Browser.BOOKMARKS_URI); 170 i.putExtra("title", title); 171 i.putExtra("url", url); 172 c.startActivity(i); 173 } 174 175 /** 176 * Boolean extra passed along with an Intent to a browser, specifying that 177 * a new tab be created. Overrides EXTRA_APPLICATION_ID; if both are set, 178 * a new tab will be used, rather than using the same one. 179 */ 180 public static final String EXTRA_CREATE_NEW_TAB = "create_new_tab"; 181 182 /** 183 * Stores a Bitmap extra in an {@link Intent} representing the screenshot of 184 * a page to share. When receiving an {@link Intent#ACTION_SEND} from the 185 * Browser, use this to access the screenshot. 186 * @hide 187 */ 188 public final static String EXTRA_SHARE_SCREENSHOT = "share_screenshot"; 189 190 /** 191 * Stores a Bitmap extra in an {@link Intent} representing the favicon of a 192 * page to share. When receiving an {@link Intent#ACTION_SEND} from the 193 * Browser, use this to access the favicon. 194 * @hide 195 */ 196 public final static String EXTRA_SHARE_FAVICON = "share_favicon"; 197 198 /** 199 * Sends the given string using an Intent with {@link Intent#ACTION_SEND} and a mime type 200 * of text/plain. The string is put into {@link Intent#EXTRA_TEXT}. 201 * 202 * @param context the context used to start the activity 203 * @param string the string to send 204 */ 205 public static final void sendString(Context context, String string) { 206 sendString(context, string, context.getString(com.android.internal.R.string.sendText)); 207 } 208 209 /** 210 * Find an application to handle the given string and, if found, invoke 211 * it with the given string as a parameter. 212 * @param c Context used to launch the new activity. 213 * @param stringToSend The string to be handled. 214 * @param chooserDialogTitle The title of the dialog that allows the user 215 * to select between multiple applications that are all capable of handling 216 * the string. 217 * @hide pending API council approval 218 */ 219 public static final void sendString(Context c, 220 String stringToSend, 221 String chooserDialogTitle) { 222 Intent send = new Intent(Intent.ACTION_SEND); 223 send.setType("text/plain"); 224 send.putExtra(Intent.EXTRA_TEXT, stringToSend); 225 226 try { 227 Intent i = Intent.createChooser(send, chooserDialogTitle); 228 // In case this is called from outside an Activity 229 i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 230 c.startActivity(i); 231 } catch(android.content.ActivityNotFoundException ex) { 232 // if no app handles it, do nothing 233 } 234 } 235 236 /** 237 * Return a cursor pointing to a list of all the bookmarks. The cursor will have a single 238 * column, {@link BookmarkColumns#URL}. 239 * <p> 240 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 241 * 242 * @param cr The ContentResolver used to access the database. 243 */ 244 @RequiresPermission(READ_HISTORY_BOOKMARKS) 245 public static final Cursor getAllBookmarks(ContentResolver cr) throws 246 IllegalStateException { 247 return cr.query(Bookmarks.CONTENT_URI, 248 new String[] { Bookmarks.URL }, 249 Bookmarks.IS_FOLDER + " = 0", null, null); 250 } 251 252 /** 253 * Return a cursor pointing to a list of all visited site urls. The cursor will 254 * have a single column, {@link BookmarkColumns#URL}. 255 * <p> 256 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 257 * 258 * @param cr The ContentResolver used to access the database. 259 */ 260 @RequiresPermission(READ_HISTORY_BOOKMARKS) 261 public static final Cursor getAllVisitedUrls(ContentResolver cr) throws 262 IllegalStateException { 263 return cr.query(Combined.CONTENT_URI, 264 new String[] { Combined.URL }, null, null, 265 Combined.DATE_CREATED + " ASC"); 266 } 267 268 private static final void addOrUrlEquals(StringBuilder sb) { 269 sb.append(" OR " + BookmarkColumns.URL + " = "); 270 } 271 272 private static final Cursor getVisitedLike(ContentResolver cr, String url) { 273 boolean secure = false; 274 String compareString = url; 275 if (compareString.startsWith("http://")) { 276 compareString = compareString.substring(7); 277 } else if (compareString.startsWith("https://")) { 278 compareString = compareString.substring(8); 279 secure = true; 280 } 281 if (compareString.startsWith("www.")) { 282 compareString = compareString.substring(4); 283 } 284 StringBuilder whereClause = null; 285 if (secure) { 286 whereClause = new StringBuilder(Bookmarks.URL + " = "); 287 DatabaseUtils.appendEscapedSQLString(whereClause, 288 "https://" + compareString); 289 addOrUrlEquals(whereClause); 290 DatabaseUtils.appendEscapedSQLString(whereClause, 291 "https://www." + compareString); 292 } else { 293 whereClause = new StringBuilder(Bookmarks.URL + " = "); 294 DatabaseUtils.appendEscapedSQLString(whereClause, 295 compareString); 296 addOrUrlEquals(whereClause); 297 String wwwString = "www." + compareString; 298 DatabaseUtils.appendEscapedSQLString(whereClause, 299 wwwString); 300 addOrUrlEquals(whereClause); 301 DatabaseUtils.appendEscapedSQLString(whereClause, 302 "http://" + compareString); 303 addOrUrlEquals(whereClause); 304 DatabaseUtils.appendEscapedSQLString(whereClause, 305 "http://" + wwwString); 306 } 307 return cr.query(History.CONTENT_URI, new String[] { History._ID, History.VISITS }, 308 whereClause.toString(), null, null); 309 } 310 311 /** 312 * Update the visited history to acknowledge that a site has been 313 * visited. 314 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 315 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 316 * @param cr The ContentResolver used to access the database. 317 * @param url The site being visited. 318 * @param real If true, this is an actual visit, and should add to the 319 * number of visits. If false, the user entered it manually. 320 */ 321 @RequiresPermission(allOf = {READ_HISTORY_BOOKMARKS, WRITE_HISTORY_BOOKMARKS}) 322 public static final void updateVisitedHistory(ContentResolver cr, 323 String url, boolean real) { 324 long now = System.currentTimeMillis(); 325 Cursor c = null; 326 try { 327 c = getVisitedLike(cr, url); 328 /* We should only get one answer that is exactly the same. */ 329 if (c.moveToFirst()) { 330 ContentValues values = new ContentValues(); 331 if (real) { 332 values.put(History.VISITS, c.getInt(1) + 1); 333 } else { 334 values.put(History.USER_ENTERED, 1); 335 } 336 values.put(History.DATE_LAST_VISITED, now); 337 cr.update(ContentUris.withAppendedId(History.CONTENT_URI, c.getLong(0)), 338 values, null, null); 339 } else { 340 truncateHistory(cr); 341 ContentValues values = new ContentValues(); 342 int visits; 343 int user_entered; 344 if (real) { 345 visits = 1; 346 user_entered = 0; 347 } else { 348 visits = 0; 349 user_entered = 1; 350 } 351 values.put(History.URL, url); 352 values.put(History.VISITS, visits); 353 values.put(History.DATE_LAST_VISITED, now); 354 values.put(History.TITLE, url); 355 values.put(History.DATE_CREATED, 0); 356 values.put(History.USER_ENTERED, user_entered); 357 cr.insert(History.CONTENT_URI, values); 358 } 359 } catch (IllegalStateException e) { 360 Log.e(LOGTAG, "updateVisitedHistory", e); 361 } finally { 362 if (c != null) c.close(); 363 } 364 } 365 366 /** 367 * Returns all the URLs in the history. 368 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 369 * @param cr The ContentResolver used to access the database. 370 * @hide pending API council approval 371 */ 372 @RequiresPermission(READ_HISTORY_BOOKMARKS) 373 public static final String[] getVisitedHistory(ContentResolver cr) { 374 Cursor c = null; 375 String[] str = null; 376 try { 377 String[] projection = new String[] { 378 History.URL, 379 }; 380 c = cr.query(History.CONTENT_URI, projection, History.VISITS + " > 0", null, null); 381 if (c == null) return new String[0]; 382 str = new String[c.getCount()]; 383 int i = 0; 384 while (c.moveToNext()) { 385 str[i] = c.getString(0); 386 i++; 387 } 388 } catch (IllegalStateException e) { 389 Log.e(LOGTAG, "getVisitedHistory", e); 390 str = new String[0]; 391 } finally { 392 if (c != null) c.close(); 393 } 394 return str; 395 } 396 397 /** 398 * If there are more than MAX_HISTORY_COUNT non-bookmark history 399 * items in the bookmark/history table, delete TRUNCATE_N_OLDEST 400 * of them. This is used to keep our history table to a 401 * reasonable size. Note: it does not prune bookmarks. If the 402 * user wants 1000 bookmarks, the user gets 1000 bookmarks. 403 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 404 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 405 * 406 * @param cr The ContentResolver used to access the database. 407 */ 408 @RequiresPermission(allOf = {READ_HISTORY_BOOKMARKS, WRITE_HISTORY_BOOKMARKS}) 409 public static final void truncateHistory(ContentResolver cr) { 410 // TODO make a single request to the provider to do this in a single transaction 411 Cursor cursor = null; 412 try { 413 414 // Select non-bookmark history, ordered by date 415 cursor = cr.query(History.CONTENT_URI, 416 new String[] { History._ID, History.URL, History.DATE_LAST_VISITED }, 417 null, null, History.DATE_LAST_VISITED + " ASC"); 418 419 if (cursor.moveToFirst() && cursor.getCount() >= MAX_HISTORY_COUNT) { 420 /* eliminate oldest history items */ 421 for (int i = 0; i < TRUNCATE_N_OLDEST; i++) { 422 cr.delete(ContentUris.withAppendedId(History.CONTENT_URI, cursor.getLong(0)), 423 null, null); 424 if (!cursor.moveToNext()) break; 425 } 426 } 427 } catch (IllegalStateException e) { 428 Log.e(LOGTAG, "truncateHistory", e); 429 } finally { 430 if (cursor != null) cursor.close(); 431 } 432 } 433 434 /** 435 * Returns whether there is any history to clear. 436 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 437 * @param cr The ContentResolver used to access the database. 438 * @return boolean True if the history can be cleared. 439 */ 440 @RequiresPermission(READ_HISTORY_BOOKMARKS) 441 public static final boolean canClearHistory(ContentResolver cr) { 442 Cursor cursor = null; 443 boolean ret = false; 444 try { 445 cursor = cr.query(History.CONTENT_URI, 446 new String [] { History._ID, History.VISITS }, 447 null, null, null); 448 ret = cursor.getCount() > 0; 449 } catch (IllegalStateException e) { 450 Log.e(LOGTAG, "canClearHistory", e); 451 } finally { 452 if (cursor != null) cursor.close(); 453 } 454 return ret; 455 } 456 457 /** 458 * Delete all entries from the bookmarks/history table which are 459 * not bookmarks. Also set all visited bookmarks to unvisited. 460 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 461 * @param cr The ContentResolver used to access the database. 462 */ 463 @RequiresPermission(WRITE_HISTORY_BOOKMARKS) 464 public static final void clearHistory(ContentResolver cr) { 465 deleteHistoryWhere(cr, null); 466 } 467 468 /** 469 * Helper function to delete all history items and release the icons for them in the 470 * {@link WebIconDatabase}. 471 * 472 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 473 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 474 * 475 * @param cr The ContentResolver used to access the database. 476 * @param whereClause String to limit the items affected. 477 * null means all items. 478 */ 479 @RequiresPermission(allOf = {READ_HISTORY_BOOKMARKS, WRITE_HISTORY_BOOKMARKS}) 480 private static final void deleteHistoryWhere(ContentResolver cr, String whereClause) { 481 Cursor cursor = null; 482 try { 483 cursor = cr.query(History.CONTENT_URI, new String[] { History.URL }, whereClause, 484 null, null); 485 if (cursor.moveToFirst()) { 486 cr.delete(History.CONTENT_URI, whereClause, null); 487 } 488 } catch (IllegalStateException e) { 489 Log.e(LOGTAG, "deleteHistoryWhere", e); 490 return; 491 } finally { 492 if (cursor != null) cursor.close(); 493 } 494 } 495 496 /** 497 * Delete all history items from begin to end. 498 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 499 * @param cr The ContentResolver used to access the database. 500 * @param begin First date to remove. If -1, all dates before end. 501 * Inclusive. 502 * @param end Last date to remove. If -1, all dates after begin. 503 * Non-inclusive. 504 */ 505 @RequiresPermission(WRITE_HISTORY_BOOKMARKS) 506 public static final void deleteHistoryTimeFrame(ContentResolver cr, 507 long begin, long end) { 508 String whereClause; 509 String date = BookmarkColumns.DATE; 510 if (-1 == begin) { 511 if (-1 == end) { 512 clearHistory(cr); 513 return; 514 } 515 whereClause = date + " < " + Long.toString(end); 516 } else if (-1 == end) { 517 whereClause = date + " >= " + Long.toString(begin); 518 } else { 519 whereClause = date + " >= " + Long.toString(begin) + " AND " + date 520 + " < " + Long.toString(end); 521 } 522 deleteHistoryWhere(cr, whereClause); 523 } 524 525 /** 526 * Remove a specific url from the history database. 527 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 528 * @param cr The ContentResolver used to access the database. 529 * @param url url to remove. 530 */ 531 @RequiresPermission(WRITE_HISTORY_BOOKMARKS) 532 public static final void deleteFromHistory(ContentResolver cr, 533 String url) { 534 cr.delete(History.CONTENT_URI, History.URL + "=?", new String[] { url }); 535 } 536 537 /** 538 * Add a search string to the searches database. 539 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 540 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 541 * @param cr The ContentResolver used to access the database. 542 * @param search The string to add to the searches database. 543 */ 544 @RequiresPermission(allOf = {READ_HISTORY_BOOKMARKS, WRITE_HISTORY_BOOKMARKS}) 545 public static final void addSearchUrl(ContentResolver cr, String search) { 546 // The content provider will take care of updating existing searches instead of duplicating 547 ContentValues values = new ContentValues(); 548 values.put(Searches.SEARCH, search); 549 values.put(Searches.DATE, System.currentTimeMillis()); 550 cr.insert(Searches.CONTENT_URI, values); 551 } 552 553 /** 554 * Remove all searches from the search database. 555 * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} 556 * @param cr The ContentResolver used to access the database. 557 */ 558 @RequiresPermission(WRITE_HISTORY_BOOKMARKS) 559 public static final void clearSearches(ContentResolver cr) { 560 // FIXME: Should this clear the urls to which these searches lead? 561 // (i.e. remove google.com/query= blah blah blah) 562 try { 563 cr.delete(Searches.CONTENT_URI, null, null); 564 } catch (IllegalStateException e) { 565 Log.e(LOGTAG, "clearSearches", e); 566 } 567 } 568 569 /** 570 * Request all icons from the database. This call must either be called 571 * in the main thread or have had Looper.prepare() invoked in the calling 572 * thread. 573 * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} 574 * @param cr The ContentResolver used to access the database. 575 * @param where Clause to be used to limit the query from the database. 576 * Must be an allowable string to be passed into a database query. 577 * @param listener IconListener that gets the icons once they are 578 * retrieved. 579 */ 580 @RequiresPermission(READ_HISTORY_BOOKMARKS) 581 public static final void requestAllIcons(ContentResolver cr, String where, 582 WebIconDatabase.IconListener listener) { 583 // Do nothing: this is no longer used. 584 } 585 586 /** 587 * Column definitions for the mixed bookmark and history items available 588 * at {@link #BOOKMARKS_URI}. 589 */ 590 public static class BookmarkColumns implements BaseColumns { 591 /** 592 * The URL of the bookmark or history item. 593 * <p>Type: TEXT (URL)</p> 594 */ 595 public static final String URL = "url"; 596 597 /** 598 * The number of time the item has been visited. 599 * <p>Type: NUMBER</p> 600 */ 601 public static final String VISITS = "visits"; 602 603 /** 604 * The date the item was last visited, in milliseconds since the epoch. 605 * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p> 606 */ 607 public static final String DATE = "date"; 608 609 /** 610 * Flag indicating that an item is a bookmark. A value of 1 indicates a bookmark, a value 611 * of 0 indicates a history item. 612 * <p>Type: INTEGER (boolean)</p> 613 */ 614 public static final String BOOKMARK = "bookmark"; 615 616 /** 617 * The user visible title of the bookmark or history item. 618 * <p>Type: TEXT</p> 619 */ 620 public static final String TITLE = "title"; 621 622 /** 623 * The date the item created, in milliseconds since the epoch. 624 * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p> 625 */ 626 public static final String CREATED = "created"; 627 628 /** 629 * The favicon of the bookmark. Must decode via {@link BitmapFactory#decodeByteArray}. 630 * <p>Type: BLOB (image)</p> 631 */ 632 public static final String FAVICON = "favicon"; 633 634 /** 635 * @hide 636 */ 637 public static final String THUMBNAIL = "thumbnail"; 638 639 /** 640 * @hide 641 */ 642 public static final String TOUCH_ICON = "touch_icon"; 643 644 /** 645 * @hide 646 */ 647 public static final String USER_ENTERED = "user_entered"; 648 } 649 650 /** 651 * Column definitions for the search history table, available at {@link #SEARCHES_URI}. 652 */ 653 public static class SearchColumns implements BaseColumns { 654 /** 655 * @deprecated Not used. 656 */ 657 @Deprecated 658 public static final String URL = "url"; 659 660 /** 661 * The user entered search term. 662 */ 663 public static final String SEARCH = "search"; 664 665 /** 666 * The date the search was performed, in milliseconds since the epoch. 667 * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p> 668 */ 669 public static final String DATE = "date"; 670 } 671} 672