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

Commit aa3a7e62 authored by Jacqueline Bronger's avatar Jacqueline Bronger
Browse files

Implement custom PiP close action on TV.

The custom close action will replace the system close action and
the button in the menu will be colored red to be able to tell it
apart.
If one of the custom actions matches the close actions it will be
removed to avoid duplicates resulting from the custom close action.

If the app doesn't close the PiP after five seconds the system will
continue to close the PiP as normal.

Bug: 218487423
Test: manual
Change-Id: Ic3c520c50ac0e3d2f0e73cf2f71d47a4f548f861
parent d8a9414b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ oneway interface IPinnedTaskListener {
     * Called when the set of actions for the current PiP activity changes, or when the listener
     * is first registered to allow the listener to synchronize its state with the controller.
     */
    void onActionsChanged(in ParceledListSlice<RemoteAction> actions);
    void onActionsChanged(in ParceledListSlice<RemoteAction> actions, in RemoteAction closeAction);

    /**
     * Called by the window manager to notify the listener that Activity (was or is in pinned mode)
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2022 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/tv_pip_menu_icon_unfocused" />
</selector>
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2022 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true"
          android:color="@color/tv_pip_menu_close_icon_bg_focused" />
    <item android:color="@color/tv_pip_menu_close_icon_bg_unfocused" />
</selector>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -39,4 +39,8 @@

    <!-- Duration (in milliseconds) the PiP stays stashed before automatically unstashing. -->
    <integer name="config_pipStashDuration">5000</integer>

    <!-- Time (duration in milliseconds) that the shell waits for an app to close the PiP by itself
    if a custom action is present before closing it. -->
    <integer name="config_pipForceCloseDelay">5000</integer>
</resources>
+3 −1
Original line number Diff line number Diff line
@@ -16,8 +16,10 @@
  -->
<resources>
    <color name="tv_pip_menu_icon_focused">#0E0E0F</color>
    <color name="tv_pip_menu_icon_unfocused">#E8EAED</color>
    <color name="tv_pip_menu_icon_unfocused">#F8F9FA</color>
    <color name="tv_pip_menu_icon_disabled">#80868B</color>
    <color name="tv_pip_menu_close_icon_bg_focused">#D93025</color>
    <color name="tv_pip_menu_close_icon_bg_unfocused">#D69F261F</color>
    <color name="tv_pip_menu_icon_bg_focused">#E8EAED</color>
    <color name="tv_pip_menu_icon_bg_unfocused">#990E0E0F</color>
    <color name="tv_pip_menu_focus_border">#E8EAED</color>
Loading