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

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

Snap for 11949167 from d5687233 to 24Q3-release

Change-Id: I482af477735b5b97a37e6ac2ec981ee589394975
parents 07fd6822 d5687233
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ hidden_api_txt_exclude_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/exclu
ktlint_hook = ${REPO_ROOT}/prebuilts/ktlint/ktlint.py --no-verify-format -f ${PREUPLOAD_FILES}

# This flag check hook runs only for "packages/SystemUI" subdirectory. If you want to include this check for other subdirectories, please modify flag_check.py.
flag_hook = ${REPO_ROOT}/frameworks/base/packages/SystemUI/flag_check.py --msg=${PREUPLOAD_COMMIT_MESSAGE} --files=${PREUPLOAD_FILES} --project=${REPO_PATH}
flag_hook = ${REPO_ROOT}/frameworks/base/packages/SystemUI/flag_check.py --msg=${PREUPLOAD_COMMIT_MESSAGE} --files=${PREUPLOAD_FILES} --project=${REPO_PROJECT}

[Tool Paths]
ktfmt = ${REPO_ROOT}/prebuilts/build-tools/common/framework/ktfmt.jar
+65 −65
Original line number Diff line number Diff line
@@ -695,13 +695,13 @@ public class LauncherApps {
     * <p>If the caller is running on a managed profile, it'll return only the current profile.
     * Otherwise it'll return the same list as {@link UserManager#getUserProfiles()} would.
     *
     * <p>To get hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>To get hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     */
    @SuppressLint("RequiresPermission")
@@ -764,13 +764,13 @@ public class LauncherApps {
     * list.</li>
     * </ul>
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param packageName The specific package to query. If null, it checks all installed packages
@@ -820,13 +820,13 @@ public class LauncherApps {
     * Returns information related to a user which is useful for displaying UI elements
     * to distinguish it from other users (eg, badges).
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param userHandle user handle of the user for which LauncherUserInfo is requested.
@@ -873,13 +873,13 @@ public class LauncherApps {
     * </ul>
     * </p>
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param packageName the package for which intent sender to launch App Market Activity is
@@ -913,13 +913,13 @@ public class LauncherApps {
     * <p>An empty list denotes that all system packages should be treated as pre-installed for that
     * user at creation.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param userHandle the user for which installed system packages are required.
@@ -945,7 +945,7 @@ public class LauncherApps {
    /**
     * Returns {@link IntentSender} which can be used to start the Private Space Settings Activity.
     *
     * <p> Caller should have {@link android.app.role.RoleManager.ROLE_HOME} and either of the
     * <p> Caller should have {@link android.app.role.RoleManager#ROLE_HOME} and either of the
     * permissions required.</p>
     *
     * @return {@link IntentSender} object which launches the Private Space Settings Activity, if
@@ -968,13 +968,13 @@ public class LauncherApps {
     * Returns the activity info for a given intent and user handle, if it resolves. Otherwise it
     * returns null.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param intent The intent to find a match for.
@@ -1033,13 +1033,13 @@ public class LauncherApps {
    /**
     * Starts a Main activity in the specified profile.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param component The ComponentName of the activity to launch
@@ -1087,13 +1087,13 @@ public class LauncherApps {
     * Starts the settings activity to show the application details for a
     * package in the specified profile.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param component The ComponentName of the package to launch settings for.
@@ -1215,13 +1215,13 @@ public class LauncherApps {
    /**
     * Checks if the package is installed and enabled for a profile.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param packageName The package to check.
@@ -1249,13 +1249,13 @@ public class LauncherApps {
     * <p>The contents of this {@link Bundle} are supposed to be a contract between the suspending
     * app and the launcher.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * <p>Note: This just returns whatever extras were provided to the system, <em>which might
@@ -1286,13 +1286,13 @@ public class LauncherApps {
     * could be done because the package was marked as distracting to the user via
     * {@code PackageManager.setDistractingPackageRestrictions(String[], int)}.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param packageName The package for which to check.
@@ -1316,13 +1316,13 @@ public class LauncherApps {
    /**
     * Returns {@link ApplicationInfo} about an application installed for a specific user profile.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param packageName The package name of the application
@@ -1385,13 +1385,13 @@ public class LauncherApps {
     * <p>The activity may still not be exported, in which case {@link #startMainActivity} will
     * throw a {@link SecurityException} unless the caller has the same UID as the target app's.
     *
     * <p>If the user in question is a hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>If the user in question is a hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param component The activity to check.
@@ -1960,13 +1960,13 @@ public class LauncherApps {
    /**
     * Registers a callback for changes to packages in this user and managed profiles.
     *
     * <p>To receive callbacks for hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>To receive callbacks for hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param callback The callback to register.
@@ -1981,13 +1981,13 @@ public class LauncherApps {
    /**
     * Registers a callback for changes to packages in this user and managed profiles.
     *
     * <p>To receive callbacks for hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>To receive callbacks for hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @param callback The callback to register.
@@ -2446,13 +2446,13 @@ public class LauncherApps {
     * package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be
     * the session owner to retrieve these details.
     *
     * <p>To receive callbacks for hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE},
     * <p>To receive callbacks for hidden profile {@link UserManager#USER_TYPE_PROFILE_PRIVATE},
     * caller should have either:</p>
     * <ul>
     * <li>the privileged {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES}
     * <li>the privileged {@code android.Manifest.permission#ACCESS_HIDDEN_PROFILES_FULL}
     * permission</li>
     * <li>the normal {@link android.Manifest.permission.ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager.ROLE_HOME} role. </li>
     * <li>the normal {@link android.Manifest.permission#ACCESS_HIDDEN_PROFILES} permission and the
     * {@link android.app.role.RoleManager#ROLE_HOME} role. </li>
     * </ul>
     *
     * @see PackageInstaller#getAllSessions()
+1 −0
Original line number Diff line number Diff line
@@ -720,6 +720,7 @@ public class InputMethodService extends AbstractInputMethodService {

    final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> {
        onComputeInsets(mTmpInsets);
        mNavigationBarController.updateInsets(mTmpInsets);
        if (!mViewsCreated) {
            // The IME views are not ready, keep visible insets untouched.
            mTmpInsets.visibleTopInsets = 0;
+31 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ import java.util.Objects;
final class NavigationBarController {

    private interface Callback {

        default void updateInsets(@NonNull InputMethodService.Insets originalInsets) {
        }

        default void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets,
                @NonNull ViewTreeObserver.InternalInsetsInfo dest) {
        }
@@ -96,6 +100,15 @@ final class NavigationBarController {
                ? new Impl(inputMethodService) : Callback.NOOP;
    }

    /**
     * Update the given insets to be at least as big as the IME navigation bar, when visible.
     *
     * @param originalInsets the insets to check and modify to include the IME navigation bar.
     */
    void updateInsets(@NonNull InputMethodService.Insets originalInsets) {
        mImpl.updateInsets(originalInsets);
    }

    void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets,
            @NonNull ViewTreeObserver.InternalInsetsInfo dest) {
        mImpl.updateTouchableInsets(originalInsets, dest);
@@ -269,6 +282,24 @@ final class NavigationBarController {
            mNavigationBarFrame = null;
        }

        @Override
        public void updateInsets(@NonNull InputMethodService.Insets originalInsets) {
            if (!mImeDrawsImeNavBar || mNavigationBarFrame == null
                    || mNavigationBarFrame.getVisibility() != View.VISIBLE
                    || mService.isFullscreenMode()) {
                return;
            }

            final int[] loc = new int[2];
            mNavigationBarFrame.getLocationInWindow(loc);
            if (originalInsets.contentTopInsets > loc[1]) {
                originalInsets.contentTopInsets = loc[1];
            }
            if (originalInsets.visibleTopInsets > loc[1]) {
                originalInsets.visibleTopInsets = loc[1];
            }
        }

        @Override
        public void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets,
                @NonNull ViewTreeObserver.InternalInsetsInfo dest) {
+11 −39
Original line number Diff line number Diff line
@@ -7504,8 +7504,6 @@ public final class ViewRootImpl implements ViewParent,
            final KeyEvent event = (KeyEvent)q.mEvent;
            if (mView.dispatchKeyEventPreIme(event)) {
                return FINISH_HANDLED;
            } else if (q.forPreImeOnly()) {
                return FINISH_NOT_HANDLED;
            }
            return FORWARD;
        }
@@ -10002,7 +10000,6 @@ public final class ViewRootImpl implements ViewParent,
        public static final int FLAG_RESYNTHESIZED = 1 << 4;
        public static final int FLAG_UNHANDLED = 1 << 5;
        public static final int FLAG_MODIFIED_FOR_COMPATIBILITY = 1 << 6;
        public static final int FLAG_PRE_IME_ONLY = 1 << 7;
        public QueuedInputEvent mNext;
@@ -10010,13 +10007,6 @@ public final class ViewRootImpl implements ViewParent,
        public InputEventReceiver mReceiver;
        public int mFlags;
        public boolean forPreImeOnly() {
            if ((mFlags & FLAG_PRE_IME_ONLY) != 0) {
                return true;
            }
            return false;
        }
        public boolean shouldSkipIme() {
            if ((mFlags & FLAG_DELIVER_POST_IME) != 0) {
                return true;
@@ -10043,7 +10033,6 @@ public final class ViewRootImpl implements ViewParent,
            hasPrevious = flagToString("FINISHED_HANDLED", FLAG_FINISHED_HANDLED, hasPrevious, sb);
            hasPrevious = flagToString("RESYNTHESIZED", FLAG_RESYNTHESIZED, hasPrevious, sb);
            hasPrevious = flagToString("UNHANDLED", FLAG_UNHANDLED, hasPrevious, sb);
            hasPrevious = flagToString("FLAG_PRE_IME_ONLY", FLAG_PRE_IME_ONLY, hasPrevious, sb);
            if (!hasPrevious) {
                sb.append("0");
            }
@@ -10100,7 +10089,7 @@ public final class ViewRootImpl implements ViewParent,
    }
    @UnsupportedAppUsage
    QueuedInputEvent enqueueInputEvent(InputEvent event,
    void enqueueInputEvent(InputEvent event,
            InputEventReceiver receiver, int flags, boolean processImmediately) {
        QueuedInputEvent q = obtainQueuedInputEvent(event, receiver, flags);
@@ -10139,7 +10128,6 @@ public final class ViewRootImpl implements ViewParent,
        } else {
            scheduleProcessInputEvents();
        }
        return q;
    }
    private void scheduleProcessInputEvents() {
@@ -12461,45 +12449,29 @@ public final class ViewRootImpl implements ViewParent,
                            + "IWindow:%s Session:%s",
                    mOnBackInvokedDispatcher, mBasePackageName, mWindow, mWindowSession));
        }
        mOnBackInvokedDispatcher.attachToWindow(mWindowSession, mWindow, this,
        mOnBackInvokedDispatcher.attachToWindow(mWindowSession, mWindow,
                mImeBackAnimationController);
    }
    /**
     * Sends {@link KeyEvent#ACTION_DOWN ACTION_DOWN} and {@link KeyEvent#ACTION_UP ACTION_UP}
     * back key events
     *
     * @param preImeOnly whether the back events should be sent to the pre-ime stage only
     * @return whether the event was handled (i.e. onKeyPreIme consumed it if preImeOnly=true)
     */
    public boolean injectBackKeyEvents(boolean preImeOnly) {
        boolean consumed;
        try {
            processingBackKey(true);
            sendBackKeyEvent(KeyEvent.ACTION_DOWN, preImeOnly);
            consumed = sendBackKeyEvent(KeyEvent.ACTION_UP, preImeOnly);
        } finally {
            processingBackKey(false);
        }
        return consumed;
    }
    private boolean sendBackKeyEvent(int action, boolean preImeOnly) {
    private void sendBackKeyEvent(int action) {
        long when = SystemClock.uptimeMillis();
        final KeyEvent ev = new KeyEvent(when, when, action,
                KeyEvent.KEYCODE_BACK, 0 /* repeat */, 0 /* metaState */,
                KeyCharacterMap.VIRTUAL_KEYBOARD, 0 /* scancode */,
                KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY,
                InputDevice.SOURCE_KEYBOARD);
        int flags = preImeOnly ? QueuedInputEvent.FLAG_PRE_IME_ONLY : 0;
        QueuedInputEvent q = enqueueInputEvent(ev, null /* receiver */, flags,
                true /* processImmediately */);
        return (q.mFlags & QueuedInputEvent.FLAG_FINISHED_HANDLED) != 0;
        enqueueInputEvent(ev, null /* receiver */, 0 /* flags */, true /* processImmediately */);
    }
    private void registerCompatOnBackInvokedCallback() {
        mCompatOnBackInvokedCallback = () -> {
            injectBackKeyEvents(/* preImeOnly */ false);
            try {
                processingBackKey(true);
                sendBackKeyEvent(KeyEvent.ACTION_DOWN);
                sendBackKeyEvent(KeyEvent.ACTION_UP);
            } finally {
                processingBackKey(false);
            }
        };
        if (mOnBackInvokedDispatcher.hasImeOnBackInvokedDispatcher()) {
            Log.d(TAG, "Skip registering CompatOnBackInvokedCallback on IME dispatcher");
Loading