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

Commit b379fefb authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Move lock icon view." into udc-qpr-dev am: d864ae83 am: 236f0401"

parents 2db3acff 801fce02
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -132,21 +132,6 @@
        android:id="@+id/lock_icon_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <!-- Background protection -->
        <ImageView
            android:id="@+id/lock_icon_bg"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/fingerprint_bg"
            android:visibility="invisible"/>

        <ImageView
            android:id="@+id/lock_icon"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:scaleType="centerCrop"/>

    </com.android.keyguard.LockIconView>

    <include
+2 −0
Original line number Diff line number Diff line
@@ -211,4 +211,6 @@
    <item type="id" name="keyguard_indication_area" />
    <item type="id" name="keyguard_indication_text" />
    <item type="id" name="keyguard_indication_text_bottom" />
    <item type="id" name="lock_icon" />
    <item type="id" name="lock_icon_bg" />
</resources>
+29 −6
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.keyguard;

import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
@@ -23,6 +25,7 @@ import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -68,13 +71,9 @@ public class LockIconView extends FrameLayout implements Dumpable {
    public LockIconView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mSensorRect = new RectF();
    }

    @Override
    public void onFinishInflate() {
        super.onFinishInflate();
        mLockIcon = findViewById(R.id.lock_icon);
        mBgView = findViewById(R.id.lock_icon_bg);
        addBgImageView(context, attrs);
        addLockIconImageView(context, attrs);
    }

    void setDozeAmount(float dozeAmount) {
@@ -184,6 +183,30 @@ public class LockIconView extends FrameLayout implements Dumpable {
        mLockIcon.setImageState(getLockIconState(mIconType, mAod), true);
    }

    private void addLockIconImageView(Context context, AttributeSet attrs) {
        mLockIcon = new ImageView(context, attrs);
        mLockIcon.setId(R.id.lock_icon);
        mLockIcon.setScaleType(ImageView.ScaleType.CENTER_CROP);
        addView(mLockIcon);
        LayoutParams lp = (LayoutParams) mLockIcon.getLayoutParams();
        lp.height = MATCH_PARENT;
        lp.width = MATCH_PARENT;
        lp.gravity = Gravity.CENTER;
        mLockIcon.setLayoutParams(lp);
    }

    private void addBgImageView(Context context, AttributeSet attrs) {
        mBgView = new ImageView(context, attrs);
        mBgView.setId(R.id.lock_icon_bg);
        mBgView.setImageDrawable(context.getDrawable(R.drawable.fingerprint_bg));
        mBgView.setVisibility(View.INVISIBLE);
        addView(mBgView);
        LayoutParams lp = (LayoutParams) mBgView.getLayoutParams();
        lp.height = MATCH_PARENT;
        lp.width = MATCH_PARENT;
        mBgView.setLayoutParams(lp);
    }

    private static int[] getLockIconState(@IconType int icon, boolean aod) {
        if (icon == ICON_NONE) {
            return new int[0];
+8 −0
Original line number Diff line number Diff line
@@ -249,11 +249,19 @@ object Flags {
    @JvmField
    val DELAY_BOUNCER = unreleasedFlag(235, "delay_bouncer", teamfood = true)


    /** Keyguard Migration */

    /** Migrate the indication area to the new keyguard root view. */
    // TODO(b/280067944): Tracking bug.
    @JvmField
    val MIGRATE_INDICATION_AREA = unreleasedFlag(236, "migrate_indication_area", teamfood = true)

    /** Migrate the lock icon view to the new keyguard root view. */
    // TODO(b/286552209): Tracking bug.
    @JvmField
    val MIGRATE_LOCK_ICON = unreleasedFlag(238, "migrate_lock_icon")

    /** Whether to listen for fingerprint authentication over keyguard occluding activities. */
    // TODO(b/283260512): Tracking bug.
    @JvmField
+15 −2
Original line number Diff line number Diff line
@@ -47,9 +47,10 @@ constructor(
    private var indicationAreaHandle: DisposableHandle? = null

    override fun start() {
        bindIndicationArea(
        val notificationPanel =
            notificationShadeWindowView.requireViewById(R.id.notification_panel) as ViewGroup
        )
        bindIndicationArea(notificationPanel)
        bindLockIconView(notificationPanel)
    }

    fun bindIndicationArea(legacyParent: ViewGroup) {
@@ -74,4 +75,16 @@ constructor(
                indicationController
            )
    }

    private fun bindLockIconView(legacyParent: ViewGroup) {
        if (featureFlags.isEnabled(Flags.MIGRATE_LOCK_ICON)) {
            legacyParent.requireViewById<View>(R.id.lock_icon_view).let {
                legacyParent.removeView(it)
            }
        } else {
            keyguardRootView.findViewById<View?>(R.id.lock_icon_view)?.let {
                keyguardRootView.removeView(it)
            }
        }
    }
}
Loading