From f8daccffc061e2f05f6605913c19d4aa807eaddb Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 9 Nov 2020 15:37:31 +0100 Subject: initial auto-update implementation: introducing fatweb flavor, pgpverify go library and bitmask core library, basic update mechanism --- app/build.gradle | 71 +++- app/src/fatweb/AndroidManifest.xml | 62 +++ app/src/fatweb/assets/public.pgp | 458 +++++++++++++++++++++ .../appUpdate/DownloadBroadcastReceiver.java | 114 +++++ .../appUpdate/DownloadConnector.java | 116 ++++++ .../appUpdate/DownloadNotificationManager.java | 113 +++++ .../appUpdate/DownloadService.java | 82 ++++ .../appUpdate/DownloadServiceCommand.java | 81 ++++ .../appUpdate/FileProviderUtil.java | 52 +++ .../appUpdate/UpdateDownloadManager.java | 231 +++++++++++ .../java/se/leap/bitmaskclient/BitmaskApp.java | 38 +- .../se/leap/bitmaskclient/ButterKnifeActivity.java | 16 + .../main/java/se/leap/bitmaskclient/Constants.java | 20 + .../se/leap/bitmaskclient/EipSetupObserver.java | 21 + .../leap/bitmaskclient/OkHttpClientGenerator.java | 50 ++- .../java/se/leap/bitmaskclient/ProviderAPI.java | 2 +- .../se/leap/bitmaskclient/utils/ConfigHelper.java | 28 +- .../se/leap/bitmaskclient/utils/FileHelper.java | 24 ++ app/src/main/res/values/strings.xml | 6 + app/src/main/res/xml/file_provider_paths.xml | 12 + .../appUpdate/DownloadBroadcastReceiver.java | 18 + .../appUpdate/DownloadServiceCommand.java | 19 + 22 files changed, 1611 insertions(+), 23 deletions(-) create mode 100644 app/src/fatweb/AndroidManifest.xml create mode 100644 app/src/fatweb/assets/public.pgp create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadServiceCommand.java create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java create mode 100644 app/src/main/res/xml/file_provider_paths.xml create mode 100644 app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadBroadcastReceiver.java create mode 100644 app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadServiceCommand.java (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 7134e543..0b3403ff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,8 +27,6 @@ android { //This is the default donation URL and should be set to the donation page of LEAP // and this should not be set/altered anywhere else. buildConfigField 'String', 'default_donation_url', '"https://leap.se/en/about-us/donate"' - //This is the donation URL and should be set to the relevant donation page. - buildConfigField 'String', 'donation_url', 'null' //The field to enable donations in the app. buildConfigField 'boolean', 'enable_donation', 'true' //The field to enable donation reminder popup in the app if enable_donation is set to 'false' this will be disabled. @@ -37,7 +35,16 @@ android { buildConfigField 'int', 'donation_reminder_duration', '30' //skip the account creation / login screen if the provider offers anonymous vpn usage, use directly the anonymous cert instead buildConfigField 'boolean', 'priotize_anonymous_usage', 'false' + + // static update url pointing to the latest stable release apk + buildConfigField "String", "update_apk_url", '"https://dl.bitmask.net/client/android/Bitmask-Android-latest.apk"' + // the the pgp signature file of the apk + buildConfigField "String", "signature_url", '"https://dl.bitmask.net/client/android/Bitmask-Android-latest.apk.sig"' + // the version file contains the versionCode of the latest release + buildConfigField "String", "version_file_url", '"https://dl.bitmask.net/client/android/versioncode.txt"' + //ignore the following configs, only used in custom flavor + buildConfigField 'String', 'donation_url', 'null' buildConfigField "String", "customProviderUrl", '""' buildConfigField "String", "customProviderIp", '""' buildConfigField "String", "customProviderApiIp", '""' @@ -108,6 +115,17 @@ android { //skip the account creation / login screen if the provider offers anonymous vpn usage, use directly the anonymous cert instead buildConfigField 'boolean', 'priotize_anonymous_usage', 'true' + //Build Config Fields for automatic apk update checks + + // static update url pointing to the latest stable release apk + def apkURL = '"https://dl.bitmask.net/RiseupVPN/android/RiseupVPN-Android-latest.apk"' + buildConfigField "String", "update_apk_url", apkURL + // the the pgp signature file of the apk + def signatureURL = '"https://dl.bitmask.net/RiseupVPN/android/RiseupVPN-Android-latest.apk.sig"' + buildConfigField "String", "signature_url", signatureURL + // the version file should contain a single line with the versionCode of the latest release + buildConfigField "String", "version_file_url", '"https://dl.bitmask.net/client/android/versioncode.txt"' //'"https://dl.bitmask.net/RiseupVPN/android/versioncode.txt"' + //Build Config Fields for default donation details //This is the donation URL and should be set to the relevant donation page. @@ -130,6 +148,13 @@ android { } + fatweb { + dimension "abi" + ext { + abiVersionCode = 0 + abiFilter = "" + } + } fat { dimension "abi" @@ -232,6 +257,31 @@ android { androidTest { java.srcDirs += ['src/sharedTest/java'] } + + fatweb { + java.srcDirs += ['src/fatweb/java'] + } + + fat { + java.srcDirs += ['src/notFatweb/java'] + } + + x86 { + java.srcDirs += ['src/notFatweb/java'] + } + + x86_64 { + java.srcDirs += ['src/notFatweb/java'] + } + + armv7 { + java.srcDirs += ['src/notFatweb/java'] + } + + arm64 { + java.srcDirs += ['src/notFatweb/java'] + } + } /** @@ -241,6 +291,8 @@ android { * -------------------- * customProductionFatDebug -> branded development build, includes all ABIs * normalProductionFatDebug -> Bitmask development build, includes all ABIS + * customProductionFatwebDebug -> branded development build, includes all ABIs, for distribution through a download page + * normalProductionFatWebDebug -> Bitmask development build, includes all ABIS, for distribution through a download page * customInsecureFatDebug -> branded development build, doesn't checks certificates (for test server setup w/o valid certificates), includes all ABIs * normalInsecureFatDebug -> Bitmask development build, doesn't checks certificates (for test server setup w/o valid certificates), includes all ABIs * @@ -248,6 +300,7 @@ android { * ----------------- * customProductionFatBeta -> branded build, includes all ABI's, Beta release * customProductionFatRelease -> branded build, includes all ABI's, stable release (-> F-Droid, GPlay if not splitApk is set to true) + * customProductionFatwebRelease -> branded build, includes all ABI's, stable release (-> F-Droid, GPlay if not splitApk is set to true), for distribution through a download page * * Bitmask Beta releases: * ---------------------- @@ -263,7 +316,8 @@ android { * normalProductionArmv7Release -> Bitmask build, only for ABI armeabi-v7a, for GPlay releases with split apks (2 of 4) * normalProductionX86Release -> Bitmask build, only for ABI x86, for GPlay releases with split apks (3 of 4) * normalProductionX86_64Release -> Bitmask build, only for ABI x86 64 bit, for GPlay releases with split apks (4 of 4) - * normalProductionFatRelease -> Bitmask build, including all ABIS, for official F-Droid repo and stable link on download page + * normalProductionFatRelease -> Bitmask build, including all ABIS, for official F-Droid repo + * normalProductionFatWebRelease -> Bitmask build, including all ABIS, for distribution through a download page */ variantFilter { variant -> @@ -276,7 +330,8 @@ android { if (((names.contains("insecure") && !names.contains("fat")) || (names.contains("insecure") && buildTypeName.contains("beta")) || (names.contains("insecure") && buildTypeName.contains("release")) || - (buildTypeName.contains("debug") && !names.contains("fat")) || + (buildTypeName.contains("debug") && !(names.contains("fatweb") || names.contains("fat"))) || + (names.contains("fatweb") && buildTypeName.contains("beta")) || (!supportsSplitApk && !names.contains("fat"))) ) { // Gradle ignores any variants that satisfy the conditions above. @@ -330,7 +385,13 @@ dependencies { implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' implementation 'de.hdodenhof:circleimageview:3.1.0' - implementation project(path: ':shapeshifter') + //implementation project(path: ':shapeshifter') + fatwebImplementation project(path: ':bitmask-web-core') + fatImplementation project(path: ':bitmask-core') + x86Implementation project(path: ':bitmask-core') + x86_64Implementation project(path: ':bitmask-core') + armv7Implementation project(path: ':bitmask-core') + arm64Implementation project(path: ':bitmask-core') } android.applicationVariants.all { variant -> diff --git a/app/src/fatweb/AndroidManifest.xml b/app/src/fatweb/AndroidManifest.xml new file mode 100644 index 00000000..5188b05b --- /dev/null +++ b/app/src/fatweb/AndroidManifest.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/fatweb/assets/public.pgp b/app/src/fatweb/assets/public.pgp new file mode 100644 index 00000000..6964df42 --- /dev/null +++ b/app/src/fatweb/assets/public.pgp @@ -0,0 +1,458 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFESwt0BEAC2CR+XgW04DVwT427v2T4+qz+O/xGOwQcalVaSOUuguYgf29en +Apb6mUqROOTuJWN1nw1lvXiA6iFxg6DjDUhsp6j54X7GAAAjZ9QuavPgcsractsJ +LRz9WSWqDjOAYsb4B5pwmSPAKYtmRAxLVzdxUsuHs2HxRO4VWnaNJQEBj7j7zuGs +gvSJBSq9Vici6cGI9c1fsWyKsnp7R6M54mmQRbsCg2+G/N0hqOz0HE6ZlJKVKaZq +uTrPxGWFuU3mAUpzFLa6Wj8DSUYiWZ/xrqiFdbB4t1HM3vlKB9LEg93DEuG/8Q0T +g2KS0lEWxequBXyE6+jklDNqJeyHmfgkuAfFlkNYa5870XT87MzGE/hS40lbmhQV +HHlwxMkAiERMc0Ys+OfgUJMbIDQBNRFg3Q/bjajFoVBgBoKFp7C22zgoJkUNT+7H +Yv/t6zeDlIzNhgYms5d0gEiAeLauwju36BmwUsbQHwejWKP8pADRZL1bTj0E+rRU +M4FFNh9D2XTFFKaaNubub8tUmo+ZUIEEKfPhNHK9wS/bsFyPv9y3HLe2b3NYGFK5 ++Hznqg8N0H+29I7zLx7VpOh3iRN3Lbxv9dMmukVJtw8Rq/Udprd3Z5p8oCisFo+k +nY+J+IgNjC0eniN8rkkl/4rIN5fvvOR8YCts50hL1fAy3dd/MKExz+QTXQARAQAB +tClMRUFQIGFyY2hpdmUgc2lnbmluZyBrZXkgPHN5c2RldkBsZWFwLnNlPohdBBAR +CAAGBQJToyd4AAoJEJwCrGKo9aTfErwBALArOyHjW8WcknvNM1/gMfMd0FUk2Pda +Qkp31pNb1BGiAPjrGavSVPXANL71oqyyTqnypEXQL1sq/GMsjQUvDugfiQEcBBAB +AgAGBQJTjl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4b +D/98vDkJdEn9qrPyqAS0jb7074nGHr4mKrK7txitHBy5NAtRcCOQTdms9GZYYcov +bGyyF87gPZHYoJTt6LLUnRZa8msxB7q7+DyvIlfb22biu3fQvlWf6JM6azq8edoP +PMr8qlnKtE0yUiEVomE9ifH3nS4pWfIXsFJsoioLeeAClm6vhA3mgC/1b/T2sxIn +YYgxdr0yj7h+QOJnxygcHLLEGZuivwhixosLP9kq5PtEcFuH2a3dLZ4hrv0zsZXT +7iUzbCL6GY9igDz82C/7TiG6s02u+CPq+PUsf6qkRn7NB0fhBytBhco7/VAJcUoo +CTwJDD6UYYVwJyvBWAZ/Ob5lMZLQ7EmFeiwdv4Gx1+Hb197EKIBYwf2ZKw1aajnn +hlBJ2aE5J7oJpigNINv7/4UOq7NfAlZmNNhh7PqVseQnuJw+jkgZvfHGOxcHu+sM +5ZIio2m2xpEFKNC2Gxfw1QPwAL+p5IQrtgvQne1u7AFhTPdA3kmTeeZmL5YsEdv0 +bPpeu6hQ3kKnQ9mZiItCOlT5k2nY1vZ9U1n8W6tIeC7bxVk3d8V1buxDn+agEtY/ +/wor7IxaknoCPnXrZ04vT7jXL3D675zEe4Rmw5cWLGC5sVyWOKlMM1F94c1mWzK5 +a5vBh+IcwIWACuS10VGea0MCeMOpM6TwQ0rEJ+BZKhnO1w== +=9gOD +-----END PGP PUBLIC KEY BLOCK----- diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java new file mode 100644 index 00000000..6613d394 --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient.appUpdate; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.util.Log; +import android.widget.Toast; + +import java.io.File; + +import se.leap.bitmaskclient.Constants; + +import static android.app.Activity.RESULT_CANCELED; +import static se.leap.bitmaskclient.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; +import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.appUpdate.DownloadConnector.APP_TYPE; +import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_FAILED; +import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_PROGRESS; +import static se.leap.bitmaskclient.appUpdate.DownloadService.NO_NEW_VERISON; +import static se.leap.bitmaskclient.appUpdate.DownloadService.PROGRESS_VALUE; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_DOWNLOADED; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_DOWNLOAD_FAILED; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_FOUND; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_NOT_FOUND; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; +import static se.leap.bitmaskclient.appUpdate.FileProviderUtil.getUriFor; + +public class DownloadBroadcastReceiver extends BroadcastReceiver { + + public static final String ACTION_DOWNLOAD = "se.leap.bitmaskclient.appUpdate.ACTION_DOWNLOAD"; + private static final String TAG = DownloadBroadcastReceiver.class.getSimpleName(); + + private DownloadNotificationManager notificationManager; + + + @Override + public void onReceive(Context context, Intent intent) { + Log.d(TAG, "DOWNLOAD ON RECEIVE!"); + String action = intent.getAction(); + if (action == null) { + return; + } + + if (notificationManager == null) { + notificationManager = new DownloadNotificationManager(context.getApplicationContext()); + } + + int resultCode = intent.getIntExtra(BROADCAST_RESULT_CODE, RESULT_CANCELED); + Bundle resultData = intent.getParcelableExtra(Constants.BROADCAST_RESULT_KEY); + + switch (action) { + case BROADCAST_DOWNLOAD_SERVICE_EVENT: + switch (resultCode) { + case UPDATE_FOUND: + notificationManager.buildDownloadFoundNotification(); + break; + case UPDATE_NOT_FOUND: + if (resultData.getBoolean(NO_NEW_VERISON, false)) { + //TODO: Save in preferences date, retry in a week + } else if (resultData.getBoolean(DOWNLOAD_FAILED, false)) { + Toast.makeText(context.getApplicationContext(), "Update check failed.", Toast.LENGTH_LONG).show(); + } + break; + case UPDATE_DOWNLOADED: + notificationManager.cancelNotifications(); + Intent installIntent = new Intent(Intent.ACTION_VIEW); + File update = UpdateDownloadManager.getUpdateFile(context); + if (update.exists()) { + installIntent.setDataAndType(getUriFor(context, update), APP_TYPE); + } + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + context.startActivity(installIntent); + break; + case UPDATE_DOWNLOAD_FAILED: + notificationManager.cancelNotifications(); + Toast.makeText(context.getApplicationContext(), "Update download failed.", Toast.LENGTH_LONG).show(); + break; + case DOWNLOAD_PROGRESS: + int progress = resultData.getInt(PROGRESS_VALUE, 0); + notificationManager.buildDownloadUpdateProgress(progress); + break; + } + break; + + case ACTION_DOWNLOAD: + DownloadServiceCommand.execute(context.getApplicationContext(), DOWNLOAD_UPDATE); + break; + + default: + break; + } + + } +} diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java new file mode 100644 index 00000000..9427083d --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient.appUpdate; + + +import android.util.Log; +import android.util.Pair; + +import androidx.annotation.NonNull; + +import java.io.File; +import java.io.InputStream; +import java.util.List; +import java.util.Scanner; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import okio.Buffer; +import okio.BufferedSink; +import okio.BufferedSource; +import okio.Okio; + + +/** + * This class encapsulates HTTP requests so that the results can be mocked + * and it's owning UpdateDownloadManager class logic can be unit tested properly + * + */ +public class DownloadConnector { + + private static final String TAG = DownloadConnector.class.getSimpleName(); + final static String APP_TYPE = "application/vnd.android.package-archive"; + final static String TEXT_FILE_TYPE = "application/text"; + + public interface DownloadProgress { + void onUpdate(int progress); + } + + static String requestTextFileFromServer(@NonNull String url, @NonNull OkHttpClient okHttpClient) { + try { + Request request = new Request.Builder() + .url(url) + .addHeader("Content-Type", TEXT_FILE_TYPE) + .build(); + + Response response = okHttpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + return null; + } + InputStream inputStream = response.body().byteStream(); + Scanner scanner = new Scanner(inputStream).useDelimiter("\\A"); + if (scanner.hasNext()) { + return scanner.next(); + } + return null; + + } catch (Exception e) { + Log.d(TAG, "Text file download failed"); + } + + return null; + } + + static File requestFileFromServer(@NonNull String url, @NonNull OkHttpClient okHttpClient, File destFile, DownloadProgress callback) { + BufferedSink sink = null; + BufferedSource source = null; + try { + Request.Builder requestBuilder = new Request.Builder() + .url(url) + .addHeader("Content-Type", APP_TYPE); + Request request = requestBuilder.build(); + + Response response = okHttpClient.newCall(request).execute(); + ResponseBody body = response.body(); + InputStream in = body.byteStream(); + long contentLength = body.contentLength(); + source = body.source(); + sink = Okio.buffer(Okio.sink(destFile)); + Buffer sinkBuffer = sink.buffer(); + long totalBytesRead = 0; + int bufferSize = 8 * 1024; + long bytesRead; + while ((bytesRead = source.read(sinkBuffer, bufferSize)) != -1) { + sink.emit(); + totalBytesRead += bytesRead; + int progress = (int) ((totalBytesRead * 100) / contentLength); + callback.onUpdate(progress); + } + sink.flush(); + + return destFile; + + } catch (Exception e) { + Log.d(TAG, "File download failed"); + } + + return null; + } + +} diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java new file mode 100644 index 00000000..4f7f2883 --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java @@ -0,0 +1,113 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient.appUpdate; + +import android.annotation.TargetApi; +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.os.Build; + +import androidx.annotation.NonNull; +import androidx.core.app.NotificationCompat; + +import se.leap.bitmaskclient.R; + +import static android.content.Intent.CATEGORY_DEFAULT; +import static se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver.ACTION_DOWNLOAD; + +public class DownloadNotificationManager { + private Context context; + private final static int DOWNLOAD_NOTIFICATION_ID = 1; + + public DownloadNotificationManager(@NonNull Context context) { + this.context = context; + } + + public void buildDownloadFoundNotification() { + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager == null) { + return; + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + createNotificationChannel(notificationManager); + } + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this.context, DownloadService.NOTIFICATION_CHANNEL_NEWSTATUS_ID); + notificationBuilder.setAutoCancel(true) + .setDefaults(Notification.DEFAULT_ALL) + .setWhen(System.currentTimeMillis()) + .setSmallIcon(R.mipmap.ic_launcher) + .setTicker(context.getString(R.string.version_update_title, context.getString(R.string.app_name))) + .setContentTitle(context.getString(R.string.version_update_title, context.getString(R.string.app_name))) + .setContentText(context.getString(R.string.version_update_found)) + .setContentIntent(getDownloadIntent()); + notificationManager.notify(DOWNLOAD_NOTIFICATION_ID, notificationBuilder.build()); + } + + @TargetApi(26) + private void createNotificationChannel(NotificationManager notificationManager) { + CharSequence name = "Bitmask Updates"; + String description = "Informs about available updates"; + NotificationChannel channel = new NotificationChannel(DownloadService.NOTIFICATION_CHANNEL_NEWSTATUS_ID, + name, + NotificationManager.IMPORTANCE_LOW); + channel.setSound(null, null); + channel.setDescription(description); + // Register the channel with the system; you can't change the importance + // or other notification behaviors after this + notificationManager.createNotificationChannel(channel); + } + + + + private PendingIntent getDownloadIntent() { + Intent downloadIntent = new Intent(context, DownloadBroadcastReceiver.class); + downloadIntent.setAction(ACTION_DOWNLOAD); + return PendingIntent.getBroadcast(context, 0, downloadIntent, PendingIntent.FLAG_CANCEL_CURRENT); + } + + public void buildDownloadUpdateProgress(int progress) { + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager == null) { + return; + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + createNotificationChannel(notificationManager); + } + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this.context, DownloadService.NOTIFICATION_CHANNEL_NEWSTATUS_ID); + notificationBuilder.setAutoCancel(true) + .setDefaults(Notification.DEFAULT_ALL) + .setAutoCancel(false) + .setOngoing(true) + .setSmallIcon(R.mipmap.ic_launcher) + .setContentTitle(context.getString(R.string.version_update_apk_description, context.getString(R.string.app_name))) + .setProgress(100, progress, false) + .setContentIntent(getDownloadIntent()); + notificationManager.notify(DOWNLOAD_NOTIFICATION_ID, notificationBuilder.build()); + } + + public void cancelNotifications() { + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager == null) { + return; + } + notificationManager.cancel(DOWNLOAD_NOTIFICATION_ID); + } +} diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java new file mode 100644 index 00000000..bc9adfc1 --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient.appUpdate; + +import android.content.Context; +import android.content.Intent; + +import androidx.annotation.NonNull; +import androidx.core.app.JobIntentService; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + +import se.leap.bitmaskclient.OkHttpClientGenerator; + +public class DownloadService extends JobIntentService implements UpdateDownloadManager.DownloadServiceCallback { + + static final int JOB_ID = 161376; + static final String NOTIFICATION_CHANNEL_NEWSTATUS_ID = "bitmask_download_service_news"; + + final public static String TAG = DownloadService.class.getSimpleName(), + PROGRESS_VALUE = "progressValue", + NO_NEW_VERISON = "noNewVersion", + DOWNLOAD_FAILED = "downloadFailed", + NO_PUB_KEY = "noPubKey", + VERIFICATION_ERROR = "verificationError"; + + final public static int + UPDATE_DOWNLOADED = 1, + UPDATE_DOWNLOAD_FAILED = 2, + UPDATE_FOUND = 3, + UPDATE_NOT_FOUND = 4, + DOWNLOAD_PROGRESS = 6; + + + private UpdateDownloadManager updateDownloadManager; + + + @Override + public void onCreate() { + super.onCreate(); + updateDownloadManager = initDownloadManager(); + } + + @Override + protected void onHandleWork(@NonNull Intent intent) { + updateDownloadManager.handleIntent(intent); + } + + /** + * Convenience method for enqueuing work in to this service. + */ + static void enqueueWork(Context context, Intent work) { + try { + DownloadService.enqueueWork(context, DownloadService.class, JOB_ID, work); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + private UpdateDownloadManager initDownloadManager() { + OkHttpClientGenerator clientGenerator = new OkHttpClientGenerator(null); + return new UpdateDownloadManager(this, clientGenerator, this); + } + + @Override + public void broadcastEvent(Intent intent) { + LocalBroadcastManager.getInstance(this).sendBroadcast(intent); + } +} diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadServiceCommand.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadServiceCommand.java new file mode 100644 index 00000000..c4e809f2 --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadServiceCommand.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient.appUpdate; + +import android.content.Context; +import android.content.Intent; +import android.os.ResultReceiver; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import se.leap.bitmaskclient.ProviderAPI; + +public class DownloadServiceCommand { + + public final static String + CHECK_VERSION_FILE = "checkVersionFile", + DOWNLOAD_UPDATE = "downloadUpdate"; + + private Context context; + private String action; + private ResultReceiver resultReceiver; + + private DownloadServiceCommand(@NotNull Context context, @NotNull String action) { + this(context.getApplicationContext(), action, null); + } + + private DownloadServiceCommand(@NotNull Context context, @NotNull String action, @Nullable ResultReceiver resultReceiver) { + super(); + this.context = context; + this.action = action; + this.resultReceiver = resultReceiver; + } + + + private Intent setUpIntent() { + Intent command = new Intent(context, ProviderAPI.class); + command.setAction(action); + if (resultReceiver != null) { + command.putExtra(ProviderAPI.RECEIVER_KEY, resultReceiver); + } + return command; + } + + private boolean isInitialized() { + return context != null; + } + + + private void execute() { + if (isInitialized()) { + Intent intent = setUpIntent(); + DownloadService.enqueueWork(context, intent); + } + } + + public static void execute(Context context, String action) { + DownloadServiceCommand command = new DownloadServiceCommand(context, action); + command.execute(); + } + + public static void execute(Context context, String action, ResultReceiver resultReceiver) { + DownloadServiceCommand command = new DownloadServiceCommand(context, action, resultReceiver); + command.execute(); + } + +} diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java new file mode 100644 index 00000000..756a3b99 --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient.appUpdate; + +import android.content.Context; +import android.net.Uri; +import android.os.Build; +import androidx.annotation.NonNull; +import androidx.core.content.FileProvider; + +import java.io.File; + +import se.leap.bitmaskclient.BuildConfig; + +/** + * From Signal + */ + +public class FileProviderUtil { + + private static final String AUTHORITY = BuildConfig.APPLICATION_ID +".fileprovider"; + + public static Uri getUriFor(@NonNull Context context, @NonNull File file) { + if (Build.VERSION.SDK_INT >= 24) return FileProvider.getUriForFile(context, AUTHORITY, file); + else return Uri.fromFile(file); + } + + public static boolean isAuthority(@NonNull Uri uri) { + return AUTHORITY.equals(uri.getAuthority()); + } + + public static boolean delete(@NonNull Context context, @NonNull Uri uri) { + if (AUTHORITY.equals(uri.getAuthority())) { + return context.getContentResolver().delete(uri, null, null) > 0; + } + return new File(uri.getPath()).delete(); + } +} diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java new file mode 100644 index 00000000..698a0d17 --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java @@ -0,0 +1,231 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient.appUpdate; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.os.ResultReceiver; +import android.util.Log; + +import androidx.annotation.NonNull; + +import java.io.File; + +import okhttp3.OkHttpClient; +import pgpverify.Logger; +import pgpverify.PgpVerifier; +import se.leap.bitmaskclient.BuildConfig; +import se.leap.bitmaskclient.OkHttpClientGenerator; +import se.leap.bitmaskclient.R; + +import static android.text.TextUtils.isEmpty; +import static se.leap.bitmaskclient.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; +import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.ProviderAPI.RECEIVER_KEY; +import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_FAILED; +import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_PROGRESS; +import static se.leap.bitmaskclient.appUpdate.DownloadService.NO_NEW_VERISON; +import static se.leap.bitmaskclient.appUpdate.DownloadService.NO_PUB_KEY; +import static se.leap.bitmaskclient.appUpdate.DownloadService.PROGRESS_VALUE; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_DOWNLOADED; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_DOWNLOAD_FAILED; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_FOUND; +import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_NOT_FOUND; +import static se.leap.bitmaskclient.appUpdate.DownloadService.VERIFICATION_ERROR; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; +import static se.leap.bitmaskclient.utils.FileHelper.readPublicKey; + +public class UpdateDownloadManager implements Logger, DownloadConnector.DownloadProgress { + + + private static final String TAG = UpdateDownloadManager.class.getSimpleName(); + + public interface DownloadServiceCallback { + void broadcastEvent(Intent intent); + } + + private Context context; + + private PgpVerifier pgpVerifier; + private DownloadServiceCallback serviceCallback; + OkHttpClientGenerator clientGenerator; + + + public UpdateDownloadManager(Context context, OkHttpClientGenerator clientGenerator, DownloadServiceCallback callback) { + this.context = context; + this.clientGenerator = clientGenerator; + pgpVerifier = new PgpVerifier(); + pgpVerifier.setLogger(this); + serviceCallback = callback; + } + + //pgpverify Logger interface + @Override + public void log(String s) { + + } + + @Override + public void onUpdate(int progress) { + Bundle resultData = new Bundle(); + resultData.putInt(PROGRESS_VALUE, progress); + broadcastEvent(DOWNLOAD_PROGRESS, resultData); + } + + public void handleIntent(Intent command) { + ResultReceiver receiver = null; + if (command.getParcelableExtra(RECEIVER_KEY) != null) { + receiver = command.getParcelableExtra(RECEIVER_KEY); + } + String action = command.getAction(); + + Bundle result = new Bundle(); + switch (action) { + case CHECK_VERSION_FILE: + result = checkVersionFile(result); + if (result.getBoolean(BROADCAST_RESULT_KEY)) { + sendToReceiverOrBroadcast(receiver, UPDATE_FOUND, result); + } else { + sendToReceiverOrBroadcast(receiver, UPDATE_NOT_FOUND, result); + } + break; + case DOWNLOAD_UPDATE: + result = downloadUpdate(result); + if (result.getBoolean(BROADCAST_RESULT_KEY)) { + sendToReceiverOrBroadcast(receiver, UPDATE_DOWNLOADED, result); + } else { + sendToReceiverOrBroadcast(receiver, UPDATE_DOWNLOAD_FAILED, result); + } + break; + + } + } + + public static File getUpdateFile(Context context) { + return new File(context.getExternalFilesDir(null) + "/" + context.getString(R.string.app_name) + "_update.apk"); + } + + private Bundle downloadUpdate(Bundle task) { + + String publicKey = readPublicKey(context); + if (isEmpty(publicKey)) { + task.putBoolean(BROADCAST_RESULT_KEY, false); + task.putBoolean(NO_PUB_KEY, true); + return task; + } + + OkHttpClient client = clientGenerator.init(); + String signature = DownloadConnector.requestTextFileFromServer(BuildConfig.signature_url, client); + if (signature == null) { + task.putBoolean(BROADCAST_RESULT_KEY, false); + task.putBoolean(DOWNLOAD_FAILED, true); + return task; + } + + File destinationFile = getUpdateFile(context); + if (destinationFile.exists()) { + destinationFile.delete(); + } + + destinationFile = DownloadConnector.requestFileFromServer(BuildConfig.update_apk_url, client, destinationFile, this); + + if (destinationFile == null) { + task.putBoolean(BROADCAST_RESULT_KEY, false); + task.putBoolean(DOWNLOAD_FAILED, true); + return task; + } + + boolean successfulVerified = pgpVerifier.verify(signature, publicKey, destinationFile.getAbsolutePath()); + if (!successfulVerified) { + destinationFile.delete(); + task.putBoolean(BROADCAST_RESULT_KEY, false); + task.putBoolean(VERIFICATION_ERROR, true); + return task; + } + + task.putBoolean(BROADCAST_RESULT_KEY, true); + return task; + } + + private static void clearPreviousDownloads(@NonNull Context context, String destinationFile) { + File directory = context.getExternalFilesDir(null); + + if (directory == null) { + Log.w(TAG, "Failed to read external files directory."); + return; + } + + for (File file : directory.listFiles()) { + if (file.getName().equals(destinationFile)) { + if (file.delete()) { + Log.d(TAG, "Deleted " + file.getName()); + } + } + } + } + + private Bundle checkVersionFile(Bundle task) { + OkHttpClient client = clientGenerator.init(); + String versionString = DownloadConnector.requestTextFileFromServer(BuildConfig.version_file_url, client); + + if (versionString != null) { + versionString = versionString.replace("\n", "").trim(); + } + + int version = -1; + try { + version = Integer.valueOf(versionString); + } catch (NumberFormatException e) { + e.printStackTrace(); + Log.e(TAG, "could not parse version code: " + versionString); + } + + if (version == -1) { + task.putBoolean(BROADCAST_RESULT_KEY, false); + task.putBoolean(DOWNLOAD_FAILED, true); + } else if (BuildConfig.VERSION_CODE >= version) { + task.putBoolean(BROADCAST_RESULT_KEY, false); + task.putBoolean(NO_NEW_VERISON, true); + } else { + task.putBoolean(BROADCAST_RESULT_KEY, true); + } + return task; + } + + private void sendToReceiverOrBroadcast(ResultReceiver receiver, int resultCode, Bundle resultData) { + if (resultData == null || resultData == Bundle.EMPTY) { + resultData = new Bundle(); + } + if (receiver != null) { + receiver.send(resultCode, resultData); + } else { + broadcastEvent(resultCode, resultData); + } + } + + private void broadcastEvent(int resultCode , Bundle resultData) { + Intent intentUpdate = new Intent(BROADCAST_DOWNLOAD_SERVICE_EVENT); + intentUpdate.addCategory(Intent.CATEGORY_DEFAULT); + intentUpdate.putExtra(BROADCAST_RESULT_CODE, resultCode); + intentUpdate.putExtra(BROADCAST_RESULT_KEY, resultData); + serviceCallback.broadcastEvent(intentUpdate); + } + +} diff --git a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java b/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java index bde5114b..437998e0 100644 --- a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java +++ b/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java @@ -1,16 +1,42 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package se.leap.bitmaskclient; import android.content.Context; +import android.content.IntentFilter; import android.content.SharedPreferences; -import androidx.multidex.MultiDexApplication; + import androidx.appcompat.app.AppCompatDelegate; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; +import androidx.multidex.MultiDexApplication; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; +import se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver; import se.leap.bitmaskclient.tethering.TetheringStateManager; +import static android.content.Intent.CATEGORY_DEFAULT; +import static se.leap.bitmaskclient.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver.ACTION_DOWNLOAD; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; import static se.leap.bitmaskclient.utils.PreferenceHelper.getSavedProviderFromSharedPreferences; /** @@ -22,6 +48,7 @@ public class BitmaskApp extends MultiDexApplication { private final static String TAG = BitmaskApp.class.getSimpleName(); private RefWatcher refWatcher; private ProviderObservable providerObservable; + private DownloadBroadcastReceiver downloadBroadcastReceiver; @Override @@ -41,6 +68,15 @@ public class BitmaskApp extends MultiDexApplication { EipSetupObserver.init(this, preferences); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); TetheringStateManager.getInstance().init(this); + if (BuildConfig.FLAVOR.contains("Fatweb")) { + downloadBroadcastReceiver = new DownloadBroadcastReceiver(); + IntentFilter intentFilter = new IntentFilter(BROADCAST_DOWNLOAD_SERVICE_EVENT); + intentFilter.addAction(ACTION_DOWNLOAD); + intentFilter.addAction(CHECK_VERSION_FILE); + intentFilter.addAction(DOWNLOAD_UPDATE); + intentFilter.addCategory(CATEGORY_DEFAULT); + LocalBroadcastManager.getInstance(this.getApplicationContext()).registerReceiver(downloadBroadcastReceiver, intentFilter); + } } /** diff --git a/app/src/main/java/se/leap/bitmaskclient/ButterKnifeActivity.java b/app/src/main/java/se/leap/bitmaskclient/ButterKnifeActivity.java index 0ef77e2b..4f27f88a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ButterKnifeActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ButterKnifeActivity.java @@ -1,3 +1,19 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package se.leap.bitmaskclient; import androidx.appcompat.app.AppCompatActivity; diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index 6462b663..dfd94759 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -1,3 +1,19 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package se.leap.bitmaskclient; import android.text.TextUtils; @@ -20,6 +36,9 @@ public interface Constants { String ALLOW_TETHERING_USB = "tethering_usb"; String SHOW_EXPERIMENTAL = "show_experimental"; String USE_IPv6_FIREWALL = "use_ipv6_firewall"; + String APK_DOWNLOAD_ID = "apk_download_id"; + String VERSION_FILE_DOWNLOAD_ID = "version_file_downlaod_id"; + String SIGNATURE_DOWNLOAD_ID = "signature_file_download_id"; ////////////////////////////////////////////// @@ -105,6 +124,7 @@ public interface Constants { String BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT = "BROADCAST.GATEWAY_SETUP_WATCHER_EVENT"; String BROADCAST_RESULT_CODE = "BROADCAST.RESULT_CODE"; String BROADCAST_RESULT_KEY = "BROADCAST.RESULT_KEY"; + String BROADCAST_DOWNLOAD_SERVICE_EVENT = "BROADCAST.DOWNLOAD_SERVICE_EVENT"; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java b/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java index 7504e0c0..174e6657 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java @@ -1,3 +1,20 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package se.leap.bitmaskclient; import android.content.BroadcastReceiver; @@ -21,6 +38,7 @@ import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConnectionStatus; import de.blinkt.openvpn.core.LogItem; import de.blinkt.openvpn.core.VpnStatus; +import se.leap.bitmaskclient.appUpdate.DownloadServiceCommand; import se.leap.bitmaskclient.eip.EIP; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; @@ -48,6 +66,7 @@ import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON; import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE; /** * Created by cyberta on 05.12.18. @@ -292,6 +311,8 @@ class EipSetupObserver extends BroadcastReceiver implements VpnStatus.StateListe //setupNClostestGateway > 0: at least one failed gateway -> did the provider change it's gateways? ProviderAPICommand.execute(context, ProviderAPI.DOWNLOAD_SERVICE_JSON, provider); } + + DownloadServiceCommand.execute(context, CHECK_VERSION_FILE); finishGatewaySetup(false); } else if ("TCP_CONNECT".equals(state)) { changingGateway.set(false); diff --git a/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java b/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java index 7b9874e0..576e76e0 100644 --- a/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java @@ -62,7 +62,7 @@ public class OkHttpClientGenerator { Resources resources; - public OkHttpClientGenerator(SharedPreferences preferences, Resources resources) { + public OkHttpClientGenerator(/*SharedPreferences preferences,*/ Resources resources) { this.resources = resources; } @@ -74,22 +74,21 @@ public class OkHttpClientGenerator { return initHttpClient(initError, caCert); } + public OkHttpClient init() { + try { + return createClient(null); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + private OkHttpClient initHttpClient(JSONObject initError, String certificate) { + if (resources == null) { + return null; + } try { - TLSCompatSocketFactory sslCompatFactory; - ConnectionSpec spec = getConnectionSpec(); - OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); - - if (!isEmpty(certificate)) { - sslCompatFactory = new TLSCompatSocketFactory(certificate); - } else { - sslCompatFactory = new TLSCompatSocketFactory(); - } - sslCompatFactory.initSSLSocketFactory(clientBuilder); - clientBuilder.cookieJar(getCookieJar()) - .connectionSpecs(Collections.singletonList(spec)); - clientBuilder.dns(new DnsResolver()); - return clientBuilder.build(); + return createClient(certificate); } catch (IllegalArgumentException e) { e.printStackTrace(); // TODO ca cert is invalid - show better error ?! @@ -110,10 +109,31 @@ public class OkHttpClientGenerator { } catch (IOException e) { e.printStackTrace(); addErrorMessageToJson(initError, resources.getString(error_io_exception_user_message)); + } catch (Exception e) { + e.printStackTrace(); + // unexpected exception, should never happen + // only to shorten the method signature createClient(String certificate) } return null; } + private OkHttpClient createClient(String certificate) throws Exception { + TLSCompatSocketFactory sslCompatFactory; + ConnectionSpec spec = getConnectionSpec(); + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); + + if (!isEmpty(certificate)) { + sslCompatFactory = new TLSCompatSocketFactory(certificate); + } else { + sslCompatFactory = new TLSCompatSocketFactory(); + } + sslCompatFactory.initSSLSocketFactory(clientBuilder); + clientBuilder.cookieJar(getCookieJar()) + .connectionSpecs(Collections.singletonList(spec)); + clientBuilder.dns(new DnsResolver()); + return clientBuilder.build(); + } + @NonNull diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java index 4058b824..bec16139 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java @@ -120,7 +120,7 @@ public class ProviderAPI extends JobIntentService implements ProviderApiManagerB private ProviderApiManager initApiManager() { SharedPreferences preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); - OkHttpClientGenerator clientGenerator = new OkHttpClientGenerator(preferences, getResources()); + OkHttpClientGenerator clientGenerator = new OkHttpClientGenerator(getResources()); return new ProviderApiManager(preferences, getResources(), clientGenerator, this); } } diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java index 2748c944..5a142d90 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java @@ -53,6 +53,7 @@ import static se.leap.bitmaskclient.Constants.DEFAULT_BITMASK; /** * Stores constants, and implements auxiliary methods used across all Bitmask Android classes. + * Wraps BuildConfigFields for to support easier unit testing * * @author parmegv * @author MeanderingCode @@ -120,7 +121,7 @@ public class ConfigHelper { try { KeyFactory kf; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { - kf = KeyFactory.getInstance("RSA", "BC"); + kf = KeyFactory.getInstance("RSA", "BC"); } else { kf = KeyFactory.getInstance("RSA"); } @@ -201,4 +202,29 @@ public class ConfigHelper { return (string1 == null && string2 == null) || (string1 != null && string1.equals(string2)); } + + public static String getApkFileName() { + try { + return BuildConfig.update_apk_url.substring(BuildConfig.update_apk_url.lastIndexOf("/")); + } catch (Exception e) { + return null; + } + } + + public static String getVersionFileName() { + try { + return BuildConfig.version_file_url.substring(BuildConfig.version_file_url.lastIndexOf("/")); + } catch (Exception e) { + return null; + } + } + + public static String getSignatureFileName() { + try { + return BuildConfig.signature_url.substring(BuildConfig.signature_url.lastIndexOf("/")); + } catch (Exception e) { + return null; + } + } + } diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/FileHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/FileHelper.java index 1c3e1ebb..ebcc32ba 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/FileHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/FileHelper.java @@ -1,8 +1,13 @@ package se.leap.bitmaskclient.utils; +import android.content.Context; + +import java.io.BufferedReader; import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; /** * Created by cyberta on 18.03.18. @@ -19,4 +24,23 @@ public class FileHelper { writer.close(); } + public static String readPublicKey(Context context) { + { + InputStream inputStream; + try { + inputStream = context.getAssets().open("public.pgp"); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line).append("\n"); + } + reader.close(); + return sb.toString(); + } catch (IOException errabi) { + return null; + } + } + } + } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d4c62e1..dd1ddeb4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -142,4 +142,10 @@ %s cannot execute features like VPN Hotspot or IPv6 firewall without root permissions. Start %s + Tap here to start the download. + A new %s version has been found. + Downloading a new %s version + Storage access is required to web update. + Storage permission request was denied. + diff --git a/app/src/main/res/xml/file_provider_paths.xml b/app/src/main/res/xml/file_provider_paths.xml new file mode 100644 index 00000000..5b9dd9fb --- /dev/null +++ b/app/src/main/res/xml/file_provider_paths.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadBroadcastReceiver.java b/app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadBroadcastReceiver.java new file mode 100644 index 00000000..7adbb85d --- /dev/null +++ b/app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadBroadcastReceiver.java @@ -0,0 +1,18 @@ +package se.leap.bitmaskclient.appUpdate; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +/** + * DownloadBroadcastReceiver is only implemented in Fatweb builds + * + */ +public class DownloadBroadcastReceiver extends BroadcastReceiver { + + public static final String ACTION_DOWNLOAD = "se.leap.bitmaskclient.appUpdate.ACTION_DOWNLOAD"; + @Override + public void onReceive(Context context, Intent intent) { + + } +} diff --git a/app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadServiceCommand.java b/app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadServiceCommand.java new file mode 100644 index 00000000..157f04fe --- /dev/null +++ b/app/src/notFatweb/java/se/leap/bitmaskclient/appUpdate/DownloadServiceCommand.java @@ -0,0 +1,19 @@ +package se.leap.bitmaskclient.appUpdate; + +import android.content.Context; + +/** + * DownloadServiceCommand is only implemented in Fatweb builds + * + */ +public class DownloadServiceCommand { + + public final static String + CHECK_VERSION_FILE = "checkVersionFile", + DOWNLOAD_UPDATE = "downloadUpdate"; + + + public static void execute(Context context, String action) { + // DO NOTHING. + } +} -- cgit v1.2.3 From 95554c3eb064114f9a8d494aec7ba05e8cd3aaf1 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 00:06:00 +0100 Subject: improve invisible activity theme --- .../fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java | 4 ++++ app/src/main/res/values/themes.xml | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java new file mode 100644 index 00000000..e373a888 --- /dev/null +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java @@ -0,0 +1,4 @@ +package se.leap.bitmaskclient.appUpdate; + +public class InstallActivity { +} diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 7e98ccf4..ab489fc6 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -22,6 +22,8 @@ -- cgit v1.2.3 From 8efd199a90e6d9388400b19e9fc6b68c81284f11 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 00:06:27 +0100 Subject: add new download notification strings --- app/src/main/res/values/strings.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dd1ddeb4..5ba51afe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -147,5 +147,6 @@ Downloading a new %s version Storage access is required to web update. Storage permission request was denied. - + A new %s version has been downloaded. + Tap here to install the update. -- cgit v1.2.3 From c008a935f92b79cb7b6f649fc876d398e20ebb22 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 00:47:19 +0100 Subject: download apk, request permission and install app update --- app/src/fatweb/AndroidManifest.xml | 7 +- .../appUpdate/DownloadBroadcastReceiver.java | 32 ++++---- .../appUpdate/DownloadConnector.java | 8 +- .../appUpdate/DownloadNotificationManager.java | 86 +++++++++++++------- .../appUpdate/InstallActivity.java | 94 +++++++++++++++++++++- .../main/java/se/leap/bitmaskclient/Constants.java | 6 +- .../java/se/leap/bitmaskclient/StartActivity.java | 9 ++- .../leap/bitmaskclient/utils/PreferenceHelper.java | 9 +++ app/src/main/res/values/strings.xml | 3 + 9 files changed, 195 insertions(+), 59 deletions(-) (limited to 'app') diff --git a/app/src/fatweb/AndroidManifest.xml b/app/src/fatweb/AndroidManifest.xml index 5188b05b..28246e5f 100644 --- a/app/src/fatweb/AndroidManifest.xml +++ b/app/src/fatweb/AndroidManifest.xml @@ -39,10 +39,6 @@ - - - - + diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java index 6613d394..f410b9ff 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java @@ -19,7 +19,6 @@ package se.leap.bitmaskclient.appUpdate; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.widget.Toast; @@ -27,12 +26,12 @@ import android.widget.Toast; import java.io.File; import se.leap.bitmaskclient.Constants; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.utils.ConfigHelper; import static android.app.Activity.RESULT_CANCELED; import static se.leap.bitmaskclient.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; -import static se.leap.bitmaskclient.appUpdate.DownloadConnector.APP_TYPE; -import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_FAILED; import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_PROGRESS; import static se.leap.bitmaskclient.appUpdate.DownloadService.NO_NEW_VERISON; import static se.leap.bitmaskclient.appUpdate.DownloadService.PROGRESS_VALUE; @@ -40,8 +39,9 @@ import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_DOWNLOADED; import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_DOWNLOAD_FAILED; import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_FOUND; import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_NOT_FOUND; +import static se.leap.bitmaskclient.appUpdate.DownloadService.VERIFICATION_ERROR; import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; -import static se.leap.bitmaskclient.appUpdate.FileProviderUtil.getUriFor; +import static se.leap.bitmaskclient.appUpdate.UpdateDownloadManager.getUpdateFile; public class DownloadBroadcastReceiver extends BroadcastReceiver { @@ -75,25 +75,21 @@ public class DownloadBroadcastReceiver extends BroadcastReceiver { case UPDATE_NOT_FOUND: if (resultData.getBoolean(NO_NEW_VERISON, false)) { //TODO: Save in preferences date, retry in a week - } else if (resultData.getBoolean(DOWNLOAD_FAILED, false)) { - Toast.makeText(context.getApplicationContext(), "Update check failed.", Toast.LENGTH_LONG).show(); } break; case UPDATE_DOWNLOADED: - notificationManager.cancelNotifications(); - Intent installIntent = new Intent(Intent.ACTION_VIEW); - File update = UpdateDownloadManager.getUpdateFile(context); - if (update.exists()) { - installIntent.setDataAndType(getUriFor(context, update), APP_TYPE); - } - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true); - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - context.startActivity(installIntent); + notificationManager.buildDownloadSuccessfulNotification(); break; case UPDATE_DOWNLOAD_FAILED: - notificationManager.cancelNotifications(); - Toast.makeText(context.getApplicationContext(), "Update download failed.", Toast.LENGTH_LONG).show(); + if (resultData.getBoolean(VERIFICATION_ERROR, false)) { + Toast.makeText(context.getApplicationContext(), context.getString(R.string.version_update_error_pgp_verification), Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(context.getApplicationContext(), context.getString(R.string.version_update_error), Toast.LENGTH_LONG).show(); + } + File file = getUpdateFile(context); + if (file.exists()) { + file.delete(); + } break; case DOWNLOAD_PROGRESS: int progress = resultData.getInt(PROGRESS_VALUE, 0); diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java index 9427083d..d4c5de7f 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java @@ -45,8 +45,8 @@ import okio.Okio; public class DownloadConnector { private static final String TAG = DownloadConnector.class.getSimpleName(); - final static String APP_TYPE = "application/vnd.android.package-archive"; - final static String TEXT_FILE_TYPE = "application/text"; + public final static String APP_TYPE = "application/vnd.android.package-archive"; + public final static String TEXT_FILE_TYPE = "application/text"; public interface DownloadProgress { void onUpdate(int progress); @@ -78,8 +78,8 @@ public class DownloadConnector { } static File requestFileFromServer(@NonNull String url, @NonNull OkHttpClient okHttpClient, File destFile, DownloadProgress callback) { - BufferedSink sink = null; - BufferedSource source = null; + BufferedSink sink; + BufferedSource source; try { Request.Builder requestBuilder = new Request.Builder() .url(url) diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java index 4f7f2883..aaf487aa 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadNotificationManager.java @@ -42,18 +42,14 @@ public class DownloadNotificationManager { } public void buildDownloadFoundNotification() { - NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + NotificationManager notificationManager = initNotificationManager(); if (notificationManager == null) { return; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - createNotificationChannel(notificationManager); - } - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this.context, DownloadService.NOTIFICATION_CHANNEL_NEWSTATUS_ID); - notificationBuilder.setAutoCancel(true) - .setDefaults(Notification.DEFAULT_ALL) + NotificationCompat.Builder notificationBuilder = initNotificationBuilderDefaults(); + notificationBuilder + .setSmallIcon(R.drawable.ic_about_36) .setWhen(System.currentTimeMillis()) - .setSmallIcon(R.mipmap.ic_launcher) .setTicker(context.getString(R.string.version_update_title, context.getString(R.string.app_name))) .setContentTitle(context.getString(R.string.version_update_title, context.getString(R.string.app_name))) .setContentText(context.getString(R.string.version_update_found)) @@ -61,6 +57,51 @@ public class DownloadNotificationManager { notificationManager.notify(DOWNLOAD_NOTIFICATION_ID, notificationBuilder.build()); } + public void buildDownloadSuccessfulNotification() { + NotificationManager notificationManager = initNotificationManager(); + if (notificationManager == null) { + return; + } + NotificationCompat.Builder notificationBuilder = initNotificationBuilderDefaults(); + notificationBuilder + .setSmallIcon(android.R.drawable.stat_sys_download_done) + .setWhen(System.currentTimeMillis()) + .setTicker(context.getString(R.string.version_update_title, context.getString(R.string.app_name))) + .setContentTitle(context.getString(R.string.version_update_download_title, context.getString(R.string.app_name))) + .setContentText(context.getString(R.string.version_update_download_description)) + .setContentIntent(getInstallIntent()); + notificationManager.notify(DOWNLOAD_NOTIFICATION_ID, notificationBuilder.build()); + } + + public void buildDownloadUpdateProgress(int progress) { + NotificationManager notificationManager = initNotificationManager(); + if (notificationManager == null) { + return; + } + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this.context, DownloadService.NOTIFICATION_CHANNEL_NEWSTATUS_ID); + notificationBuilder + .setDefaults(Notification.DEFAULT_ALL) + .setAutoCancel(false) + .setOngoing(true) + .setSmallIcon(android.R.drawable.stat_sys_download) + .setContentTitle(context.getString(R.string.version_update_apk_description, context.getString(R.string.app_name))) + .setProgress(100, progress, false) + .setContentIntent(getDownloadIntent()); + notificationManager.notify(DOWNLOAD_NOTIFICATION_ID, notificationBuilder.build()); + } + + private NotificationManager initNotificationManager() { + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager == null) { + return null; + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + createNotificationChannel(notificationManager); + } + return notificationManager; + } + @TargetApi(26) private void createNotificationChannel(NotificationManager notificationManager) { CharSequence name = "Bitmask Updates"; @@ -75,7 +116,13 @@ public class DownloadNotificationManager { notificationManager.createNotificationChannel(channel); } - + private NotificationCompat.Builder initNotificationBuilderDefaults() { + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this.context, DownloadService.NOTIFICATION_CHANNEL_NEWSTATUS_ID); + notificationBuilder. + setDefaults(Notification.DEFAULT_ALL). + setAutoCancel(true); + return notificationBuilder; + } private PendingIntent getDownloadIntent() { Intent downloadIntent = new Intent(context, DownloadBroadcastReceiver.class); @@ -83,24 +130,9 @@ public class DownloadNotificationManager { return PendingIntent.getBroadcast(context, 0, downloadIntent, PendingIntent.FLAG_CANCEL_CURRENT); } - public void buildDownloadUpdateProgress(int progress) { - NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager == null) { - return; - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - createNotificationChannel(notificationManager); - } - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this.context, DownloadService.NOTIFICATION_CHANNEL_NEWSTATUS_ID); - notificationBuilder.setAutoCancel(true) - .setDefaults(Notification.DEFAULT_ALL) - .setAutoCancel(false) - .setOngoing(true) - .setSmallIcon(R.mipmap.ic_launcher) - .setContentTitle(context.getString(R.string.version_update_apk_description, context.getString(R.string.app_name))) - .setProgress(100, progress, false) - .setContentIntent(getDownloadIntent()); - notificationManager.notify(DOWNLOAD_NOTIFICATION_ID, notificationBuilder.build()); + private PendingIntent getInstallIntent() { + Intent installIntent = new Intent(context, InstallActivity.class); + return PendingIntent.getActivity(context, 0, installIntent, PendingIntent.FLAG_CANCEL_CURRENT); } public void cancelNotifications() { diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java index e373a888..f2f82238 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java @@ -1,4 +1,96 @@ +/** + * Copyright (c) 2020 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package se.leap.bitmaskclient.appUpdate; -public class InstallActivity { +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.provider.Settings; +import android.widget.Toast; + +import androidx.annotation.Nullable; + +import java.io.File; + +import de.blinkt.openvpn.core.VpnStatus; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.utils.PreferenceHelper; + +import static se.leap.bitmaskclient.Constants.REQUEST_CODE_INSTALL_UPDATE; +import static se.leap.bitmaskclient.Constants.REQUEST_CODE_REQUEST_UPDATE; +import static se.leap.bitmaskclient.appUpdate.DownloadConnector.APP_TYPE; +import static se.leap.bitmaskclient.appUpdate.FileProviderUtil.getUriFor; + +public class InstallActivity extends Activity { + + private static final String TAG = InstallActivity.class.getSimpleName(); + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + requestPermissionAndInstall(); + } + + + private void requestPermissionAndInstall() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !this.getPackageManager().canRequestPackageInstalls()) { + startActivityForResult(new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:"+getPackageName())), + REQUEST_CODE_REQUEST_UPDATE); + } else { + installUpdate(); + } + } + + protected void installUpdate() { + PreferenceHelper.restartOnUpdate(this.getApplicationContext(), true); + + Intent installIntent = new Intent(Intent.ACTION_VIEW); + File update = UpdateDownloadManager.getUpdateFile(this.getApplicationContext()); + if (update.exists()) { + installIntent.setDataAndType(getUriFor(this.getApplicationContext(), update), APP_TYPE); + installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + this.startActivityForResult(installIntent, REQUEST_CODE_INSTALL_UPDATE); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == REQUEST_CODE_REQUEST_UPDATE) { + if (resultCode == RESULT_OK) { + installUpdate(); + } else { + Toast.makeText(this, getString(R.string.version_update_error_permissions), Toast.LENGTH_LONG).show(); + finish(); + } + } else if (requestCode == REQUEST_CODE_INSTALL_UPDATE) { + switch (resultCode) { + case RESULT_OK: + Toast.makeText(this, "Update successful.", Toast.LENGTH_LONG).show(); + break; + case RESULT_CANCELED: + case RESULT_FIRST_USER: + Toast.makeText(this, getString(R.string.version_update_error), Toast.LENGTH_LONG).show(); + break; + } + finish(); + } + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index dfd94759..f62af638 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -36,9 +36,7 @@ public interface Constants { String ALLOW_TETHERING_USB = "tethering_usb"; String SHOW_EXPERIMENTAL = "show_experimental"; String USE_IPv6_FIREWALL = "use_ipv6_firewall"; - String APK_DOWNLOAD_ID = "apk_download_id"; - String VERSION_FILE_DOWNLOAD_ID = "version_file_downlaod_id"; - String SIGNATURE_DOWNLOAD_ID = "signature_file_download_id"; + String RESTART_ON_UPDATE = "restart_on_update"; ////////////////////////////////////////////// @@ -50,6 +48,8 @@ public interface Constants { int REQUEST_CODE_SWITCH_PROVIDER = 1; int REQUEST_CODE_LOG_IN = 2; int REQUEST_CODE_ADD_PROVIDER = 3; + int REQUEST_CODE_INSTALL_UPDATE = 4; + int REQUEST_CODE_REQUEST_UPDATE = 5; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index 9937eeeb..9d49d5da 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -183,9 +183,14 @@ public class StartActivity extends Activity{ if (getIntent() != null && getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false)) { EipCommand.startVPN(this.getApplicationContext(), true); finish(); - return; + } else if (PreferenceHelper.getRestartOnUpdate(this.getApplicationContext())) { + PreferenceHelper.restartOnUpdate(this.getApplicationContext(), false); + EipCommand.startVPN(this.getApplicationContext(), false); + showMainActivity(); + finish(); + } else { + showMainActivity(); } - showMainActivity(); } } else { configureLeapProvider(); diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java index cb2aeb26..5ca2ec75 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java @@ -27,6 +27,7 @@ import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.Constants.RESTART_ON_UPDATE; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.Constants.SHOW_EXPERIMENTAL; import static se.leap.bitmaskclient.Constants.USE_IPv6_FIREWALL; @@ -121,6 +122,14 @@ public class PreferenceHelper { apply(); } + public static void restartOnUpdate(Context context, boolean isEnabled) { + putBoolean(context, RESTART_ON_UPDATE, isEnabled); + } + + public static boolean getRestartOnUpdate(Context context) { + return getBoolean(context, RESTART_ON_UPDATE, false); + } + public static boolean getUsePluggableTransports(Context context) { return getBoolean(context, USE_PLUGGABLE_TRANSPORTS, false); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5ba51afe..d047da21 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -149,4 +149,7 @@ Storage permission request was denied. A new %s version has been downloaded. Tap here to install the update. + PGP verification error. Ignoring download. + Update failed. + No permissions to install app. -- cgit v1.2.3 From c057256828743fd1f7ee9d735d84b3a077dac2a8 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 00:48:35 +0100 Subject: remove never implemented multi-profile feature version code --- app/src/main/java/se/leap/bitmaskclient/FeatureVersionCode.java | 1 - app/src/main/java/se/leap/bitmaskclient/StartActivity.java | 3 --- 2 files changed, 4 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/FeatureVersionCode.java b/app/src/main/java/se/leap/bitmaskclient/FeatureVersionCode.java index 3b67d96b..519e4fc2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/FeatureVersionCode.java +++ b/app/src/main/java/se/leap/bitmaskclient/FeatureVersionCode.java @@ -1,7 +1,6 @@ package se.leap.bitmaskclient; public interface FeatureVersionCode { - int MULTIPLE_PROFILES = 132; int RENAMED_EIP_IN_PREFERENCES = 132; int GEOIP_SERVICE = 148; } diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index 9d49d5da..1a679b1c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -133,9 +133,6 @@ public class StartActivity extends Activity{ * execute necessary upgrades for version change */ private void executeUpgrade() { - if (hasNewFeature(FeatureVersionCode.MULTIPLE_PROFILES)) { - // TODO prepare usage of multiple profiles - } if (hasNewFeature(FeatureVersionCode.RENAMED_EIP_IN_PREFERENCES)) { String eipJson = preferences.getString(PROVIDER_KEY, null); if (eipJson != null) { -- cgit v1.2.3 From 10a6c27ab03189cf5c504d09affedb309d1dafe6 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 16:08:48 +0100 Subject: check once a week for an app update --- .../appUpdate/DownloadBroadcastReceiver.java | 6 ++---- .../main/java/se/leap/bitmaskclient/Constants.java | 1 + .../java/se/leap/bitmaskclient/EipSetupObserver.java | 9 ++++++++- .../se/leap/bitmaskclient/utils/PreferenceHelper.java | 19 +++++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java index f410b9ff..4719737b 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java @@ -20,14 +20,13 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.util.Log; import android.widget.Toast; import java.io.File; import se.leap.bitmaskclient.Constants; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.utils.ConfigHelper; +import se.leap.bitmaskclient.utils.PreferenceHelper; import static android.app.Activity.RESULT_CANCELED; import static se.leap.bitmaskclient.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; @@ -53,7 +52,6 @@ public class DownloadBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - Log.d(TAG, "DOWNLOAD ON RECEIVE!"); String action = intent.getAction(); if (action == null) { return; @@ -74,7 +72,7 @@ public class DownloadBroadcastReceiver extends BroadcastReceiver { break; case UPDATE_NOT_FOUND: if (resultData.getBoolean(NO_NEW_VERISON, false)) { - //TODO: Save in preferences date, retry in a week + PreferenceHelper.setLastAppUpdateCheck(context.getApplicationContext()); } break; case UPDATE_DOWNLOADED: diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index f62af638..5fcaba2f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -37,6 +37,7 @@ public interface Constants { String SHOW_EXPERIMENTAL = "show_experimental"; String USE_IPv6_FIREWALL = "use_ipv6_firewall"; String RESTART_ON_UPDATE = "restart_on_update"; + String LAST_UPDATE_CHECK = "last_update_check"; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java b/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java index 174e6657..e365c857 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java @@ -77,6 +77,7 @@ class EipSetupObserver extends BroadcastReceiver implements VpnStatus.StateListe //The real timout is 4*2s + 1*4s + 1*8s + 1*16s + 1*32s + 1*64s = 132 s; private static final String TIMEOUT = "4"; + private static final int UPDATE_CHECK_TIMEOUT = 1000*60*60*24*7; private Context context; private VpnProfile setupVpnProfile; private String observedProfileFromVpnStatus; @@ -312,13 +313,19 @@ class EipSetupObserver extends BroadcastReceiver implements VpnStatus.StateListe ProviderAPICommand.execute(context, ProviderAPI.DOWNLOAD_SERVICE_JSON, provider); } - DownloadServiceCommand.execute(context, CHECK_VERSION_FILE); + if (shouldCheckAppUpdate()) { + DownloadServiceCommand.execute(context, CHECK_VERSION_FILE); + } finishGatewaySetup(false); } else if ("TCP_CONNECT".equals(state)) { changingGateway.set(false); } } + private boolean shouldCheckAppUpdate() { + return System.currentTimeMillis() - PreferenceHelper.getLastAppUpdateCheck(context) >= UPDATE_CHECK_TIMEOUT; + } + private void selectNextGateway() { changingGateway.set(true); reconnectTry.set(0); diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java index 5ca2ec75..5b62d0ff 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java @@ -22,6 +22,7 @@ import static se.leap.bitmaskclient.Constants.ALLOW_TETHERING_WIFI; import static se.leap.bitmaskclient.Constants.ALWAYS_ON_SHOW_DIALOG; import static se.leap.bitmaskclient.Constants.DEFAULT_SHARED_PREFS_BATTERY_SAVER; import static se.leap.bitmaskclient.Constants.EXCLUDED_APPS; +import static se.leap.bitmaskclient.Constants.LAST_UPDATE_CHECK; import static se.leap.bitmaskclient.Constants.LAST_USED_PROFILE; import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; @@ -122,6 +123,14 @@ public class PreferenceHelper { apply(); } + public static void setLastAppUpdateCheck(Context context) { + putLong(context, LAST_UPDATE_CHECK, System.currentTimeMillis()); + } + + public static long getLastAppUpdateCheck(Context context) { + return getLong(context, LAST_UPDATE_CHECK, 0); + } + public static void restartOnUpdate(Context context, boolean isEnabled) { putBoolean(context, RESTART_ON_UPDATE, isEnabled); } @@ -223,6 +232,16 @@ public class PreferenceHelper { return preferences.getStringSet(EXCLUDED_APPS, new HashSet<>()); } + public static long getLong(Context context, String key, long defValue) { + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); + return preferences.getLong(key, defValue); + } + + public static void putLong(Context context, String key, long value) { + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); + preferences.edit().putLong(key, value).apply(); + } + public static String getString(Context context, String key, String defValue) { SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); return preferences.getString(key, defValue); -- cgit v1.2.3 From 09865483f39e01a52e401baba280260df2c2e766 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 16:12:01 +0100 Subject: cleanup, remove unused code and deprecated comments --- .../appUpdate/DownloadConnector.java | 1 - .../appUpdate/FileProviderUtil.java | 15 --------------- .../appUpdate/InstallActivity.java | 1 - .../appUpdate/UpdateDownloadManager.java | 20 -------------------- .../java/se/leap/bitmaskclient/eip/EipCommand.java | 3 +-- 5 files changed, 1 insertion(+), 39 deletions(-) (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java index d4c5de7f..f081331f 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java @@ -88,7 +88,6 @@ public class DownloadConnector { Response response = okHttpClient.newCall(request).execute(); ResponseBody body = response.body(); - InputStream in = body.byteStream(); long contentLength = body.contentLength(); source = body.source(); sink = Okio.buffer(Okio.sink(destFile)); diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java index 756a3b99..4966a863 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java @@ -26,10 +26,6 @@ import java.io.File; import se.leap.bitmaskclient.BuildConfig; -/** - * From Signal - */ - public class FileProviderUtil { private static final String AUTHORITY = BuildConfig.APPLICATION_ID +".fileprovider"; @@ -38,15 +34,4 @@ public class FileProviderUtil { if (Build.VERSION.SDK_INT >= 24) return FileProvider.getUriForFile(context, AUTHORITY, file); else return Uri.fromFile(file); } - - public static boolean isAuthority(@NonNull Uri uri) { - return AUTHORITY.equals(uri.getAuthority()); - } - - public static boolean delete(@NonNull Context context, @NonNull Uri uri) { - if (AUTHORITY.equals(uri.getAuthority())) { - return context.getContentResolver().delete(uri, null, null) > 0; - } - return new File(uri.getPath()).delete(); - } } diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java index f2f82238..028f47bc 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java @@ -28,7 +28,6 @@ import androidx.annotation.Nullable; import java.io.File; -import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.utils.PreferenceHelper; diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java index 698a0d17..f2eabc7b 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java @@ -22,8 +22,6 @@ import android.os.Bundle; import android.os.ResultReceiver; import android.util.Log; -import androidx.annotation.NonNull; - import java.io.File; import okhttp3.OkHttpClient; @@ -114,7 +112,6 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download sendToReceiverOrBroadcast(receiver, UPDATE_DOWNLOAD_FAILED, result); } break; - } } @@ -164,23 +161,6 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download return task; } - private static void clearPreviousDownloads(@NonNull Context context, String destinationFile) { - File directory = context.getExternalFilesDir(null); - - if (directory == null) { - Log.w(TAG, "Failed to read external files directory."); - return; - } - - for (File file : directory.listFiles()) { - if (file.getName().equals(destinationFile)) { - if (file.delete()) { - Log.d(TAG, "Deleted " + file.getName()); - } - } - } - } - private Bundle checkVersionFile(Bundle task) { OkHttpClient client = clientGenerator.init(); String versionString = DownloadConnector.requestTextFileFromServer(BuildConfig.version_file_url, client); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java index 1ee32654..25450f56 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java @@ -4,9 +4,9 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.ResultReceiver; + import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; -import androidx.core.content.ContextCompat; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -38,7 +38,6 @@ public class EipCommand { * @param resultReceiver The resultreceiver to reply to */ private static void execute(@NotNull Context context, @NotNull String action, @Nullable ResultReceiver resultReceiver, @Nullable Intent vpnIntent) { - // TODO validate "action"...how do we get the list of intent-filters for a class via Android API? if (vpnIntent == null) { vpnIntent = new Intent(); } -- cgit v1.2.3 From 0ce7baa3ce5138d9b298b67cfcd03d04ba6a66c0 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 16:12:51 +0100 Subject: fix lint issue, use parseInt instead of valueOf for string to integer conversion --- .../java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java index f2eabc7b..b79c2a91 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java @@ -171,7 +171,7 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download int version = -1; try { - version = Integer.valueOf(versionString); + version = Integer.parseInt(versionString); } catch (NumberFormatException e) { e.printStackTrace(); Log.e(TAG, "could not parse version code: " + versionString); -- cgit v1.2.3 From a41c9876bac7c769a876d5aebc3e797c7c2e73a4 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 16:13:52 +0100 Subject: debounce notification creation during app download --- .../java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java index f081331f..8723f515 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java @@ -95,11 +95,16 @@ public class DownloadConnector { long totalBytesRead = 0; int bufferSize = 8 * 1024; long bytesRead; + int lastProgress = 0; while ((bytesRead = source.read(sinkBuffer, bufferSize)) != -1) { sink.emit(); totalBytesRead += bytesRead; int progress = (int) ((totalBytesRead * 100) / contentLength); - callback.onUpdate(progress); + // debouncing callbacks + if (lastProgress < progress) { + lastProgress = progress; + callback.onUpdate(progress); + } } sink.flush(); -- cgit v1.2.3 From 00f449b80ea1704d1772e580e4ce16beac5039bf Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 16:14:49 +0100 Subject: remove redundant check for file deletion if app update failed --- .../se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java | 7 ------- 1 file changed, 7 deletions(-) (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java index 4719737b..525c3c9b 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java @@ -22,8 +22,6 @@ import android.content.Intent; import android.os.Bundle; import android.widget.Toast; -import java.io.File; - import se.leap.bitmaskclient.Constants; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.utils.PreferenceHelper; @@ -40,7 +38,6 @@ import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_FOUND; import static se.leap.bitmaskclient.appUpdate.DownloadService.UPDATE_NOT_FOUND; import static se.leap.bitmaskclient.appUpdate.DownloadService.VERIFICATION_ERROR; import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; -import static se.leap.bitmaskclient.appUpdate.UpdateDownloadManager.getUpdateFile; public class DownloadBroadcastReceiver extends BroadcastReceiver { @@ -84,10 +81,6 @@ public class DownloadBroadcastReceiver extends BroadcastReceiver { } else { Toast.makeText(context.getApplicationContext(), context.getString(R.string.version_update_error), Toast.LENGTH_LONG).show(); } - File file = getUpdateFile(context); - if (file.exists()) { - file.delete(); - } break; case DOWNLOAD_PROGRESS: int progress = resultData.getInt(PROGRESS_VALUE, 0); -- cgit v1.2.3 From 73efd90a7bb170481ae827e8ae0523daed992b40 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 18:43:33 +0100 Subject: no need to use onActivityResult in InstallActivity during installation it won't be called --- .../se.leap.bitmaskclient/appUpdate/InstallActivity.java | 16 ++-------------- app/src/main/java/se/leap/bitmaskclient/Constants.java | 3 +-- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java index 028f47bc..6629425c 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java @@ -31,7 +31,6 @@ import java.io.File; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.utils.PreferenceHelper; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_INSTALL_UPDATE; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_REQUEST_UPDATE; import static se.leap.bitmaskclient.appUpdate.DownloadConnector.APP_TYPE; import static se.leap.bitmaskclient.appUpdate.FileProviderUtil.getUriFor; @@ -46,7 +45,6 @@ public class InstallActivity extends Activity { requestPermissionAndInstall(); } - private void requestPermissionAndInstall() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !this.getPackageManager().canRequestPackageInstalls()) { startActivityForResult(new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:"+getPackageName())), @@ -65,7 +63,8 @@ public class InstallActivity extends Activity { installIntent.setDataAndType(getUriFor(this.getApplicationContext(), update), APP_TYPE); installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - this.startActivityForResult(installIntent, REQUEST_CODE_INSTALL_UPDATE); + this.startActivity(installIntent); + finish(); } } @@ -79,17 +78,6 @@ public class InstallActivity extends Activity { Toast.makeText(this, getString(R.string.version_update_error_permissions), Toast.LENGTH_LONG).show(); finish(); } - } else if (requestCode == REQUEST_CODE_INSTALL_UPDATE) { - switch (resultCode) { - case RESULT_OK: - Toast.makeText(this, "Update successful.", Toast.LENGTH_LONG).show(); - break; - case RESULT_CANCELED: - case RESULT_FIRST_USER: - Toast.makeText(this, getString(R.string.version_update_error), Toast.LENGTH_LONG).show(); - break; - } - finish(); } } } diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index 5fcaba2f..1d364074 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -49,8 +49,7 @@ public interface Constants { int REQUEST_CODE_SWITCH_PROVIDER = 1; int REQUEST_CODE_LOG_IN = 2; int REQUEST_CODE_ADD_PROVIDER = 3; - int REQUEST_CODE_INSTALL_UPDATE = 4; - int REQUEST_CODE_REQUEST_UPDATE = 5; + int REQUEST_CODE_REQUEST_UPDATE = 4; ////////////////////////////////////////////// -- cgit v1.2.3 From 13a495d18917f9b8952088b4a3e960239c5a168c Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 18:44:00 +0100 Subject: cancel ongoing download notification if download failed --- .../java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java index 525c3c9b..a4acc2aa 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadBroadcastReceiver.java @@ -81,6 +81,7 @@ public class DownloadBroadcastReceiver extends BroadcastReceiver { } else { Toast.makeText(context.getApplicationContext(), context.getString(R.string.version_update_error), Toast.LENGTH_LONG).show(); } + notificationManager.cancelNotifications(); break; case DOWNLOAD_PROGRESS: int progress = resultData.getInt(PROGRESS_VALUE, 0); -- cgit v1.2.3