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

Commit cf3a1e8b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26514828',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26514828', 'googleplex-android-review.googlesource.com/26540911', 'googleplex-android-review.googlesource.com/26543767'] into sparse-11555371-L02300030002451772.
SPARSE_CHANGE: Ib06f6a740eb151036f9662da7f2d372051cc25af
SPARSE_CHANGE: Ib3a9fd5b517a279e4b0e245c78a306db803381dd
SPARSE_CHANGE: I5dc00dde76c0a0a13a18d9e74d6983226a228ea3

Change-Id: I99428f810200dc7a170e34ac2b905c8982254ff7
parents 9522aeeb 1f7dbd19
Loading
Loading
Loading
Loading
+12 −61
Original line number Diff line number Diff line
@@ -25,9 +25,6 @@ import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.ArraySet;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -38,7 +35,8 @@ import java.util.Objects;
import java.util.Set;

/**
 * A state of the device managed by {@link DeviceStateManager}.
 * A state of the device defined by the {@link DeviceStateProvider} and managed by the
 * {@link DeviceStateManagerService}.
 * <p>
 * Device state is an abstract concept that allows mapping the current state of the device to the
 * state of the system. This is useful for variable-state devices, like foldable or rollable
@@ -300,14 +298,13 @@ public final class DeviceState {
    public @interface SystemDeviceStateProperties {}

    @NonNull
    private final DeviceState.Configuration mDeviceStateConfiguration;
    private DeviceState.Configuration mDeviceStateConfiguration;

    @DeviceStateFlags
    private final int mFlags;

    /** @hide */
    public DeviceState(@NonNull DeviceState.Configuration deviceStateConfiguration) {
        Objects.requireNonNull(deviceStateConfiguration, "Device StateConfiguration is null");
        mDeviceStateConfiguration = deviceStateConfiguration;
        mFlags = 0;
    }
@@ -411,7 +408,8 @@ public final class DeviceState {
     */
    public boolean hasProperties(@NonNull @DeviceStateProperties int... properties) {
        for (int i = 0; i < properties.length; i++) {
            if (!hasProperty(properties[i])) {
            if (!mDeviceStateConfiguration.mSystemProperties.contains(properties[i])
                    || !mDeviceStateConfiguration.mPhysicalProperties.contains(properties[i])) {
                return false;
            }
        }
@@ -438,7 +436,7 @@ public final class DeviceState {
     * @see DeviceStateManager
     * @hide
     */
    public static final class Configuration implements Parcelable {
    public static class Configuration {
        /** Unique identifier for the device state. */
        @IntRange(from = MINIMUM_DEVICE_STATE_IDENTIFIER, to = MAXIMUM_DEVICE_STATE_IDENTIFIER)
        private final int mIdentifier;
@@ -447,23 +445,21 @@ public final class DeviceState {
        @NonNull
        private final String mName;

        /** {@link ArraySet} of system properties that apply to this state. */
        /** {@link Set} of system properties that apply to this state. */
        @NonNull
        private final ArraySet<@SystemDeviceStateProperties Integer> mSystemProperties;
        private final Set<@SystemDeviceStateProperties Integer> mSystemProperties;

        /** {@link ArraySet} of physical device properties that apply to this state. */
        /** {@link Set} of physical device properties that apply to this state. */
        @NonNull
        private final ArraySet<@PhysicalDeviceStateProperties Integer> mPhysicalProperties;
        private final Set<@PhysicalDeviceStateProperties Integer> mPhysicalProperties;

        private Configuration(int identifier, @NonNull String name,
                @NonNull Set<@SystemDeviceStateProperties Integer> systemProperties,
                @NonNull Set<@PhysicalDeviceStateProperties Integer> physicalProperties) {
            mIdentifier = identifier;
            mName = name;
            mSystemProperties = new ArraySet<@SystemDeviceStateProperties Integer>(
                    systemProperties);
            mPhysicalProperties = new ArraySet<@PhysicalDeviceStateProperties Integer>(
                    physicalProperties);
            mSystemProperties = systemProperties;
            mPhysicalProperties = physicalProperties;
        }

        /** Returns the unique identifier for the device state. */
@@ -515,51 +511,6 @@ public final class DeviceState {
            return Objects.hash(mIdentifier, mName, mSystemProperties, mPhysicalProperties);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(@NonNull Parcel dest, int flags) {
            dest.writeInt(mIdentifier);
            dest.writeString8(mName);

            dest.writeInt(mSystemProperties.size());
            for (int i = 0; i < mSystemProperties.size(); i++) {
                dest.writeInt(mSystemProperties.valueAt(i));
            }

            dest.writeInt(mPhysicalProperties.size());
            for (int i = 0; i < mPhysicalProperties.size(); i++) {
                dest.writeInt(mPhysicalProperties.valueAt(i));
            }
        }

        @NonNull
        public static final Creator<DeviceState.Configuration> CREATOR = new Creator<>() {
            @Override
            public DeviceState.Configuration createFromParcel(Parcel source) {
                int identifier = source.readInt();
                String name = source.readString8();
                ArraySet<@DeviceStateProperties Integer> systemProperties = new ArraySet<>();
                for (int i = 0; i < source.readInt(); i++) {
                    systemProperties.add(source.readInt());
                }
                ArraySet<@DeviceStateProperties Integer> physicalProperties = new ArraySet<>();
                for (int j = 0; j < source.readInt(); j++) {
                    physicalProperties.add(source.readInt());
                }
                return new DeviceState.Configuration(identifier, name, systemProperties,
                        physicalProperties);
            }

            @Override
            public DeviceState.Configuration[] newArray(int size) {
                return new DeviceState.Configuration[size];
            }
        };

        /** @hide */
        public static class Builder {
            private final int mIdentifier;
+25 −31
Original line number Diff line number Diff line
@@ -24,8 +24,7 @@ import android.os.Parcelable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.Executor;

@@ -57,19 +56,19 @@ public final class DeviceStateInfo implements Parcelable {
     * The list of states supported by the device.
     */
    @NonNull
    public final ArrayList<DeviceState> supportedStates;
    public final int[] supportedStates;

    /**
     * The base (non-override) state of the device. The base state is the state of the device
     * ignoring any override requests made through a call to {@link DeviceStateManager#requestState(
     * DeviceStateRequest, Executor, DeviceStateRequest.Callback)}.
     */
    public final DeviceState baseState;
    public final int baseState;

    /**
     * The state of the device.
     */
    public final DeviceState currentState;
    public final int currentState;

    /**
     * Creates a new instance of {@link DeviceStateInfo}.
@@ -77,9 +76,8 @@ public final class DeviceStateInfo implements Parcelable {
     * NOTE: Unlike {@link #DeviceStateInfo(DeviceStateInfo)}, this constructor does not copy the
     * supplied parameters.
     */
    public DeviceStateInfo(@NonNull List<DeviceState> supportedStates, DeviceState baseState,
            DeviceState state) {
        this.supportedStates = new ArrayList<>(supportedStates);
    public DeviceStateInfo(@NonNull int[] supportedStates, int baseState, int state) {
        this.supportedStates = supportedStates;
        this.baseState = baseState;
        this.currentState = state;
    }
@@ -89,7 +87,8 @@ public final class DeviceStateInfo implements Parcelable {
     * the fields of the returned instance.
     */
    public DeviceStateInfo(@NonNull DeviceStateInfo info) {
        this(List.copyOf(info.supportedStates), info.baseState, info.currentState);
        this(Arrays.copyOf(info.supportedStates, info.supportedStates.length),
                info.baseState, info.currentState);
    }

    @Override
@@ -97,15 +96,15 @@ public final class DeviceStateInfo implements Parcelable {
        if (this == other) return true;
        if (other == null || getClass() != other.getClass()) return false;
        DeviceStateInfo that = (DeviceStateInfo) other;
        return baseState.equals(that.baseState)
                &&  currentState.equals(that.currentState)
                && Objects.equals(supportedStates, that.supportedStates);
        return baseState == that.baseState
                &&  currentState == that.currentState
                && Arrays.equals(supportedStates, that.supportedStates);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(baseState, currentState);
        result = 31 * result + supportedStates.hashCode();
        result = 31 * result + Arrays.hashCode(supportedStates);
        return result;
    }

@@ -113,13 +112,13 @@ public final class DeviceStateInfo implements Parcelable {
    @ChangeFlags
    public int diff(@NonNull DeviceStateInfo other) {
        int diff = 0;
        if (!supportedStates.equals(other.supportedStates)) {
        if (!Arrays.equals(supportedStates, other.supportedStates)) {
            diff |= CHANGED_SUPPORTED_STATES;
        }
        if (!baseState.equals(other.baseState)) {
        if (baseState != other.baseState) {
            diff |= CHANGED_BASE_STATE;
        }
        if (!currentState.equals(other.currentState)) {
        if (currentState != other.currentState) {
            diff |= CHANGED_CURRENT_STATE;
        }
        return diff;
@@ -127,13 +126,13 @@ public final class DeviceStateInfo implements Parcelable {

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(supportedStates.size());
        for (int i = 0; i < supportedStates.size(); i++) {
            dest.writeTypedObject(supportedStates.get(i).getConfiguration(), flags);
        dest.writeInt(supportedStates.length);
        for (int i = 0; i < supportedStates.length; i++) {
            dest.writeInt(supportedStates[i]);
        }

        dest.writeTypedObject(baseState.getConfiguration(), flags);
        dest.writeTypedObject(currentState.getConfiguration(), flags);
        dest.writeInt(baseState);
        dest.writeInt(currentState);
    }

    @Override
@@ -141,21 +140,16 @@ public final class DeviceStateInfo implements Parcelable {
        return 0;
    }

    public static final @NonNull Creator<DeviceStateInfo> CREATOR = new Creator<>() {
    public static final @NonNull Creator<DeviceStateInfo> CREATOR = new Creator<DeviceStateInfo>() {
        @Override
        public DeviceStateInfo createFromParcel(Parcel source) {
            final int numberOfSupportedStates = source.readInt();
            final ArrayList<DeviceState> supportedStates = new ArrayList<>(numberOfSupportedStates);
            final int[] supportedStates = new int[numberOfSupportedStates];
            for (int i = 0; i < numberOfSupportedStates; i++) {
                DeviceState.Configuration configuration = source.readTypedObject(
                        DeviceState.Configuration.CREATOR);
                supportedStates.add(i, new DeviceState(configuration));
                supportedStates[i] = source.readInt();
            }

            final DeviceState baseState = new DeviceState(
                    source.readTypedObject(DeviceState.Configuration.CREATOR));
            final DeviceState currentState = new DeviceState(
                    source.readTypedObject(DeviceState.Configuration.CREATOR));
            final int baseState = source.readInt();
            final int currentState = source.readInt();

            return new DeviceStateInfo(supportedStates, baseState, currentState);
        }
+68 −27
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.hardware.devicestate;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.app.ActivityThread;
import android.content.Context;
import android.hardware.devicestate.DeviceStateManager.DeviceStateCallback;
import android.os.Binder;
@@ -32,9 +33,13 @@ import android.util.ArrayMap;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting.Visibility;
import com.android.internal.util.ArrayUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;

/**
@@ -50,12 +55,18 @@ public final class DeviceStateManagerGlobal {
    private static final String TAG = "DeviceStateManagerGlobal";
    private static final boolean DEBUG = Build.IS_DEBUGGABLE;

    // TODO(b/325124054): Remove when system server refactor is completed
    private static int[] sFoldedDeviceStates = new int[0];

    /**
     * Returns an instance of {@link DeviceStateManagerGlobal}. May return {@code null} if a
     * connection with the device state service couldn't be established.
     */
    @Nullable
    public static DeviceStateManagerGlobal getInstance() {
        // TODO(b/325124054): Remove when system server refactor is completed
        instantiateFoldedStateArray();

        synchronized (DeviceStateManagerGlobal.class) {
            if (sInstance == null) {
                IBinder b = ServiceManager.getService(Context.DEVICE_STATE_SERVICE);
@@ -68,6 +79,16 @@ public final class DeviceStateManagerGlobal {
        }
    }

    // TODO(b/325124054): Remove when system server refactor is completed
    // TODO(b/325330654): Investigate if we need a Context passed in to DSMGlobal
    private static void instantiateFoldedStateArray() {
        Context context = ActivityThread.currentApplication();
        if (context != null) {
            sFoldedDeviceStates = context.getResources().getIntArray(
                    com.android.internal.R.array.config_foldedDeviceStates);
        }
    }

    private final Object mLock = new Object();
    @NonNull
    private final IDeviceStateManager mDeviceStateManager;
@@ -94,7 +115,6 @@ public final class DeviceStateManagerGlobal {
     *
     * @see DeviceStateManager#getSupportedStates()
     */
    // TODO(b/325124054): Remove unused methods when clients are migrated.
    public int[] getSupportedStates() {
        synchronized (mLock) {
            final DeviceStateInfo currentInfo;
@@ -112,12 +132,12 @@ public final class DeviceStateManagerGlobal {
                }
            }

            return getSupportedStateIdentifiersLocked(currentInfo.supportedStates);
            return Arrays.copyOf(currentInfo.supportedStates, currentInfo.supportedStates.length);
        }
    }

    /**
     * Returns {@link List} of supported {@link DeviceState}s.
     * Returns the {@link List} of supported device states.
     *
     * @see DeviceStateManager#getSupportedDeviceStates()
     */
@@ -138,7 +158,7 @@ public final class DeviceStateManagerGlobal {
                }
            }

            return List.copyOf(currentInfo.supportedStates);
            return createDeviceStateList(currentInfo.supportedStates);
        }
    }

@@ -265,14 +285,13 @@ public final class DeviceStateManagerGlobal {

            if (mLastReceivedInfo != null) {
                // Copy the array to prevent the callback from modifying the internal state.
                final int[] supportedStates = getSupportedStateIdentifiersLocked(
                        mLastReceivedInfo.supportedStates);
                final int[] supportedStates = Arrays.copyOf(mLastReceivedInfo.supportedStates,
                        mLastReceivedInfo.supportedStates.length);
                wrapper.notifySupportedStatesChanged(supportedStates);
                wrapper.notifySupportedDeviceStatesChanged(
                        List.copyOf(mLastReceivedInfo.supportedStates));
                wrapper.notifyBaseStateChanged(mLastReceivedInfo.baseState.getIdentifier());
                wrapper.notifyStateChanged(mLastReceivedInfo.currentState.getIdentifier());
                wrapper.notifyDeviceStateChanged(mLastReceivedInfo.currentState);
                wrapper.notifySupportedDeviceStatesChanged(createDeviceStateList(supportedStates));
                wrapper.notifyBaseStateChanged(mLastReceivedInfo.baseState);
                wrapper.notifyStateChanged(mLastReceivedInfo.currentState);
                wrapper.notifyDeviceStateChanged(createDeviceState(mLastReceivedInfo.currentState));
            }
        }
    }
@@ -330,15 +349,6 @@ public final class DeviceStateManagerGlobal {
        return -1;
    }

    @GuardedBy("mLock")
    private int[] getSupportedStateIdentifiersLocked(List<DeviceState> states) {
        int[] identifiers = new int[states.size()];
        for (int i = 0; i < states.size(); i++) {
            identifiers[i] = states.get(i).getIdentifier();
        }
        return identifiers;
    }

    @Nullable
    private IBinder findRequestTokenLocked(@NonNull DeviceStateRequest request) {
        for (int i = 0; i < mRequests.size(); i++) {
@@ -353,31 +363,32 @@ public final class DeviceStateManagerGlobal {
    private void handleDeviceStateInfoChanged(@NonNull DeviceStateInfo info) {
        ArrayList<DeviceStateCallbackWrapper> callbacks;
        DeviceStateInfo oldInfo;
        int[] supportedStateIdentifiers;
        synchronized (mLock) {
            oldInfo = mLastReceivedInfo;
            mLastReceivedInfo = info;
            callbacks = new ArrayList<>(mCallbacks);
            supportedStateIdentifiers = getSupportedStateIdentifiersLocked(info.supportedStates);
        }

        final int diff = oldInfo == null ? ~0 : info.diff(oldInfo);
        if ((diff & DeviceStateInfo.CHANGED_SUPPORTED_STATES) > 0) {
            for (int i = 0; i < callbacks.size(); i++) {
                // Copy the array to prevent callbacks from modifying the internal state.
                final int[] supportedStates = Arrays.copyOf(info.supportedStates,
                        info.supportedStates.length);
                callbacks.get(i).notifySupportedStatesChanged(supportedStates);
                callbacks.get(i).notifySupportedDeviceStatesChanged(
                        List.copyOf(info.supportedStates));
                callbacks.get(i).notifySupportedStatesChanged(supportedStateIdentifiers);
                        createDeviceStateList(supportedStates));
            }
        }
        if ((diff & DeviceStateInfo.CHANGED_BASE_STATE) > 0) {
            for (int i = 0; i < callbacks.size(); i++) {
                callbacks.get(i).notifyBaseStateChanged(info.baseState.getIdentifier());
                callbacks.get(i).notifyBaseStateChanged(info.baseState);
            }
        }
        if ((diff & DeviceStateInfo.CHANGED_CURRENT_STATE) > 0) {
            for (int i = 0; i < callbacks.size(); i++) {
                callbacks.get(i).notifyDeviceStateChanged(info.currentState);
                callbacks.get(i).notifyStateChanged(info.currentState.getIdentifier());
                callbacks.get(i).notifyStateChanged(info.currentState);
                callbacks.get(i).notifyDeviceStateChanged(createDeviceState(info.currentState));
            }
        }
    }
@@ -410,6 +421,36 @@ public final class DeviceStateManagerGlobal {
        }
    }

    /**
     * Creates a {@link DeviceState} object from a device state identifier, with the
     * {@link DeviceState} property that corresponds to what display is primary.
     *
     */
    // TODO(b/325124054): Remove when system server refactor is completed
    @NonNull
    private DeviceState createDeviceState(int stateIdentifier) {
        final Set<@DeviceState.DeviceStateProperties Integer> properties = new HashSet<>();
        if (ArrayUtils.contains(sFoldedDeviceStates, stateIdentifier)) {
            properties.add(DeviceState.PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_OUTER_PRIMARY);
        } else {
            properties.add(DeviceState.PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_INNER_PRIMARY);
        }
        return new DeviceState(stateIdentifier, "" /* name */, properties);
    }

    /**
     * Creates a list of {@link DeviceState} objects from an array of state identifiers.
     */
    // TODO(b/325124054): Remove when system server refactor is completed
    @NonNull
    private List<DeviceState> createDeviceStateList(int[] supportedStates) {
        List<DeviceState> deviceStateList = new ArrayList<>();
        for (int i = 0; i < supportedStates.length; i++) {
            deviceStateList.add(createDeviceState(supportedStates[i]));
        }
        return deviceStateList;
    }

    private final class DeviceStateManagerCallback extends IDeviceStateManagerCallback.Stub {
        @Override
        public void onDeviceStateInfoChanged(DeviceStateInfo info) {
+12 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.internal.inputmethod;

import static android.view.inputmethod.InputConnectionProto.CURSOR_CAPS_MODE;
import static android.view.inputmethod.InputConnectionProto.EDITABLE_TEXT;
import static android.view.inputmethod.InputConnectionProto.SELECTED_TEXT;
import static android.view.inputmethod.InputConnectionProto.SELECTED_TEXT_END;
import static android.view.inputmethod.InputConnectionProto.SELECTED_TEXT_START;

@@ -333,6 +335,16 @@ public final class EditableInputConnection extends BaseInputConnection
    @Override
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        CharSequence editableText = mTextView.getText();
        CharSequence selectedText = getSelectedText(0 /* flags */);
        if (InputConnectionProtoDumper.DUMP_TEXT) {
            if (editableText != null) {
                proto.write(EDITABLE_TEXT, editableText.toString());
            }
            if (selectedText != null) {
                proto.write(SELECTED_TEXT, selectedText.toString());
            }
        }
        final Editable content = getEditable();
        if (content != null) {
            int start = Selection.getSelectionStart(content);
+30 −2
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.view.inputmethod.SurroundingText;
 */
public final class InputConnectionProtoDumper {
    static final String TAG = "InputConnectionProtoDumper";
    public static final boolean DUMP_TEXT = false;

    private InputConnectionProtoDumper() {}

@@ -66,6 +67,11 @@ public final class InputConnectionProtoDumper {
        final long token = proto.start(GET_TEXT_AFTER_CURSOR);
        proto.write(GetTextAfterCursor.LENGTH, length);
        proto.write(GetTextAfterCursor.FLAGS, flags);
        if (result == null) {
            proto.write(GetTextAfterCursor.RESULT, "null result");
        } else if (DUMP_TEXT) {
            proto.write(GetTextAfterCursor.RESULT, result.toString());
        }
        proto.end(token);
        return proto.getBytes();
    }
@@ -89,6 +95,11 @@ public final class InputConnectionProtoDumper {
        final long token = proto.start(GET_TEXT_BEFORE_CURSOR);
        proto.write(GetTextBeforeCursor.LENGTH, length);
        proto.write(GetTextBeforeCursor.FLAGS, flags);
        if (result == null) {
            proto.write(GetTextBeforeCursor.RESULT, "null result");
        } else if (DUMP_TEXT) {
            proto.write(GetTextBeforeCursor.RESULT, result.toString());
        }
        proto.end(token);
        return proto.getBytes();
    }
@@ -111,6 +122,11 @@ public final class InputConnectionProtoDumper {
        ProtoOutputStream proto = new ProtoOutputStream();
        final long token = proto.start(GET_SELECTED_TEXT);
        proto.write(GetSelectedText.FLAGS, flags);
        if (result == null) {
            proto.write(GetSelectedText.RESULT, "null result");
        } else if (DUMP_TEXT) {
            proto.write(GetSelectedText.RESULT, result.toString());
        }
        proto.end(token);
        return proto.getBytes();
    }
@@ -139,8 +155,13 @@ public final class InputConnectionProtoDumper {
        proto.write(GetSurroundingText.BEFORE_LENGTH, beforeLength);
        proto.write(GetSurroundingText.AFTER_LENGTH, afterLength);
        proto.write(GetSurroundingText.FLAGS, flags);
        if (result != null) {
        if (result == null) {
            final long token_result = proto.start(GetSurroundingText.RESULT);
            proto.write(GetSurroundingText.SurroundingText.TEXT, "null result");
            proto.end(token_result);
        } else if (DUMP_TEXT) {
            final long token_result = proto.start(GetSurroundingText.RESULT);
            proto.write(GetSurroundingText.SurroundingText.TEXT, result.getText().toString());
            proto.write(GetSurroundingText.SurroundingText.SELECTION_START,
                    result.getSelectionStart());
            proto.write(GetSurroundingText.SurroundingText.SELECTION_END,
@@ -167,7 +188,9 @@ public final class InputConnectionProtoDumper {
        ProtoOutputStream proto = new ProtoOutputStream();
        final long token = proto.start(GET_CURSOR_CAPS_MODE);
        proto.write(GetCursorCapsMode.REQ_MODES, reqModes);
        if (DUMP_TEXT) {
            proto.write(GetCursorCapsMode.RESULT, result);
        }
        proto.end(token);
        return proto.getBytes();
    }
@@ -200,6 +223,11 @@ public final class InputConnectionProtoDumper {
        proto.write(GetExtractedText.ExtractedTextRequest.HINT_MAX_CHARS, request.hintMaxChars);
        proto.end(token_request);
        proto.write(GetExtractedText.FLAGS, flags);
        if (result == null) {
            proto.write(GetExtractedText.RESULT, "null result");
        } else if (DUMP_TEXT) {
            proto.write(GetExtractedText.RESULT, result.text.toString());
        }
        proto.end(token);
        return proto.getBytes();
    }
Loading