diff options
author | Andrew Flynn <flynn@google.com> | 2015-04-14 23:33:45 -0400 |
---|---|---|
committer | Andrew Flynn <flynn@google.com> | 2015-04-16 08:37:43 -0400 |
commit | a478d70a68696380acbd4a9739dfaaebff61c728 (patch) | |
tree | 554951a175ddac6d684111d9d0ea65c5d850c504 /packages | |
parent | 5925a910f9a5844e24b086e6da93c66631ef55f2 (diff) | |
download | frameworks_base-a478d70a68696380acbd4a9739dfaaebff61c728.zip frameworks_base-a478d70a68696380acbd4a9739dfaaebff61c728.tar.gz frameworks_base-a478d70a68696380acbd4a9739dfaaebff61c728.tar.bz2 |
SysUI: Carrier Network Change icon
- Listen for new PhoneStateListener.CARRIER_NETWORK_CHANGE events.
- Show/hide a new unique animated icon in status bar and quick settings during
Carrier Network Change events if we are instructed by PhoneStateListener
and it's during a period without connectivity.
- ObjectAnimator doesn't let you animate colors between themed colors, so
there's quite a bit of boilerplate duplication in the animation xml.
- Add a new demo mode command to toggle it on/off.
Change-Id: Ic5bb2aa7444303c6b7f2456526a9c25325c6e1f4
Diffstat (limited to 'packages')
24 files changed, 699 insertions, 23 deletions
diff --git a/packages/SystemUI/res/anim/ic_qs_signal_blink_1.xml b/packages/SystemUI/res/anim/ic_qs_signal_blink_1.xml new file mode 100644 index 0000000..57b61da --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_signal_blink_1.xml @@ -0,0 +1,38 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="#FFFFFFFF"/> + <keyframe + android:fraction="0.32" + android:value="#FFFFFFFF"/> + <keyframe + android:fraction="0.33" + android:value="#4DFFFFFF"/> + <keyframe + android:fraction="1.0" + android:value="#4DFFFFFF"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_qs_signal_blink_2.xml b/packages/SystemUI/res/anim/ic_qs_signal_blink_2.xml new file mode 100644 index 0000000..09694c3 --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_signal_blink_2.xml @@ -0,0 +1,44 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="#4DFFFFFF"/> + <keyframe + android:fraction="0.32" + android:value="#4DFFFFFF"/> + <keyframe + android:fraction="0.33" + android:value="#FFFFFFFF"/> + <keyframe + android:fraction="0.66" + android:value="#FFFFFFFF"/> + <keyframe + android:fraction="0.67" + android:value="#4DFFFFFF"/> + <keyframe + android:fraction="1.0" + android:value="#4DFFFFFF"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_qs_signal_blink_3.xml b/packages/SystemUI/res/anim/ic_qs_signal_blink_3.xml new file mode 100644 index 0000000..2270e3f --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_signal_blink_3.xml @@ -0,0 +1,38 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="#4DFFFFFF"/> + <keyframe + android:fraction="0.66" + android:value="#4DFFFFFF"/> + <keyframe + android:fraction="0.67" + android:value="#FFFFFFFF"/> + <keyframe + android:fraction="1.0" + android:value="#FFFFFFFF"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_blink_1.xml b/packages/SystemUI/res/anim/ic_signal_blink_1.xml new file mode 100644 index 0000000..ab1905a --- /dev/null +++ b/packages/SystemUI/res/anim/ic_signal_blink_1.xml @@ -0,0 +1,38 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="@color/light_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.32" + android:value="@color/light_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.33" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="1.0" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_blink_2.xml b/packages/SystemUI/res/anim/ic_signal_blink_2.xml new file mode 100644 index 0000000..1b7ace2 --- /dev/null +++ b/packages/SystemUI/res/anim/ic_signal_blink_2.xml @@ -0,0 +1,44 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.32" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.33" + android:value="@color/light_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.66" + android:value="@color/light_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.67" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="1.0" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_blink_3.xml b/packages/SystemUI/res/anim/ic_signal_blink_3.xml new file mode 100644 index 0000000..cee831c --- /dev/null +++ b/packages/SystemUI/res/anim/ic_signal_blink_3.xml @@ -0,0 +1,38 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.66" + android:value="@color/light_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.67" + android:value="@color/light_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="1.0" + android:value="@color/light_mode_icon_color_dual_tone_fill"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml new file mode 100644 index 0000000..9d398fa --- /dev/null +++ b/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml @@ -0,0 +1,38 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="@color/dark_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.32" + android:value="@color/dark_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.33" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="1.0" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml new file mode 100644 index 0000000..c6e213d --- /dev/null +++ b/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml @@ -0,0 +1,44 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.32" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.33" + android:value="@color/dark_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.66" + android:value="@color/dark_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="0.67" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="1.0" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml new file mode 100644 index 0000000..dce148c --- /dev/null +++ b/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml @@ -0,0 +1,38 @@ +<!-- + Copyright (C) 2015 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. +--> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/linear_interpolator" + android:duration="@integer/carrier_network_change_anim_time" + android:repeatCount="-1"> + + <propertyValuesHolder + android:propertyName="fillColor" + android:valueType="colorType"> + <keyframe + android:fraction="0.0" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.66" + android:value="@color/dark_mode_icon_color_dual_tone_background"/> + <keyframe + android:fraction="0.67" + android:value="@color/dark_mode_icon_color_dual_tone_fill"/> + <keyframe + android:fraction="1.0" + android:value="@color/dark_mode_icon_color_dual_tone_fill"/> + </propertyValuesHolder> + +</objectAnimator> diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_carrier_network_change.xml b/packages/SystemUI/res/drawable/ic_qs_signal_carrier_network_change.xml new file mode 100644 index 0000000..96e2fd4 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_signal_carrier_network_change.xml @@ -0,0 +1,36 @@ +<!-- + Copyright (C) 2015 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:width="32dp" + android:height="32dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:name="dot1" + android:fillColor="#FFFFFFFF" + android:pathData="M9.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/> + <path + android:name="dot2" + android:fillColor="#4DFFFFFF" + android:pathData="M14.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/> + <path + android:name="dot3" + android:fillColor="#4DFFFFFF" + android:pathData="M19.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/> + <path + android:fillColor="#4DFFFFFF" + android:pathData="M2.0,22.0l6.0,0.0 0.0,-4.0 14.0,0.0 0.0,-16.0z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_carrier_network_change_animation.xml b/packages/SystemUI/res/drawable/ic_qs_signal_carrier_network_change_animation.xml new file mode 100644 index 0000000..2186aa8 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_signal_carrier_network_change_animation.xml @@ -0,0 +1,27 @@ +<!-- + Copyright (C) 2015 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. +--> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_qs_signal_carrier_network_change" > + <target + android:name="dot1" + android:animation="@anim/ic_qs_signal_blink_1"/> + <target + android:name="dot2" + android:animation="@anim/ic_qs_signal_blink_2"/> + <target + android:name="dot3" + android:animation="@anim/ic_qs_signal_blink_3"/> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/stat_sys_signal_carrier_network_change.xml b/packages/SystemUI/res/drawable/stat_sys_signal_carrier_network_change.xml new file mode 100644 index 0000000..f69ffe4 --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_signal_carrier_network_change.xml @@ -0,0 +1,36 @@ +<!-- + Copyright (C) 2015 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:width="17dp" + android:height="17dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:name="dot1" + android:fillColor="?attr/fillColor" + android:pathData="M9.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/> + <path + android:name="dot2" + android:fillColor="?attr/backgroundColor" + android:pathData="M14.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/> + <path + android:name="dot3" + android:fillColor="?attr/backgroundColor" + android:pathData="M19.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/> + <path + android:fillColor="?attr/backgroundColor" + android:pathData="M2.0,22.0l6.0,0.0 0.0,-4.0 14.0,0.0 0.0,-16.0z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/stat_sys_signal_carrier_network_change_animation.xml b/packages/SystemUI/res/drawable/stat_sys_signal_carrier_network_change_animation.xml new file mode 100644 index 0000000..275f037 --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_signal_carrier_network_change_animation.xml @@ -0,0 +1,27 @@ +<!-- + Copyright (C) 2015 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. +--> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/stat_sys_signal_carrier_network_change" > + <target + android:name="dot1" + android:animation="@anim/ic_signal_blink_1"/> + <target + android:name="dot2" + android:animation="@anim/ic_signal_blink_2"/> + <target + android:name="dot3" + android:animation="@anim/ic_signal_blink_3"/> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml b/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml new file mode 100644 index 0000000..ff49d4c --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml @@ -0,0 +1,27 @@ +<!-- + Copyright (C) 2015 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. +--> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/stat_sys_signal_carrier_network_change" > + <target + android:name="dot1" + android:animation="@anim/ic_signal_dark_blink_1"/> + <target + android:name="dot2" + android:animation="@anim/ic_signal_dark_blink_2"/> + <target + android:name="dot3" + android:animation="@anim/ic_signal_dark_blink_3"/> +</animated-vector> diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 051d233..88bf58a 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -293,5 +293,8 @@ <!-- Enable the default volume dialog --> <bool name="enable_volume_ui">true</bool> + + <!-- Duration of the full carrier network change icon animation. --> + <integer name="carrier_network_change_anim_time">3000</integer> </resources> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 6c8f154..67a0bc6 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -359,6 +359,9 @@ <!-- Content description of the airplane mode icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_airplane_mode">Airplane mode.</string> + <!-- Content description of the carrier network changing icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_carrier_network_change_mode">Carrier network changing.</string> + <!-- Content description of the battery level icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_battery_level">Battery <xliff:g id="number">%d</xliff:g> percent.</string> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index 1790a4e..5a84db5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -18,6 +18,7 @@ package com.android.systemui.qs; import android.content.Context; import android.content.Intent; +import android.graphics.drawable.Animatable; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; @@ -325,7 +326,7 @@ public abstract class QSTile<TState extends State> implements Listenable { public static class ResourceIcon extends Icon { private static final SparseArray<Icon> ICONS = new SparseArray<Icon>(); - private final int mResId; + protected final int mResId; private ResourceIcon(int resId) { mResId = resId; @@ -342,7 +343,11 @@ public abstract class QSTile<TState extends State> implements Listenable { @Override public Drawable getDrawable(Context context) { - return context.getDrawable(mResId); + Drawable d = context.getDrawable(mResId); + if (d instanceof Animatable) { + ((Animatable) d).start(); + } + return d; } @Override @@ -370,7 +375,7 @@ public abstract class QSTile<TState extends State> implements Listenable { @Override public Drawable getDrawable(Context context) { // workaround: get a clean state for every new AVD - final AnimatedVectorDrawable d = (AnimatedVectorDrawable) super.getDrawable(context) + final AnimatedVectorDrawable d = (AnimatedVectorDrawable) context.getDrawable(mResId) .getConstantState().newDrawable(); d.start(); if (mAllowAnimation) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index ec83ca7..af9d3a5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -38,6 +38,7 @@ import android.widget.TextView; import com.android.systemui.FontSizeUtils; import com.android.systemui.R; +import com.android.systemui.qs.QSTile.AnimationIcon; import com.android.systemui.qs.QSTile.State; import java.util.Objects; @@ -315,8 +316,9 @@ public class QSTileView extends ViewGroup { iv.setImageDrawable(d); iv.setTag(R.id.qs_icon_tag, state.icon); if (d instanceof Animatable) { - if (!iv.isShown()) { - ((Animatable) d).stop(); // skip directly to end state + Animatable a = (Animatable) d; + if (state.icon instanceof AnimationIcon && !iv.isShown()) { + a.stop(); // skip directly to end state } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index a82afcf..b2bb021 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -20,6 +20,8 @@ import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Color; import android.graphics.PorterDuff; +import android.graphics.drawable.Animatable; +import android.graphics.drawable.Drawable; import android.telephony.SubscriptionInfo; import android.util.AttributeSet; import android.util.Log; @@ -165,12 +167,13 @@ public class SignalClusterView } @Override - public void setMobileDataIndicators(boolean visible, int strengthIcon, int typeIcon, - String contentDescription, String typeContentDescription, boolean isTypeIconWide, - int subId) { + public void setMobileDataIndicators(boolean visible, int strengthIcon, int darkStrengthIcon, + int typeIcon, String contentDescription, String typeContentDescription, + boolean isTypeIconWide, int subId) { PhoneState state = getOrInflateState(subId); state.mMobileVisible = visible; state.mMobileStrengthId = strengthIcon; + state.mMobileDarkStrengthId = darkStrengthIcon; state.mMobileTypeId = typeIcon; state.mMobileDescription = contentDescription; state.mMobileTypeDescription = typeContentDescription; @@ -360,7 +363,7 @@ public class SignalClusterView private class PhoneState { private final int mSubId; private boolean mMobileVisible = false; - private int mMobileStrengthId = 0, mMobileTypeId = 0; + private int mMobileStrengthId = 0, mMobileDarkStrengthId = 0, mMobileTypeId = 0; private boolean mIsMobileTypeIconWide; private String mMobileDescription, mMobileTypeDescription; @@ -384,7 +387,23 @@ public class SignalClusterView public boolean apply(boolean isSecondaryIcon) { if (mMobileVisible && !mIsAirplaneMode) { mMobile.setImageResource(mMobileStrengthId); + Drawable mobileDrawable = mMobile.getDrawable(); + if (mobileDrawable instanceof Animatable) { + Animatable ad = (Animatable) mobileDrawable; + if (!ad.isRunning()) { + ad.start(); + } + } + mMobileDark.setImageResource(mMobileStrengthId); + Drawable mobileDarkDrawable = mMobileDark.getDrawable(); + if (mobileDarkDrawable instanceof Animatable) { + Animatable ad = (Animatable) mobileDarkDrawable; + if (!ad.isRunning()) { + ad.start(); + } + } + mMobileType.setImageResource(mMobileTypeId); mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription); @@ -401,8 +420,9 @@ public class SignalClusterView mMobileDark.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0, 0, 0, 0); - if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d typ=%d", - (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileTypeId)); + if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d dark=%d typ=%d", + (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, + mMobileDarkStrengthId, mMobileTypeId)); mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index ba938cc..c3c6b12 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -114,6 +114,11 @@ public class MobileSignalController extends SignalController< setInetCondition(inetCondition); } + public void setCarrierNetworkChangeMode(boolean carrierNetworkChangeMode) { + mCurrentState.carrierNetworkChangeMode = carrierNetworkChangeMode; + notifyListenersIfNecessary(); + } + /** * Start listening for phone state changes. */ @@ -123,7 +128,8 @@ public class MobileSignalController extends SignalController< | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | PhoneStateListener.LISTEN_CALL_STATE | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE - | PhoneStateListener.LISTEN_DATA_ACTIVITY); + | PhoneStateListener.LISTEN_DATA_ACTIVITY + | PhoneStateListener.LISTEN_CARRIER_NETWORK_CHANGE); } /** @@ -201,8 +207,12 @@ public class MobileSignalController extends SignalController< && !mCurrentState.isEmergency, getQsCurrentIconId(), contentDescription, qsTypeIcon, - mCurrentState.dataConnected && mCurrentState.activityIn, - mCurrentState.dataConnected && mCurrentState.activityOut, + mCurrentState.dataConnected + && !mCurrentState.carrierNetworkChangeMode + && mCurrentState.activityIn, + mCurrentState.dataConnected + && !mCurrentState.carrierNetworkChangeMode + && mCurrentState.activityOut, dataContentDescription, mCurrentState.isEmergency ? null : mCurrentState.networkName, // Only wide if actually showing something. @@ -215,6 +225,7 @@ public class MobileSignalController extends SignalController< mSignalClusters.get(i).setMobileDataIndicators( mCurrentState.enabled && !mCurrentState.airplaneMode, getCurrentIconId(), + getCurrentDarkIconId(), typeIcon, contentDescription, dataContentDescription, @@ -224,6 +235,10 @@ public class MobileSignalController extends SignalController< } } + private int getCurrentDarkIconId() { + return getCurrentIconId(false /* light */); + } + @Override protected MobileState cleanState() { return new MobileState(); @@ -270,6 +285,10 @@ public class MobileSignalController extends SignalController< } } + private boolean isCarrierNetworkChangeActive() { + return !hasService() && mCurrentState.carrierNetworkChangeMode; + } + public void handleBroadcast(Intent intent) { String action = intent.getAction(); if (action.equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) { @@ -351,7 +370,9 @@ public class MobileSignalController extends SignalController< mCurrentState.dataConnected = mCurrentState.connected && mDataState == TelephonyManager.DATA_CONNECTED; - if (isRoaming()) { + if (isCarrierNetworkChangeActive()) { + mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE; + } else if (isRoaming()) { mCurrentState.iconGroup = TelephonyIcons.ROAMING; } if (isEmergencyOnly() != mCurrentState.isEmergency) { @@ -363,6 +384,7 @@ public class MobileSignalController extends SignalController< && mServiceState.getOperatorAlphaShort() != null) { mCurrentState.networkName = mServiceState.getOperatorAlphaShort(); } + notifyListenersIfNecessary(); } @@ -428,6 +450,16 @@ public class MobileSignalController extends SignalController< } setActivity(direction); } + + @Override + public void onCarrierNetworkChange(boolean active) { + if (DEBUG) { + Log.d(mTag, "onCarrierNetworkChange: active=" + active); + } + mCurrentState.carrierNetworkChangeMode = active; + + updateTelephony(); + } }; static class MobileIconGroup extends SignalController.IconGroup { @@ -440,8 +472,17 @@ public class MobileSignalController extends SignalController< int sbNullState, int qsNullState, int sbDiscState, int qsDiscState, int discContentDesc, int dataContentDesc, int dataType, boolean isWide, int[] qsDataType) { - super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState, - qsDiscState, discContentDesc); + this(name, sbIcons, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, + sbDiscState, sbDiscState, qsDiscState, discContentDesc, dataContentDesc, + dataType, isWide, qsDataType); + } + + public MobileIconGroup(String name, int[][] sbIcons, int[][] sbDarkIcons, int[][] qsIcons, + int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, + int sbDarkDiscState, int qsDiscState, int discContentDesc, int dataContentDesc, + int dataType, boolean isWide, int[] qsDataType) { + super(name, sbIcons, sbDarkIcons, qsIcons, contentDesc, sbNullState, qsNullState, + sbDiscState, sbDarkDiscState, qsDiscState, discContentDesc); mDataContentDescription = dataContentDesc; mDataType = dataType; mIsWide = isWide; @@ -455,6 +496,7 @@ public class MobileSignalController extends SignalController< boolean dataConnected; boolean isEmergency; boolean airplaneMode; + boolean carrierNetworkChangeMode; int inetForNetwork; @Override @@ -467,6 +509,7 @@ public class MobileSignalController extends SignalController< inetForNetwork = state.inetForNetwork; isEmergency = state.isEmergency; airplaneMode = state.airplaneMode; + carrierNetworkChangeMode = state.carrierNetworkChangeMode; } @Override @@ -478,7 +521,8 @@ public class MobileSignalController extends SignalController< builder.append("dataConnected=").append(dataConnected).append(','); builder.append("inetForNetwork=").append(inetForNetwork).append(','); builder.append("isEmergency=").append(isEmergency).append(','); - builder.append("airplaneMode=").append(airplaneMode); + builder.append("airplaneMode=").append(airplaneMode).append(','); + builder.append("carrierNetworkChangeMode=").append(carrierNetworkChangeMode); } @Override @@ -489,6 +533,7 @@ public class MobileSignalController extends SignalController< && ((MobileState) o).dataConnected == dataConnected && ((MobileState) o).isEmergency == isEmergency && ((MobileState) o).airplaneMode == airplaneMode + && ((MobileState) o).carrierNetworkChangeMode == carrierNetworkChangeMode && ((MobileState) o).inetForNetwork == inetForNetwork; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index bb3eb7a..5cf6a6e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -704,6 +704,13 @@ public class NetworkControllerImpl extends BroadcastReceiver controller.getState().enabled = show; controller.notifyListeners(); } + String carrierNetworkChange = args.getString("carriernetworkchange"); + if (carrierNetworkChange != null) { + boolean show = carrierNetworkChange.equals("show"); + for (MobileSignalController controller : mMobileSignalControllers.values()) { + controller.setCarrierNetworkChangeMode(show); + } + } } } @@ -718,9 +725,9 @@ public class NetworkControllerImpl extends BroadcastReceiver public interface SignalCluster { void setWifiIndicators(boolean visible, int strengthIcon, String contentDescription); - void setMobileDataIndicators(boolean visible, int strengthIcon, int typeIcon, - String contentDescription, String typeContentDescription, boolean isTypeIconWide, - int subId); + void setMobileDataIndicators(boolean visible, int strengthIcon, int darkStrengthIcon, + int typeIcon, String contentDescription, String typeContentDescription, + boolean isTypeIconWide, int subId); void setSubs(List<SubscriptionInfo> subs); void setNoSims(boolean show); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java index 1d96c6b..c204814 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java @@ -142,8 +142,16 @@ public abstract class SignalController<T extends SignalController.State, * Gets the signal icon for SB based on current state of connected, enabled, and level. */ public int getCurrentIconId() { + return getCurrentIconId(true /* light */); + } + + protected int getCurrentIconId(boolean light) { if (mCurrentState.connected) { - return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level]; + if (light) { + return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level]; + } else { + return getIcons().mSbDarkIcons[mCurrentState.inetCondition][mCurrentState.level]; + } } else if (mCurrentState.enabled) { return getIcons().mSbDiscState; } else { @@ -226,11 +234,13 @@ public abstract class SignalController<T extends SignalController.State, */ static class IconGroup { final int[][] mSbIcons; + final int[][] mSbDarkIcons; final int[][] mQsIcons; final int[] mContentDesc; final int mSbNullState; final int mQsNullState; final int mSbDiscState; + final int mSbDarkDiscState; final int mQsDiscState; final int mDiscContentDesc; // For logging. @@ -239,13 +249,22 @@ public abstract class SignalController<T extends SignalController.State, public IconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, int qsDiscState, int discContentDesc) { + this(name, sbIcons, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, + sbDiscState, sbDiscState, qsDiscState, discContentDesc); + } + + public IconGroup(String name, int[][] sbIcons, int[][] sbDarkIcons, int[][] qsIcons, + int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, + int sbDarkDiscState, int qsDiscState, int discContentDesc) { mName = name; mSbIcons = sbIcons; + mSbDarkIcons = sbDarkIcons; mQsIcons = qsIcons; mContentDesc = contentDesc; mSbNullState = sbNullState; mQsNullState = qsNullState; mSbDiscState = sbDiscState; + mSbDarkDiscState = sbDarkDiscState; mQsDiscState = qsDiscState; mDiscContentDesc = discContentDesc; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java index d266ed8..053feb12 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java @@ -68,6 +68,42 @@ class TelephonyIcons { R.drawable.stat_sys_signal_4_fully } }; + //CarrierNetworkChange + static final int[][] TELEPHONY_CARRIER_NETWORK_CHANGE = { + { R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation }, + { R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation } + }; + + static final int[][] TELEPHONY_CARRIER_NETWORK_CHANGE_DARK = { + { R.drawable.stat_sys_signal_dark_carrier_network_change_animation, + R.drawable.stat_sys_signal_dark_carrier_network_change_animation, + R.drawable.stat_sys_signal_dark_carrier_network_change_animation, + R.drawable.stat_sys_signal_dark_carrier_network_change_animation }, + { R.drawable.stat_sys_signal_dark_carrier_network_change_animation, + R.drawable.stat_sys_signal_dark_carrier_network_change_animation, + R.drawable.stat_sys_signal_dark_carrier_network_change_animation, + R.drawable.stat_sys_signal_dark_carrier_network_change_animation } + }; + + static final int[][] QS_TELEPHONY_CARRIER_NETWORK_CHANGE = { + { R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation }, + { R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation, + R.drawable.ic_qs_signal_carrier_network_change_animation } + }; + static final int[] QS_DATA_R = { R.drawable.ic_qs_signal_r, R.drawable.ic_qs_signal_r @@ -202,11 +238,34 @@ class TelephonyIcons { static final int ICON_3G = R.drawable.stat_sys_data_fully_connected_3g; static final int ICON_4G = R.drawable.stat_sys_data_fully_connected_4g; static final int ICON_1X = R.drawable.stat_sys_data_fully_connected_1x; + static final int ICON_CARRIER_NETWORK_CHANGE = + R.drawable.stat_sys_signal_carrier_network_change_animation; + static final int ICON_CARRIER_NETWORK_CHANGE_DARK = + R.drawable.stat_sys_signal_dark_carrier_network_change_animation; static final int QS_ICON_LTE = R.drawable.ic_qs_signal_lte; static final int QS_ICON_3G = R.drawable.ic_qs_signal_3g; static final int QS_ICON_4G = R.drawable.ic_qs_signal_4g; static final int QS_ICON_1X = R.drawable.ic_qs_signal_1x; + static final int QS_ICON_CARRIER_NETWORK_CHANGE = + R.drawable.ic_qs_signal_carrier_network_change_animation; + + static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup( + "CARRIER_NETWORK_CHANGE", + TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE, + TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE_DARK, + TelephonyIcons.QS_TELEPHONY_CARRIER_NETWORK_CHANGE, + AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH, + 0, 0, + TelephonyIcons.ICON_CARRIER_NETWORK_CHANGE, + TelephonyIcons.ICON_CARRIER_NETWORK_CHANGE_DARK, + TelephonyIcons.QS_ICON_CARRIER_NETWORK_CHANGE, + AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0], + R.string.accessibility_carrier_network_change_mode, + 0, + false, + null + ); static final MobileIconGroup THREE_G = new MobileIconGroup( "3G", diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java index 5d88407..5d40eed 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java @@ -279,7 +279,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase { // TODO: Verify all fields. Mockito.verify(mSignalCluster, Mockito.atLeastOnce()).setMobileDataIndicators( - visibleArg.capture(), iconArg.capture(), typeIconArg.capture(), + visibleArg.capture(), iconArg.capture(), iconArg.capture(), typeIconArg.capture(), ArgumentCaptor.forClass(String.class).capture(), ArgumentCaptor.forClass(String.class).capture(), ArgumentCaptor.forClass(Boolean.class).capture(), |