aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorMatthew Wong <mawong@redhat.com>2016-12-26 05:19:49 -0500
committerMatthew Wong <mawong@redhat.com>2016-12-26 05:19:49 -0500
commit57be6f5e14925bae9f8b0b01c9aebe9f4592e1f2 (patch)
tree7f7e7765d96f564f7b54946b33ac47104429d213 /app/src/main/java
parent0a050bbe03f1c864a53c1c0167e5f7794c910e43 (diff)
Fix #247: avoid npe getting accessibility event package name
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
index 58bbbe4c..f4bbddc4 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
@@ -97,7 +97,8 @@ public class AutofillService extends AccessibilityService {
// if returning to the source app from a successful AutofillActivity
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
- && event.getPackageName().equals(packageName) && resultData != null) {
+ && event.getPackageName() != null && event.getPackageName().equals(packageName)
+ && resultData != null) {
bindDecryptAndVerify();
}
@@ -105,9 +106,9 @@ public class AutofillService extends AccessibilityService {
// or if page changes in chrome
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
|| (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
- && event.getSource() != null && event.getSource().getPackageName() != null
- && (event.getSource().getPackageName().equals("com.android.chrome")
- || event.getSource().getPackageName().equals("com.android.browser")))) {
+ && event.getPackageName() != null
+ && (event.getPackageName().equals("com.android.chrome")
+ || event.getPackageName().equals("com.android.browser")))) {
// there is a chance for getRootInActiveWindow() to return null at any time. save it.
AccessibilityNodeInfo root = getRootInActiveWindow();
webViewTitle = searchWebView(root);
@@ -136,8 +137,8 @@ public class AutofillService extends AccessibilityService {
// nothing to do if not password field focus, field is keychain app
if (!event.isPassword()
|| event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
- || event.getPackageName().equals("org.sufficientlysecure.keychain")
- || event.getPackageName().equals("com.android.systemui")) {
+ || event.getPackageName() != null && event.getPackageName().equals("org.sufficientlysecure.keychain")
+ || event.getPackageName() != null && event.getPackageName().equals("com.android.systemui")) {
dismissDialog(event);
return;
}