android11 SystemUI入門之KeyguardPatternView解析

view层级树为:

被包含在 keyguard_host_view.xml中 。

xml 复制代码
<?xml version="1.0" encoding="utf-8"?>
<!-- This is the host view that generally contains two sub views: the widget view
    and the security view. -->
<com.android.keyguard.KeyguardHostView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/res-auto"
    android:id="@+id/keyguard_host_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:importantForAccessibility="yes"> <!-- Needed because TYPE_WINDOW_STATE_CHANGED is sent
                                                  from this view when bouncer is shown -->

    <com.android.keyguard.KeyguardSecurityContainer
        android:id="@+id/keyguard_security_container"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        androidprv:layout_maxHeight="@dimen/keyguard_security_max_height"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:padding="0dp"
        android:fitsSystemWindows="true"
        android:layout_gravity="center">
        <com.android.keyguard.KeyguardSecurityViewFlipper
            android:id="@+id/view_flipper"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:paddingTop="@dimen/keyguard_security_view_top_margin"
            android:paddingStart="@dimen/keyguard_security_view_lateral_margin"
            android:paddingEnd="@dimen/keyguard_security_view_lateral_margin"
            android:gravity="center">
        </com.android.keyguard.KeyguardSecurityViewFlipper>
    </com.android.keyguard.KeyguardSecurityContainer>
</com.android.keyguard.KeyguardHostView>

而 KeyguardPatternView 是 KeyguardSecurityViewFlipper的一个孩子 。

继承接口KeyguardSecurityView。

开机显示KeyguardPatternView的方法调用堆栈:

开机调用KeyguardViewMediator的doKeyguardLocked方法的调用堆栈为:

KeyguardService 的binder方法 onSystemReady 调用 mKeyguardViewMediator.onSystemReady() 到 doKeyguardLocked方法 。

KeyguardPatternView:

手势验证成功的回调以及 Keyguard如何消失:

最终调用到SecurityCallback的dismiss方法 然后到 ViewMediatorCallback 的

待续。

KeyguardPatternView 何时显示在界面上:

KeyguardSecurityContainer#getLayoutIdFor

放入mSecurityViewFlipper ,然后调用mSecurityViewFlipper的setDisplayedChild来显示.

最终放入NotificationShadeWindowView中.

开机是否显示Keyguard?

客户端调用 KeyguardService的onSystemReady 方法,后者调用 KeyguardViewMediator的onSystemReady()方法,

继续到doKeyguardLocked中的 LockPatternUtils.isLockScreenDisabled 来判断是否要显示锁屏界面。

哪里调用KeyguardService的onSystemReady方法

待续。

创建一个KeyguardBouncer的流程:

外部调用其show方法.它将自己作为一个孩子加入参数 container中.

在锁屏界面解锁的过程:

在以上的通知信息双击, 方法的调用堆栈如下:

主要的方法有:

StatusBar.dismissKeyguardThenExecute

StatusBarNotificationActivityStarter.onNotificationClicked:272

NotificationClicker.onClick:99

在StatusBarNotificationActivityStarter的方法handleNotificationClickAfterKeyguardDismissed中处理通知信息的点击打开.

系统如何创建一个NotificationClicker

待續.

相关推荐
ItJavawfc8 天前
Android12_13左上角状态栏数字时间显示右移动
systemui·时间右移动
Swuagg15 天前
AR 眼镜之-系统通知定制(通知弹窗)-实现方案
notification·systemui·系统通知·通知弹窗
Swuagg16 天前
AR 眼镜之-系统通知定制(通知中心)-实现方案
systemui·系统通知·通知中心
小先生Zcutie5 个月前
【Android】SystemUI通知栏过滤指定应用的通知
android·systemui
JohnnyDeng9410 个月前
StatusBarManager中的相关标志位
systemui
Jon_Lo1 年前
Android SystemUI setSystemUiVisibility()参数Flag详解
android·导航栏·systemui·1024程序员节·状态栏·fullscreen
xhBruce1 年前
SystemUI状态栏
systemui·状态栏
xhBruce1 年前
SystemUI导航栏
导航栏·systemui
一化十1 年前
Android 6.0 Settings中添加虚拟键开关
android·settings·mtk·systemui