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

Commit a47fea55 authored by Bryce Lee's avatar Bryce Lee
Browse files

Idle Mode Support.

This changelist introduces idle mode, a user interface
shown when user interaction times out on the lockscreen.
A host view and accompanying controller have been added
to handle the relevant lifecycles inside the notification
view panel.

Test: manual
Bug: 194230499
Change-Id: I5ce5fc790b93be7aa036faf8caa569de7cae8379
parent 5f327a6c
Loading
Loading
Loading
Loading
+23 −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.
  -->


<com.android.systemui.idle.IdleHostView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/idle_host_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
+6 −1
Original line number Diff line number Diff line
@@ -73,6 +73,11 @@
            layout="@layout/keyguard_status_view"
            android:visibility="gone"/>

        <include layout="@layout/idle_host_view"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:visibility="gone"/>

        <include layout="@layout/dock_info_overlay"/>

        <FrameLayout
+7 −0
Original line number Diff line number Diff line
@@ -684,4 +684,11 @@

    <!-- Component name of communal source service -->
    <string name="config_communalSourceComponent" translatable="false">@null</string>

    <!-- Whether idle mode should be enabled. When enabled, the lock screen will timeout to an idle
         screen on inactivity. -->
    <bool name="config_enableIdleMode">false</bool>

    <!-- Timeout to idle mode duration in milliseconds. -->
    <integer name="config_idleModeTimeout">10000</integer>
</resources>
+20 −1
Original line number Diff line number Diff line
@@ -16,13 +16,32 @@

package com.android.systemui.communal.dagger;

import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;

import com.android.systemui.idle.dagger.IdleViewComponent;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;

/**
 * Dagger Module providing Communal-related functionality.
 */
@Module(subcomponents = {
        CommunalViewComponent.class,
        IdleViewComponent.class,
})
public class CommunalModule {
public interface CommunalModule {
    String IDLE_VIEW = "idle_view";

    /** */
    @Provides
    @Named(IDLE_VIEW)
    static View provideIdleView(Context context) {
        FrameLayout view = new FrameLayout(context);
        return view;
    }
}
+42 −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.
 */

package com.android.systemui.idle;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * {@link IdleHostView} houses a surface to be displayed when the device idle.
 */
public class IdleHostView extends FrameLayout {
    public IdleHostView(@NonNull Context context) {
        this(context, null);
    }

    public IdleHostView(@NonNull Context context,
            @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public IdleHostView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
}
Loading