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

Commit 1b73896e authored by Evan Laird's avatar Evan Laird
Browse files

Phase 1 of status bar system event animations

Sketch of how things might work:
    - SystemEventCoordinator ties together arbitrary events and funnels
      them to the scheduler
    - Scheduler - a very simple prioritization and scheduling utility,
      since we don't want a spammy status bar
    - Animation controller - this class is probably going to evolve the
      most. Once an animation has a clear path, this class will actually
      make sure views are visible and allow individual view to animate
      in and out properly. It also potentially keeps the status bar open
      in immersive mode

This CL stands up a couple of things meant to achieve system animations
(currently only privacy items) that live in the status bar:

  1. SystemStatusAnimationScheduler - simple prioritization queue
     which can take requests to play system status animations. It also
     handles the running of said animations by maintaining
     ValueAnimators and providing callbacks for the system to get out of
     the way while animations are happening.

  2. SystemEventCoordinator - This is the front end for generating
     system events which trigger animations. Pretty simple, it sends
     StatusEvent objects to the scheduler to maybe play the relevant
     animation.

  3. StatusEvent - Events are sent to be scheduled, and wrap a priority
     int. They also create the view that is to be animated (still WIP)

  4. SystemStatusChipAnimationController - handles the presentation of
     the chip view. Still needs to be updated with prettier animations

  5. PrivacyDotViewController - the most bespoke of classes added here.
     controls the location of the privacy dots (more on this below)

System spaces are expected to listen for callbacks from the scheduler
and do whatever is appropriate to get out of the way. E.g., hide the
status bar system elements, keep the status bar window open in immersive
mode, or hide keyguard elements.

And finally, a note on the dot: for reasons(tm), the dot lives in
ScreenDecorations. But since screen decorations creates very special
windows that don't "just rotate", the locations are controlled by the
PrivacyDotController. However, to create the illusion that the dots are
in the status bar, they are always positioned on either side of where
the status bar happens to be.

Bug: 177323724
Test: coming soon to a theater near you
Change-Id: If528bd7e9d1e0ca3be7391f83f7416fa10e7a41b
parent 1198ed06
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->

<!-- dot drawable for ongoing system privacy events -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid
        android:color="@color/privacy_circle"/>
    <size
        android:width="6dp"
        android:height="6dp"
        />
</shape>
 No newline at end of file
+39 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
** See the License for the specific language governing permissions and
** limitations under the License.
-->

<!-- TODO: remove this in favor of requiring top and bottom layouts -->
<com.android.systemui.RegionInterceptingFrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rounded_corners_default"
@@ -26,6 +28,25 @@
        android:layout_gravity="left|top"
        android:tint="#ff000000"
        android:src="@drawable/rounded"/>

    <FrameLayout
        android:id="@+id/privacy_dot_left_container"
        android:layout_height="@dimen/status_bar_height"
        android:layout_width="wrap_content"
        android:layout_marginTop="@dimen/status_bar_padding_top"
        android:layout_marginLeft="8dp"
        android:layout_gravity="left|top"
        android:visibility="invisible" >
        <ImageView
            android:id="@+id/privacy_dot_left"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center"
            android:src="@drawable/system_animation_ongoing_dot"
            android:visibility="visible" />
    </FrameLayout>


    <ImageView
        android:id="@+id/right"
        android:layout_width="12dp"
@@ -33,4 +54,22 @@
        android:tint="#ff000000"
        android:layout_gravity="right|bottom"
        android:src="@drawable/rounded"/>
    <FrameLayout
        android:id="@+id/privacy_dot_right_container"
        android:layout_height="@dimen/status_bar_height"
        android:layout_width="wrap_content"
        android:layout_marginTop="@dimen/status_bar_padding_top"
        android:layout_marginRight="8dp"
        android:layout_gravity="right|top"
        android:visibility="invisible" >
        <ImageView
            android:id="@+id/privacy_dot_right"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center"
            android:src="@drawable/system_animation_ongoing_dot"
            android:visibility="visible" />

    </FrameLayout>

</com.android.systemui.RegionInterceptingFrameLayout>
+35 −0
Original line number Diff line number Diff line
@@ -26,6 +26,24 @@
        android:layout_gravity="left|bottom"
        android:tint="#ff000000"
        android:src="@drawable/rounded_corner_bottom"/>

    <FrameLayout
        android:id="@+id/privacy_dot_left_container"
        android:layout_height="@dimen/status_bar_height"
        android:layout_width="wrap_content"
        android:layout_marginTop="@dimen/status_bar_padding_top"
        android:layout_marginLeft="0dp"
        android:layout_gravity="left|bottom"
        android:visibility="invisible" >
        <ImageView
            android:id="@+id/privacy_dot"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical|right"
            android:src="@drawable/system_animation_ongoing_dot"
            android:visibility="visible" />
    </FrameLayout>

    <ImageView
        android:id="@+id/right"
        android:layout_width="12dp"
@@ -33,4 +51,21 @@
        android:tint="#ff000000"
        android:layout_gravity="right|bottom"
        android:src="@drawable/rounded_corner_bottom"/>
    <FrameLayout
        android:id="@+id/privacy_dot_right_container"
        android:layout_height="@dimen/status_bar_height"
        android:layout_width="wrap_content"
        android:layout_marginTop="@dimen/status_bar_padding_top"
        android:layout_marginRight="0dp"
        android:layout_gravity="right|bottom"
        android:visibility="invisible" >
        <ImageView
            android:id="@+id/privacy_dot"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical|left"
            android:src="@drawable/system_animation_ongoing_dot"
            android:visibility="visible" />
    </FrameLayout>

</com.android.systemui.RegionInterceptingFrameLayout>
+38 −0
Original line number Diff line number Diff line
@@ -26,6 +26,24 @@
        android:layout_gravity="left|top"
        android:tint="#ff000000"
        android:src="@drawable/rounded_corner_top"/>

    <FrameLayout
        android:id="@+id/privacy_dot_left_container"
        android:layout_height="@*android:dimen/status_bar_height_portrait"
        android:layout_width="wrap_content"
        android:layout_marginTop="@dimen/status_bar_padding_top"
        android:layout_marginLeft="0dp"
        android:layout_gravity="left|top"
        android:visibility="invisible" >
        <ImageView
            android:id="@+id/privacy_dot"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical|right"
            android:src="@drawable/system_animation_ongoing_dot"
            android:visibility="visible" />
    </FrameLayout>

    <ImageView
        android:id="@+id/right"
        android:layout_width="12dp"
@@ -33,4 +51,24 @@
        android:tint="#ff000000"
        android:layout_gravity="right|top"
        android:src="@drawable/rounded_corner_top"/>

    <FrameLayout
        android:id="@+id/privacy_dot_right_container"
        android:layout_height="@*android:dimen/status_bar_height_portrait"
        android:layout_width="wrap_content"
        android:layout_marginTop="@dimen/status_bar_padding_top"
        android:layout_marginRight="0dp"
        android:layout_gravity="right|top"
        android:visibility="invisible" >
        <ImageView
            android:id="@+id/privacy_dot"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical|left"
            android:src="@drawable/system_animation_ongoing_dot"
            android:visibility="visible" />

    </FrameLayout>


</com.android.systemui.RegionInterceptingFrameLayout>
+35 −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.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_vertical|end"
    android:paddingTop="@dimen/status_bar_padding_top"
    android:paddingEnd="8dp"
    >

    <ImageView
        android:id="@+id/dot_view"
        android:layout_width="10dp"
        android:layout_height="10dp"
        android:layout_gravity="center_vertical|end"
        android:src="@drawable/system_animation_ongoing_dot"
        android:visibility="invisible"
        />

</FrameLayout>
 No newline at end of file
Loading