mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-02 07:15:21 +00:00
Fix crash on first start & use documentLaunchMode for nicer openkeychain-api behaviour (5+ only)
This commit is contained in:
@@ -55,7 +55,9 @@
|
|||||||
</service>
|
</service>
|
||||||
|
|
||||||
<activity android:name=".autofill.AutofillActivity"
|
<activity android:name=".autofill.AutofillActivity"
|
||||||
android:parentActivityName=".PasswordStore">
|
android:parentActivityName=".PasswordStore"
|
||||||
|
android:documentLaunchMode="intoExisting"
|
||||||
|
android:excludeFromRecents="true">
|
||||||
|
|
||||||
<meta-data android:name="android.support.PARENT_ACTIVITY"
|
<meta-data android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="com.zeapo.pwdstore.PasswordStore" />
|
android:value="com.zeapo.pwdstore.PasswordStore" />
|
||||||
|
@@ -130,11 +130,17 @@ public class AutofillService extends AccessibilityService {
|
|||||||
String preference = prefs.getString(event.getPackageName().toString(), defValue);
|
String preference = prefs.getString(event.getPackageName().toString(), defValue);
|
||||||
switch (preference) {
|
switch (preference) {
|
||||||
case "first":
|
case "first":
|
||||||
|
if (!PasswordRepository.isInitialized()) {
|
||||||
|
PasswordRepository.initialize(this);
|
||||||
|
}
|
||||||
items = recursiveFilter(appName, null);
|
items = recursiveFilter(appName, null);
|
||||||
break;
|
break;
|
||||||
case "never":
|
case "never":
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
if (!PasswordRepository.isInitialized()) {
|
||||||
|
PasswordRepository.initialize(this);
|
||||||
|
}
|
||||||
String path = PasswordRepository.getWorkTree() + "/" + preference + ".gpg";
|
String path = PasswordRepository.getWorkTree() + "/" + preference + ".gpg";
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
items = new ArrayList<>();
|
items = new ArrayList<>();
|
||||||
@@ -177,9 +183,6 @@ public class AutofillService extends AccessibilityService {
|
|||||||
|
|
||||||
private ArrayList<PasswordItem> recursiveFilter(String filter, File dir) {
|
private ArrayList<PasswordItem> recursiveFilter(String filter, File dir) {
|
||||||
ArrayList<PasswordItem> items = new ArrayList<>();
|
ArrayList<PasswordItem> items = new ArrayList<>();
|
||||||
if (!PasswordRepository.isInitialized()) {
|
|
||||||
PasswordRepository.initialize(this);
|
|
||||||
}
|
|
||||||
ArrayList<PasswordItem> passwordItems = dir == null ?
|
ArrayList<PasswordItem> passwordItems = dir == null ?
|
||||||
PasswordRepository.getPasswords(PasswordRepository.getRepositoryDirectory(this)) :
|
PasswordRepository.getPasswords(PasswordRepository.getRepositoryDirectory(this)) :
|
||||||
PasswordRepository.getPasswords(dir, PasswordRepository.getRepositoryDirectory(this));
|
PasswordRepository.getPasswords(dir, PasswordRepository.getRepositoryDirectory(this));
|
||||||
@@ -252,8 +255,7 @@ public class AutofillService extends AccessibilityService {
|
|||||||
PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
||||||
// need to start a blank activity to call startIntentSenderForResult
|
// need to start a blank activity to call startIntentSenderForResult
|
||||||
Intent intent = new Intent(AutofillService.this, AutofillActivity.class);
|
Intent intent = new Intent(AutofillService.this, AutofillActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
|
||||||
intent.putExtra("pending_intent", pi);
|
intent.putExtra("pending_intent", pi);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user