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

Commit 16701bcf authored by ryanlwlin's avatar ryanlwlin Committed by Ryan Lin
Browse files

Delete the obsolete code for accessibility title population

For now we could get the window title from ViewRootImpl, so
we delete all obsolete code. Besides we add new string
for the tile of the pip window and split-screen divider

Bug: 210985169
Test: atest android.accessibilityservice.cts
      manual test with talkback
Change-Id: Ia418b2f4175636c2109082b8daeb7b2cc1cfd845
parent ead96e04
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@
    <!-- Title of menu shown over picture-in-picture. Used for accessibility. -->
    <string name="pip_menu_title">Menu</string>

    <!-- accessibility Title of menu shown over picture-in-picture [CHAR LIMIT=NONE] -->
    <string name="pip_menu_accessibility_title">Picture-in-Picture Menu</string>

    <!-- PiP BTW notification title. [CHAR LIMIT=50] -->
    <string name="pip_notification_title"><xliff:g id="name" example="Google Maps">%s</xliff:g> is in picture-in-picture</string>

@@ -73,8 +76,10 @@
    <!-- Warning message when we try to launch a non-resizeable activity on a secondary display and launch it on the primary instead. -->
    <string name="activity_launch_on_secondary_display_failed_text">App does not support launch on secondary displays.</string>

    <!-- Accessibility label for the divider that separates the windows in split-screen mode [CHAR LIMIT=NONE] -->
    <!-- Accessibility label and window tile for the divider that separates the windows in split-screen mode [CHAR LIMIT=NONE] -->
    <string name="accessibility_divider">Split-screen divider</string>
    <!-- Accessibility window title for the split-screen divider window [CHAR LIMIT=NONE] -->
    <string name="divider_title">Split-screen divider</string>

    <!-- Accessibility action for moving docked stack divider to make the left screen full screen [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_left_full">Left full screen</string>
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ public final class SplitWindowManager extends WindowlessWindowManager {
        lp.token = new Binder();
        lp.setTitle(mWindowName);
        lp.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION | PRIVATE_FLAG_TRUSTED_OVERLAY;
        lp.accessibilityTitle = mContext.getResources().getString(R.string.accessibility_divider);
        mViewHost.setView(mDividerView, lp);
        mDividerView.setup(splitLayout, this, mViewHost, insetsState);
    }
+8 −1
Original line number Diff line number Diff line
@@ -26,11 +26,14 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import android.annotation.Nullable;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.RemoteAction;
import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.view.SurfaceControl;
import android.view.WindowManager;

import com.android.wm.shell.R;

import java.util.List;

/**
@@ -97,16 +100,20 @@ public interface PipMenuController {

    /**
     * Returns a default LayoutParams for the PIP Menu.
     * @param context the context.
     * @param width the PIP stack width.
     * @param height the PIP stack height.
     */
    default WindowManager.LayoutParams getPipMenuLayoutParams(String title, int width, int height) {
    default WindowManager.LayoutParams getPipMenuLayoutParams(Context context, String title,
            int width, int height) {
        final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height,
                TYPE_APPLICATION_OVERLAY,
                FLAG_WATCH_OUTSIDE_TOUCH | FLAG_SPLIT_TOUCH | FLAG_SLIPPERY | FLAG_NOT_TOUCHABLE,
                PixelFormat.TRANSLUCENT);
        lp.privateFlags |= PRIVATE_FLAG_TRUSTED_OVERLAY;
        lp.setTitle(title);
        lp.accessibilityTitle = context.getResources().getString(
                R.string.pip_menu_accessibility_title);
        return lp;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ public class PhonePipMenuController implements PipMenuController {
        mPipMenuView = new PipMenuView(mContext, this, mMainExecutor, mMainHandler,
                mSplitScreenController, mPipUiEventLogger);
        mSystemWindows.addView(mPipMenuView,
                getPipMenuLayoutParams(MENU_WINDOW_TITLE, 0 /* width */, 0 /* height */),
                getPipMenuLayoutParams(mContext, MENU_WINDOW_TITLE, 0 /* width */, 0 /* height */),
                0, SHELL_ROOT_LAYER_PIP);
        setShellRootAccessibilityWindow();

@@ -206,7 +206,7 @@ public class PhonePipMenuController implements PipMenuController {
    @Override
    public void updateMenuBounds(Rect destinationBounds) {
        mSystemWindows.updateViewLayout(mPipMenuView,
                getPipMenuLayoutParams(MENU_WINDOW_TITLE, destinationBounds.width(),
                getPipMenuLayoutParams(mContext, MENU_WINDOW_TITLE, destinationBounds.width(),
                        destinationBounds.height()));
        updateMenuLayout(destinationBounds);
    }
+4 −4
Original line number Diff line number Diff line
@@ -193,8 +193,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
    }

    private void addPipMenuViewToSystemWindows(View v, String title) {
        mSystemWindows.addView(v, getPipMenuLayoutParams(title, 0 /* width */, 0 /* height */),
                0 /* displayId */, SHELL_ROOT_LAYER_PIP);
        mSystemWindows.addView(v, getPipMenuLayoutParams(mContext, title, 0 /* width */,
                0 /* height */), 0 /* displayId */, SHELL_ROOT_LAYER_PIP);
    }

    void notifyPipAnimating(boolean animating) {
@@ -572,10 +572,10 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
                    "%s: updateMenuBounds: %s", TAG, menuBounds.toShortString());
        }
        mSystemWindows.updateViewLayout(mPipBackgroundView,
                getPipMenuLayoutParams(BACKGROUND_WINDOW_TITLE, menuBounds.width(),
                getPipMenuLayoutParams(mContext, BACKGROUND_WINDOW_TITLE, menuBounds.width(),
                        menuBounds.height()));
        mSystemWindows.updateViewLayout(mPipMenuView,
                getPipMenuLayoutParams(MENU_WINDOW_TITLE, menuBounds.width(),
                getPipMenuLayoutParams(mContext, MENU_WINDOW_TITLE, menuBounds.width(),
                        menuBounds.height()));

        if (mPipMenuView != null) {
Loading