Fix 'Delete' nullpointerexception and revert to working URL-getting

This commit is contained in:
Matthew Wong 2015-12-31 07:20:48 -05:00
parent c3b87f5b18
commit a3e10d3ca8
2 changed files with 5 additions and 5 deletions

View file

@ -137,7 +137,8 @@ public class AutofillFragment extends DialogFragment {
builder.setNeutralButton(R.string.autofill_apps_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (packageName != null && !packageName.equals("")) {
if (((AutofillPreferenceActivity) getActivity()).recyclerAdapter != null
&& packageName != null && !packageName.equals("")) {
editor.remove(packageName);
((AutofillPreferenceActivity) getActivity()).recyclerAdapter.removeWebsite(packageName);
editor.apply();

View file

@ -111,10 +111,9 @@ public class AutofillService extends AccessibilityService {
webViewURL = null;
if (webViewTitle != null) {
List<AccessibilityNodeInfo> nodes = new ArrayList<>();
if (event.getSource().getPackageName().equals("com.android.chrome")) {
nodes = getRootInActiveWindow().findAccessibilityNodeInfosByViewId("com.android.chrome:id/url_bar");
} else if (event.getSource().getPackageName().equals("com.android.browser")) {
List<AccessibilityNodeInfo> nodes = getRootInActiveWindow()
.findAccessibilityNodeInfosByViewId("com.android.chrome:id/url_bar");
if (nodes.size() == 0) {
nodes = getRootInActiveWindow().findAccessibilityNodeInfosByViewId("com.android.browser:id/url");
}
for (AccessibilityNodeInfo node : nodes)