use of android.database.sqlite.SQLiteFullException in project MiMangaNu by raulhaag.
the class Database method updateChapterDownloaded.
public static void updateChapterDownloaded(Context context, int cid, int state) {
ContentValues cv = new ContentValues();
cv.put(COL_CAP_DOWNLOADED, state);
try {
SQLiteDatabase database = getDatabase(context);
if (!database.isReadOnly())
database.update(TABLE_CHAPTERS, cv, COL_CAP_ID + "=" + Integer.toString(cid), null);
else {
Log.e("Database", "(updateChapterDownloaded) " + context.getResources().getString(R.string.error_database_is_read_only));
Util.getInstance().toast(context, context.getResources().getString(R.string.error_database_is_read_only));
}
} catch (SQLiteFullException sqlfe) {
Log.e("Database", "SQLiteFullException", sqlfe);
Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
} catch (SQLiteDiskIOException sqldioe) {
Log.e("Database", "SQLiteDiskIOException", sqldioe);
Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
} catch (Exception e) {
Log.e("Database", "Exception", e);
Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
}
}
use of android.database.sqlite.SQLiteFullException in project Zom-Android by zom.
the class ImPluginHelper method createAdditionalProvider.
public long createAdditionalProvider(String name) {
List<ResolveInfo> plugins = getPlugins();
ResolveInfo info = null;
ServiceInfo serviceInfo = null;
Bundle metaData = null;
long providerId = -1;
for (ResolveInfo _info : plugins) {
serviceInfo = _info.serviceInfo;
if (serviceInfo == null) {
Log.e(TAG, "Ignore bad IM plugin: " + _info);
continue;
}
if (serviceInfo.metaData == null) {
Log.e(TAG, "Ignore bad IM plugin: " + _info);
continue;
}
metaData = serviceInfo.metaData;
if (name.equals(metaData.getString(ImPluginConstants.METADATA_PROVIDER_NAME))) {
info = _info;
break;
}
}
if (info == null) {
Log.e(TAG, "Did not find plugin " + name);
return -1;
}
String providerName = metaData.getString(ImPluginConstants.METADATA_PROVIDER_NAME);
String providerFullName = metaData.getString(ImPluginConstants.METADATA_PROVIDER_FULL_NAME);
String signUpUrl = metaData.getString(ImPluginConstants.METADATA_SIGN_UP_URL);
if (TextUtils.isEmpty(providerName) || TextUtils.isEmpty(providerFullName)) {
Log.e(TAG, "Ignore bad IM plugin: " + info + ". Lack of required meta data");
return -1;
}
/*
if (!serviceInfo.packageName.equals(mContext.getPackageName())) {
Log.e(TAG, "Ignore plugin in package: " + serviceInfo.packageName);
return -1;
}*/
ImPluginInfo pluginInfo = new ImPluginInfo(providerName, serviceInfo.packageName, serviceInfo.name, serviceInfo.applicationInfo.sourceDir);
ImPlugin plugin = loadPlugin(pluginInfo);
if (plugin == null) {
Log.e(TAG, "Ignore bad IM plugin");
return -1;
}
try {
providerId = insertProviderDb(plugin, pluginInfo, providerFullName, signUpUrl);
} catch (SQLiteFullException e) {
Log.e(TAG, "Storage full", e);
return -1;
}
mPluginsInfo.add(pluginInfo);
mPluginObjects.add(plugin);
return providerId;
}
use of android.database.sqlite.SQLiteFullException in project android_packages_apps_Dialer by LineageOS.
the class ContactInfoHelper method updateCallLogContactInfo.
/**
* Stores differences between the updated contact info and the current call log contact info.
*
* @param number The number of the contact.
* @param countryIso The country associated with this number.
* @param updatedInfo The updated contact info.
* @param callLogInfo The call log entry's current contact info.
*/
public void updateCallLogContactInfo(String number, String countryIso, ContactInfo updatedInfo, ContactInfo callLogInfo) {
if (!PermissionsUtil.hasPermission(mContext, android.Manifest.permission.WRITE_CALL_LOG)) {
return;
}
final ContentValues values = new ContentValues();
boolean needsUpdate = false;
if (callLogInfo != null) {
if (!TextUtils.equals(updatedInfo.name, callLogInfo.name)) {
values.put(Calls.CACHED_NAME, updatedInfo.name);
needsUpdate = true;
}
if (updatedInfo.type != callLogInfo.type) {
values.put(Calls.CACHED_NUMBER_TYPE, updatedInfo.type);
needsUpdate = true;
}
if (!TextUtils.equals(updatedInfo.label, callLogInfo.label)) {
values.put(Calls.CACHED_NUMBER_LABEL, updatedInfo.label);
needsUpdate = true;
}
if (!UriUtils.areEqual(updatedInfo.lookupUri, callLogInfo.lookupUri)) {
values.put(Calls.CACHED_LOOKUP_URI, UriUtils.uriToString(updatedInfo.lookupUri));
needsUpdate = true;
}
// Only replace the normalized number if the new updated normalized number isn't empty.
if (!TextUtils.isEmpty(updatedInfo.normalizedNumber) && !TextUtils.equals(updatedInfo.normalizedNumber, callLogInfo.normalizedNumber)) {
values.put(Calls.CACHED_NORMALIZED_NUMBER, updatedInfo.normalizedNumber);
needsUpdate = true;
}
if (!TextUtils.equals(updatedInfo.number, callLogInfo.number)) {
values.put(Calls.CACHED_MATCHED_NUMBER, updatedInfo.number);
needsUpdate = true;
}
if (updatedInfo.photoId != callLogInfo.photoId) {
values.put(Calls.CACHED_PHOTO_ID, updatedInfo.photoId);
needsUpdate = true;
}
final Uri updatedPhotoUriContactsOnly = UriUtils.nullForNonContactsUri(updatedInfo.photoUri);
if (!UriUtils.areEqual(updatedPhotoUriContactsOnly, callLogInfo.photoUri)) {
values.put(Calls.CACHED_PHOTO_URI, UriUtils.uriToString(updatedPhotoUriContactsOnly));
needsUpdate = true;
}
if (!TextUtils.equals(updatedInfo.formattedNumber, callLogInfo.formattedNumber)) {
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
needsUpdate = true;
}
if (!TextUtils.equals(updatedInfo.geoDescription, callLogInfo.geoDescription)) {
values.put(Calls.GEOCODED_LOCATION, updatedInfo.geoDescription);
needsUpdate = true;
}
} else {
// No previous values, store all of them.
values.put(Calls.CACHED_NAME, updatedInfo.name);
values.put(Calls.CACHED_NUMBER_TYPE, updatedInfo.type);
values.put(Calls.CACHED_NUMBER_LABEL, updatedInfo.label);
values.put(Calls.CACHED_LOOKUP_URI, UriUtils.uriToString(updatedInfo.lookupUri));
values.put(Calls.CACHED_MATCHED_NUMBER, updatedInfo.number);
values.put(Calls.CACHED_NORMALIZED_NUMBER, updatedInfo.normalizedNumber);
values.put(Calls.CACHED_PHOTO_ID, updatedInfo.photoId);
values.put(Calls.CACHED_PHOTO_URI, UriUtils.uriToString(UriUtils.nullForNonContactsUri(updatedInfo.photoUri)));
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
values.put(Calls.GEOCODED_LOCATION, updatedInfo.geoDescription);
needsUpdate = true;
}
if (!needsUpdate) {
return;
}
try {
if (countryIso == null) {
mContext.getContentResolver().update(TelecomUtil.getCallLogUri(mContext), values, Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " IS NULL", new String[] { number });
} else {
mContext.getContentResolver().update(TelecomUtil.getCallLogUri(mContext), values, Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " = ?", new String[] { number, countryIso });
}
} catch (SQLiteFullException e) {
LogUtil.e(TAG, "Unable to update contact info in call log db", e);
}
}
use of android.database.sqlite.SQLiteFullException in project AnExplorer by 1hakr.
the class DocumentsActivity method onCreate.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onCreate(Bundle icicle) {
setTheme(R.style.Theme_Document);
if (Utils.hasLollipop()) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
} else if (Utils.hasKitKat()) {
setTheme(R.style.Theme_Document_Translucent);
}
setUpStatusBar();
/* StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll()
.penaltyLog()
.build());
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll()
.penaltyLog()
.build());
*/
super.onCreate(icicle);
mRoots = DocumentsApplication.getRootsCache(this);
setResult(Activity.RESULT_CANCELED);
setContentView(R.layout.activity);
final Context context = this;
final Resources res = getResources();
mShowAsDialog = res.getBoolean(R.bool.show_as_dialog);
mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
mRateContainer = (FrameLayout) findViewById(R.id.container_rate);
initControls();
if (icicle != null) {
mState = icicle.getParcelable(EXTRA_STATE);
mAuthenticated = icicle.getBoolean(EXTRA_AUTHENTICATED);
mActionMode = icicle.getBoolean(EXTRA_ACTIONMODE);
} else {
buildDefaultState();
}
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setTitleTextAppearance(context, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
if (Utils.hasKitKat() && !Utils.hasLollipop()) {
((LinearLayout.LayoutParams) mToolbar.getLayoutParams()).setMargins(0, getStatusBarHeight(this), 0, 0);
mToolbar.setPadding(0, getStatusBarHeight(this), 0, 0);
}
mToolbarStack = (Spinner) findViewById(R.id.stack);
mToolbarStack.setOnItemSelectedListener(mStackListener);
setSupportActionBar(mToolbar);
mRootsContainer = findViewById(R.id.drawer_roots);
mInfoContainer = findViewById(R.id.container_info);
if (!mShowAsDialog) {
// Non-dialog means we have a drawer
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.drawer_open, R.string.drawer_close);
mDrawerLayout.setDrawerListener(mDrawerListener);
// mDrawerLayout.setDrawerShadow(R.drawable.ic_drawer_shadow, GravityCompat.START);
lockInfoContainter();
}
changeActionBarColor();
initProtection();
// Hide roots when we're managing a specific root
if (mState.action == ACTION_MANAGE) {
if (mShowAsDialog) {
findViewById(R.id.container_roots).setVisibility(View.GONE);
} else {
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
}
if (mState.action == ACTION_CREATE) {
final String mimeType = getIntent().getType();
final String title = getIntent().getStringExtra(IntentUtils.EXTRA_TITLE);
SaveFragment.show(getFragmentManager(), mimeType, title);
} else if (mState.action == ACTION_OPEN_TREE) {
PickFragment.show(getFragmentManager());
}
if (mState.action == ACTION_BROWSE) {
final Intent moreApps = new Intent(getIntent());
moreApps.setComponent(null);
moreApps.setPackage(null);
RootsFragment.show(getFragmentManager(), moreApps);
} else if (mState.action == ACTION_OPEN || mState.action == ACTION_CREATE || mState.action == ACTION_GET_CONTENT || mState.action == ACTION_OPEN_TREE) {
RootsFragment.show(getFragmentManager(), new Intent());
}
if (!mState.restored) {
if (mState.action == ACTION_MANAGE) {
final Uri rootUri = getIntent().getData();
new RestoreRootTask(rootUri).executeOnExecutor(getCurrentExecutor());
} else {
if (isDownloadAuthority(getIntent())) {
onRootPicked(getDownloadRoot(), true);
} else if (ConnectionUtils.isServerAuthority(getIntent())) {
RootInfo root = getIntent().getExtras().getParcelable(EXTRA_ROOT);
onRootPicked(root, true);
} else if (Utils.isQSTile(getIntent())) {
NetworkConnection networkConnection = NetworkConnection.getDefaultServer(this);
RootInfo root = mRoots.getRootInfo(networkConnection);
onRootPicked(root, true);
} else {
try {
new RestoreStackTask().execute();
} catch (SQLiteFullException e) {
CrashReportingManager.logException(e);
}
}
}
} else {
onCurrentDirectoryChanged(ANIM_NONE);
}
if (!PermissionUtil.hasStoragePermission(this)) {
requestStoragePermissions();
}
}
use of android.database.sqlite.SQLiteFullException in project android_packages_apps_Dialer by MoKee.
the class ContactInfoHelper method updateCallLogContactInfo.
/**
* Stores differences between the updated contact info and the current call log contact info.
*
* @param number The number of the contact.
* @param countryIso The country associated with this number.
* @param updatedInfo The updated contact info.
* @param callLogInfo The call log entry's current contact info.
*/
public void updateCallLogContactInfo(String number, String countryIso, ContactInfo updatedInfo, ContactInfo callLogInfo) {
if (!PermissionsUtil.hasPermission(mContext, android.Manifest.permission.WRITE_CALL_LOG)) {
return;
}
final ContentValues values = new ContentValues();
boolean needsUpdate = false;
if (callLogInfo != null) {
if (!TextUtils.equals(updatedInfo.name, callLogInfo.name)) {
values.put(Calls.CACHED_NAME, updatedInfo.name);
needsUpdate = true;
}
if (updatedInfo.type != callLogInfo.type) {
values.put(Calls.CACHED_NUMBER_TYPE, updatedInfo.type);
needsUpdate = true;
}
if (!TextUtils.equals(updatedInfo.label, callLogInfo.label)) {
values.put(Calls.CACHED_NUMBER_LABEL, updatedInfo.label);
needsUpdate = true;
}
if (!UriUtils.areEqual(updatedInfo.lookupUri, callLogInfo.lookupUri)) {
values.put(Calls.CACHED_LOOKUP_URI, UriUtils.uriToString(updatedInfo.lookupUri));
needsUpdate = true;
}
// Only replace the normalized number if the new updated normalized number isn't empty.
if (!TextUtils.isEmpty(updatedInfo.normalizedNumber) && !TextUtils.equals(updatedInfo.normalizedNumber, callLogInfo.normalizedNumber)) {
values.put(Calls.CACHED_NORMALIZED_NUMBER, updatedInfo.normalizedNumber);
needsUpdate = true;
}
if (!TextUtils.equals(updatedInfo.number, callLogInfo.number)) {
values.put(Calls.CACHED_MATCHED_NUMBER, updatedInfo.number);
needsUpdate = true;
}
if (updatedInfo.photoId != callLogInfo.photoId) {
values.put(Calls.CACHED_PHOTO_ID, updatedInfo.photoId);
needsUpdate = true;
}
final Uri updatedPhotoUriContactsOnly = UriUtils.nullForNonContactsUri(updatedInfo.photoUri);
if (DialerCompatUtils.isCallsCachedPhotoUriCompatible() && !UriUtils.areEqual(updatedPhotoUriContactsOnly, callLogInfo.photoUri)) {
values.put(Calls.CACHED_PHOTO_URI, UriUtils.uriToString(updatedPhotoUriContactsOnly));
needsUpdate = true;
}
if (!TextUtils.equals(updatedInfo.formattedNumber, callLogInfo.formattedNumber)) {
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
needsUpdate = true;
}
} else {
// No previous values, store all of them.
values.put(Calls.CACHED_NAME, updatedInfo.name);
values.put(Calls.CACHED_NUMBER_TYPE, updatedInfo.type);
values.put(Calls.CACHED_NUMBER_LABEL, updatedInfo.label);
values.put(Calls.CACHED_LOOKUP_URI, UriUtils.uriToString(updatedInfo.lookupUri));
values.put(Calls.CACHED_MATCHED_NUMBER, updatedInfo.number);
values.put(Calls.CACHED_NORMALIZED_NUMBER, updatedInfo.normalizedNumber);
values.put(Calls.CACHED_PHOTO_ID, updatedInfo.photoId);
if (DialerCompatUtils.isCallsCachedPhotoUriCompatible()) {
values.put(Calls.CACHED_PHOTO_URI, UriUtils.uriToString(UriUtils.nullForNonContactsUri(updatedInfo.photoUri)));
}
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
needsUpdate = true;
}
if (!needsUpdate) {
return;
}
try {
if (countryIso == null) {
mContext.getContentResolver().update(TelecomUtil.getCallLogUri(mContext), values, Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " IS NULL", new String[] { number });
} else {
mContext.getContentResolver().update(TelecomUtil.getCallLogUri(mContext), values, Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " = ?", new String[] { number, countryIso });
}
} catch (SQLiteFullException e) {
Log.e(TAG, "Unable to update contact info in call log db", e);
}
}
Aggregations