Workaround for Recent app icon disappear

- Use the ic_home_xxxx.xml to replace the original icon.

Bug: 157623047
Test: manual review
Change-Id: I7a78ba47a0383a5e4c65bd461a15a8425beb1acb
This commit is contained in:
Sunny Shao
2020-06-15 23:00:26 +08:00
parent 2cb875aefc
commit b4a5f16b2f
6 changed files with 143 additions and 7 deletions

View File

@@ -226,7 +226,7 @@
android:name=".Settings$ConnectedDeviceDashboardActivity" android:name=".Settings$ConnectedDeviceDashboardActivity"
android:label="@string/connected_devices_dashboard_title" android:label="@string/connected_devices_dashboard_title"
android:exported="true" android:exported="true"
android:icon="@drawable/ic_devices_other"> android:icon="@drawable/ic_homepage_connected_device">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.settings.BLUETOOTH_SETTINGS" /> <action android:name="android.settings.BLUETOOTH_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@@ -261,7 +261,7 @@
<activity <activity
android:name="Settings$WifiSettingsActivity" android:name="Settings$WifiSettingsActivity"
android:label="@string/wifi_settings" android:label="@string/wifi_settings"
android:icon="@drawable/ic_settings_wireless" android:icon="@drawable/ic_homepage_network"
android:exported="true" android:exported="true"
android:configChanges="orientation|keyboardHidden|screenSize"> android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
@@ -494,7 +494,7 @@
android:name="Settings$TetherSettingsActivity" android:name="Settings$TetherSettingsActivity"
android:label="@string/tether_settings_title_all" android:label="@string/tether_settings_title_all"
android:exported="true" android:exported="true"
android:icon="@drawable/ic_settings_wireless"> android:icon="@drawable/ic_homepage_network">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.TETHER_SETTINGS" /> <action android:name="android.settings.TETHER_SETTINGS" />
@@ -754,7 +754,7 @@
<activity <activity
android:name="Settings$ZenModeSettingsActivity" android:name="Settings$ZenModeSettingsActivity"
android:label="@string/zen_mode_settings_title" android:label="@string/zen_mode_settings_title"
android:icon="@drawable/ic_notifications" android:icon="@drawable/ic_homepage_notification"
android:exported="true"> android:exported="true">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.settings.ZEN_MODE_SETTINGS" /> <action android:name="android.settings.ZEN_MODE_SETTINGS" />
@@ -930,7 +930,7 @@
android:label="@string/night_display_title" android:label="@string/night_display_title"
android:enabled="@*android:bool/config_nightDisplayAvailable" android:enabled="@*android:bool/config_nightDisplayAvailable"
android:exported="true" android:exported="true"
android:icon="@drawable/ic_settings_night_display"> android:icon="@drawable/ic_homepage_night_display">
<intent-filter android:priority="32"> <intent-filter android:priority="32">
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="com.android.settings.SHORTCUT" /> <category android:name="com.android.settings.SHORTCUT" />
@@ -1263,7 +1263,7 @@
<activity <activity
android:name="Settings$LocationSettingsActivity" android:name="Settings$LocationSettingsActivity"
android:label="@string/location_settings_title" android:label="@string/location_settings_title"
android:icon="@drawable/ic_settings_location" android:icon="@drawable/ic_homepage_location"
android:exported="true" android:exported="true"
android:configChanges="orientation|keyboardHidden|screenSize"> android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
@@ -2263,7 +2263,7 @@
android:name="Settings$PowerUsageSummaryActivity" android:name="Settings$PowerUsageSummaryActivity"
android:label="@string/power_usage_summary_title" android:label="@string/power_usage_summary_title"
android:exported="true" android:exported="true"
android:icon="@drawable/ic_settings_battery"> android:icon="@drawable/ic_homepage_battery">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.intent.action.POWER_USAGE_SUMMARY" /> <action android:name="android.intent.action.POWER_USAGE_SUMMARY" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />

View File

@@ -2449,6 +2449,38 @@
column="13"/> column="13"/>
</issue> </issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color=&quot;@color/homepage_generic_icon_background&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/drawable/ic_homepage_night_display.xml"
line="24"
column="13"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color=&quot;@color/homepage_generic_icon_background&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/drawable/ic_homepage_notification.xml"
line="24"
column="13"/>
</issue>
<issue <issue
id="HardCodedColor" id="HardCodedColor"
severity="Error" severity="Error"

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/dashboard_tile_image_size"
android:height="@dimen/dashboard_tile_image_size"
android:color="@color/homepage_generic_icon_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/dashboard_tile_foreground_image_inset"
android:top="@dimen/dashboard_tile_foreground_image_inset"
android:drawable="@drawable/ic_settings_night_display_white" />
</layer-list>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/dashboard_tile_image_size"
android:height="@dimen/dashboard_tile_image_size"
android:color="@color/homepage_generic_icon_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/dashboard_tile_foreground_image_inset"
android:top="@dimen/dashboard_tile_foreground_image_inset"
android:drawable="@drawable/ic_notifications_white" />
</layer-list>

View File

@@ -0,0 +1,19 @@
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<com.android.settings.widget.TintDrawable
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_notifications"
android:tint="?android:attr/colorPrimary" />

View File

@@ -0,0 +1,19 @@
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<com.android.settings.widget.TintDrawable
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_settings_night_display"
android:tint="?android:attr/colorPrimary" />