Fix RuntimeException on Android M Preview

This commit is contained in:
Anthony Restaino 2015-08-05 22:10:51 -04:00
parent 29d2a5f3e5
commit 5081ee2ea6
4 changed files with 10 additions and 6 deletions

View File

@ -1859,7 +1859,8 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse
if (isSystemBrowserAvailable() && mPreferences.getSyncHistoryEnabled()) {
try {
Browser.updateVisitedHistory(getContentResolver(), url, true);
} catch (NullPointerException ignored) {
} catch (Exception ignored) {
// ignored
}
}
try {
@ -1890,10 +1891,9 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse
String[] columns = new String[]{"url", "title"};
boolean browserFlag;
try {
Uri bookmarks = Browser.BOOKMARKS_URI;
c = getContentResolver().query(bookmarks, columns, null, null, null);
} catch (SQLiteException | IllegalStateException | NullPointerException e) {
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -399,7 +399,7 @@ public class BookmarkManager {
* This method imports all bookmarks that are included in the device's
* permanent bookmark storage
*/
public synchronized void importBookmarksFromBrowser(Activity activity) {
public synchronized void importBookmarksFromBrowser(Activity activity) throws Exception{
if (PreferenceManager.getInstance().getSystemBrowserPresent()) {
List<HistoryItem> bookmarkList = new ArrayList<>();

View File

@ -74,7 +74,11 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
createDialog();
return true;
case SETTINGS_BROWSER_IMPORT:
try {
mBookmarkManager.importBookmarksFromBrowser(getActivity());
} catch (Exception e) {
e.printStackTrace();
}
return true;
default:
return false;

View File

@ -44,7 +44,7 @@ public class WebUtils {
if (systemBrowserPresent) {
try {
Browser.clearHistory(context.getContentResolver());
} catch (NullPointerException ignored) {
} catch (Exception ignored) {
// ignored
}
}