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

Commit 75663cee authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Add protection for ActionMode-related window callbacks that may not implement new methods."

parents f342ac91 bf85f43e
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -1832,7 +1832,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            }

            final ActionMode.Callback wrappedCallback = new ActionModeCallbackWrapper(callback);
            ActionMode mode = getCallback().onWindowStartingActionMode(wrappedCallback);
            ActionMode mode = null;
            try {
                mode = getCallback().onWindowStartingActionMode(wrappedCallback);
            } catch (AbstractMethodError ame) {
                // Older apps might not implement this callback method.
            }
            if (mode != null) {
                mActionMode = mode;
            } else {
@@ -1877,7 +1882,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                }
            }
            if (mActionMode != null) {
                try {
                    getCallback().onActionModeStarted(mActionMode);
                } catch (AbstractMethodError ame) {
                    // Older apps might not implement this callback method.
                }
            }
            return mActionMode;
        }
@@ -2094,7 +2103,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                if (mActionModeView != null) {
                    mActionModeView.removeAllViews();
                }
                try {
                    getCallback().onActionModeFinished(mActionMode);
                } catch (AbstractMethodError ame) {
                    // Older apps might not implement this callback method.
                }
                mActionMode = null;
            }
        }