Make system Dialog Activities theme friendly and support dark theme

Change themes of the Dialog based activities to the newly created
internal theme Theme.Dialog.Confirmation in order to add abbility
to override theme in different configurations (television in this
case).

Overriding of Theme.DeviceDefault.Light.Dialog.Alert for TV
(values-television) would work but it will break the existing behavior
of the Light theme on TV. It is changing semantics of public API
Theme.DeviceDefault.Light. It will potentially break app that is using
light theme and override foreground/text color based on assumption it's
using light theme.

Change warning text color in HarmfulAppWarningActivity to
attr/textColorPrimary in order to support theme change (which is still
Dark color for the Light theme)

Test: manually verified SuspendedAppActivity theme on AndroidTV with
      and without change
      $ adb shell
      $ su
      # am start -n android/com.android.internal.app.SuspendedAppActivity
        --ei android.intent.extra.USER_ID 0 --es
	SuspendedAppActivity.extra.SUSPENDED_PACKAGE com.android.tv.settings
	--es SuspendedAppActivity.extra.DIALOG_MESSAGE "Test Message"
Bug: 112831365

Change-Id: I31b29e2b3ae7b0ff09e50f75e3288859c1799c4b
This commit is contained in:
Oleksandr Tolstykh
2018-08-20 17:58:48 +02:00
parent 6b0f8ab157
commit 1e5720eac4
5 changed files with 15 additions and 8 deletions

View File

@@ -4299,7 +4299,7 @@
</activity>
<activity android:name="com.android.internal.app.NetInitiatedActivity"
android:theme="@style/Theme.DeviceDefault.Light.Dialog.Alert"
android:theme="@style/Theme.Dialog.Confirmation"
android:excludeFromRecents="true"
android:process=":ui">
</activity>
@@ -4320,7 +4320,7 @@
<activity android:name="com.android.internal.app.ConfirmUserCreationActivity"
android:excludeFromRecents="true"
android:process=":ui"
android:theme="@style/Theme.DeviceDefault.Light.Dialog.Alert">
android:theme="@style/Theme.Dialog.Confirmation">
<intent-filter android:priority="1000">
<action android:name="android.os.action.CREATE_USER" />
<category android:name="android.intent.category.DEFAULT" />
@@ -4328,24 +4328,24 @@
</activity>
<activity android:name="com.android.internal.app.SuspendedAppActivity"
android:theme="@style/Theme.DeviceDefault.Light.Dialog.Alert"
android:theme="@style/Theme.Dialog.Confirmation"
android:excludeFromRecents="true"
android:process=":ui">
</activity>
<activity android:name="com.android.internal.app.UnlaunchableAppActivity"
android:theme="@style/Theme.DeviceDefault.Light.Dialog.Alert"
android:theme="@style/Theme.Dialog.Confirmation"
android:excludeFromRecents="true"
android:process=":ui">
</activity>
<activity android:name="com.android.settings.notification.NotificationAccessConfirmationActivity"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert"
android:theme="@style/Theme.Dialog.Confirmation"
android:excludeFromRecents="true">
</activity>
<activity android:name="com.android.internal.app.HarmfulAppWarningActivity"
android:theme="@style/Theme.DeviceDefault.Light.Dialog.Alert"
android:theme="@style/Theme.Dialog.Confirmation"
android:excludeFromRecents="true"
android:process=":ui"
android:label="@string/harmful_app_warning_title"

View File

@@ -49,7 +49,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textColor="@color/primary_text_material_light"
android:textColor="?attr/textColorPrimary"
android:textSize="@dimen/text_size_subhead_material"
android:paddingLeft="@dimen/harmful_app_icon_name_padding">
</TextView>
@@ -65,4 +65,4 @@
android:lineSpacingMultiplier="@dimen/harmful_app_message_line_spacing_modifier"
android:textSize="@dimen/text_size_body_1_material"/>
</LinearLayout>
</ScrollView>
</ScrollView>

View File

@@ -15,6 +15,7 @@
-->
<resources>
<style name="Theme.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" />
<style name="Theme.Dialog.Confirmation" parent="Theme.Leanback.Dialog.Confirmation" />
<style name="Theme.Holo.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" />
<style name="Theme.Holo.Light.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" />
<style name="Theme.Material.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" />

View File

@@ -880,6 +880,9 @@ please see themes_device_defaults.xml.
<item name="windowActivityTransitions">false</item>
</style>
<!-- @hide Special theme for the default system Activity-based Alert dialogs. -->
<style name="Theme.Dialog.Confirmation" parent="Theme.DeviceDefault.Light.Dialog.Alert" />
<!-- Theme for a window that looks like a toast. -->
<style name="Theme.Toast" parent="Theme.DeviceDefault.Dialog">
<item name="windowBackground">?attr/toastFrameBackground</item>

View File

@@ -130,4 +130,7 @@
<item name="toolbarStyle">@style/Widget.DeviceDefault.Toolbar</item>
</style>
<!-- @hide Special theme for the default system Activity-based Alert dialogs. -->
<style name="Theme.Leanback.Dialog.Confirmation" parent="Theme.DeviceDefault.Dialog.Alert" />
</resources>