2020-03-04 12:23:47 +00:00
|
|
|
package eu.faircode.email;
|
|
|
|
|
|
|
|
/*
|
|
|
|
This file is part of FairEmail.
|
|
|
|
|
|
|
|
FairEmail 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.
|
|
|
|
|
|
|
|
FairEmail 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 FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
Copyright 2018-2020 by Marcel Bokhorst (M66B)
|
|
|
|
*/
|
|
|
|
|
2020-05-25 14:57:50 +00:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.DialogInterface;
|
2020-03-04 12:23:47 +00:00
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.ResolveInfo;
|
2020-07-06 09:59:51 +00:00
|
|
|
import android.os.Build;
|
2020-03-04 12:23:47 +00:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.provider.Settings;
|
|
|
|
import android.security.KeyChain;
|
2020-05-25 14:57:50 +00:00
|
|
|
import android.text.TextUtils;
|
2020-03-04 12:23:47 +00:00
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.CompoundButton;
|
2020-09-13 16:20:03 +00:00
|
|
|
import android.widget.ImageButton;
|
2020-03-04 12:23:47 +00:00
|
|
|
import android.widget.Spinner;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
2020-05-25 14:57:50 +00:00
|
|
|
import androidx.appcompat.app.AlertDialog;
|
2020-03-04 12:23:47 +00:00
|
|
|
import androidx.appcompat.widget.SwitchCompat;
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
|
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
2020-04-24 15:23:21 +00:00
|
|
|
import org.openintents.openpgp.IOpenPgpService2;
|
2020-03-04 12:23:47 +00:00
|
|
|
import org.openintents.openpgp.util.OpenPgpApi;
|
2020-04-24 15:23:21 +00:00
|
|
|
import org.openintents.openpgp.util.OpenPgpServiceConnection;
|
2020-03-04 12:23:47 +00:00
|
|
|
|
2020-05-25 14:57:50 +00:00
|
|
|
import java.security.KeyStore;
|
2020-03-04 12:23:47 +00:00
|
|
|
import java.security.NoSuchAlgorithmException;
|
2020-05-25 14:57:50 +00:00
|
|
|
import java.security.Principal;
|
|
|
|
import java.security.cert.Certificate;
|
|
|
|
import java.security.cert.X509Certificate;
|
2020-03-04 12:23:47 +00:00
|
|
|
import java.util.ArrayList;
|
2020-05-25 14:57:50 +00:00
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Enumeration;
|
2020-03-04 12:23:47 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class FragmentOptionsEncryption extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
2020-09-13 16:20:03 +00:00
|
|
|
private ImageButton ibInfo;
|
2020-03-04 12:23:47 +00:00
|
|
|
private SwitchCompat swSign;
|
|
|
|
private SwitchCompat swEncrypt;
|
|
|
|
private SwitchCompat swAutoDecrypt;
|
|
|
|
|
|
|
|
private Spinner spOpenPgp;
|
2020-07-01 13:39:25 +00:00
|
|
|
private TextView tvOpenPgpStatus;
|
2020-03-04 12:23:47 +00:00
|
|
|
private SwitchCompat swAutocrypt;
|
|
|
|
private SwitchCompat swAutocryptMutual;
|
2020-11-18 11:01:19 +00:00
|
|
|
private SwitchCompat swEncryptSubject;
|
2020-03-04 12:23:47 +00:00
|
|
|
|
2020-06-08 06:24:50 +00:00
|
|
|
private SwitchCompat swCheckCertificate;
|
2020-03-04 12:23:47 +00:00
|
|
|
private Button btnManageCertificates;
|
|
|
|
private Button btnImportKey;
|
|
|
|
private Button btnManageKeys;
|
2020-05-25 14:57:50 +00:00
|
|
|
private Button btnCa;
|
2020-03-04 12:23:47 +00:00
|
|
|
private TextView tvKeySize;
|
|
|
|
|
2020-04-24 15:23:21 +00:00
|
|
|
private OpenPgpServiceConnection pgpService;
|
2020-03-04 12:23:47 +00:00
|
|
|
private List<String> openPgpProvider = new ArrayList<>();
|
|
|
|
|
|
|
|
private final static String[] RESET_OPTIONS = new String[]{
|
2020-05-23 12:49:53 +00:00
|
|
|
"sign_default", "encrypt_default", "auto_decrypt",
|
2020-11-18 11:01:19 +00:00
|
|
|
"openpgp_provider", "autocrypt", "autocrypt_mutual", "encrypt_subject",
|
2020-06-08 06:24:50 +00:00
|
|
|
"check_certificate"
|
2020-03-04 12:23:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Nullable
|
|
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
|
|
setSubtitle(R.string.title_setup);
|
|
|
|
setHasOptionsMenu(true);
|
|
|
|
|
|
|
|
PackageManager pm = getContext().getPackageManager();
|
|
|
|
View view = inflater.inflate(R.layout.fragment_options_encryption, container, false);
|
|
|
|
|
|
|
|
// Get controls
|
2020-09-13 16:20:03 +00:00
|
|
|
ibInfo = view.findViewById(R.id.ibInfo);
|
2020-03-04 12:23:47 +00:00
|
|
|
swSign = view.findViewById(R.id.swSign);
|
|
|
|
swEncrypt = view.findViewById(R.id.swEncrypt);
|
|
|
|
swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt);
|
|
|
|
|
|
|
|
spOpenPgp = view.findViewById(R.id.spOpenPgp);
|
2020-07-01 13:39:25 +00:00
|
|
|
tvOpenPgpStatus = view.findViewById(R.id.tvOpenPgpStatus);
|
2020-03-04 12:23:47 +00:00
|
|
|
swAutocrypt = view.findViewById(R.id.swAutocrypt);
|
|
|
|
swAutocryptMutual = view.findViewById(R.id.swAutocryptMutual);
|
2020-11-18 11:01:19 +00:00
|
|
|
swEncryptSubject = view.findViewById(R.id.swEncryptSubject);
|
2020-03-04 12:23:47 +00:00
|
|
|
|
2020-06-08 06:24:50 +00:00
|
|
|
swCheckCertificate = view.findViewById(R.id.swCheckCertificate);
|
2020-03-04 12:23:47 +00:00
|
|
|
btnManageCertificates = view.findViewById(R.id.btnManageCertificates);
|
|
|
|
btnImportKey = view.findViewById(R.id.btnImportKey);
|
|
|
|
btnManageKeys = view.findViewById(R.id.btnManageKeys);
|
2020-05-25 14:57:50 +00:00
|
|
|
btnCa = view.findViewById(R.id.btnCa);
|
2020-03-04 12:23:47 +00:00
|
|
|
tvKeySize = view.findViewById(R.id.tvKeySize);
|
|
|
|
|
|
|
|
Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
|
2020-06-14 16:34:13 +00:00
|
|
|
List<ResolveInfo> ris = pm.queryIntentServices(intent, 0); // package whitelisted
|
2020-09-07 13:58:16 +00:00
|
|
|
if (ris != null)
|
|
|
|
for (ResolveInfo ri : ris)
|
|
|
|
if (ri.serviceInfo != null)
|
|
|
|
openPgpProvider.add(ri.serviceInfo.packageName);
|
2020-03-04 12:23:47 +00:00
|
|
|
|
|
|
|
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, android.R.id.text1);
|
|
|
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
|
|
adapter.addAll(openPgpProvider);
|
|
|
|
spOpenPgp.setAdapter(adapter);
|
|
|
|
|
|
|
|
setOptions();
|
|
|
|
|
|
|
|
// Wire controls
|
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
2020-09-13 16:20:03 +00:00
|
|
|
ibInfo.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2020-11-11 16:35:32 +00:00
|
|
|
Helper.viewFAQ(v.getContext(), 12);
|
2020-09-13 16:20:03 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
swSign.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("sign_default", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swEncrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("encrypt_default", checked).apply();
|
|
|
|
swSign.setEnabled(!checked);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swAutoDecrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("auto_decrypt", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// PGP
|
|
|
|
|
|
|
|
spOpenPgp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
2020-04-24 15:23:21 +00:00
|
|
|
String pkg = openPgpProvider.get(position);
|
|
|
|
prefs.edit().putString("openpgp_provider", pkg).apply();
|
|
|
|
|
|
|
|
String tag = (String) spOpenPgp.getTag();
|
|
|
|
if (tag != null && !tag.equals(pkg)) {
|
|
|
|
spOpenPgp.setTag(pkg);
|
|
|
|
testOpenPgp(pkg);
|
|
|
|
}
|
2020-03-04 12:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("openpgp_provider").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swAutocrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("autocrypt", checked).apply();
|
|
|
|
swAutocryptMutual.setEnabled(checked);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swAutocryptMutual.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("autocrypt_mutual", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-11-18 11:01:19 +00:00
|
|
|
swEncryptSubject.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("encrypt_subject", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
// S/MIME
|
|
|
|
|
2020-06-08 06:24:50 +00:00
|
|
|
swCheckCertificate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("check_certificate", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
btnManageCertificates.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
|
|
|
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_MANAGE_CERTIFICATES));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
final Intent importKey = KeyChain.createInstallIntent();
|
2020-06-14 16:34:13 +00:00
|
|
|
btnImportKey.setEnabled(importKey.resolveActivity(pm) != null); // system whitelisted
|
2020-07-06 09:59:51 +00:00
|
|
|
btnImportKey.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.R ? View.VISIBLE : View.GONE);
|
2020-03-04 12:23:47 +00:00
|
|
|
btnImportKey.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
startActivity(importKey);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
final Intent security = new Intent(Settings.ACTION_SECURITY_SETTINGS);
|
2020-06-14 16:34:13 +00:00
|
|
|
btnImportKey.setEnabled(security.resolveActivity(pm) != null); // system whitelisted
|
2020-03-04 12:23:47 +00:00
|
|
|
btnManageKeys.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
startActivity(security);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-05-25 14:57:50 +00:00
|
|
|
btnCa.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
new SimpleTask<List<String>>() {
|
|
|
|
@Override
|
|
|
|
protected List<String> onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
KeyStore ks = KeyStore.getInstance("AndroidCAStore");
|
|
|
|
ks.load(null, null);
|
|
|
|
|
|
|
|
List<String> issuers = new ArrayList<>();
|
|
|
|
Enumeration<String> aliases = ks.aliases();
|
|
|
|
while (aliases.hasMoreElements()) {
|
|
|
|
String alias = aliases.nextElement();
|
|
|
|
Certificate kcert = ks.getCertificate(alias);
|
|
|
|
if (kcert instanceof X509Certificate) {
|
|
|
|
Principal issuer = ((X509Certificate) kcert).getIssuerDN();
|
|
|
|
if (issuer != null) {
|
|
|
|
String name = issuer.getName();
|
|
|
|
if (name != null)
|
|
|
|
issuers.add(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Collections.sort(issuers);
|
|
|
|
return issuers;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onExecuted(Bundle args, List<String> issuers) {
|
|
|
|
new AlertDialog.Builder(getContext())
|
|
|
|
.setTitle(R.string.title_advanced_ca)
|
|
|
|
.setMessage(TextUtils.join("\r\n", issuers))
|
|
|
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
Log.unexpectedError(getParentFragmentManager(), ex);
|
|
|
|
}
|
|
|
|
}.execute(FragmentOptionsEncryption.this, new Bundle(), "ca");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
try {
|
|
|
|
int maxKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength("AES");
|
|
|
|
tvKeySize.setText(getString(R.string.title_advanced_aes_key_size, maxKeySize));
|
|
|
|
} catch (NoSuchAlgorithmException ex) {
|
|
|
|
tvKeySize.setText(Log.formatThrowable(ex));
|
|
|
|
}
|
|
|
|
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDestroyView() {
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(getContext()).unregisterOnSharedPreferenceChangeListener(this);
|
2020-04-24 15:23:21 +00:00
|
|
|
|
|
|
|
if (pgpService != null && pgpService.isBound()) {
|
|
|
|
Log.i("PGP unbinding");
|
|
|
|
pgpService.unbindFromService();
|
|
|
|
}
|
|
|
|
pgpService = null;
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
super.onDestroyView();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
|
|
|
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
|
|
|
setOptions();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
|
inflater.inflate(R.menu.menu_options, menu);
|
|
|
|
super.onCreateOptionsMenu(menu, inflater);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case R.id.menu_default:
|
|
|
|
onMenuDefault();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onMenuDefault() {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
for (String option : RESET_OPTIONS)
|
|
|
|
editor.remove(option);
|
|
|
|
editor.apply();
|
|
|
|
ToastEx.makeText(getContext(), R.string.title_setup_done, Toast.LENGTH_LONG).show();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void setOptions() {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
|
|
|
swSign.setChecked(prefs.getBoolean("sign_default", false));
|
|
|
|
swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false));
|
|
|
|
swSign.setEnabled(!swEncrypt.isChecked());
|
|
|
|
swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", false));
|
|
|
|
|
|
|
|
String provider = prefs.getString("openpgp_provider", "org.sufficientlysecure.keychain");
|
2020-04-24 15:23:21 +00:00
|
|
|
spOpenPgp.setTag(provider);
|
2020-03-04 12:23:47 +00:00
|
|
|
for (int pos = 0; pos < openPgpProvider.size(); pos++)
|
|
|
|
if (provider.equals(openPgpProvider.get(pos))) {
|
|
|
|
spOpenPgp.setSelection(pos);
|
|
|
|
break;
|
|
|
|
}
|
2020-04-24 15:23:21 +00:00
|
|
|
testOpenPgp(provider);
|
2020-03-04 12:23:47 +00:00
|
|
|
|
|
|
|
swAutocrypt.setChecked(prefs.getBoolean("autocrypt", true));
|
|
|
|
swAutocryptMutual.setChecked(prefs.getBoolean("autocrypt_mutual", true));
|
|
|
|
swAutocryptMutual.setEnabled(swAutocrypt.isChecked());
|
2020-11-18 11:01:19 +00:00
|
|
|
swEncryptSubject.setChecked(prefs.getBoolean("encrypt_subject", false));
|
2020-06-08 06:24:50 +00:00
|
|
|
|
|
|
|
swCheckCertificate.setChecked(prefs.getBoolean("check_certificate", true));
|
2020-03-04 12:23:47 +00:00
|
|
|
}
|
2020-04-24 15:23:21 +00:00
|
|
|
|
|
|
|
private void testOpenPgp(String pkg) {
|
|
|
|
if (pgpService != null && pgpService.isBound())
|
|
|
|
pgpService.unbindFromService();
|
|
|
|
|
2020-07-01 13:39:25 +00:00
|
|
|
tvOpenPgpStatus.setText("PGP binding to " + pkg);
|
2020-04-24 15:23:21 +00:00
|
|
|
pgpService = new OpenPgpServiceConnection(getContext(), pkg, new OpenPgpServiceConnection.OnBound() {
|
|
|
|
@Override
|
|
|
|
public void onBound(IOpenPgpService2 service) {
|
2020-07-01 13:39:25 +00:00
|
|
|
tvOpenPgpStatus.setText("PGP bound to " + pkg);
|
2020-04-24 15:23:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onError(Exception ex) {
|
2020-04-25 14:16:07 +00:00
|
|
|
if ("bindService() returned false!".equals(ex.getMessage()))
|
2020-07-01 13:39:25 +00:00
|
|
|
tvOpenPgpStatus.setText(ex.getMessage());
|
2020-04-25 14:16:07 +00:00
|
|
|
else
|
2020-07-01 13:39:25 +00:00
|
|
|
tvOpenPgpStatus.setText(ex.toString());
|
2020-04-24 15:23:21 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
pgpService.bindToService();
|
|
|
|
}
|
2020-03-04 12:23:47 +00:00
|
|
|
}
|