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

Commit c8c8e8e8 authored by Xin Li's avatar Xin Li
Browse files

Merge RP1A.200720.011

Bug: 167588565
Merged-In: Iec7a26ecd68aca9c7a38cc8f441197a8237b0c8c
Change-Id: Ia8f5f008bc1f77115b644ab996aedc892fab68e7
parents cf7c807e 34a1b9c9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3728,7 +3728,8 @@ public class ActivityManager {
     * manner, excessive calls to this API could result a {@link java.lang.RuntimeException}.
     * </p>
     *
     * @param state The state data
     * @param state The state data. To be advised, <b>DO NOT</b> include sensitive information/data
     * (PII, SPII, or other sensitive user data) here. Maximum length is 128 bytes.
     */
    public void setProcessStateSummary(@Nullable byte[] state) {
        try {
+1 −2
Original line number Diff line number Diff line
@@ -354,8 +354,7 @@ public abstract class NetworkAgent {
    private static NetworkInfo getLegacyNetworkInfo(final NetworkAgentConfig config) {
        // The subtype can be changed with (TODO) setLegacySubtype, but it starts
        // with the type and an empty description.
        final NetworkInfo ni = new NetworkInfo(config.legacyType, config.legacyType,
                config.legacyTypeName, "");
        final NetworkInfo ni = new NetworkInfo(config.legacyType, 0, config.legacyTypeName, "");
        ni.setIsAvailable(true);
        ni.setExtraInfo(config.getLegacyExtraInfo());
        return ni;
+7 −0
Original line number Diff line number Diff line
@@ -304,6 +304,7 @@ public final class VibrationAttributes implements Parcelable {
                @Nullable VibrationEffect effect) {
            mAudioAttributes = audio;
            setUsage(audio);
            setFlags(audio);
            applyHapticFeedbackHeuristics(effect);
        }

@@ -360,6 +361,12 @@ public final class VibrationAttributes implements Parcelable {
            }
        }

        private void setFlags(@NonNull AudioAttributes audio) {
            if ((audio.getAllFlags() & AudioAttributes.FLAG_BYPASS_INTERRUPTION_POLICY) != 0) {
                mFlags |= FLAG_BYPASS_INTERRUPTION_POLICY;
            }
        }

        /**
         * Combines all of the attributes that have been set and returns a new
         * {@link VibrationAttributes} object.
+6 −4
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.os.LocaleList;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.UserHandle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Printer;
@@ -567,7 +568,8 @@ public class EditorInfo implements InputType, Parcelable {
     *                      editor wants to trim out the first 10 chars, subTextStart should be 10.
     */
    public void setInitialSurroundingSubText(@NonNull CharSequence subText, int subTextStart) {
        Objects.requireNonNull(subText);
        CharSequence newSubText = Editable.Factory.getInstance().newEditable(subText);
        Objects.requireNonNull(newSubText);

        // Swap selection start and end if necessary.
        final int subTextSelStart = initialSelStart > initialSelEnd
@@ -575,7 +577,7 @@ public class EditorInfo implements InputType, Parcelable {
        final int subTextSelEnd = initialSelStart > initialSelEnd
                ? initialSelStart - subTextStart : initialSelEnd - subTextStart;

        final int subTextLength = subText.length();
        final int subTextLength = newSubText.length();
        // Unknown or invalid selection.
        if (subTextStart < 0 || subTextSelStart < 0 || subTextSelEnd > subTextLength) {
            mInitialSurroundingText = new InitialSurroundingText();
@@ -589,12 +591,12 @@ public class EditorInfo implements InputType, Parcelable {
        }

        if (subTextLength <= MEMORY_EFFICIENT_TEXT_LENGTH) {
            mInitialSurroundingText = new InitialSurroundingText(subText, subTextSelStart,
            mInitialSurroundingText = new InitialSurroundingText(newSubText, subTextSelStart,
                    subTextSelEnd);
            return;
        }

        trimLongSurroundingText(subText, subTextSelStart, subTextSelEnd);
        trimLongSurroundingText(newSubText, subTextSelStart, subTextSelEnd);
    }

    /**
+19 −0
Original line number Diff line number Diff line
@@ -264,6 +264,25 @@ public class EditorInfoTest {
                        InputConnection.GET_TEXT_WITH_STYLES)));
    }

    @Test
    public void surroundingTextRetrieval_writeToParcel_noException() {
        StringBuilder sb = new StringBuilder("abcdefg");
        Parcel parcel = Parcel.obtain();
        EditorInfo editorInfo = new EditorInfo();
        editorInfo.initialSelStart = 2;
        editorInfo.initialSelEnd = 5;
        editorInfo.inputType = EditorInfo.TYPE_CLASS_TEXT;

        editorInfo.setInitialSurroundingText(sb);
        sb.setLength(0);
        editorInfo.writeToParcel(parcel, 0);

        try {
            editorInfo.getInitialTextBeforeCursor(60, 1);
            fail("Test shouldn't have exception");
        } catch (AssertionError e) { }
    }

    private static void assertExpectedTextLength(EditorInfo editorInfo,
            @Nullable Integer expectBeforeCursorLength, @Nullable Integer expectSelectionLength,
            @Nullable Integer expectAfterCursorLength) {
Loading