show Toast if InstalledAppProviderService encounters EIO errors
A notification would be better, but a Toast is better than nothing.
This commit is contained in:
parent
dacebceff6
commit
9cc66e035a
@ -11,12 +11,16 @@ import android.net.Uri;
|
|||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
import org.acra.ACRA;
|
import org.acra.ACRA;
|
||||||
import org.fdroid.fdroid.AppUpdateStatusManager;
|
import org.fdroid.fdroid.AppUpdateStatusManager;
|
||||||
import org.fdroid.fdroid.Hasher;
|
import org.fdroid.fdroid.Hasher;
|
||||||
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.Schema.InstalledAppTable;
|
import org.fdroid.fdroid.data.Schema.InstalledAppTable;
|
||||||
|
import rx.functions.Action1;
|
||||||
|
import rx.schedulers.Schedulers;
|
||||||
|
import rx.subjects.PublishSubject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
@ -25,10 +29,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import rx.functions.Action1;
|
|
||||||
import rx.schedulers.Schedulers;
|
|
||||||
import rx.subjects.PublishSubject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all updates to {@link InstalledAppProvider}, whether checking the contents
|
* Handles all updates to {@link InstalledAppProvider}, whether checking the contents
|
||||||
* versus what Android says is installed, or processing {@link Intent}s that come
|
* versus what Android says is installed, or processing {@link Intent}s that come
|
||||||
@ -76,12 +76,12 @@ public class InstalledAppProviderService extends IntentService {
|
|||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.debounce(3, TimeUnit.SECONDS)
|
.debounce(3, TimeUnit.SECONDS)
|
||||||
.subscribe(new Action1<String>() {
|
.subscribe(new Action1<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void call(String packageName) {
|
public void call(String packageName) {
|
||||||
Utils.debugLog(TAG, "Notifying content providers (so they can update the relevant views).");
|
Utils.debugLog(TAG, "Notifying content providers (so they can update the relevant views).");
|
||||||
getContentResolver().notifyChange(AppProvider.getContentUri(), null);
|
getContentResolver().notifyChange(AppProvider.getContentUri(), null);
|
||||||
getContentResolver().notifyChange(ApkProvider.getContentUri(), null);
|
getContentResolver().notifyChange(ApkProvider.getContentUri(), null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ...alternatively, this non-debounced version will instantly emit an event about the
|
// ...alternatively, this non-debounced version will instantly emit an event about the
|
||||||
@ -250,6 +250,8 @@ public class InstalledAppProviderService extends IntentService {
|
|||||||
|
|
||||||
insertAppIntoDb(this, packageInfo, hashType, hash);
|
insertAppIntoDb(this, packageInfo, hashType, hash);
|
||||||
} catch (Utils.PotentialFilesystemCorruptionException e) {
|
} catch (Utils.PotentialFilesystemCorruptionException e) {
|
||||||
|
String msg = getString(R.string.installed_app__file_corrupt, apk.getAbsolutePath());
|
||||||
|
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
|
||||||
Log.e(TAG, "Encountered potential filesystem corruption, or other unknown " +
|
Log.e(TAG, "Encountered potential filesystem corruption, or other unknown " +
|
||||||
"problem when calculating hash of " + apk.getAbsolutePath() + ". " +
|
"problem when calculating hash of " + apk.getAbsolutePath() + ". " +
|
||||||
"It is unlikely F-Droid can do anything about this, and this " +
|
"It is unlikely F-Droid can do anything about this, and this " +
|
||||||
|
@ -93,6 +93,7 @@ This often occurs with apps installed via Google Play or other sources, if they
|
|||||||
<string name="installed_app__updates_ignored_for_suggested_version">Updates ignored for Version %1$s</string>
|
<string name="installed_app__updates_ignored_for_suggested_version">Updates ignored for Version %1$s</string>
|
||||||
<!-- The inline download button shown in the "Updates" screen only uses an icon and so requires
|
<!-- The inline download button shown in the "Updates" screen only uses an icon and so requires
|
||||||
some descriptive text for the TTS engine -->
|
some descriptive text for the TTS engine -->
|
||||||
|
<string name="installed_app__file_corrupt">F-Droid received EIO error: %s is probably corrupt!</string>
|
||||||
<string name="updates__tts__download_app">Download</string>
|
<string name="updates__tts__download_app">Download</string>
|
||||||
<string name="updates__tts__download_updates_for_all_apps">Download all updates</string>
|
<string name="updates__tts__download_updates_for_all_apps">Download all updates</string>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user