Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 660ea8c6 authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Guarded access to mCallback and check for null before using it."

parents f61cdcb6 4997c505
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ public abstract class AutoFillService extends Service {
     * <p>You should generally do initialization here rather than in {@link #onCreate}.
     */
    public void onConnected() {

        //TODO(b/33197203): is not called anymore, fix it!
    }

    /**
@@ -221,6 +221,6 @@ public abstract class AutoFillService extends Service {
     * <p> At this point this service may no longer be an active {@link AutoFillService}.
     */
    public void onDisconnected() {

        //TODO(b/33197203): is not called anymore, fix it!
    }
}
+5 −3
Original line number Diff line number Diff line
@@ -886,9 +886,11 @@ final class AutoFillManagerServiceImpl {
        }

        private AutoFillUI getUiForShowing() {
            mUi.setCallback(this, mActivityToken);
            synchronized (mLock) {
                mUi.setCallbackLocked(this, mActivityToken);
                return mUi;
            }
        }

        private ViewNode findViewNodeByIdLocked(AutoFillId id) {
            final int size = mStructure.getWindowNodeCount();
@@ -926,7 +928,7 @@ final class AutoFillManagerServiceImpl {
        private void destroyLocked() {
            mRemoteFillService.destroy();
            mUi.hideAll();
            mUi.setCallback(null, null);
            mUi.setCallbackLocked(null, null);
        }

        private void removeSelf() {
+6 −2
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ final class AutoFillUI {
        mWm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    }

    void setCallback(AutoFillUiCallback callback, IBinder activityToken) {
    void setCallbackLocked(AutoFillUiCallback callback, IBinder activityToken) {
        hideAll();
        mCallback = callback;
        mActivityToken = activityToken;
@@ -180,7 +180,11 @@ final class AutoFillUI {
                            synchronized (mLock) {
                                callback = mCallback;
                            }
                            if (callback != null) {
                                callback.fill(dataset);
                            } else {
                                Slog.w(TAG, "null callback on showFillUi() for " + viewState.mId);
                            }
                            hideFillUi();
                        });