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

Commit 0e981bc3 authored by Caitlin Cassidy's avatar Caitlin Cassidy Committed by Android (Google) Code Review
Browse files

Merge "[Media TTT] Add a chip view and controller for the receiving device."

parents cf757af3 05898447
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2021 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.
  -->

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:shape="oval">
    <size
        android:height="@dimen/media_ttt_chip_size_receiver"
        android:width="@dimen/media_ttt_chip_size_receiver"
        />
    <solid android:color="?androidprv:attr/colorSurface" />
</shape>
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 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.
  -->
<!-- TODO(b/203800646): layout_marginTop doesn't seem to work on some large screens. -->
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/media_ttt_chip_background_receiver"
    >

    <com.android.internal.widget.CachingIconView
        android:id="@+id/app_icon"
        android:layout_width="@dimen/media_ttt_icon_size_receiver"
        android:layout_height="@dimen/media_ttt_icon_size_receiver"
        android:layout_gravity="center"
        />

</FrameLayout>
+5 −1
Original line number Diff line number Diff line
@@ -981,7 +981,7 @@
    <dimen name="qs_aa_media_rec_album_margin_vert">4dp</dimen>
    <dimen name="qq_aa_media_rec_header_text_size">16sp</dimen>

    <!-- Media tap-to-transfer chip -->
    <!-- Media tap-to-transfer chip for sender device -->
    <dimen name="media_ttt_chip_outer_padding">16dp</dimen>
    <dimen name="media_ttt_text_size">16sp</dimen>
    <dimen name="media_ttt_icon_size">24dp</dimen>
@@ -989,6 +989,10 @@
    <dimen name="media_ttt_undo_button_vertical_padding">8dp</dimen>
    <dimen name="media_ttt_undo_button_vertical_negative_margin">-8dp</dimen>

    <!-- Media tap-to-transfer chip for receiver device -->
    <dimen name="media_ttt_chip_size_receiver">100dp</dimen>
    <dimen name="media_ttt_icon_size_receiver">95dp</dimen>

    <!-- Window magnification -->
    <dimen name="magnification_border_drag_size">35dp</dimen>
    <dimen name="magnification_outer_border_margin">15dp</dimen>
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.systemui.SystemUIAppComponentFactory;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardSliceProvider;
import com.android.systemui.media.taptotransfer.MediaTttCommandLineHelper;
import com.android.systemui.media.taptotransfer.receiver.MediaTttChipControllerReceiver;
import com.android.systemui.media.taptotransfer.sender.MediaTttChipControllerSender;
import com.android.systemui.people.PeopleProvider;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -135,6 +136,7 @@ public interface SysUIComponent {
        getNaturalRotationUnfoldProgressProvider().ifPresent(o -> o.init());
        // No init method needed, just needs to be gotten so that it's created.
        getMediaTttChipControllerSender();
        getMediaTttChipControllerReceiver();
        getMediaTttCommandLineHelper();
        getUnfoldLatencyTracker().init();
    }
@@ -192,6 +194,9 @@ public interface SysUIComponent {
    /** */
    Optional<MediaTttChipControllerSender> getMediaTttChipControllerSender();

    /** */
    Optional<MediaTttChipControllerReceiver> getMediaTttChipControllerReceiver();

    /** */
    Optional<MediaTttCommandLineHelper> getMediaTttCommandLineHelper();

+22 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.media.MediaHost;
import com.android.systemui.media.MediaHostStatesManager;
import com.android.systemui.media.taptotransfer.MediaTttCommandLineHelper;
import com.android.systemui.media.taptotransfer.MediaTttFlags;
import com.android.systemui.media.taptotransfer.receiver.MediaTttChipControllerReceiver;
import com.android.systemui.media.taptotransfer.sender.MediaTttChipControllerSender;
import com.android.systemui.statusbar.commandline.CommandRegistry;
import com.android.systemui.util.concurrency.DelayableExecutor;
@@ -93,6 +94,19 @@ public interface MediaModule {
                context, windowManager, mainExecutor, backgroundExecutor));
    }

    /** */
    @Provides
    @SysUISingleton
    static Optional<MediaTttChipControllerReceiver> providesMediaTttChipControllerReceiver(
            MediaTttFlags mediaTttFlags,
            Context context,
            WindowManager windowManager) {
        if (!mediaTttFlags.isMediaTttEnabled()) {
            return Optional.empty();
        }
        return Optional.of(new MediaTttChipControllerReceiver(context, windowManager));
    }

    /** */
    @Provides
    @SysUISingleton
@@ -101,11 +115,17 @@ public interface MediaModule {
            CommandRegistry commandRegistry,
            Context context,
            MediaTttChipControllerSender mediaTttChipControllerSender,
            MediaTttChipControllerReceiver mediaTttChipControllerReceiver,
            @Main DelayableExecutor mainExecutor) {
        if (!mediaTttFlags.isMediaTttEnabled()) {
            return Optional.empty();
        }
        return Optional.of(new MediaTttCommandLineHelper(
                commandRegistry, context, mediaTttChipControllerSender, mainExecutor));
        return Optional.of(
                new MediaTttCommandLineHelper(
                        commandRegistry,
                        context,
                        mediaTttChipControllerSender,
                        mediaTttChipControllerReceiver,
                        mainExecutor));
    }
}
Loading