Merge "[FileEncap2] Remove mCanUpload instance variable"

This commit is contained in:
Kurt Partridge 2013-03-06 18:39:06 +00:00 committed by Android (Google) Code Review
commit 5e5b6b7870

View file

@ -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)) {