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() { builder.setNeutralButton(R.string.autofill_apps_delete, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (packageName != null && !packageName.equals("")) { if (((AutofillPreferenceActivity) getActivity()).recyclerAdapter != null
&& packageName != null && !packageName.equals("")) {
editor.remove(packageName); editor.remove(packageName);
((AutofillPreferenceActivity) getActivity()).recyclerAdapter.removeWebsite(packageName); ((AutofillPreferenceActivity) getActivity()).recyclerAdapter.removeWebsite(packageName);
editor.apply(); editor.apply();

View file

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