analytics: remove
This commit is contained in:
@@ -20,8 +20,6 @@ package org.sufficientlysecure.keychain;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.Proxy;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
@@ -159,10 +157,6 @@ public final class Constants {
|
||||
|
||||
public static final String KEY_SIGNATURES_TABLE_INITIALIZED = "key_signatures_table_initialized";
|
||||
|
||||
public static final String KEY_ANALYTICS_ASKED_POLITELY = "analytics_asked";
|
||||
public static final String KEY_ANALYTICS_CONSENT = "analytics_consent";
|
||||
public static final String KEY_ANALYTICS_LAST_ASKED = "analytics_last_asked";
|
||||
|
||||
public static final class Theme {
|
||||
public static final String LIGHT = "light";
|
||||
public static final String DARK = "dark";
|
||||
@@ -173,14 +167,6 @@ public final class Constants {
|
||||
public static final String TYPE_HTTP = "proxyHttp";
|
||||
public static final String TYPE_SOCKS = "proxySocks";
|
||||
}
|
||||
|
||||
// we generally only track booleans. never snoop around in the user's string settings!!
|
||||
public static final List<String> ANALYTICS_PREFS = Arrays.asList(USE_NORMAL_PROXY, USE_TOR_PROXY,
|
||||
SYNC_CONTACTS, SYNC_KEYSERVER, ENABLE_WIFI_SYNC_ONLY,
|
||||
EXPERIMENTAL_USB_ALLOW_UNTESTED,
|
||||
PASSPHRASE_CACHE_SUBS, SEARCH_KEYSERVER, SEARCH_WEB_KEY_DIRECTORY,
|
||||
TEXT_USE_COMPRESSION, TEXT_SELF_ENCRYPT, FILE_USE_COMPRESSION, FILE_SELF_ENCRYPT, USE_ARMOR,
|
||||
USE_NUMKEYPAD_FOR_SECURITY_TOKEN_PIN, ENCRYPT_FILENAMES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,7 +34,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.sufficientlysecure.keychain.analytics.AnalyticsManager;
|
||||
import org.sufficientlysecure.keychain.keysync.KeyserverSyncManager;
|
||||
import org.sufficientlysecure.keychain.network.TlsCertificatePinning;
|
||||
import org.sufficientlysecure.keychain.provider.TemporaryFileProvider;
|
||||
@@ -46,8 +45,6 @@ import timber.log.Timber.DebugTree;
|
||||
|
||||
|
||||
public class KeychainApplication extends Application {
|
||||
AnalyticsManager analyticsManager;
|
||||
|
||||
/**
|
||||
* Called when the application is starting, before any activity, service, or receiver objects
|
||||
* (excluding content providers) have been created.
|
||||
@@ -116,9 +113,6 @@ public class KeychainApplication extends Application {
|
||||
KeyserverSyncManager.updateKeyserverSyncScheduleAsync(this, false);
|
||||
|
||||
TemporaryFileProvider.scheduleCleanupImmediately(getApplicationContext());
|
||||
|
||||
analyticsManager = AnalyticsManager.getInstance(getApplicationContext());
|
||||
analyticsManager.initialize(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,10 +161,6 @@ public class KeychainApplication extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
public AnalyticsManager getAnalyticsManager() {
|
||||
return analyticsManager;
|
||||
}
|
||||
|
||||
public static String getProcessName() {
|
||||
if (Build.VERSION.SDK_INT >= 28)
|
||||
return Application.getProcessName();
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
package org.sufficientlysecure.keychain.analytics;
|
||||
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.SettingsActivity;
|
||||
import org.sufficientlysecure.keychain.ui.SettingsActivity.ExperimentalPrefsFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
|
||||
public class AnalyticsConsentRequester {
|
||||
private final Activity activity;
|
||||
|
||||
public static AnalyticsConsentRequester getInstance(Activity activity) {
|
||||
return new AnalyticsConsentRequester(activity);
|
||||
}
|
||||
|
||||
private AnalyticsConsentRequester(Activity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public void maybeAskForAnalytics() {
|
||||
Preferences preferences = Preferences.getPreferences(activity);
|
||||
if (preferences.isAnalyticsHasConsent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean askedBeforeAndWasRejected =
|
||||
preferences.isAnalyticsAskedPolitely() && !preferences.isAnalyticsHasConsent();
|
||||
if (askedBeforeAndWasRejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
long firstInstallTime =
|
||||
activity.getPackageManager().getPackageInfo(BuildConfig.APPLICATION_ID, 0).firstInstallTime;
|
||||
long threeDaysAgo = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(3);
|
||||
boolean installedLessThanThreeDaysAgo = firstInstallTime > threeDaysAgo;
|
||||
if (installedLessThanThreeDaysAgo) {
|
||||
return;
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
long twentyFourHoursAgo = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1);
|
||||
boolean askedLessThan24HoursAgo = preferences.getAnalyticsLastAsked() > twentyFourHoursAgo;
|
||||
if (askedLessThan24HoursAgo) {
|
||||
return;
|
||||
}
|
||||
|
||||
preferences.setAnalyticsLastAskedNow();
|
||||
|
||||
AnalyticsManager analyticsManager = ((KeychainApplication) activity.getApplication()).getAnalyticsManager();
|
||||
AlertDialog alertDialog = new Builder(activity)
|
||||
.setMessage(R.string.dialog_analytics_consent)
|
||||
.setPositiveButton(R.string.button_analytics_yes, (dialog, which) -> {
|
||||
preferences.setAnalyticsAskedPolitely();
|
||||
preferences.setAnalyticsGotUserConsent(true);
|
||||
analyticsManager.refreshSettings(activity);
|
||||
Notify.create(activity, R.string.snack_analytics_accept, Style.OK,
|
||||
this::startExperimentalSettingsActivity, R.string.snackbutton_analytics_settings).show();
|
||||
})
|
||||
.setNegativeButton(R.string.button_analytics_no, (dialog, which) -> {
|
||||
preferences.setAnalyticsAskedPolitely();
|
||||
preferences.setAnalyticsGotUserConsent(false);
|
||||
analyticsManager.refreshSettings(activity);
|
||||
Notify.create(activity, R.string.snack_analytics_reject, Style.OK,
|
||||
this::startExperimentalSettingsActivity, R.string.snackbutton_analytics_settings).show();
|
||||
})
|
||||
.show();
|
||||
alertDialog.<TextView>findViewById(android.R.id.message).setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
private void startExperimentalSettingsActivity() {
|
||||
Intent resultIntent = new Intent(activity, SettingsActivity.class);
|
||||
String experimentalPrefsName = ExperimentalPrefsFragment.class.getName();
|
||||
resultIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, experimentalPrefsName);
|
||||
activity.startActivity(resultIntent);
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
package org.sufficientlysecure.keychain.analytics;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.Application.ActivityLifecycleCallbacks;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.piwik.sdk.Piwik;
|
||||
import org.piwik.sdk.Tracker;
|
||||
import org.piwik.sdk.TrackerConfig;
|
||||
import org.piwik.sdk.extra.DownloadTracker.Extra.ApkChecksum;
|
||||
import org.piwik.sdk.extra.TrackHelper;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Constants.Defaults;
|
||||
import org.sufficientlysecure.keychain.Constants.Pref;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
public class AnalyticsManager implements OnSharedPreferenceChangeListener {
|
||||
private Tracker piwikTracker;
|
||||
|
||||
public static AnalyticsManager getInstance(Context context) {
|
||||
return new AnalyticsManager(context);
|
||||
}
|
||||
|
||||
private AnalyticsManager(Context context) {
|
||||
refreshSettings(context);
|
||||
}
|
||||
|
||||
public void initialize(Application application) {
|
||||
if (piwikTracker != null) {
|
||||
TrackHelper.track().download().identifier(new ApkChecksum(application)).with(piwikTracker);
|
||||
}
|
||||
|
||||
application.registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
if (piwikTracker == null) {
|
||||
return;
|
||||
}
|
||||
TrackHelper.track().screen(activity.getClass().getSimpleName()).with(piwikTracker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Preferences preferences = Preferences.getPreferences(application);
|
||||
preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
// we generally only track booleans. never snoop around in the user's string settings!!
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (piwikTracker == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// small exception: check if the user uses a custom keyserver, or one of the well-known ones
|
||||
if (Pref.KEY_SERVERS.equals(key)) {
|
||||
Timber.d("Tracking pref %s", key);
|
||||
String keyServers = sharedPreferences.getString(Pref.KEY_SERVERS, Defaults.KEY_SERVERS);
|
||||
String current = keyServers.substring(keyServers.indexOf(','));
|
||||
|
||||
String coarseGranularityKeyserver;
|
||||
if (current.contains("keyserver.ubuntu.com")) {
|
||||
coarseGranularityKeyserver = "ubuntu";
|
||||
} else if (current.contains("pgp.mit.edu")) {
|
||||
coarseGranularityKeyserver = "mit";
|
||||
} else if (current.contains("pool.sks-keyservers.net")) {
|
||||
coarseGranularityKeyserver = "pool";
|
||||
} else {
|
||||
coarseGranularityKeyserver = "custom";
|
||||
}
|
||||
TrackHelper.track().interaction("pref_" + Pref.KEY_SERVERS, coarseGranularityKeyserver).with(piwikTracker);
|
||||
return;
|
||||
}
|
||||
// unpack an enum
|
||||
if (Pref.THEME.equals(key)) {
|
||||
String value = sharedPreferences.getString(Pref.THEME, "empty");
|
||||
TrackHelper.track().interaction("pref_" + Pref.THEME, value).with(piwikTracker);
|
||||
return;
|
||||
}
|
||||
// all other values we track are individual booleans
|
||||
if (Pref.ANALYTICS_PREFS.contains(key)) {
|
||||
Timber.d("Tracking pref %s", key);
|
||||
if (!sharedPreferences.contains(key)) {
|
||||
TrackHelper.track().interaction("pref_" + key, "empty").with(piwikTracker);
|
||||
return;
|
||||
}
|
||||
boolean value = sharedPreferences.getBoolean(key, false);
|
||||
TrackHelper.track().interaction("pref_" + key, value ? "true" : "false").with(piwikTracker);
|
||||
}
|
||||
}
|
||||
|
||||
public void trackFragmentImpression(String opClassName, String fragmentName) {
|
||||
if (piwikTracker == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TrackHelper.track().screen(opClassName + "/" + fragmentName).with(piwikTracker);
|
||||
}
|
||||
|
||||
public void trackInternalServiceCall(String opClassName) {
|
||||
if (piwikTracker == null) {
|
||||
return;
|
||||
}
|
||||
TrackHelper.track()
|
||||
.interaction("internalApiCall", opClassName)
|
||||
.with(piwikTracker);
|
||||
}
|
||||
|
||||
public void trackApiServiceCall(String opClassName, String currentCallingPackage) {
|
||||
if (piwikTracker == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TrackHelper.track()
|
||||
.interaction("externalApiCall", opClassName)
|
||||
.piece(currentCallingPackage.replace(".", "/"))
|
||||
.with(piwikTracker);
|
||||
}
|
||||
|
||||
public synchronized void refreshSettings(Context context) {
|
||||
boolean shouldEnableAnalytics = shouldEnableAnalytics(context);
|
||||
boolean analyticsEnabled = piwikTracker != null;
|
||||
if (shouldEnableAnalytics != analyticsEnabled) {
|
||||
if (shouldEnableAnalytics) {
|
||||
TrackerConfig trackerConfig;
|
||||
if (Constants.DEBUG) {
|
||||
trackerConfig = new TrackerConfig("https://piwik.openkeychain.org/", 3, "OpenKeychainDebug");
|
||||
} else {
|
||||
trackerConfig = new TrackerConfig("https://piwik.openkeychain.org/", 2, "OpenKeychain");
|
||||
}
|
||||
piwikTracker = Piwik.getInstance(context).newTracker(trackerConfig);
|
||||
piwikTracker.setDispatchInterval(60000);
|
||||
piwikTracker.setOptOut(false);
|
||||
} else {
|
||||
piwikTracker.setOptOut(true);
|
||||
piwikTracker = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldEnableAnalytics(Context context) {
|
||||
Preferences preferences = Preferences.getPreferences(context);
|
||||
return preferences.isAnalyticsHasConsent() && !preferences.getUseTorProxy();
|
||||
}
|
||||
}
|
||||
@@ -38,10 +38,10 @@ import android.os.Messenger;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import org.bouncycastle.bcpg.ArmoredOutputStream;
|
||||
import org.openintents.openpgp.AutocryptPeerUpdate;
|
||||
import org.openintents.openpgp.IOpenPgpService;
|
||||
@@ -52,9 +52,12 @@ import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult.AutocryptPeerResult;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.daos.ApiAppDao;
|
||||
import org.sufficientlysecure.keychain.daos.AutocryptPeerDao;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.daos.OverriddenWarningsDao;
|
||||
import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo;
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.analytics.AnalyticsManager;
|
||||
import org.sufficientlysecure.keychain.operations.BackupOperation;
|
||||
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.ExportResult;
|
||||
@@ -69,12 +72,7 @@ import org.sufficientlysecure.keychain.pgp.PgpSignEncryptData;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpSignEncryptOperation;
|
||||
import org.sufficientlysecure.keychain.pgp.Progressable;
|
||||
import org.sufficientlysecure.keychain.pgp.SecurityProblem;
|
||||
import org.sufficientlysecure.keychain.daos.ApiAppDao;
|
||||
import org.sufficientlysecure.keychain.daos.AutocryptPeerDao;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainExternalContract.AutocryptStatus;
|
||||
import org.sufficientlysecure.keychain.daos.OverriddenWarningsDao;
|
||||
import org.sufficientlysecure.keychain.remote.OpenPgpServiceKeyIdExtractor.KeyIdResult;
|
||||
import org.sufficientlysecure.keychain.remote.OpenPgpServiceKeyIdExtractor.KeyIdResultStatus;
|
||||
import org.sufficientlysecure.keychain.service.BackupKeyringParcel;
|
||||
@@ -101,7 +99,6 @@ public class OpenPgpService extends Service {
|
||||
private ApiAppDao mApiAppDao;
|
||||
private OpenPgpServiceKeyIdExtractor mKeyIdExtractor;
|
||||
private ApiPendingIntentFactory mApiPendingIntentFactory;
|
||||
private AnalyticsManager analyticsManager;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -111,8 +108,6 @@ public class OpenPgpService extends Service {
|
||||
mApiPermissionHelper = new ApiPermissionHelper(this, mApiAppDao);
|
||||
mApiPendingIntentFactory = new ApiPendingIntentFactory(getBaseContext());
|
||||
mKeyIdExtractor = OpenPgpServiceKeyIdExtractor.getInstance(getContentResolver(), mApiPendingIntentFactory);
|
||||
|
||||
analyticsManager = ((KeychainApplication) getApplication()).getAnalyticsManager();
|
||||
}
|
||||
|
||||
private Intent signImpl(Intent data, InputStream inputStream,
|
||||
@@ -1032,8 +1027,6 @@ public class OpenPgpService extends Service {
|
||||
return errorResult;
|
||||
}
|
||||
|
||||
analyticsManager.trackApiServiceCall(data.getAction(), mApiPermissionHelper.getCurrentCallingPackage());
|
||||
|
||||
Progressable progressable = null;
|
||||
if (data.hasExtra(OpenPgpApi.EXTRA_PROGRESS_MESSENGER)) {
|
||||
Messenger messenger = data.getParcelableExtra(OpenPgpApi.EXTRA_PROGRESS_MESSENGER);
|
||||
|
||||
@@ -40,17 +40,15 @@ import org.openintents.ssh.authentication.response.PublicKeyResponse;
|
||||
import org.openintents.ssh.authentication.response.SigningResponse;
|
||||
import org.openintents.ssh.authentication.response.SshPublicKeyResponse;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.analytics.AnalyticsManager;
|
||||
import org.sufficientlysecure.keychain.daos.ApiAppDao;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogEntryParcel;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKey;
|
||||
import org.sufficientlysecure.keychain.pgp.SshPublicKey;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.daos.ApiAppDao;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
import org.sufficientlysecure.keychain.ssh.AuthenticationData;
|
||||
@@ -67,8 +65,6 @@ public class SshAuthenticationService extends Service {
|
||||
private ApiAppDao mApiAppDao;
|
||||
private ApiPendingIntentFactory mApiPendingIntentFactory;
|
||||
|
||||
private AnalyticsManager analyticsManager;
|
||||
|
||||
private static final List<Integer> SUPPORTED_VERSIONS = Collections.unmodifiableList(Collections.singletonList(1));
|
||||
private static final int INVALID_API_VERSION = -1;
|
||||
|
||||
@@ -82,8 +78,6 @@ public class SshAuthenticationService extends Service {
|
||||
mApiAppDao = ApiAppDao.getInstance(this);
|
||||
|
||||
mApiPendingIntentFactory = new ApiPendingIntentFactory(getBaseContext());
|
||||
|
||||
analyticsManager = ((KeychainApplication) getApplication()).getAnalyticsManager();
|
||||
}
|
||||
|
||||
private final ISshAuthenticationService.Stub mSSHAgent = new ISshAuthenticationService.Stub() {
|
||||
@@ -109,8 +103,6 @@ public class SshAuthenticationService extends Service {
|
||||
}
|
||||
|
||||
private Intent executeInternal(Intent intent) {
|
||||
analyticsManager.trackApiServiceCall(intent.getAction(), mApiPermissionHelper.getCurrentCallingPackage());
|
||||
|
||||
switch (intent.getAction()) {
|
||||
case SshAuthenticationApi.ACTION_SIGN:
|
||||
return authenticate(intent);
|
||||
|
||||
@@ -25,10 +25,8 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Parcelable;
|
||||
import androidx.core.os.CancellationSignal;
|
||||
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.analytics.AnalyticsManager;
|
||||
import androidx.core.os.CancellationSignal;
|
||||
import org.sufficientlysecure.keychain.daos.KeyWritableRepository;
|
||||
import org.sufficientlysecure.keychain.operations.BackupOperation;
|
||||
import org.sufficientlysecure.keychain.operations.BaseOperation;
|
||||
@@ -54,20 +52,15 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
|
||||
|
||||
public class KeychainServiceTask {
|
||||
private final AnalyticsManager analyticsManager;
|
||||
|
||||
public static KeychainServiceTask create(Activity activity) {
|
||||
Context context = activity.getApplicationContext();
|
||||
KeyWritableRepository keyRepository = KeyWritableRepository.create(context);
|
||||
AnalyticsManager analyticsManager = ((KeychainApplication) activity.getApplication()).getAnalyticsManager();
|
||||
|
||||
return new KeychainServiceTask(context, keyRepository, analyticsManager);
|
||||
return new KeychainServiceTask(context, keyRepository);
|
||||
}
|
||||
|
||||
private KeychainServiceTask(Context context, KeyWritableRepository keyRepository, AnalyticsManager analyticsManager) {
|
||||
private KeychainServiceTask(Context context, KeyWritableRepository keyRepository) {
|
||||
this.context = context;
|
||||
this.keyRepository = keyRepository;
|
||||
this.analyticsManager = analyticsManager;
|
||||
}
|
||||
|
||||
private final Context context;
|
||||
@@ -128,8 +121,6 @@ public class KeychainServiceTask {
|
||||
return null;
|
||||
}
|
||||
|
||||
analyticsManager.trackInternalServiceCall(op.getClass().getSimpleName());
|
||||
|
||||
// noinspection unchecked, we make sure it's the correct op above
|
||||
return op.execute(inputParcel, cryptoInput);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ import eu.davidea.flexibleadapter.SelectableAdapter.Mode;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.analytics.AnalyticsConsentRequester;
|
||||
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
||||
import org.sufficientlysecure.keychain.daos.DatabaseNotifyManager;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository;
|
||||
@@ -254,8 +253,6 @@ public class KeyListFragment extends RecyclerFragment<FlexibleAdapter<FlexibleKe
|
||||
GenericViewModel viewModel = ViewModelProviders.of(this).get(GenericViewModel.class);
|
||||
LiveData<List<FlexibleKeyItem>> liveData = viewModel.getGenericLiveData(requireContext(), this::loadFlexibleKeyItems);
|
||||
liveData.observe(this, this::onLoadKeyItems);
|
||||
|
||||
AnalyticsConsentRequester.getInstance(activity).maybeAskForAnalytics();
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
||||
@@ -17,18 +17,19 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.View;
|
||||
|
||||
import com.mikepenz.community_material_typeface_library.CommunityMaterial;
|
||||
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
|
||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||
@@ -37,10 +38,7 @@ import com.mikepenz.materialdrawer.DrawerBuilder;
|
||||
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
|
||||
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
|
||||
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.analytics.AnalyticsManager;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.remote.ui.AppsListFragment;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity;
|
||||
@@ -67,7 +65,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
|
||||
|
||||
public Drawer mDrawer;
|
||||
private Toolbar mToolbar;
|
||||
private AnalyticsManager analyticsManager;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -78,8 +75,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
|
||||
mToolbar.setTitle(R.string.app_name);
|
||||
setSupportActionBar(mToolbar);
|
||||
|
||||
analyticsManager = ((KeychainApplication) getApplication()).getAnalyticsManager();
|
||||
|
||||
mDrawer = new DrawerBuilder()
|
||||
.withActivity(this)
|
||||
.withHeader(R.layout.main_drawer_header)
|
||||
@@ -219,8 +214,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
|
||||
private void setFragment(Fragment frag) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
|
||||
analyticsManager.trackFragmentImpression(getClass().getSimpleName(), frag.getClass().getSimpleName());
|
||||
|
||||
FragmentTransaction ft = fragmentManager.beginTransaction();
|
||||
ft.replace(R.id.main_fragment_container, frag);
|
||||
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
|
||||
|
||||
@@ -41,14 +41,14 @@ import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.provider.ContactsContract;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@@ -579,14 +579,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
Activity activity = getActivity();
|
||||
((KeychainApplication) activity.getApplication()).getAnalyticsManager().refreshSettings(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
|
||||
@@ -22,17 +22,9 @@ import java.util.List;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.Transformations;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
||||
import android.view.ActionMode;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@@ -41,16 +33,22 @@ import android.view.View;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.Transformations;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
||||
import com.astuetz.PagerSlidingTabStrip;
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.livedata.GenericLiveData;
|
||||
import org.sufficientlysecure.keychain.model.SubKey;
|
||||
import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo;
|
||||
import org.sufficientlysecure.keychain.model.UserPacket.UserId;
|
||||
import org.sufficientlysecure.keychain.analytics.AnalyticsManager;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.daos.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.PagerTabStripAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity;
|
||||
@@ -89,8 +87,6 @@ public class ViewKeyAdvActivity extends BaseActivity implements OnPageChangeList
|
||||
}
|
||||
}
|
||||
|
||||
private AnalyticsManager analyticsManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -98,7 +94,6 @@ public class ViewKeyAdvActivity extends BaseActivity implements OnPageChangeList
|
||||
setFullScreenDialogClose(v -> finish());
|
||||
|
||||
keyRepository = KeyRepository.create(this);
|
||||
analyticsManager = ((KeychainApplication) getApplication()).getAnalyticsManager();
|
||||
|
||||
viewPager = findViewById(R.id.pager);
|
||||
slidingTabLayout = findViewById(R.id.sliding_tab_layout);
|
||||
@@ -300,9 +295,6 @@ public class ViewKeyAdvActivity extends BaseActivity implements OnPageChangeList
|
||||
actionMode = null;
|
||||
}
|
||||
invalidateOptionsMenu();
|
||||
|
||||
String fragmentName = tabAdapter.getItem(position).getClass().getSimpleName();
|
||||
analyticsManager.trackFragmentImpression(getClass().getSimpleName(), fragmentName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -359,30 +359,6 @@ public class Preferences {
|
||||
mSharedPreferences.edit().putString(Pref.SYNC_WORK_UUID, value).apply();
|
||||
}
|
||||
|
||||
public boolean isAnalyticsAskedPolitely() {
|
||||
return mSharedPreferences.getBoolean(Pref.KEY_ANALYTICS_ASKED_POLITELY, false);
|
||||
}
|
||||
|
||||
public void setAnalyticsAskedPolitely() {
|
||||
mSharedPreferences.edit().putBoolean(Pref.KEY_ANALYTICS_ASKED_POLITELY, true).apply();
|
||||
}
|
||||
|
||||
public boolean isAnalyticsHasConsent() {
|
||||
return mSharedPreferences.getBoolean(Pref.KEY_ANALYTICS_CONSENT, false);
|
||||
}
|
||||
|
||||
public void setAnalyticsGotUserConsent(boolean hasUserConsent) {
|
||||
mSharedPreferences.edit().putBoolean(Pref.KEY_ANALYTICS_CONSENT, hasUserConsent).apply();
|
||||
}
|
||||
|
||||
public void setAnalyticsLastAskedNow() {
|
||||
mSharedPreferences.edit().putLong(Pref.KEY_ANALYTICS_LAST_ASKED, System.currentTimeMillis()).apply();
|
||||
}
|
||||
|
||||
public long getAnalyticsLastAsked() {
|
||||
return mSharedPreferences.getLong(Pref.KEY_ANALYTICS_LAST_ASKED, 0);
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
public static abstract class CloudSearchPrefs implements Parcelable {
|
||||
public abstract boolean isKeyserverEnabled();
|
||||
|
||||
Reference in New Issue
Block a user