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

Commit 5c0d41dd authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-787c7134-f106-4590-90f7-0fb685b91259-for-git_oc-mr1-release-43...

release-request-787c7134-f106-4590-90f7-0fb685b91259-for-git_oc-mr1-release-4360035 snap-temp-L24200000106060350

Change-Id: I2a6858753e424f3143ff5e55ed5de7acbc4ab7b8
parents bc3c95eb d7122735
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public class KeyguardManager {
     */
    public Intent createConfirmFactoryResetCredentialIntent(
            CharSequence title, CharSequence description, CharSequence alternateButtonLabel) {
        if (!LockPatternUtils.frpCredentialEnabled()) {
        if (!LockPatternUtils.frpCredentialEnabled(mContext)) {
            Log.w(TAG, "Factory reset credentials not supported.");
            return null;
        }
+28 −1
Original line number Diff line number Diff line
@@ -47,6 +47,19 @@ public class AutofillPopupWindow extends PopupWindow {
    private final WindowPresenter mWindowPresenter;
    private WindowManager.LayoutParams mWindowLayoutParams;

    private final View.OnAttachStateChangeListener mOnAttachStateChangeListener =
            new View.OnAttachStateChangeListener() {
        @Override
        public void onViewAttachedToWindow(View v) {
            /* ignore - handled by the super class */
        }

        @Override
        public void onViewDetachedFromWindow(View v) {
            dismiss();
        }
    };

    /**
     * Creates a popup window with a presenter owning the window and responsible for
     * showing/hiding/updating the backing window. This can be useful of the window is
@@ -208,7 +221,21 @@ public class AutofillPopupWindow extends PopupWindow {
        p.packageName = anchor.getContext().getPackageName();
        mWindowPresenter.show(p, getTransitionEpicenter(), isLayoutInsetDecor(),
                anchor.getLayoutDirection());
        return;
    }

    @Override
    protected void attachToAnchor(View anchor, int xoff, int yoff, int gravity) {
        super.attachToAnchor(anchor, xoff, yoff, gravity);
        anchor.addOnAttachStateChangeListener(mOnAttachStateChangeListener);
    }

    @Override
    protected void detachFromAnchor() {
        final View anchor = getAnchor();
        if (anchor != null) {
            anchor.removeOnAttachStateChangeListener(mOnAttachStateChangeListener);
        }
        super.detachFromAnchor();
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -582,6 +582,7 @@ public final class SmartSelectionEventTracker {
                case ActionType.SMART_SHARE:  // fall through
                case ActionType.DRAG:  // fall through
                case ActionType.ABANDON:  // fall through
                case ActionType.OTHER:  // fall through
                    return true;
                default:
                    return false;
+8 −3
Original line number Diff line number Diff line
@@ -2296,8 +2296,8 @@ public class PopupWindow {
    }

    /** @hide */
    protected final void detachFromAnchor() {
        final View anchor = mAnchor != null ? mAnchor.get() : null;
    protected void detachFromAnchor() {
        final View anchor = getAnchor();
        if (anchor != null) {
            final ViewTreeObserver vto = anchor.getViewTreeObserver();
            vto.removeOnScrollChangedListener(mOnScrollChangedListener);
@@ -2316,7 +2316,7 @@ public class PopupWindow {
    }

    /** @hide */
    protected final void attachToAnchor(View anchor, int xoff, int yoff, int gravity) {
    protected void attachToAnchor(View anchor, int xoff, int yoff, int gravity) {
        detachFromAnchor();

        final ViewTreeObserver vto = anchor.getViewTreeObserver();
@@ -2339,6 +2339,11 @@ public class PopupWindow {
        mAnchoredGravity = gravity;
    }

    /** @hide */
    protected @Nullable View getAnchor() {
        return mAnchor != null ? mAnchor.get() : null;
    }

    private void alignToAnchor() {
        final View anchor = mAnchor != null ? mAnchor.get() : null;
        if (anchor != null && anchor.isAttachedToWindow() && hasDecorView()) {
+40 −6
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ import java.util.regex.Pattern;
@UiThread
final class SelectionActionModeHelper {

    private static final String LOG_TAG = "SelectActionModeHelper";

    /**
     * Maximum time (in milliseconds) to wait for a result before timing out.
     */
@@ -216,6 +218,7 @@ final class SelectionActionModeHelper {
        private int mSelectionStart;
        private int mSelectionEnd;
        private boolean mAllowReset;
        private final LogAbandonRunnable mDelayedLogAbandon = new LogAbandonRunnable();

        SelectionTracker(TextView textView) {
            mTextView = Preconditions.checkNotNull(textView);
@@ -227,6 +230,10 @@ final class SelectionActionModeHelper {
         */
        public void onOriginalSelection(
                CharSequence text, int selectionStart, int selectionEnd, boolean editableText) {
            // If we abandoned a selection and created a new one very shortly after, we may still
            // have a pending request to log ABANDON, which we flush here.
            mDelayedLogAbandon.flush();

            mOriginalStart = mSelectionStart = selectionStart;
            mOriginalEnd = mSelectionEnd = selectionEnd;
            mAllowReset = false;
@@ -267,12 +274,7 @@ final class SelectionActionModeHelper {
        public void onSelectionDestroyed() {
            mAllowReset = false;
            // Wait a few ms to see if the selection was destroyed because of a text change event.
            mTextView.postDelayed(() -> {
                mLogger.logSelectionAction(
                        mSelectionStart, mSelectionEnd,
                        SelectionEvent.ActionType.ABANDON, null /* classification */);
                mSelectionStart = mSelectionEnd = -1;
            }, 100 /* ms */);
            mDelayedLogAbandon.schedule(100 /* ms */);
        }

        /**
@@ -329,6 +331,38 @@ final class SelectionActionModeHelper {
        private boolean isSelectionStarted() {
            return mSelectionStart >= 0 && mSelectionEnd >= 0 && mSelectionStart != mSelectionEnd;
        }

        /** A helper for keeping track of pending abandon logging requests. */
        private final class LogAbandonRunnable implements Runnable {
            private boolean mIsPending;

            /** Schedules an abandon to be logged with the given delay. Flush if necessary. */
            void schedule(int delayMillis) {
                if (mIsPending) {
                    Log.e(LOG_TAG, "Force flushing abandon due to new scheduling request");
                    flush();
                }
                mIsPending = true;
                mTextView.postDelayed(this, delayMillis);
            }

            /** If there is a pending log request, execute it now. */
            void flush() {
                mTextView.removeCallbacks(this);
                run();
            }

            @Override
            public void run() {
                if (mIsPending) {
                    mLogger.logSelectionAction(
                            mSelectionStart, mSelectionEnd,
                            SelectionEvent.ActionType.ABANDON, null /* classification */);
                    mSelectionStart = mSelectionEnd = -1;
                    mIsPending = false;
                }
            }
        }
    }

    // TODO: Write tests
Loading