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

Commit a5b030c7 authored by Hao Dong's avatar Hao Dong Committed by Android (Google) Code Review
Browse files

Merge "Fix default logo is wrong for some apps." into main

parents 63c2e779 dde01370
Loading
Loading
Loading
Loading
+22 −1
Original line number Original line Diff line number Diff line
@@ -34,6 +34,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.annotation.TestApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
@@ -603,7 +604,6 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
            mPromptInfo.setIsForLegacyFingerprintManager(sensorId);
            mPromptInfo.setIsForLegacyFingerprintManager(sensorId);
            return this;
            return this;
        }
        }
        // LINT.ThenChange(frameworks/base/core/java/android/hardware/biometrics/PromptInfo.java)


        /**
        /**
         * Set if emergency call button should show, for example if biometrics are
         * Set if emergency call button should show, for example if biometrics are
@@ -613,11 +613,32 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
         * @hide
         * @hide
         */
         */
        @NonNull
        @NonNull
        @RequiresPermission(anyOf = {TEST_BIOMETRIC, USE_BIOMETRIC_INTERNAL})
        public Builder setShowEmergencyCallButton(boolean showEmergencyCallButton) {
        public Builder setShowEmergencyCallButton(boolean showEmergencyCallButton) {
            mPromptInfo.setShowEmergencyCallButton(showEmergencyCallButton);
            mPromptInfo.setShowEmergencyCallButton(showEmergencyCallButton);
            return this;
            return this;
        }
        }


        /**
         * Set caller's component name for getting logo icon/description. This should only be used
         * by ConfirmDeviceCredentialActivity, see b/337082634 for more context.
         *
         * @param componentNameForConfirmDeviceCredentialActivity set the component name for
         *                                                        ConfirmDeviceCredentialActivity.
         * @return This builder.
         * @hide
         */
        @NonNull
        @RequiresPermission(anyOf = {TEST_BIOMETRIC, USE_BIOMETRIC_INTERNAL})
        public Builder setComponentNameForConfirmDeviceCredentialActivity(
                ComponentName componentNameForConfirmDeviceCredentialActivity) {
            mPromptInfo.setComponentNameForConfirmDeviceCredentialActivity(
                    componentNameForConfirmDeviceCredentialActivity);
            return this;
        }

        // LINT.ThenChange(frameworks/base/core/java/android/hardware/biometrics/PromptInfo.java)

        /**
        /**
         * Creates a {@link BiometricPrompt}.
         * Creates a {@link BiometricPrompt}.
         *
         *
+22 −3
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package android.hardware.biometrics;
import android.annotation.DrawableRes;
import android.annotation.DrawableRes;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -56,6 +57,7 @@ public class PromptInfo implements Parcelable {
    private boolean mIsForLegacyFingerprintManager = false;
    private boolean mIsForLegacyFingerprintManager = false;
    private boolean mShowEmergencyCallButton = false;
    private boolean mShowEmergencyCallButton = false;
    private boolean mUseParentProfileForDeviceCredential = false;
    private boolean mUseParentProfileForDeviceCredential = false;
    private ComponentName mComponentNameForConfirmDeviceCredentialActivity = null;


    public PromptInfo() {
    public PromptInfo() {


@@ -87,6 +89,8 @@ public class PromptInfo implements Parcelable {
        mIsForLegacyFingerprintManager = in.readBoolean();
        mIsForLegacyFingerprintManager = in.readBoolean();
        mShowEmergencyCallButton = in.readBoolean();
        mShowEmergencyCallButton = in.readBoolean();
        mUseParentProfileForDeviceCredential = in.readBoolean();
        mUseParentProfileForDeviceCredential = in.readBoolean();
        mComponentNameForConfirmDeviceCredentialActivity = in.readParcelable(
                ComponentName.class.getClassLoader(), ComponentName.class);
    }
    }


    public static final Creator<PromptInfo> CREATOR = new Creator<PromptInfo>() {
    public static final Creator<PromptInfo> CREATOR = new Creator<PromptInfo>() {
@@ -132,10 +136,11 @@ public class PromptInfo implements Parcelable {
        dest.writeBoolean(mIsForLegacyFingerprintManager);
        dest.writeBoolean(mIsForLegacyFingerprintManager);
        dest.writeBoolean(mShowEmergencyCallButton);
        dest.writeBoolean(mShowEmergencyCallButton);
        dest.writeBoolean(mUseParentProfileForDeviceCredential);
        dest.writeBoolean(mUseParentProfileForDeviceCredential);
        dest.writeParcelable(mComponentNameForConfirmDeviceCredentialActivity, 0);
    }
    }


    // LINT.IfChange
    // LINT.IfChange
    public boolean containsTestConfigurations() {
    public boolean requiresTestOrInternalPermission() {
        if (mIsForLegacyFingerprintManager
        if (mIsForLegacyFingerprintManager
                && mAllowedSensorIds.size() == 1
                && mAllowedSensorIds.size() == 1
                && !mAllowBackgroundAuthentication) {
                && !mAllowBackgroundAuthentication) {
@@ -148,11 +153,15 @@ public class PromptInfo implements Parcelable {
            return true;
            return true;
        } else if (mIgnoreEnrollmentState) {
        } else if (mIgnoreEnrollmentState) {
            return true;
            return true;
        } else if (mShowEmergencyCallButton) {
            return true;
        } else if (mComponentNameForConfirmDeviceCredentialActivity != null) {
            return true;
        }
        }
        return false;
        return false;
    }
    }


    public boolean containsPrivateApiConfigurations() {
    public boolean requiresInternalPermission() {
        if (mDisallowBiometricsIfPolicyExists) {
        if (mDisallowBiometricsIfPolicyExists) {
            return true;
            return true;
        } else if (mUseDefaultTitle) {
        } else if (mUseDefaultTitle) {
@@ -177,7 +186,7 @@ public class PromptInfo implements Parcelable {
     * Currently, logo res, logo bitmap, logo description, PromptContentViewWithMoreOptions needs
     * Currently, logo res, logo bitmap, logo description, PromptContentViewWithMoreOptions needs
     * this permission.
     * this permission.
     */
     */
    public boolean containsAdvancedApiConfigurations() {
    public boolean requiresAdvancedPermission() {
        if (mLogoRes != -1) {
        if (mLogoRes != -1) {
            return true;
            return true;
        } else if (mLogoBitmap != null) {
        } else if (mLogoBitmap != null) {
@@ -305,6 +314,12 @@ public class PromptInfo implements Parcelable {
        mShowEmergencyCallButton = showEmergencyCallButton;
        mShowEmergencyCallButton = showEmergencyCallButton;
    }
    }


    public void setComponentNameForConfirmDeviceCredentialActivity(
            ComponentName componentNameForConfirmDeviceCredentialActivity) {
        mComponentNameForConfirmDeviceCredentialActivity =
                componentNameForConfirmDeviceCredentialActivity;
    }

    public void setUseParentProfileForDeviceCredential(
    public void setUseParentProfileForDeviceCredential(
            boolean useParentProfileForDeviceCredential) {
            boolean useParentProfileForDeviceCredential) {
        mUseParentProfileForDeviceCredential = useParentProfileForDeviceCredential;
        mUseParentProfileForDeviceCredential = useParentProfileForDeviceCredential;
@@ -417,6 +432,10 @@ public class PromptInfo implements Parcelable {
        return mShowEmergencyCallButton;
        return mShowEmergencyCallButton;
    }
    }


    public ComponentName getComponentNameForConfirmDeviceCredentialActivity() {
        return mComponentNameForConfirmDeviceCredentialActivity;
    }

    private void checkOnlyOneLogoSet() {
    private void checkOnlyOneLogoSet() {
        if (mLogoRes != -1 && mLogoBitmap != null) {
        if (mLogoRes != -1 && mLogoBitmap != null) {
            throw new IllegalStateException(
            throw new IllegalStateException(
+2 −0
Original line number Original line Diff line number Diff line
@@ -384,6 +384,8 @@


    <!-- Content description for the app logo icon on biometric prompt. [CHAR LIMIT=NONE] -->
    <!-- Content description for the app logo icon on biometric prompt. [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_logo">App logo</string>
    <string name="biometric_dialog_logo">App logo</string>
    <!-- List of packages for which we want to show overridden logo. For example, an app overrides its launcher logo, if it's in this array, biometric dialog shows the overridden logo; otherwise biometric dialog still shows the default application info icon. [CHAR LIMIT=NONE] -->
    <string-array name="biometric_dialog_package_names_for_logo_with_overrides" />
    <!-- Message shown when a biometric is authenticated, asking the user to confirm authentication [CHAR LIMIT=30] -->
    <!-- Message shown when a biometric is authenticated, asking the user to confirm authentication [CHAR LIMIT=30] -->
    <string name="biometric_dialog_confirm">Confirm</string>
    <string name="biometric_dialog_confirm">Confirm</string>
    <!-- Button name on BiometricPrompt shown when a biometric is detected but not authenticated. Tapping the button resumes authentication [CHAR LIMIT=30] -->
    <!-- Button name on BiometricPrompt shown when a biometric is detected but not authenticated. Tapping the button resumes authentication [CHAR LIMIT=30] -->
+2 −0
Original line number Original line Diff line number Diff line
@@ -1249,6 +1249,8 @@ public class AuthController implements
        }
        }
        mCurrentDialog = newDialog;
        mCurrentDialog = newDialog;


        // TODO(b/339532378): We should check whether |allowBackgroundAuthentication| should be
        //  removed.
        if (!promptInfo.isAllowBackgroundAuthentication() && !isOwnerInForeground()) {
        if (!promptInfo.isAllowBackgroundAuthentication() && !isOwnerInForeground()) {
            cancelIfOwnerIsNotInForeground();
            cancelIfOwnerIsNotInForeground();
        } else {
        } else {
+5 −0
Original line number Original line Diff line number Diff line
@@ -16,8 +16,10 @@


package com.android.systemui.biometrics.dagger
package com.android.systemui.biometrics.dagger


import android.content.Context
import android.content.res.Resources
import android.content.res.Resources
import com.android.internal.R
import com.android.internal.R
import com.android.launcher3.icons.IconProvider
import com.android.systemui.CoreStartable
import com.android.systemui.CoreStartable
import com.android.systemui.biometrics.AuthController
import com.android.systemui.biometrics.AuthController
import com.android.systemui.biometrics.EllipseOverlapDetectorParams
import com.android.systemui.biometrics.EllipseOverlapDetectorParams
@@ -110,6 +112,9 @@ interface BiometricsModule {


        @Provides fun providesUdfpsUtils(): UdfpsUtils = UdfpsUtils()
        @Provides fun providesUdfpsUtils(): UdfpsUtils = UdfpsUtils()


        @Provides
        fun provideIconProvider(context: Context): IconProvider = IconProvider(context)

        @Provides
        @Provides
        @SysUISingleton
        @SysUISingleton
        fun providesOverlapDetector(): OverlapDetector {
        fun providesOverlapDetector(): OverlapDetector {
Loading