Clean up pre-Lollipop checks
This commit is contained in:
parent
7cb137ae8d
commit
99104fc11d
73 changed files with 59 additions and 425 deletions
|
|
@ -1,6 +1,5 @@
|
|||
package us.shandian.giga.get;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.OsConstants;
|
||||
|
|
@ -316,16 +315,14 @@ public class DownloadMission extends Mission {
|
|||
|
||||
public synchronized void notifyError(int code, Exception err) {
|
||||
Log.e(TAG, "notifyError() code = " + code, err);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (err != null && err.getCause() instanceof ErrnoException) {
|
||||
int errno = ((ErrnoException) err.getCause()).errno;
|
||||
if (errno == OsConstants.ENOSPC) {
|
||||
code = ERROR_INSUFFICIENT_STORAGE;
|
||||
err = null;
|
||||
} else if (errno == OsConstants.EACCES) {
|
||||
code = ERROR_PERMISSION_DENIED;
|
||||
err = null;
|
||||
}
|
||||
if (err != null && err.getCause() instanceof ErrnoException) {
|
||||
int errno = ((ErrnoException) err.getCause()).errno;
|
||||
if (errno == OsConstants.ENOSPC) {
|
||||
code = ERROR_INSUFFICIENT_STORAGE;
|
||||
err = null;
|
||||
} else if (errno == OsConstants.EACCES) {
|
||||
code = ERROR_PERMISSION_DENIED;
|
||||
err = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue