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

Commit 5372c42f authored by Edgar Wang's avatar Edgar Wang Committed by Android (Google) Code Review
Browse files

Merge "Update Regulatory Label page dialog" into main

parents f2267851 1af874aa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4274,7 +4274,7 @@
        <!-- Show regulatory info (from settings item or dialing "*#07#") -->
        <activity
            android:name="RegulatoryInfoDisplayActivity"
            android:theme="@style/Theme.AlertDialog"
            android:theme="@style/Transparent"
            android:label="@string/regulatory_labels"
            android:exported="true"
            android:enabled="@bool/config_show_regulatory_info">
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,13 @@

<resources
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">

    <style name="Transparent.Expressive">
        <item name="alertDialogTheme">@style/Theme.AlertDialog.SettingsLib.Expressive</item>
        <!-- For AlertDialog -->
        <item name="android:alertDialogTheme">@style/Theme.AlertDialog.SettingsLib.Expressive</item>
    </style>

    <style name="Theme.Settings.Expressive" parent="Theme.SettingsBase.Expressive">
        <item name="android:clipToPadding">false</item>
        <item name="android:clipChildren">false</item>
@@ -48,6 +55,8 @@

        <!-- For AndroidX AlertDialog -->
        <item name="alertDialogTheme">@style/Theme.AlertDialog.SettingsLib.Expressive</item>
        <!-- For AlertDialog -->
        <item name="android:alertDialogTheme">@style/Theme.AlertDialog.SettingsLib.Expressive</item>

        <item name="*android:lockPatternStyle">@style/LockPatternStyle</item>

+16 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings

import android.app.Activity
import android.content.res.Resources
import android.os.Bundle
import android.view.Gravity
import android.widget.ImageView
@@ -24,6 +25,7 @@ import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import com.android.settings.deviceinfo.regulatory.RegulatoryInfo.getRegulatoryInfo
import com.android.settings.overlay.FeatureFactory.Companion.featureFactory
import com.android.settingslib.widget.SettingsThemeHelper.isExpressiveTheme

/**
 * [Activity] that displays regulatory information for the "Regulatory information"
@@ -40,6 +42,11 @@ class RegulatoryInfoDisplayActivity : Activity() {
    /** Display the regulatory info graphic in a dialog window. */
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val resId = if (isExpressiveTheme(this))
            R.style.Transparent_Expressive
        else
            R.style.Transparent
        setTheme(resId)
        val builder = AlertDialog.Builder(this)
            .setTitle(R.string.regulatory_labels)
            .setOnDismissListener { finish() }  // close the activity
@@ -71,4 +78,13 @@ class RegulatoryInfoDisplayActivity : Activity() {
        if (regulatoryInfoText.isNotBlank()) return regulatoryInfoText
        return featureFactory.hardwareInfoFeatureProvider?.countryOfOriginLabel
    }

    /** Returns the current theme and checks if needing to apply expressive theme. */
    override fun getTheme(): Resources.Theme? {
        val theme = super.getTheme()
        if (isExpressiveTheme(this)) {
            theme.applyStyle(R.style.Transparent_Expressive, true)
        }
        return theme
    }
}