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

Commit b514cba8 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Cleanup IME layering/input/control target fields

This is a general cleanup of all the references to IME layering target,
IME input target and IME control target. This also adds some
documentation to these fields and the methods which update and refer to
them.

Previously we were refering to the IME layering target as simply the IME
target, which was sometimes confusing. This makes the reference
explicit.

Flag: EXEMPT cleanup
Bug: 281029564
Test: atest DisplayContentTests DualDisplayAreaGroupPolicyTest
  InsetsStateControllerTest WindowStateTests ZOrderingTests
Change-Id: I7d224a06d8d55e605c37b119860c3c82a75d97f3
parent bfe2c0c9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -4476,7 +4476,7 @@ package android.window {
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void createRootTask(int, int, @Nullable android.os.IBinder);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void createRootTask(int, int, @Nullable android.os.IBinder);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean deleteRootTask(@NonNull android.window.WindowContainerToken);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean deleteRootTask(@NonNull android.window.WindowContainerToken);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.app.ActivityManager.RunningTaskInfo> getChildTasks(@NonNull android.window.WindowContainerToken, @NonNull int[]);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.app.ActivityManager.RunningTaskInfo> getChildTasks(@NonNull android.window.WindowContainerToken, @NonNull int[]);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public android.window.WindowContainerToken getImeTarget(int);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public android.window.WindowContainerToken getImeLayeringTarget(int);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.app.ActivityManager.RunningTaskInfo> getRootTasks(int, @NonNull int[]);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.app.ActivityManager.RunningTaskInfo> getRootTasks(int, @NonNull int[]);
    method @BinderThread public void onAppSplashScreenViewRemoved(int);
    method @BinderThread public void onAppSplashScreenViewRemoved(int);
    method @BinderThread public void onBackPressedOnTaskRoot(@NonNull android.app.ActivityManager.RunningTaskInfo);
    method @BinderThread public void onBackPressedOnTaskRoot(@NonNull android.app.ActivityManager.RunningTaskInfo);
+2 −0
Original line number Original line Diff line number Diff line
@@ -2223,6 +2223,8 @@ UnflaggedApi: android.view.inputmethod.InputMethodManager#isStylusHandwritingAva
    New API must be flagged with @FlaggedApi: method android.view.inputmethod.InputMethodManager.isStylusHandwritingAvailableAsUser(android.os.UserHandle)
    New API must be flagged with @FlaggedApi: method android.view.inputmethod.InputMethodManager.isStylusHandwritingAvailableAsUser(android.os.UserHandle)
UnflaggedApi: android.view.inputmethod.InsertModeGesture:
UnflaggedApi: android.view.inputmethod.InsertModeGesture:
    New API must be flagged with @FlaggedApi: class android.view.inputmethod.InsertModeGesture
    New API must be flagged with @FlaggedApi: class android.view.inputmethod.InsertModeGesture
UnflaggedApi: android.window.TaskOrganizer#getImeLayeringTarget(int):
    New API must be flagged with @FlaggedApi: method android.window.TaskOrganizer.getImeLayeringTarget(int)
UnflaggedApi: android.window.WindowInfosListenerForTest.WindowInfo#displayId:
UnflaggedApi: android.window.WindowInfosListenerForTest.WindowInfo#displayId:
    New API must be flagged with @FlaggedApi: field android.window.WindowInfosListenerForTest.WindowInfo.displayId
    New API must be flagged with @FlaggedApi: field android.window.WindowInfosListenerForTest.WindowInfo.displayId
UnflaggedApi: android.window.WindowInfosListenerForTest.WindowInfo#isVisible:
UnflaggedApi: android.window.WindowInfosListenerForTest.WindowInfo#isVisible:
+5 −2
Original line number Original line Diff line number Diff line
@@ -58,8 +58,11 @@ interface ITaskOrganizerController {
    /** Gets all root tasks on a display (ordered from top-to-bottom) */
    /** Gets all root tasks on a display (ordered from top-to-bottom) */
    List<ActivityManager.RunningTaskInfo> getRootTasks(int displayId, in int[] activityTypes);
    List<ActivityManager.RunningTaskInfo> getRootTasks(int displayId, in int[] activityTypes);


    /** Get the {@link WindowContainerToken} of the task which contains the current ime target */
    /**
    WindowContainerToken getImeTarget(int display);
     * Get the {@link WindowContainerToken} of the task which contains the current IME layering
     * target
     */
    @nullable WindowContainerToken getImeLayeringTarget(int display);


    /**
    /**
     * Requests that the given task organizer is notified when back is pressed on the root activity
     * Requests that the given task organizer is notified when back is pressed on the root activity
+8 −3
Original line number Original line Diff line number Diff line
@@ -211,12 +211,17 @@ public class TaskOrganizer extends WindowOrganizer {
        }
        }
    }
    }


    /** Get the {@link WindowContainerToken} of the task which contains the current ime target */
    /**
     * Get the {@link WindowContainerToken} of the task which contains the current IME layering
     * target.
     *
     * @param displayId the ID of the display to get the IME layering target for.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    @Nullable
    @Nullable
    public WindowContainerToken getImeTarget(int display) {
    public WindowContainerToken getImeLayeringTarget(int displayId) {
        try {
        try {
            return mTaskOrganizerController.getImeTarget(display);
            return mTaskOrganizerController.getImeLayeringTarget(displayId);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
+7 −7
Original line number Original line Diff line number Diff line
@@ -1440,8 +1440,8 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                return 0;
                return 0;
            }
            }


            final int imeTargetPosition = getImeTargetPosition();
            final int imeLayeringTargetPosition = getImeLayeringTargetPosition();
            mHasImeFocus = imeTargetPosition != SPLIT_POSITION_UNDEFINED;
            mHasImeFocus = imeLayeringTargetPosition != SPLIT_POSITION_UNDEFINED;
            if (!mHasImeFocus) {
            if (!mHasImeFocus) {
                if (!android.view.inputmethod.Flags.refactorInsetsController() || showing) {
                if (!android.view.inputmethod.Flags.refactorInsetsController() || showing) {
                    return 0;
                    return 0;
@@ -1454,15 +1454,15 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange


            // Update target dim values
            // Update target dim values
            mLastDim1 = mDimValue1;
            mLastDim1 = mDimValue1;
            mTargetDim1 = imeTargetPosition == SPLIT_POSITION_BOTTOM_OR_RIGHT && mImeShown
            mTargetDim1 = imeLayeringTargetPosition == SPLIT_POSITION_BOTTOM_OR_RIGHT && mImeShown
                    && mDimNonImeSide ? ADJUSTED_NONFOCUS_DIM : 0.0f;
                    && mDimNonImeSide ? ADJUSTED_NONFOCUS_DIM : 0.0f;
            mLastDim2 = mDimValue2;
            mLastDim2 = mDimValue2;
            mTargetDim2 = imeTargetPosition == SPLIT_POSITION_TOP_OR_LEFT && mImeShown
            mTargetDim2 = imeLayeringTargetPosition == SPLIT_POSITION_TOP_OR_LEFT && mImeShown
                    && mDimNonImeSide ? ADJUSTED_NONFOCUS_DIM : 0.0f;
                    && mDimNonImeSide ? ADJUSTED_NONFOCUS_DIM : 0.0f;


            // Calculate target bounds offset for IME
            // Calculate target bounds offset for IME
            mLastYOffset = mYOffsetForIme;
            mLastYOffset = mYOffsetForIme;
            final boolean needOffset = imeTargetPosition == SPLIT_POSITION_BOTTOM_OR_RIGHT
            final boolean needOffset = imeLayeringTargetPosition == SPLIT_POSITION_BOTTOM_OR_RIGHT
                    && !isFloating && !mIsLeftRightSplit && mImeShown;
                    && !isFloating && !mIsLeftRightSplit && mImeShown;
            mTargetYOffset = needOffset ? getTargetYOffset() : 0;
            mTargetYOffset = needOffset ? getTargetYOffset() : 0;


@@ -1565,8 +1565,8 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
        }
        }


        @SplitPosition
        @SplitPosition
        private int getImeTargetPosition() {
        private int getImeLayeringTargetPosition() {
            final WindowContainerToken token = mTaskOrganizer.getImeTarget(mDisplayId);
            final WindowContainerToken token = mTaskOrganizer.getImeLayeringTarget(mDisplayId);
            return mSplitLayoutHandler.getSplitItemPosition(token);
            return mSplitLayoutHandler.getSplitItemPosition(token);
        }
        }


Loading