Fix incorrect dock defender banner icon.
Screenshots:
https://screenshot.googleplex.com/32YV7V6A6wxBPxc.png
https://screenshot.googleplex.com/77iMZ8CeuE5W8wE.png
Bug: 261156455
Test: Unit tests passed and manual test on the device
Merged-In: I084c9cd52a408efa3b9aeee96a0af0cae481ec79
Change-Id: I084c9cd52a408efa3b9aeee96a0af0cae481ec79
Signed-off-by: Zhenwei Chen <zhenwec@google.com>
(cherry picked from commit 52323128dc
)
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (C) 2022 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<vector
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:name="vector"
|
|
||||||
android:width="16dp"
|
|
||||||
android:height="16dp"
|
|
||||||
android:viewportWidth="16"
|
|
||||||
android:viewportHeight="16">
|
|
||||||
<path
|
|
||||||
android:name="path_1"
|
|
||||||
android:pathData="M 11.739 14.409 C 11.572 14.576 11.346 14.67 11.11 14.67 L 4.89 14.67 C 4.654 14.67 4.428 14.576 4.261 14.409 C 4.094 14.242 4 14.016 4 13.78 L 4 3.55 C 4 3.316 4.092 3.091 4.257 2.924 C 4.422 2.758 4.646 2.663 4.88 2.66 L 6.33 2.66 L 6.33 1.33 L 9.66 1.33 L 9.66 2.66 L 11.11 2.66 C 11.227 2.66 11.343 2.683 11.451 2.728 C 11.559 2.773 11.657 2.838 11.739 2.921 C 11.822 3.003 11.887 3.102 11.932 3.209 C 11.977 3.317 12 3.433 12 3.55 L 12 13.78 C 12 14.016 11.906 14.242 11.739 14.409 Z M 6 9 L 8.67 4 L 8.67 7.67 L 10 7.67 L 7.33 12.67 L 7.33 9 L 6 9 Z"
|
|
||||||
android:fillColor="#ffffff"
|
|
||||||
android:strokeWidth="1"
|
|
||||||
android:fillType="evenOdd"/>
|
|
||||||
</vector>
|
|
30
res/drawable/ic_battery_dock_defender_untriggered_24dp.xml
Normal file
30
res/drawable/ic_battery_dock_defender_untriggered_24dp.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2022 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:name="vector"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:name="path"
|
||||||
|
android:pathData="M 18 20.673 C 18 21.027 17.859 21.367 17.609 21.617 C 17.359 21.867 17.019 22.008 16.665 22.008 L 7.335 22.008 C 6.981 22.008 6.641 21.867 6.391 21.617 C 6.141 21.367 6 21.027 6 20.673 L 6 5.328 C 6 4.977 6.139 4.639 6.386 4.389 C 6.633 4.139 6.969 3.997 7.32 3.993 L 9.495 3.993 L 9.495 1.998 L 14.49 1.998 L 14.49 3.993 L 16.665 3.993 C 16.84 3.993 17.014 4.028 17.176 4.095 C 17.338 4.162 17.485 4.26 17.609 4.384 C 17.733 4.508 17.831 4.655 17.898 4.817 C 17.965 4.979 18 5.153 18 5.328 L 18 20.673 Z M 9 13.503 L 13.005 6.003 L 13.005 11.508 L 15 11.508 L 10.995 19.008 L 10.995 13.503 L 9 13.503 Z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:fillColor="?android:attr/colorAccent"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
</vector>
|
@@ -17,14 +17,18 @@
|
|||||||
<vector
|
<vector
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:name="vector"
|
android:name="vector"
|
||||||
android:width="16dp"
|
android:width="24dp"
|
||||||
android:height="16dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="16"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="16">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:name="path"
|
android:name="path"
|
||||||
android:pathData="M 11.739 14.409 C 11.572 14.576 11.346 14.67 11.11 14.67 L 4.89 14.67 C 4.654 14.67 4.428 14.576 4.261 14.409 C 4.094 14.242 4 14.016 4 13.78 L 4 3.55 C 4 3.316 4.092 3.091 4.257 2.924 C 4.422 2.758 4.646 2.663 4.88 2.66 L 6.33 2.66 L 6.33 1.33 L 9.66 1.33 L 9.66 2.66 L 11.11 2.66 C 11.227 2.66 11.343 2.683 11.451 2.728 C 11.559 2.773 11.657 2.838 11.739 2.921 C 11.822 3.003 11.887 3.102 11.932 3.209 C 11.977 3.317 12 3.433 12 3.55 L 12 13.78 C 12 14.016 11.906 14.242 11.739 14.409 Z M 6 9 L 8.67 4 L 8.67 7.67 L 10 7.67 L 7.33 12.67 L 7.33 9 L 6 9 Z"
|
android:pathData="M 12 11.493 L 18 9.243 L 18 5.328 C 18 4.593 17.4 3.993 16.665 3.993 L 14.49 3.993 L 14.49 1.998 L 9.495 1.998 L 9.495 3.993 L 7.32 3.993 C 6.585 3.993 5.985 4.593 5.985 5.328 L 5.985 20.673 C 5.985 21.408 6.585 22.008 7.32 22.008 L 13.365 22.008 C 12.495 20.583 12 18.918 12 17.193 L 12 11.493 Z M 7.995 6.003 L 15.99 6.003 L 15.99 9.003 L 7.995 9.003 L 7.995 6.003 Z"
|
||||||
android:fillColor="#000000"
|
android:fillColor="?android:attr/colorAccent"
|
||||||
android:strokeWidth="1"
|
android:strokeWidth="1"/>
|
||||||
android:fillType="evenOdd"/>
|
<path
|
||||||
|
android:name="path_2"
|
||||||
|
android:pathData="M 19.005 10.998 L 14.01 12.873 L 14.01 17.178 C 14.01 20.328 16.14 23.283 19.005 24.003 C 21.87 23.283 24 20.343 24 17.178 L 24 12.873 L 19.005 10.998 Z"
|
||||||
|
android:fillColor="?android:attr/colorAccent"
|
||||||
|
android:strokeWidth="1"/>
|
||||||
</vector>
|
</vector>
|
@@ -90,7 +90,8 @@ public class DockDefenderTip extends BatteryTip {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIconId() {
|
public int getIconId() {
|
||||||
return R.drawable.ic_battery_status_protected_24dp;
|
return mMode == DockDefenderMode.ACTIVE ? R.drawable.ic_battery_status_protected_24dp :
|
||||||
|
R.drawable.ic_battery_dock_defender_untriggered_24dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -109,11 +109,21 @@ public class DockDefenderTipTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetIconId() {
|
public void testGetIconId_dockDefenderActive_getProtectedIcon() {
|
||||||
assertThat(mDockDefenderTipFutureBypass.getIconId()).isEqualTo(
|
assertThat(mDockDefenderTipActive.getIconId()).isEqualTo(
|
||||||
R.drawable.ic_battery_status_protected_24dp);
|
R.drawable.ic_battery_status_protected_24dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetIconId_dockDefenderNotActive_getUntriggeredIcon() {
|
||||||
|
assertThat(mDockDefenderTipFutureBypass.getIconId()).isEqualTo(
|
||||||
|
R.drawable.ic_battery_dock_defender_untriggered_24dp);
|
||||||
|
assertThat(mDockDefenderTipTemporarilyBypassed.getIconId()).isEqualTo(
|
||||||
|
R.drawable.ic_battery_dock_defender_untriggered_24dp);
|
||||||
|
assertThat(mDockDefenderTipDisabled.getIconId()).isEqualTo(
|
||||||
|
R.drawable.ic_battery_dock_defender_untriggered_24dp);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateState() {
|
public void testUpdateState() {
|
||||||
mDockDefenderTipTemporarilyBypassed.updateState(mDockDefenderTipDisabled);
|
mDockDefenderTipTemporarilyBypassed.updateState(mDockDefenderTipDisabled);
|
||||||
|
Reference in New Issue
Block a user