am 5e5b6b78: Merge "[FileEncap2] Remove mCanUpload instance variable"
* commit '5e5b6b78709b055ac5ed71153c0a696c63201a38': [FileEncap2] Remove mCanUpload instance variablemain
commit
dd5055862f
|
@ -56,7 +56,6 @@ public final class UploaderService extends IntentService {
|
|||
private static final int BUF_SIZE = 1024 * 8;
|
||||
protected static final int TIMEOUT_IN_MS = 1000 * 4;
|
||||
|
||||
private boolean mCanUpload;
|
||||
private File mFilesDir;
|
||||
private URL mUrl;
|
||||
|
||||
|
@ -68,7 +67,6 @@ public final class UploaderService extends IntentService {
|
|||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
mCanUpload = false;
|
||||
mFilesDir = null;
|
||||
mUrl = null;
|
||||
|
||||
|
@ -83,12 +81,15 @@ public final class UploaderService extends IntentService {
|
|||
}
|
||||
mFilesDir = getFilesDir();
|
||||
mUrl = new URL(urlString);
|
||||
mCanUpload = true;
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPossibleToUpload() {
|
||||
return hasUploadingPermission() && mUrl != null && !IS_INHIBITING_AUTO_UPLOAD;
|
||||
}
|
||||
|
||||
private boolean hasUploadingPermission() {
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
return packageManager.checkPermission(Manifest.permission.INTERNET,
|
||||
|
@ -97,9 +98,7 @@ public final class UploaderService extends IntentService {
|
|||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
if (!mCanUpload) {
|
||||
return;
|
||||
}
|
||||
if (!isPossibleToUpload()) return;
|
||||
boolean isUploadingUnconditionally = false;
|
||||
Bundle bundle = intent.getExtras();
|
||||
if (bundle != null && bundle.containsKey(EXTRA_UPLOAD_UNCONDITIONALLY)) {
|
||||
|
|
Loading…
Reference in New Issue