Merge "AOD: Fix wakeup transition jank" into oc-dr1-dev
diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java
index f9f5901..98d8a13 100644
--- a/core/java/android/widget/EdgeEffect.java
+++ b/core/java/android/widget/EdgeEffect.java
@@ -59,8 +59,7 @@
// Time it will take in ms for a pulled glow to decay to partial strength before release
private static final int PULL_DECAY_TIME = 2000;
- private static final float MAX_ALPHA = 0.15f;
- private static final float GLOW_ALPHA_START = .09f;
+ private static final float MAX_ALPHA = 0.5f;
private static final float MAX_GLOW_SCALE = 2.f;
@@ -76,7 +75,6 @@
private static final double ANGLE = Math.PI / 6;
private static final float SIN = (float) Math.sin(ANGLE);
private static final float COS = (float) Math.cos(ANGLE);
- private static final float RADIUS_FACTOR = 0.6f;
private float mGlowAlpha;
private float mGlowScaleY;
@@ -136,10 +134,10 @@
* @param height Effect height in pixels
*/
public void setSize(int width, int height) {
- final float r = width * RADIUS_FACTOR / SIN;
+ final float r = width * 0.75f / SIN;
final float y = COS * r;
final float h = r - y;
- final float or = height * RADIUS_FACTOR / SIN;
+ final float or = height * 0.75f / SIN;
final float oy = COS * or;
final float oh = or - oy;
@@ -274,7 +272,7 @@
// The glow depends more on the velocity, and therefore starts out
// nearly invisible.
- mGlowAlphaStart = GLOW_ALPHA_START;
+ mGlowAlphaStart = 0.3f;
mGlowScaleYStart = Math.max(mGlowScaleY, 0.f);
diff --git a/core/java/com/android/internal/colorextraction/ColorExtractor.java b/core/java/com/android/internal/colorextraction/ColorExtractor.java
index 477285e63..727412b 100644
--- a/core/java/com/android/internal/colorextraction/ColorExtractor.java
+++ b/core/java/com/android/internal/colorextraction/ColorExtractor.java
@@ -45,12 +45,12 @@
private static final String TAG = "ColorExtractor";
- private final SparseArray<GradientColors[]> mGradientColors;
+ protected final SparseArray<GradientColors[]> mGradientColors;
private final ArrayList<WeakReference<OnColorsChangedListener>> mOnColorsChangedListeners;
private final Context mContext;
private final ExtractionType mExtractionType;
- private WallpaperColors mSystemColors;
- private WallpaperColors mLockColors;
+ protected WallpaperColors mSystemColors;
+ protected WallpaperColors mLockColors;
public ColorExtractor(Context context) {
this(context, new Tonal(context));
diff --git a/core/res/res/drawable-hdpi/toast_frame.9.png b/core/res/res/drawable-hdpi/toast_frame.9.png
new file mode 100644
index 0000000..a804a8a
--- /dev/null
+++ b/core/res/res/drawable-hdpi/toast_frame.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldpi/toast_frame.9.png b/core/res/res/drawable-ldpi/toast_frame.9.png
new file mode 100644
index 0000000..e64dc75
--- /dev/null
+++ b/core/res/res/drawable-ldpi/toast_frame.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/toast_frame.9.png b/core/res/res/drawable-mdpi/toast_frame.9.png
new file mode 100644
index 0000000..778e4e6
--- /dev/null
+++ b/core/res/res/drawable-mdpi/toast_frame.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/toast_frame.9.png b/core/res/res/drawable-xhdpi/toast_frame.9.png
new file mode 100644
index 0000000..77e69c7
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/toast_frame.9.png
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/toast_frame.9.png b/core/res/res/drawable-xxhdpi/toast_frame.9.png
new file mode 100644
index 0000000..edecb63
--- /dev/null
+++ b/core/res/res/drawable-xxhdpi/toast_frame.9.png
Binary files differ
diff --git a/core/res/res/drawable/toast_frame.xml b/core/res/res/drawable/toast_frame.xml
deleted file mode 100644
index 053b4f4..0000000
--- a/core/res/res/drawable/toast_frame.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* Copyright 2017, 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.
-*/
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <!-- background is material_grey_300 with .9 alpha -->
- <solid android:color="#E6E0E0E0" />
- <corners android:radius="22dp" />
-</shape>
-
diff --git a/core/res/res/layout/transient_notification.xml b/core/res/res/layout/transient_notification.xml
index 2c08bf7..daa9faf 100644
--- a/core/res/res/layout/transient_notification.xml
+++ b/core/res/res/layout/transient_notification.xml
@@ -29,11 +29,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:layout_marginHorizontal="24dp"
- android:layout_marginVertical="15dp"
android:layout_gravity="center_horizontal"
android:textAppearance="@style/TextAppearance.Toast"
- android:textColor="@color/primary_text_default_material_light"
+ android:textColor="@color/bright_foreground_dark"
android:shadowColor="#BB000000"
android:shadowRadius="2.75"
/>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 706099d..136d777 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -63,7 +63,7 @@
<string name="needPuk2" msgid="4526033371987193070">"Introduza o PUK2 para desbloquear o cartão SIM."</string>
<string name="enablePin" msgid="209412020907207950">"Ação sem êxito. Ative o bloqueio do SIM/RUIM."</string>
<plurals name="pinpuk_attempts" formatted="false" msgid="1251012001539225582">
- <item quantity="one">Tem mais <xliff:g id="NUMBER_1">%d</xliff:g> tentativa antes de o cartão SIM ficar bloqueado.</item>
+ <item quantity="one">Tem mais <xliff:g id="NUMBER_0">%d</xliff:g> tentativa antes de o cartão SIM ficar bloqueado.</item>
<item quantity="other">Tem mais <xliff:g id="NUMBER_1">%d</xliff:g> tentativas antes de o cartão SIM ficar bloqueado.</item>
</plurals>
<string name="imei" msgid="2625429890869005782">"IMEI"</string>
@@ -232,7 +232,7 @@
<string name="bugreport_option_full_title" msgid="6354382025840076439">"Relatório completo"</string>
<string name="bugreport_option_full_summary" msgid="7210859858969115745">"Utilize esta opção para uma interferência mínima do sistema quando o dispositivo não responder ou estiver demasiado lento, ou quando precisar de todas as secções de relatório. Não permite introduzir mais detalhes ou tirar capturas de ecrã adicionais."</string>
<plurals name="bugreport_countdown" formatted="false" msgid="6878900193900090368">
- <item quantity="one">A tirar uma captura de ecrã do relatório de erro dentro de <xliff:g id="NUMBER_1">%d</xliff:g> segundo…</item>
+ <item quantity="one">A tirar uma captura de ecrã do relatório de erro dentro de <xliff:g id="NUMBER_0">%d</xliff:g> segundo…</item>
<item quantity="other">A tirar uma captura de ecrã do relatório de erro dentro de <xliff:g id="NUMBER_1">%d</xliff:g> segundos.</item>
</plurals>
<string name="global_action_toggle_silent_mode" msgid="8219525344246810925">"Modo silencioso"</string>
@@ -868,7 +868,7 @@
<string name="oneMonthDurationPast" msgid="7396384508953779925">"Há 1 mês"</string>
<string name="beforeOneMonthDurationPast" msgid="909134546836499826">"Há mais de 1 mês"</string>
<plurals name="last_num_days" formatted="false" msgid="5104533550723932025">
- <item quantity="one">Últimos <xliff:g id="COUNT_1">%d</xliff:g> dia</item>
+ <item quantity="one">Último <xliff:g id="COUNT_0">%d</xliff:g> dia</item>
<item quantity="other">Últimos <xliff:g id="COUNT_1">%d</xliff:g> dias</item>
</plurals>
<string name="last_month" msgid="3959346739979055432">"Último mês"</string>
@@ -890,67 +890,67 @@
<string name="years" msgid="6881577717993213522">"anos"</string>
<string name="now_string_shortest" msgid="8912796667087856402">"agora"</string>
<plurals name="duration_minutes_shortest" formatted="false" msgid="3957499975064245495">
- <item quantity="one"><xliff:g id="COUNT_1">%d</xliff:g> m</item>
+ <item quantity="one"><xliff:g id="COUNT_0">%d</xliff:g> m</item>
<item quantity="other"><xliff:g id="COUNT_1">%d</xliff:g> m</item>
</plurals>
<plurals name="duration_hours_shortest" formatted="false" msgid="3552182110578602356">
- <item quantity="one"><xliff:g id="COUNT_1">%d</xliff:g> h</item>
+ <item quantity="one"><xliff:g id="COUNT_0">%d</xliff:g> h</item>
<item quantity="other"><xliff:g id="COUNT_1">%d</xliff:g> h</item>
</plurals>
<plurals name="duration_days_shortest" formatted="false" msgid="5213655532597081640">
- <item quantity="one"><xliff:g id="COUNT_1">%d</xliff:g> d</item>
+ <item quantity="one"><xliff:g id="COUNT_0">%d</xliff:g> d</item>
<item quantity="other"><xliff:g id="COUNT_1">%d</xliff:g> d</item>
</plurals>
<plurals name="duration_years_shortest" formatted="false" msgid="7848711145196397042">
- <item quantity="one"><xliff:g id="COUNT_1">%d</xliff:g> a</item>
+ <item quantity="one"><xliff:g id="COUNT_0">%d</xliff:g> a</item>
<item quantity="other"><xliff:g id="COUNT_1">%d</xliff:g> a</item>
</plurals>
<plurals name="duration_minutes_shortest_future" formatted="false" msgid="3277614521231489951">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> min</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> min</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> min</item>
</plurals>
<plurals name="duration_hours_shortest_future" formatted="false" msgid="2152452368397489370">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> h</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> h</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> h</item>
</plurals>
<plurals name="duration_days_shortest_future" formatted="false" msgid="8088331502820295701">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> d</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> d</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> d</item>
</plurals>
<plurals name="duration_years_shortest_future" formatted="false" msgid="2317006667145250301">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> a</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> a</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> a</item>
</plurals>
<plurals name="duration_minutes_relative" formatted="false" msgid="3178131706192980192">
- <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> minuto</item>
+ <item quantity="one">há <xliff:g id="COUNT_0">%d</xliff:g> minuto</item>
<item quantity="other">há <xliff:g id="COUNT_1">%d</xliff:g> minutos</item>
</plurals>
<plurals name="duration_hours_relative" formatted="false" msgid="676894109982008411">
- <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> hora</item>
+ <item quantity="one">há <xliff:g id="COUNT_0">%d</xliff:g> hora</item>
<item quantity="other">há <xliff:g id="COUNT_1">%d</xliff:g> horas</item>
</plurals>
<plurals name="duration_days_relative" formatted="false" msgid="2203515825765397130">
- <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> dia</item>
+ <item quantity="one">há <xliff:g id="COUNT_0">%d</xliff:g> dia</item>
<item quantity="other">há <xliff:g id="COUNT_1">%d</xliff:g> dias</item>
</plurals>
<plurals name="duration_years_relative" formatted="false" msgid="4820062134188885734">
- <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> ano</item>
+ <item quantity="one">há <xliff:g id="COUNT_0">%d</xliff:g> ano</item>
<item quantity="other">há <xliff:g id="COUNT_1">%d</xliff:g> anos</item>
</plurals>
<plurals name="duration_minutes_relative_future" formatted="false" msgid="4655043589817680966">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> minuto</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> minuto</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> minutos</item>
</plurals>
<plurals name="duration_hours_relative_future" formatted="false" msgid="8084579714205223891">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> hora</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> hora</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> horas</item>
</plurals>
<plurals name="duration_days_relative_future" formatted="false" msgid="333215369363433992">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> dia</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> dia</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> dias</item>
</plurals>
<plurals name="duration_years_relative_future" formatted="false" msgid="8644862986413104011">
- <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> ano</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_0">%d</xliff:g> ano</item>
<item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g> anos</item>
</plurals>
<string name="VideoView_error_title" msgid="3534509135438353077">"Problema com o vídeo"</string>
@@ -1316,7 +1316,7 @@
<string name="no_matches" msgid="8129421908915840737">"Sem correspondências"</string>
<string name="find_on_page" msgid="1946799233822820384">"Localizar na página"</string>
<plurals name="matches_found" formatted="false" msgid="1210884353962081884">
- <item quantity="one"><xliff:g id="INDEX">%d</xliff:g> de <xliff:g id="TOTAL">%d</xliff:g></item>
+ <item quantity="one">1 correspondência</item>
<item quantity="other"><xliff:g id="INDEX">%d</xliff:g> de <xliff:g id="TOTAL">%d</xliff:g></item>
</plurals>
<string name="action_mode_done" msgid="7217581640461922289">"Concluído"</string>
@@ -1602,7 +1602,7 @@
<string name="restr_pin_error_doesnt_match" msgid="2224214190906994548">"Os PINs não correspondem. Tente novamente."</string>
<string name="restr_pin_error_too_short" msgid="8173982756265777792">"O PIN é demasiado pequeno. Deve ter, no mínimo, 4 dígitos."</string>
<plurals name="restr_pin_countdown" formatted="false" msgid="9061246974881224688">
- <item quantity="one">Tente novamente dentro de <xliff:g id="COUNT">%d</xliff:g> segundo</item>
+ <item quantity="one">Tente novamente dentro de 1 segundo</item>
<item quantity="other">Tente novamente dentro de <xliff:g id="COUNT">%d</xliff:g> segundos</item>
</plurals>
<string name="restr_pin_try_later" msgid="973144472490532377">"Tente novamente mais tarde"</string>
@@ -1635,35 +1635,35 @@
<string name="data_saver_enable_title" msgid="4674073932722787417">"Ativar a Poupança de dados?"</string>
<string name="data_saver_enable_button" msgid="7147735965247211818">"Ativar"</string>
<plurals name="zen_mode_duration_minutes_summary" formatted="false" msgid="4367877408072000848">
- <item quantity="one">Durante %1$d minuto (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante um minuto (até à(s) <xliff:g id="FORMATTEDTIME_0">%2$s</xliff:g>)</item>
<item quantity="other">Durante %1$d minutos (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
</plurals>
<plurals name="zen_mode_duration_minutes_summary_short" formatted="false" msgid="6830154222366042597">
- <item quantity="one">Durante %1$d min (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante 1 min (até à(s) <xliff:g id="FORMATTEDTIME_0">%2$s</xliff:g>)</item>
<item quantity="other">Durante %1$d min (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
</plurals>
<plurals name="zen_mode_duration_hours_summary" formatted="false" msgid="8152974162096743862">
- <item quantity="one">Durante %1$d hora (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante uma hora (até à(s) <xliff:g id="FORMATTEDTIME_0">%2$s</xliff:g>)</item>
<item quantity="other">Durante %1$d horas (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
</plurals>
<plurals name="zen_mode_duration_hours_summary_short" formatted="false" msgid="4787552595253082371">
- <item quantity="one">Durante %1$d h (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante 1 h (até à(s) <xliff:g id="FORMATTEDTIME_0">%2$s</xliff:g>)</item>
<item quantity="other">Durante %1$d h (até à(s) <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
</plurals>
<plurals name="zen_mode_duration_minutes" formatted="false" msgid="5127407202506485571">
- <item quantity="one">Durante %d minuto</item>
+ <item quantity="one">Durante um minuto</item>
<item quantity="other">Durante %d minutos</item>
</plurals>
<plurals name="zen_mode_duration_minutes_short" formatted="false" msgid="2199350154433426128">
- <item quantity="one">Durante %d min</item>
+ <item quantity="one">Durante 1 min</item>
<item quantity="other">Durante %d min</item>
</plurals>
<plurals name="zen_mode_duration_hours" formatted="false" msgid="3938821308277433854">
- <item quantity="one">Durante %d hora</item>
+ <item quantity="one">Durante uma hora</item>
<item quantity="other">Durante %d horas</item>
</plurals>
<plurals name="zen_mode_duration_hours_short" formatted="false" msgid="6748277774662434217">
- <item quantity="one">Durante %d h</item>
+ <item quantity="one">Durante 1 h</item>
<item quantity="other">Durante %d h</item>
</plurals>
<string name="zen_mode_until" msgid="7336308492289875088">"Até às <xliff:g id="FORMATTEDTIME">%1$s</xliff:g>"</string>
@@ -1699,7 +1699,7 @@
<string name="close_button_text" msgid="3937902162644062866">"Fechar"</string>
<string name="notification_messaging_title_template" msgid="3452480118762691020">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
<plurals name="selected_count" formatted="false" msgid="7187339492915744615">
- <item quantity="one"><xliff:g id="COUNT_1">%1$d</xliff:g> selecionado</item>
+ <item quantity="one"><xliff:g id="COUNT_0">%1$d</xliff:g> selecionado</item>
<item quantity="other"><xliff:g id="COUNT_1">%1$d</xliff:g> selecionados</item>
</plurals>
<string name="default_notification_channel_label" msgid="5929663562028088222">"Sem categoria"</string>
@@ -1757,7 +1757,7 @@
<string name="autofill_error_cannot_autofill" msgid="7402758580060110371">"Não é possível preencher automaticamente o conteúdo"</string>
<string name="autofill_picker_no_suggestions" msgid="3908514303773350735">"Sem sugestões do preenchimento automático"</string>
<plurals name="autofill_picker_some_suggestions" formatted="false" msgid="5506565809835815274">
- <item quantity="one"><xliff:g id="COUNT">%1$s</xliff:g> sugestão do preenchimento automático</item>
+ <item quantity="one">Uma sugestão do preenchimento automático</item>
<item quantity="other"><xliff:g id="COUNT">%1$s</xliff:g> sugestões do preenchimento automático</item>
</plurals>
<string name="autofill_save_title" msgid="3345527308992082601">"Pretende guardar no <b><xliff:g id="LABEL">%1$s</xliff:g></b>?"</string>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 7819f30..807b4e7 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1854,9 +1854,8 @@
states. -->
<bool name="config_dozeAlwaysOnDisplayAvailable">false</bool>
- <!-- Whether the display hardware requires we go to the off state before transitioning
- out of any doze states. -->
- <bool name="config_displayTransitionOffAfterDoze">false</bool>
+ <!-- Whether the display blanks itself when transitioning from a doze to a non-doze state -->
+ <bool name="config_displayBlanksAfterDoze">false</bool>
<!-- Power Management: Specifies whether to decouple the auto-suspend state of the
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index b4636a6..80d8ab5 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -30,7 +30,7 @@
will be displayed in the app launcher and elsewhere. -->
<dimen name="app_icon_size">48dip</dimen>
- <dimen name="toast_y_offset">24dp</dimen>
+ <dimen name="toast_y_offset">64dip</dimen>
<!-- Height of the status bar -->
<dimen name="status_bar_height">24dp</dimen>
<!-- Height of the bottom navigation / system bar. -->
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 4b0fe3f..5c6e3df 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -956,8 +956,7 @@
</style>
<style name="TextAppearance.Toast">
- <item name="fontFamily">sans-serif</item>
- <item name="textSize">14sp</item>
+ <item name="fontFamily">sans-serif-condensed</item>
</style>
<style name="TextAppearance.Tooltip">
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index decf42d..ba5bbfe 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3051,7 +3051,7 @@
<java-symbol type="bool" name="config_handleVolumeKeysInWindowManager" />
<java-symbol type="integer" name="config_inCallNotificationVolumeRelative" />
<java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" />
- <java-symbol type="bool" name="config_displayTransitionOffAfterDoze" />
+ <java-symbol type="bool" name="config_displayBlanksAfterDoze" />
<java-symbol type="integer" name="config_storageManagerDaystoRetainDefault" />
<java-symbol type="string" name="config_headlineFontFamily" />
<java-symbol type="string" name="config_headlineFontFamilyLight" />
diff --git a/media/java/android/media/IMediaRouterClient.aidl b/media/java/android/media/IMediaRouterClient.aidl
index 9640dcb..08344f1 100644
--- a/media/java/android/media/IMediaRouterClient.aidl
+++ b/media/java/android/media/IMediaRouterClient.aidl
@@ -21,4 +21,5 @@
*/
oneway interface IMediaRouterClient {
void onStateChanged();
+ void onRestoreRoute();
}
diff --git a/media/java/android/media/IMediaRouterService.aidl b/media/java/android/media/IMediaRouterService.aidl
index f8f5fdf..3308fc9 100644
--- a/media/java/android/media/IMediaRouterService.aidl
+++ b/media/java/android/media/IMediaRouterService.aidl
@@ -27,6 +27,7 @@
void unregisterClient(IMediaRouterClient client);
MediaRouterClientState getState(IMediaRouterClient client);
+ boolean isPlaybackActive(IMediaRouterClient client);
void setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan);
void setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit);
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index 8caba81..80a0315 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -88,6 +88,7 @@
RouteInfo mBluetoothA2dpRoute;
RouteInfo mSelectedRoute;
+ RouteInfo mSystemAudioRoute;
final boolean mCanConfigureWifiDisplays;
boolean mActivelyScanningWifiDisplays;
@@ -149,6 +150,7 @@
}
addRouteStatic(mDefaultAudioVideo);
+ mSystemAudioRoute = mDefaultAudioVideo;
// This will select the active wifi display route if there is one.
updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
@@ -197,8 +199,8 @@
} else {
name = com.android.internal.R.string.default_audio_route_name;
}
- sStatic.mDefaultAudioVideo.mNameResId = name;
- dispatchRouteChanged(sStatic.mDefaultAudioVideo);
+ mDefaultAudioVideo.mNameResId = name;
+ dispatchRouteChanged(mDefaultAudioVideo);
updated = true;
}
@@ -207,22 +209,28 @@
if (!TextUtils.equals(newRoutes.bluetoothName, mCurAudioRoutesInfo.bluetoothName)) {
mCurAudioRoutesInfo.bluetoothName = newRoutes.bluetoothName;
if (mCurAudioRoutesInfo.bluetoothName != null) {
- if (sStatic.mBluetoothA2dpRoute == null) {
- final RouteInfo info = new RouteInfo(sStatic.mSystemCategory);
+ if (mBluetoothA2dpRoute == null) {
+ // BT connected
+ final RouteInfo info = new RouteInfo(mSystemCategory);
info.mName = mCurAudioRoutesInfo.bluetoothName;
- info.mDescription = sStatic.mResources.getText(
+ info.mDescription = mResources.getText(
com.android.internal.R.string.bluetooth_a2dp_audio_route_name);
info.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO;
info.mDeviceType = RouteInfo.DEVICE_TYPE_BLUETOOTH;
- sStatic.mBluetoothA2dpRoute = info;
- addRouteStatic(sStatic.mBluetoothA2dpRoute);
+ mBluetoothA2dpRoute = info;
+ addRouteStatic(mBluetoothA2dpRoute);
+ mSystemAudioRoute = mBluetoothA2dpRoute;
+ selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mSystemAudioRoute, false);
} else {
- sStatic.mBluetoothA2dpRoute.mName = mCurAudioRoutesInfo.bluetoothName;
- dispatchRouteChanged(sStatic.mBluetoothA2dpRoute);
+ mBluetoothA2dpRoute.mName = mCurAudioRoutesInfo.bluetoothName;
+ dispatchRouteChanged(mBluetoothA2dpRoute);
}
- } else if (sStatic.mBluetoothA2dpRoute != null) {
- removeRouteStatic(sStatic.mBluetoothA2dpRoute);
- sStatic.mBluetoothA2dpRoute = null;
+ } else if (mBluetoothA2dpRoute != null) {
+ // BT disconnected
+ removeRouteStatic(mBluetoothA2dpRoute);
+ mBluetoothA2dpRoute = null;
+ mSystemAudioRoute = mDefaultAudioVideo;
+ selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mSystemAudioRoute, false);
}
updated = true;
}
@@ -230,11 +238,13 @@
if (mBluetoothA2dpRoute != null) {
final boolean a2dpEnabled = isBluetoothA2dpOn();
if (mSelectedRoute == mBluetoothA2dpRoute && !a2dpEnabled) {
- selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mDefaultAudioVideo, false);
+ // A2DP off
+ mSystemAudioRoute = mDefaultAudioVideo;
updated = true;
} else if ((mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == null) &&
a2dpEnabled) {
- selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mBluetoothA2dpRoute, false);
+ // A2DP on or BT connected
+ mSystemAudioRoute = mBluetoothA2dpRoute;
updated = true;
}
}
@@ -471,7 +481,7 @@
}
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute) {
- RouteInfo route = new RouteInfo(sStatic.mSystemCategory);
+ RouteInfo route = new RouteInfo(mSystemCategory);
route.mGlobalRouteId = globalRoute.id;
route.mName = globalRoute.name;
route.mDescription = globalRoute.description;
@@ -567,6 +577,17 @@
return null;
}
+ boolean isPlaybackActive() {
+ if (mClient != null) {
+ try {
+ return mMediaRouterService.isPlaybackActive(mClient);
+ } catch (RemoteException ex) {
+ Log.e(TAG, "Unable to retrieve playback active state.", ex);
+ }
+ }
+ return false;
+ }
+
final class Client extends IMediaRouterClient.Stub {
@Override
public void onStateChanged() {
@@ -579,6 +600,19 @@
}
});
}
+
+ @Override
+ public void onRestoreRoute() {
+ if ((mSelectedRoute != mDefaultAudioVideo && mSelectedRoute != mBluetoothA2dpRoute)
+ || mSelectedRoute == mSystemAudioRoute) {
+ return;
+ }
+ try {
+ sStatic.mAudioService.setBluetoothA2dpOn(mSelectedRoute == mBluetoothA2dpRoute);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error changing Bluetooth A2DP state", e);
+ }
+ }
}
}
@@ -909,7 +943,12 @@
Log.v(TAG, "Selecting route: " + route);
assert(route != null);
final RouteInfo oldRoute = sStatic.mSelectedRoute;
- if (oldRoute == route) return;
+ boolean wasDefaultOrBluetoothRoute = (oldRoute == sStatic.mDefaultAudioVideo
+ || oldRoute == sStatic.mBluetoothA2dpRoute);
+ if (oldRoute == route
+ && (!wasDefaultOrBluetoothRoute || oldRoute == sStatic.mSystemAudioRoute)) {
+ return;
+ }
if (!route.matchesTypes(types)) {
Log.w(TAG, "selectRoute ignored; cannot select route with supported types " +
typesToString(route.getSupportedTypes()) + " into route types " +
@@ -918,8 +957,8 @@
}
final RouteInfo btRoute = sStatic.mBluetoothA2dpRoute;
- if (btRoute != null && (types & ROUTE_TYPE_LIVE_AUDIO) != 0 &&
- (route == btRoute || route == sStatic.mDefaultAudioVideo)) {
+ if (sStatic.isPlaybackActive() && btRoute != null && (types & ROUTE_TYPE_LIVE_AUDIO) != 0
+ && (route == btRoute || route == sStatic.mDefaultAudioVideo)) {
try {
sStatic.mAudioService.setBluetoothA2dpOn(route == btRoute);
// TODO: Remove the following logging when no longer needed.
diff --git a/packages/PrintSpooler/res/values-pt-rPT/strings.xml b/packages/PrintSpooler/res/values-pt-rPT/strings.xml
index 174789f..eac6d36 100644
--- a/packages/PrintSpooler/res/values-pt-rPT/strings.xml
+++ b/packages/PrintSpooler/res/values-pt-rPT/strings.xml
@@ -56,7 +56,7 @@
<string name="print_select_printer" msgid="7388760939873368698">"Selecionar impressora"</string>
<string name="print_forget_printer" msgid="5035287497291910766">"Esquecer impressora"</string>
<plurals name="print_search_result_count_utterance" formatted="false" msgid="6997663738361080868">
- <item quantity="one"><xliff:g id="COUNT_1">%1$s</xliff:g> printers found</item>
+ <item quantity="one"><xliff:g id="COUNT_0">%1$s</xliff:g> impressora encontrada</item>
<item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> impressoras encontradas</item>
</plurals>
<string name="printer_extended_description_template" msgid="1366699227703381874">"<xliff:g id="PRINT_SERVICE_LABEL">%1$s</xliff:g> – <xliff:g id="PRINTER_DESCRIPTION">%2$s</xliff:g>"</string>
@@ -76,7 +76,7 @@
<string name="disabled_services_title" msgid="7313253167968363211">"Serviços desativados"</string>
<string name="all_services_title" msgid="5578662754874906455">"Todos os serviços"</string>
<plurals name="print_services_recommendation_subtitle" formatted="false" msgid="5678487708807185138">
- <item quantity="one">Install to discover <xliff:g id="COUNT_1">%1$s</xliff:g> printers</item>
+ <item quantity="one">Instale para detetar <xliff:g id="COUNT_0">%1$s</xliff:g> impressora</item>
<item quantity="other">Instale para detetar <xliff:g id="COUNT_1">%1$s</xliff:g> impressoras</item>
</plurals>
<string name="printing_notification_title_template" msgid="295903957762447362">"A imprimir <xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g>"</string>
diff --git a/packages/SettingsLib/res/values-pt-rBR/arrays.xml b/packages/SettingsLib/res/values-pt-rBR/arrays.xml
index a444b59..e3f287b 100644
--- a/packages/SettingsLib/res/values-pt-rBR/arrays.xml
+++ b/packages/SettingsLib/res/values-pt-rBR/arrays.xml
@@ -190,9 +190,9 @@
</string-array>
<string-array name="animator_duration_scale_entries">
<item msgid="6039901060648228241">"Animação desativada"</item>
- <item msgid="1138649021950863198">"Escala de animação 5x"</item>
+ <item msgid="1138649021950863198">"Escala de animação 0,5x"</item>
<item msgid="4394388961370833040">"Escala de animação 1x"</item>
- <item msgid="8125427921655194973">"Escala de animação 1.5 x"</item>
+ <item msgid="8125427921655194973">"Escala de animação 1,5x"</item>
<item msgid="3334024790739189573">"Escala de animação 2x"</item>
<item msgid="3170120558236848008">"Escala de animação 5x"</item>
<item msgid="1069584980746680398">"Escala de animação 10x"</item>
diff --git a/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml b/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml
index f3fa491..6bdf2d9 100644
--- a/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml
+++ b/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml
@@ -93,12 +93,12 @@
<string name="kg_failed_attempts_almost_at_login" product="default" msgid="8364140853305528449">"Desenhou a sequência de desbloqueio incorretamente <xliff:g id="NUMBER_0">%1$d</xliff:g> vezes. Após mais <xliff:g id="NUMBER_1">%2$d</xliff:g> tentativas sem êxito, ser-lhe-á pedido para desbloquear o telemóvel através de uma conta de email.\n\n Tente novamente dentro de <xliff:g id="NUMBER_2">%3$d</xliff:g> segundos."</string>
<string name="kg_password_wrong_pin_code_pukked" msgid="3389829202093674267">"Código PIN do cartão SIM incorreto. Tem de contactar o seu operador para desbloquear o dispositivo."</string>
<plurals name="kg_password_wrong_pin_code" formatted="false" msgid="4314341367727055967">
- <item quantity="one">Incorrect SIM PIN code, you have <xliff:g id="NUMBER_1">%d</xliff:g> remaining attempts.</item>
+ <item quantity="one">Código PIN do cartão SIM incorreto. Tem mais <xliff:g id="NUMBER_0">%d</xliff:g> tentativa antes de precisar de contactar o seu operador para desbloquear o dispositivo.</item>
<item quantity="other">Código PIN do cartão SIM incorreto. Tem mais <xliff:g id="NUMBER_1">%d</xliff:g> tentativas.</item>
</plurals>
<string name="kg_password_wrong_puk_code_dead" msgid="3329017604125179374">"Cartão SIM inutilizável. Contacte o seu operador."</string>
<plurals name="kg_password_wrong_puk_code" formatted="false" msgid="2287504898931957513">
- <item quantity="one">Incorrect SIM PUK code, you have <xliff:g id="NUMBER_1">%d</xliff:g> remaining attempts before SIM becomes permanently unusable.</item>
+ <item quantity="one">Código PUK do cartão SIM incorreto. Tem mais <xliff:g id="NUMBER_0">%d</xliff:g> tentativa antes de o cartão SIM ficar permanentemente inutilizável.</item>
<item quantity="other">Código PUK do cartão SIM incorreto. Tem mais <xliff:g id="NUMBER_1">%d</xliff:g> tentativas antes de o cartão SIM ficar permanentemente inutilizável.</item>
</plurals>
<string name="kg_password_pin_failed" msgid="8769990811451236223">"Falha ao introduzir o PIN do cartão SIM!"</string>
@@ -119,15 +119,15 @@
<string name="kg_prompt_reason_device_admin" msgid="3452168247888906179">"Dispositivo bloqueado pelo administrador"</string>
<string name="kg_prompt_reason_user_request" msgid="8236951765212462286">"O dispositivo foi bloqueado manualmente"</string>
<plurals name="kg_prompt_reason_time_pattern" formatted="false" msgid="71299470072448533">
- <item quantity="one">Device hasn\'t been unlocked for <xliff:g id="NUMBER_1">%d</xliff:g> hours. Confirm pattern.</item>
+ <item quantity="one">O dispositivo não é desbloqueado há <xliff:g id="NUMBER_0">%d</xliff:g> hora. Confirme o padrão.</item>
<item quantity="other">O dispositivo não é desbloqueado há <xliff:g id="NUMBER_1">%d</xliff:g> horas. Confirme o padrão.</item>
</plurals>
<plurals name="kg_prompt_reason_time_pin" formatted="false" msgid="34586942088144385">
- <item quantity="one">Device hasn\'t been unlocked for <xliff:g id="NUMBER_1">%d</xliff:g> hours. Confirm PIN.</item>
+ <item quantity="one">O dispositivo não é desbloqueado há <xliff:g id="NUMBER_0">%d</xliff:g> hora. Confirme o PIN.</item>
<item quantity="other">O dispositivo não é desbloqueado há <xliff:g id="NUMBER_1">%d</xliff:g> horas. Confirme o PIN.</item>
</plurals>
<plurals name="kg_prompt_reason_time_password" formatted="false" msgid="257297696215346527">
- <item quantity="one">Device hasn\'t been unlocked for <xliff:g id="NUMBER_1">%d</xliff:g> hours. Confirm password.</item>
+ <item quantity="one">O dispositivo não é desbloqueado há <xliff:g id="NUMBER_0">%d</xliff:g> hora. Confirme a palavra-passe.</item>
<item quantity="other">O dispositivo não é desbloqueado há <xliff:g id="NUMBER_1">%d</xliff:g> horas. Confirme a palavra-passe.</item>
</plurals>
<string name="fingerprint_not_recognized" msgid="348813995267914625">"Não reconhecido"</string>
diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml
index 7d7c9c6..0614849 100644
--- a/packages/SystemUI/res/values-pt-rBR/strings.xml
+++ b/packages/SystemUI/res/values-pt-rBR/strings.xml
@@ -775,4 +775,5 @@
<string name="qs_dnd_replace" msgid="8019520786644276623">"Substituir"</string>
<string name="running_foreground_services_title" msgid="381024150898615683">"Apps sendo executados em segundo plano"</string>
<string name="running_foreground_services_msg" msgid="6326247670075574355">"Tocar para ver detalhes sobre a bateria e o uso de dados"</string>
+ <string name="data_usage_disable_mobile" msgid="5116269981510015864">"Desativar os dados móveis?"</string>
</resources>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml
index b40b6d4..65bed3c 100644
--- a/packages/SystemUI/res/values-pt-rPT/strings.xml
+++ b/packages/SystemUI/res/values-pt-rPT/strings.xml
@@ -26,7 +26,7 @@
<string name="status_bar_no_recent_apps" msgid="7374907845131203189">"Os ecrãs recentes aparecem aqui"</string>
<string name="status_bar_accessibility_dismiss_recents" msgid="4576076075226540105">"Ignorar aplicações recentes"</string>
<plurals name="status_bar_accessibility_recent_apps" formatted="false" msgid="9138535907802238759">
- <item quantity="one">%d ecrã na Vista geral</item>
+ <item quantity="one">1 ecrã na Vista geral</item>
<item quantity="other">%d ecrãs na Vista geral</item>
</plurals>
<string name="status_bar_no_notifications_title" msgid="4755261167193833213">"Sem notificações"</string>
@@ -252,7 +252,7 @@
<string name="accessibility_clear_all" msgid="5235938559247164925">"Limpar todas as notificações."</string>
<string name="notification_group_overflow_indicator" msgid="1863231301642314183">"+ <xliff:g id="NUMBER">%s</xliff:g>"</string>
<plurals name="notification_group_overflow_description" formatted="false" msgid="4579313201268495404">
- <item quantity="one">Mais <xliff:g id="NUMBER_1">%s</xliff:g> notificação no grupo.</item>
+ <item quantity="one">Mais <xliff:g id="NUMBER_0">%s</xliff:g> notificação no grupo.</item>
<item quantity="other">Mais <xliff:g id="NUMBER_1">%s</xliff:g> notificações no grupo.</item>
</plurals>
<string name="status_bar_notification_inspect_item_title" msgid="5668348142410115323">"Definições de notificação"</string>
@@ -556,12 +556,12 @@
<string name="notification_default_channel_desc" msgid="2506053815870808359">"Esta aplicação não tem categorias de notificação"</string>
<string name="notification_unblockable_desc" msgid="3561016061737896906">"Não é possível desativar as notificações desta aplicação"</string>
<plurals name="notification_num_channels_desc" formatted="false" msgid="5492793452274077663">
- <item quantity="one">1 de <xliff:g id="NUMBER_1">%d</xliff:g> categoria de notificação desta aplicação</item>
+ <item quantity="one">1 de <xliff:g id="NUMBER_0">%d</xliff:g> categoria de notificação desta aplicação</item>
<item quantity="other">1 de <xliff:g id="NUMBER_1">%d</xliff:g> categorias de notificação desta aplicação</item>
</plurals>
<string name="notification_channels_list_desc_2" msgid="6214732715833946441">"<xliff:g id="CHANNEL_NAME_1">%1$s</xliff:g>, <xliff:g id="CHANNEL_NAME_2">%2$s</xliff:g>"</string>
<plurals name="notification_channels_list_desc_2_and_others" formatted="false" msgid="2747813553355336157">
- <item quantity="one"><xliff:g id="CHANNEL_NAME_1_3">%1$s</xliff:g>, <xliff:g id="CHANNEL_NAME_2_4">%2$s</xliff:g> e mais <xliff:g id="NUMBER_5">%3$d</xliff:g></item>
+ <item quantity="one"><xliff:g id="CHANNEL_NAME_1_0">%1$s</xliff:g>, <xliff:g id="CHANNEL_NAME_2_1">%2$s</xliff:g> e mais <xliff:g id="NUMBER_2">%3$d</xliff:g></item>
<item quantity="other"><xliff:g id="CHANNEL_NAME_1_3">%1$s</xliff:g>, <xliff:g id="CHANNEL_NAME_2_4">%2$s</xliff:g> e mais <xliff:g id="NUMBER_5">%3$d</xliff:g></item>
</plurals>
<string name="notification_channel_controls_opened_accessibility" msgid="6553950422055908113">"Controlos de notificações da aplicação <xliff:g id="APP_NAME">%1$s</xliff:g> abertos"</string>
@@ -577,11 +577,11 @@
<string name="snooze_undo" msgid="6074877317002985129">"ANULAR"</string>
<string name="snoozed_for_time" msgid="2390718332980204462">"Suspensa por <xliff:g id="TIME_AMOUNT">%1$s</xliff:g>"</string>
<plurals name="snoozeHourOptions" formatted="false" msgid="2124335842674413030">
- <item quantity="one">%d horas</item>
+ <item quantity="one">%d hora</item>
<item quantity="other">%d horas</item>
</plurals>
<plurals name="snoozeMinuteOptions" formatted="false" msgid="4127251700591510196">
- <item quantity="one">%d minutos</item>
+ <item quantity="one">%d minuto</item>
<item quantity="other">%d minutos</item>
</plurals>
<string name="battery_panel_title" msgid="7944156115535366613">"Utiliz. da bateria"</string>
@@ -773,4 +773,5 @@
<string name="qs_dnd_replace" msgid="8019520786644276623">"Substituir"</string>
<string name="running_foreground_services_title" msgid="381024150898615683">"Aplicações em execução em segundo plano"</string>
<string name="running_foreground_services_msg" msgid="6326247670075574355">"Toque para obter detalhes acerca da utilização da bateria e dos dados"</string>
+ <string name="data_usage_disable_mobile" msgid="5116269981510015864">"Pretende desativar os dados móveis?"</string>
</resources>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings_tv.xml b/packages/SystemUI/res/values-pt-rPT/strings_tv.xml
index a621877..ee90009 100644
--- a/packages/SystemUI/res/values-pt-rPT/strings_tv.xml
+++ b/packages/SystemUI/res/values-pt-rPT/strings_tv.xml
@@ -19,7 +19,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="notification_channel_tv_pip" msgid="134047986446577723">"Imagem na imagem"</string>
+ <string name="notification_channel_tv_pip" msgid="134047986446577723">"Ecrã no ecrã"</string>
<string name="pip_notification_unknown_title" msgid="6289156118095849438">"(Sem título do programa)"</string>
<string name="pip_close" msgid="3480680679023423574">"Fechar PIP"</string>
<string name="pip_fullscreen" msgid="8604643018538487816">"Ecrã inteiro"</string>
diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
index fe8373f..9ba7be8 100644
--- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
+++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
@@ -31,11 +31,16 @@
import com.android.internal.colorextraction.ColorExtractor;
import com.android.internal.colorextraction.types.ExtractionType;
import com.android.internal.colorextraction.types.Tonal;
+import com.android.systemui.Dumpable;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.Arrays;
/**
* ColorExtractor aware of wallpaper visibility
*/
-public class SysuiColorExtractor extends ColorExtractor {
+public class SysuiColorExtractor extends ColorExtractor implements Dumpable {
private static final String TAG = "SysuiColorExtractor";
private boolean mWallpaperVisible;
// Colors to return when the wallpaper isn't visible
@@ -134,6 +139,11 @@
* @return colors
*/
public GradientColors getColors(int which, int type, boolean ignoreWallpaperVisibility) {
+ // mWallpaperVisible only handles the "system wallpaper" and will be always set to false
+ // if we have different lock and system wallpapers.
+ if (which == WallpaperManager.FLAG_LOCK) {
+ ignoreWallpaperVisibility = true;
+ }
if (mWallpaperVisible || ignoreWallpaperVisibility) {
return super.getColors(which, type);
} else {
@@ -149,4 +159,20 @@
}
}
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("SysuiColorExtractor:");
+
+ pw.println(" Current wallpaper colors:");
+ pw.println(" system: " + mSystemColors);
+ pw.println(" lock: " + mLockColors);
+
+ GradientColors[] system = mGradientColors.get(WallpaperManager.FLAG_SYSTEM);
+ GradientColors[] lock = mGradientColors.get(WallpaperManager.FLAG_LOCK);
+ pw.println(" Gradients:");
+ pw.println(" system: " + Arrays.toString(system));
+ pw.println(" lock: " + Arrays.toString(lock));
+ pw.println(" Default scrim: " + mWpHiddenColors);
+
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
index 7391509..d9984f7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
@@ -324,12 +324,30 @@
@Override
public void onAccessPointsChanged(final List<AccessPoint> accessPoints) {
mAccessPoints = accessPoints.toArray(new AccessPoint[accessPoints.size()]);
+ filterUnreachableAPs();
+
updateItems();
if (accessPoints != null && accessPoints.size() > 0) {
fireScanStateChanged(false);
}
}
+ /** Filter unreachable APs from mAccessPoints */
+ private void filterUnreachableAPs() {
+ int numReachable = 0;
+ for (AccessPoint ap : mAccessPoints) {
+ if (ap.isReachable()) numReachable++;
+ }
+ if (numReachable != mAccessPoints.length) {
+ AccessPoint[] unfiltered = mAccessPoints;
+ mAccessPoints = new AccessPoint[numReachable];
+ int i = 0;
+ for (AccessPoint ap : unfiltered) {
+ if (ap.isReachable()) mAccessPoints[i++] = ap;
+ }
+ }
+ }
+
@Override
public void onSettingsActivityTriggered(Intent settingsIntent) {
mActivityStarter.postStartActivityDismissingKeyguard(settingsIntent, 0);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
index b4fe900..02202cf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
@@ -166,14 +166,6 @@
}
mHandler.postDelayed(mReleaseFingerprintWakeLockRunnable,
FINGERPRINT_WAKELOCK_TIMEOUT_MS);
-
- if (pulsingOrAod()) {
- // If we are waking the device up while we are pulsing the clock and the
- // notifications would light up first, creating an unpleasant animation.
- // Defer changing the screen brightness by forcing doze brightness on our window
- // until the clock and the notifications are faded out.
- mStatusBarWindowManager.setForceDozeBrightness(true);
- }
}
Trace.endSection();
}
@@ -194,6 +186,13 @@
}
boolean wasDeviceInteractive = mUpdateMonitor.isDeviceInteractive();
mMode = calculateMode();
+ if (mMode == MODE_WAKE_AND_UNLOCK_PULSING && pulsingOrAod()) {
+ // If we are waking the device up while we are pulsing the clock and the
+ // notifications would light up first, creating an unpleasant animation.
+ // Defer changing the screen brightness by forcing doze brightness on our window
+ // until the clock and the notifications are faded out.
+ mStatusBarWindowManager.setForceDozeBrightness(true);
+ }
if (!wasDeviceInteractive) {
if (DEBUG_FP_WAKELOCK) {
Log.i(TAG, "fp wakelock: Authenticated, waking up...");
@@ -244,9 +243,6 @@
case MODE_NONE:
break;
}
- if (mMode != MODE_WAKE_AND_UNLOCK_PULSING) {
- mStatusBarWindowManager.setForceDozeBrightness(false);
- }
mStatusBar.notifyFpAuthModeChanged();
Trace.endSection();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index 95f32bb..49bac99 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -249,6 +249,7 @@
mKeyguardView.setViewMediatorCallback(mCallback);
mContainer.addView(mRoot, mContainer.getChildCount());
mRoot.setVisibility(View.INVISIBLE);
+ mRoot.dispatchApplyWindowInsets(mRoot.getRootWindowInsets());
}
protected void removeView() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index f3ba5aa..d1ef035 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -196,8 +196,7 @@
}
// TTY status
- mIconController.setIcon(mSlotTty, R.drawable.stat_sys_tty_mode, null);
- mIconController.setIconVisibility(mSlotTty, false);
+ updateTTY();
// bluetooth status
updateBluetooth();
@@ -419,9 +418,17 @@
mIconController.setIconVisibility(mSlotBluetooth, bluetoothEnabled);
}
- private final void updateTTY(Intent intent) {
- int currentTtyMode = intent.getIntExtra(TelecomManager.EXTRA_CURRENT_TTY_MODE,
- TelecomManager.TTY_MODE_OFF);
+ private final void updateTTY() {
+ TelecomManager telecomManager =
+ (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
+ if (telecomManager == null) {
+ updateTTY(TelecomManager.TTY_MODE_OFF);
+ } else {
+ updateTTY(telecomManager.getCurrentTtyMode());
+ }
+ }
+
+ private final void updateTTY(int currentTtyMode) {
boolean enabled = currentTtyMode != TelecomManager.TTY_MODE_OFF;
if (DEBUG) Log.v(TAG, "updateTTY: enabled: " + enabled);
@@ -754,7 +761,8 @@
} else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
updateSimState(intent);
} else if (action.equals(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED)) {
- updateTTY(intent);
+ updateTTY(intent.getIntExtra(TelecomManager.EXTRA_CURRENT_TTY_MODE,
+ TelecomManager.TTY_MODE_OFF));
} else if (action.equals(Intent.ACTION_MANAGED_PROFILE_AVAILABLE) ||
action.equals(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE) ||
action.equals(Intent.ACTION_MANAGED_PROFILE_REMOVED)) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 8acd2c4..18c9504 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -119,6 +119,7 @@
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Display;
+import android.view.HapticFeedbackConstants;
import android.view.IWindowManager;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -3508,6 +3509,14 @@
pw.print (" ");
mStackScroller.dump(fd, pw, args);
}
+ pw.println(" Theme:");
+ if (mOverlayManager == null) {
+ pw.println(" overlay manager not initialized!");
+ } else {
+ pw.println(" dark overlay on: " + isUsingDarkTheme());
+ }
+ final boolean lightWpTheme = mContext.getThemeResId() == R.style.Theme_SystemUI_Light;
+ pw.println(" light wallpaper theme: " + lightWpTheme);
DozeLog.dump(pw);
@@ -4715,6 +4724,7 @@
// Make our window larger and the panel expanded.
makeExpandedVisible(true);
mNotificationPanel.expand(false /* animate */);
+ recomputeDisableFlags(false /* animate */);
}
private void instantCollapseNotificationPanel() {
@@ -6353,6 +6363,7 @@
if (row.isDark()) {
return false;
}
+ v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (row.areGutsExposed()) {
closeAndSaveGuts(false /* removeLeavebehind */, false /* force */,
true /* removeControls */, -1 /* x */, -1 /* y */,
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
index 73ec0a4..ad47411 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
@@ -913,11 +913,7 @@
@Override
public void onRemoteUpdate(Token token, String name, PlaybackInfo pi) {
- if (!mRemoteStreams.containsKey(token)) {
- mRemoteStreams.put(token, mNextStream);
- if (D.BUG) Log.d(TAG, "onRemoteUpdate: " + name + " is stream " + mNextStream);
- mNextStream++;
- }
+ addStream(token, "onRemoteUpdate");
final int stream = mRemoteStreams.get(token);
boolean changed = mState.states.indexOfKey(stream) < 0;
final StreamState ss = streamStateW(stream);
@@ -942,6 +938,7 @@
@Override
public void onRemoteVolumeChanged(Token token, int flags) {
+ addStream(token, "onRemoteVolumeChanged");
final int stream = mRemoteStreams.get(token);
final boolean showUI = shouldShowUI(flags);
boolean changed = updateActiveStreamW(stream);
@@ -958,6 +955,11 @@
@Override
public void onRemoteRemoved(Token token) {
+ if (!mRemoteStreams.containsKey(token)) {
+ if (D.BUG) Log.d(TAG, "onRemoteRemoved: stream doesn't exist, "
+ + "aborting remote removed for token:" + token.toString());
+ return;
+ }
final int stream = mRemoteStreams.get(token);
mState.states.remove(stream);
if (mState.activeStream == stream) {
@@ -983,6 +985,15 @@
}
return null;
}
+
+ private void addStream(Token token, String triggeringMethod) {
+ if (!mRemoteStreams.containsKey(token)) {
+ mRemoteStreams.put(token, mNextStream);
+ if (D.BUG) Log.d(TAG, triggeringMethod + ": added stream " + mNextStream
+ + " from token + "+ token.toString());
+ mNextStream++;
+ }
+ }
}
public interface UserActivityListener {
diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto
index d6ca23f..a4849fc 100644
--- a/proto/src/metrics_constants.proto
+++ b/proto/src/metrics_constants.proto
@@ -4214,6 +4214,11 @@
// OS: O DR
ACTION_CAMERA_EVENT = 1032;
+ // OPEN: Settings > Trampoline Intent > Settings page
+ // CATEGORY: SETTINGS
+ // OS: O DR
+ TRAMPOLINE_SETTINGS_EVENT = 1033;
+
// ---- End O-DR1 Constants, all O-DR1 constants go above this line ----
// Add new aosp constants above this line.
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index f718e80..383cc8b 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -2955,6 +2955,11 @@
synchronized (mLock) {
mLocalUnlockedUsers = ArrayUtils.appendInt(mLocalUnlockedUsers, userId);
}
+ if (userId == UserHandle.USER_SYSTEM) {
+ String propertyName = "sys.user." + userId + ".ce_available";
+ Slog.d(TAG, "Setting property: " + propertyName + "=true");
+ SystemProperties.set(propertyName, "true");
+ }
}
@Override
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index cbd02ac..e858edb 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -165,11 +165,11 @@
// a stylish color fade animation instead.
private boolean mColorFadeFadesConfig;
- // True if we need to transition to the off state when coming out of a doze state.
- // Some display hardware will show artifacts (flickers, etc) when transitioning from a doze
- // to a fully on state. In order to hide these, we first transition to off to let the system
- // animate the screen on as it normally would, which is a much smoother experience.
- private boolean mTransitionOffAfterDozeConfig;
+ // True if we need to fake a transition to off when coming out of a doze state.
+ // Some display hardware will blank itself when coming out of doze in order to hide
+ // artifacts. For these displays we fake a transition into OFF so that policy can appropriately
+ // blank itself and begin an appropriate power on animation.
+ private boolean mDisplayBlanksAfterDozeConfig;
// The pending power request.
// Initially null until the first call to requestPowerState.
@@ -416,8 +416,8 @@
mColorFadeFadesConfig = resources.getBoolean(
com.android.internal.R.bool.config_animateScreenLights);
- mTransitionOffAfterDozeConfig = resources.getBoolean(
- com.android.internal.R.bool.config_displayTransitionOffAfterDoze);
+ mDisplayBlanksAfterDozeConfig = resources.getBoolean(
+ com.android.internal.R.bool.config_displayBlanksAfterDoze);
if (!DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT) {
mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
@@ -803,7 +803,7 @@
// Notify policy about screen turned on.
if (ready && state != Display.STATE_OFF
&& mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_ON) {
- mReportedScreenStateToPolicy = REPORTED_TO_POLICY_SCREEN_ON;
+ setReportedScreenState(REPORTED_TO_POLICY_SCREEN_ON);
mWindowManagerPolicy.screenTurnedOn();
}
@@ -886,10 +886,10 @@
}
private boolean setScreenState(int state) {
- return setScreenState(state, false /*force*/);
+ return setScreenState(state, false /*reportOnly*/);
}
- private boolean setScreenState(int state, boolean force) {
+ private boolean setScreenState(int state, boolean reportOnly) {
final boolean isOff = (state == Display.STATE_OFF);
if (mPowerState.getScreenState() != state) {
@@ -897,32 +897,24 @@
// actually turn the screen off.
if (isOff && !mScreenOffBecauseOfProximity) {
if (mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_ON) {
- mReportedScreenStateToPolicy = REPORTED_TO_POLICY_SCREEN_TURNING_OFF;
+ setReportedScreenState(REPORTED_TO_POLICY_SCREEN_TURNING_OFF);
blockScreenOff();
mWindowManagerPolicy.screenTurningOff(mPendingScreenOffUnblocker);
- if (force) {
- // If we're forcing the power state transition then immediately
- // unblock the screen off event. This keeps the lifecycle consistent,
- // so WindowManagerPolicy will always see screenTurningOff before
- // screenTurnedOff, but we don't actually block on them for the state
- // change.
- unblockScreenOff();
- } else {
- return false;
- }
+ unblockScreenOff();
} else if (mPendingScreenOffUnblocker != null) {
// Abort doing the state change until screen off is unblocked.
return false;
}
}
- mPowerState.setScreenState(state);
-
- // Tell battery stats about the transition.
- try {
- mBatteryStats.noteScreenState(state);
- } catch (RemoteException ex) {
- // same process
+ if (!reportOnly) {
+ mPowerState.setScreenState(state);
+ // Tell battery stats about the transition.
+ try {
+ mBatteryStats.noteScreenState(state);
+ } catch (RemoteException ex) {
+ // same process
+ }
}
}
@@ -934,7 +926,7 @@
// finished drawing underneath.
if (isOff && mReportedScreenStateToPolicy != REPORTED_TO_POLICY_SCREEN_OFF
&& !mScreenOffBecauseOfProximity) {
- mReportedScreenStateToPolicy = REPORTED_TO_POLICY_SCREEN_OFF;
+ setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
unblockScreenOn();
mWindowManagerPolicy.screenTurnedOff();
} else if (!isOff
@@ -944,10 +936,10 @@
// Complete the full state transition on -> turningOff -> off.
unblockScreenOff();
mWindowManagerPolicy.screenTurnedOff();
- mReportedScreenStateToPolicy = REPORTED_TO_POLICY_SCREEN_OFF;
+ setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
}
if (!isOff && mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_OFF) {
- mReportedScreenStateToPolicy = REPORTED_TO_POLICY_SCREEN_TURNING_ON;
+ setReportedScreenState(REPORTED_TO_POLICY_SCREEN_TURNING_ON);
if (mPowerState.getColorFadeLevel() == 0.0f) {
blockScreenOn();
} else {
@@ -960,6 +952,11 @@
return mPendingScreenOnUnblocker == null;
}
+ private void setReportedScreenState(int state) {
+ Trace.traceCounter(Trace.TRACE_TAG_POWER, "ReportedScreenStateToPolicy", state);
+ mReportedScreenStateToPolicy = state;
+ }
+
private int clampScreenBrightness(int value) {
return MathUtils.constrain(
value, mScreenBrightnessRangeMinimum, mScreenBrightnessRangeMaximum);
@@ -989,15 +986,20 @@
mPendingScreenOff = false;
}
- if (mTransitionOffAfterDozeConfig &&
- Display.isDozeState(mPowerState.getScreenState())
+ if (mDisplayBlanksAfterDozeConfig
+ && Display.isDozeState(mPowerState.getScreenState())
&& !Display.isDozeState(target)) {
- setScreenState(Display.STATE_OFF, true /*force*/);
// Skip the screen off animation and add a black surface to hide the
- // contents of the screen. This will also trigger another power state update so that we
- // end up converging on the target state.
+ // contents of the screen.
+ mPowerState.prepareColorFade(mContext,
+ mColorFadeFadesConfig ? ColorFade.MODE_FADE : ColorFade.MODE_WARM_UP);
mColorFadeOffAnimator.end();
- return;
+ // Some display hardware will blank itself on the transition between doze and non-doze
+ // but still on display states. In this case we want to report to policy that the
+ // display has turned off so it can prepare the appropriate power on animation, but we
+ // don't want to actually transition to the fully off state since that takes
+ // significantly longer to transition from.
+ setScreenState(Display.STATE_OFF, target != Display.STATE_OFF /*reportOnly*/);
}
// If we were in the process of turning off the screen but didn't quite
@@ -1295,7 +1297,8 @@
pw.println(" mAppliedLowPower=" + mAppliedLowPower);
pw.println(" mPendingScreenOnUnblocker=" + mPendingScreenOnUnblocker);
pw.println(" mPendingScreenOff=" + mPendingScreenOff);
- pw.println(" mReportedToPolicy=" + reportedToPolicyToString(mReportedScreenStateToPolicy));
+ pw.println(" mReportedToPolicy=" +
+ reportedToPolicyToString(mReportedScreenStateToPolicy));
pw.println(" mScreenBrightnessRampAnimator.isAnimating()=" +
mScreenBrightnessRampAnimator.isAnimating());
diff --git a/services/core/java/com/android/server/display/DisplayPowerState.java b/services/core/java/com/android/server/display/DisplayPowerState.java
index e2fd0ac..7b55ec1 100644
--- a/services/core/java/com/android/server/display/DisplayPowerState.java
+++ b/services/core/java/com/android/server/display/DisplayPowerState.java
@@ -20,6 +20,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
+import android.os.Trace;
import android.util.FloatProperty;
import android.util.IntProperty;
import android.util.Slog;
@@ -49,6 +50,7 @@
private static final String TAG = "DisplayPowerState";
private static boolean DEBUG = false;
+ private static String COUNTER_COLOR_FADE = "ColorFadeLevel";
private final Handler mHandler;
private final Choreographer mChoreographer;
@@ -190,6 +192,7 @@
* Dismisses the color fade surface.
*/
public void dismissColorFade() {
+ Trace.traceCounter(Trace.TRACE_TAG_POWER, COUNTER_COLOR_FADE, 100);
mColorFade.dismiss();
mColorFadePrepared = false;
mColorFadeReady = true;
@@ -328,6 +331,8 @@
if (mColorFadePrepared) {
mColorFade.draw(mColorFadeLevel);
+ Trace.traceCounter(Trace.TRACE_TAG_POWER,
+ COUNTER_COLOR_FADE, Math.round(mColorFadeLevel* 100));
}
mColorFadeReady = true;
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index cdc973b..ce5f430 100644
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -515,6 +515,7 @@
try {
final int mode = getPowerModeForState(state);
SurfaceControl.setDisplayPowerMode(token, mode);
+ Trace.traceCounter(Trace.TRACE_TAG_POWER, "DisplayPowerMode", mode);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
@@ -530,6 +531,8 @@
+ "id=" + displayId + ", brightness=" + brightness + ")");
try {
mBacklight.setBrightness(brightness);
+ Trace.traceCounter(Trace.TRACE_TAG_POWER,
+ "DisplayBrightness", brightness);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
index 98c65fd..7cacdb8 100644
--- a/services/core/java/com/android/server/job/JobSchedulerService.java
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -355,11 +355,11 @@
synchronized (mLock) {
try {
mParser.setString(Settings.Global.getString(mResolver,
- Settings.Global.ALARM_MANAGER_CONSTANTS));
+ Settings.Global.JOB_SCHEDULER_CONSTANTS));
} catch (IllegalArgumentException e) {
// Failed to parse the settings string, log this and move on
// with defaults.
- Slog.e(TAG, "Bad device idle settings", e);
+ Slog.e(TAG, "Bad jobscheduler settings", e);
}
MIN_IDLE_COUNT = mParser.getInt(KEY_MIN_IDLE_COUNT,
diff --git a/services/core/java/com/android/server/media/AudioPlaybackMonitor.java b/services/core/java/com/android/server/media/AudioPlaybackMonitor.java
index c6dc11c..f6f7676 100644
--- a/services/core/java/com/android/server/media/AudioPlaybackMonitor.java
+++ b/services/core/java/com/android/server/media/AudioPlaybackMonitor.java
@@ -31,17 +31,22 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
- * Monitors changes in audio playback and notify the newly started audio playback through the
- * {@link OnAudioPlaybackStartedListener}.
+ * Monitors changes in audio playback, and notify the newly started audio playback through the
+ * {@link OnAudioPlaybackStartedListener} and the activeness change through the
+ * {@link OnAudioPlaybackActiveStateListener}.
*/
class AudioPlaybackMonitor extends IPlaybackConfigDispatcher.Stub {
private static boolean DEBUG = MediaSessionService.DEBUG;
private static String TAG = "AudioPlaybackMonitor";
+ private static AudioPlaybackMonitor sInstance;
+
/**
* Called when audio playback is started for a given UID.
*/
@@ -49,22 +54,36 @@
void onAudioPlaybackStarted(int uid);
}
+ /**
+ * Called when audio player state is changed.
+ */
+ interface OnAudioPlayerActiveStateChangedListener {
+ void onAudioPlayerActiveStateChanged(int uid, boolean active);
+ }
+
private final Object mLock = new Object();
private final Context mContext;
- private final OnAudioPlaybackStartedListener mListener;
-
- private Set<Integer> mActiveAudioPlaybackPlayerInterfaceIds = new HashSet<>();
- private Set<Integer> mActiveAudioPlaybackClientUids = new HashSet<>();
+ private final List<OnAudioPlaybackStartedListener> mAudioPlaybackStartedListeners
+ = new ArrayList<>();
+ private final List<OnAudioPlayerActiveStateChangedListener>
+ mAudioPlayerActiveStateChangedListeners = new ArrayList<>();
+ private final Map<Integer, Integer> mAudioPlaybackStates = new HashMap<>();
+ private final Set<Integer> mActiveAudioPlaybackClientUids = new HashSet<>();
// Sorted array of UIDs that had active audio playback. (i.e. playing an audio/video)
// The UID whose audio playback becomes active at the last comes first.
// TODO(b/35278867): Find and use unique identifier for apps because apps may share the UID.
private final IntArray mSortedAudioPlaybackClientUids = new IntArray();
- AudioPlaybackMonitor(Context context, IAudioService audioService,
- OnAudioPlaybackStartedListener listener) {
+ static AudioPlaybackMonitor getInstance(Context context, IAudioService audioService) {
+ if (sInstance == null) {
+ sInstance = new AudioPlaybackMonitor(context, audioService);
+ }
+ return sInstance;
+ }
+
+ private AudioPlaybackMonitor(Context context, IAudioService audioService) {
mContext = context;
- mListener = listener;
try {
audioService.registerPlaybackCallback(this);
} catch (RemoteException e) {
@@ -84,9 +103,12 @@
public void dispatchPlaybackConfigChange(List<AudioPlaybackConfiguration> configs) {
final long token = Binder.clearCallingIdentity();
try {
- Set<Integer> newActiveAudioPlaybackPlayerInterfaceIds = new HashSet<>();
List<Integer> newActiveAudioPlaybackClientUids = new ArrayList<>();
+ List<OnAudioPlayerActiveStateChangedListener> audioPlayerActiveStateChangedListeners;
+ List<OnAudioPlaybackStartedListener> audioPlaybackStartedListeners;
synchronized (mLock) {
+ // Update mActiveAudioPlaybackClientUids and mSortedAudioPlaybackClientUids,
+ // and find newly activated audio playbacks.
mActiveAudioPlaybackClientUids.clear();
for (AudioPlaybackConfiguration config : configs) {
// Ignore inactive (i.e. not playing) or PLAYER_TYPE_JAM_SOUNDPOOL
@@ -94,16 +116,14 @@
// playback.
// Note that we shouldn't ignore PLAYER_TYPE_UNKNOWN because it might be OEM
// specific audio/video players.
- if (!config.isActive()
- || config.getPlayerType()
+ if (!config.isActive() || config.getPlayerType()
== AudioPlaybackConfiguration.PLAYER_TYPE_JAM_SOUNDPOOL) {
continue;
}
- mActiveAudioPlaybackClientUids.add(config.getClientUid());
- newActiveAudioPlaybackPlayerInterfaceIds.add(config.getPlayerInterfaceId());
- if (!mActiveAudioPlaybackPlayerInterfaceIds.contains(
- config.getPlayerInterfaceId())) {
+ mActiveAudioPlaybackClientUids.add(config.getClientUid());
+ Integer oldState = mAudioPlaybackStates.get(config.getPlayerInterfaceId());
+ if (!isActiveState(oldState)) {
if (DEBUG) {
Log.d(TAG, "Found a new active media playback. " +
AudioPlaybackConfiguration.toLogFriendlyString(config));
@@ -120,11 +140,32 @@
mSortedAudioPlaybackClientUids.add(0, config.getClientUid());
}
}
- mActiveAudioPlaybackPlayerInterfaceIds.clear();
- mActiveAudioPlaybackPlayerInterfaceIds = newActiveAudioPlaybackPlayerInterfaceIds;
+ audioPlayerActiveStateChangedListeners = new ArrayList<>(
+ mAudioPlayerActiveStateChangedListeners);
+ audioPlaybackStartedListeners = new ArrayList<>(mAudioPlaybackStartedListeners);
}
+ // Notify the change of audio playback states.
+ for (AudioPlaybackConfiguration config : configs) {
+ boolean wasActive = isActiveState(
+ mAudioPlaybackStates.get(config.getPlayerInterfaceId()));
+ boolean isActive = config.isActive();
+ if (wasActive != isActive) {
+ for (OnAudioPlayerActiveStateChangedListener listener
+ : audioPlayerActiveStateChangedListeners) {
+ listener.onAudioPlayerActiveStateChanged(config.getClientUid(),
+ isActive);
+ }
+ }
+ }
+ // Notify the start of audio playback
for (int uid : newActiveAudioPlaybackClientUids) {
- mListener.onAudioPlaybackStarted(uid);
+ for (OnAudioPlaybackStartedListener listener : audioPlaybackStartedListeners) {
+ listener.onAudioPlaybackStarted(uid);
+ }
+ }
+ mAudioPlaybackStates.clear();
+ for (AudioPlaybackConfiguration config : configs) {
+ mAudioPlaybackStates.put(config.getPlayerInterfaceId(), config.getPlayerState());
}
} finally {
Binder.restoreCallingIdentity(token);
@@ -132,6 +173,44 @@
}
/**
+ * Registers OnAudioPlaybackStartedListener.
+ */
+ public void registerOnAudioPlaybackStartedListener(OnAudioPlaybackStartedListener listener) {
+ synchronized (mLock) {
+ mAudioPlaybackStartedListeners.add(listener);
+ }
+ }
+
+ /**
+ * Unregisters OnAudioPlaybackStartedListener.
+ */
+ public void unregisterOnAudioPlaybackStartedListener(OnAudioPlaybackStartedListener listener) {
+ synchronized (mLock) {
+ mAudioPlaybackStartedListeners.remove(listener);
+ }
+ }
+
+ /**
+ * Registers OnAudioPlayerActiveStateChangedListener.
+ */
+ public void registerOnAudioPlayerActiveStateChangedListener(
+ OnAudioPlayerActiveStateChangedListener listener) {
+ synchronized (mLock) {
+ mAudioPlayerActiveStateChangedListeners.add(listener);
+ }
+ }
+
+ /**
+ * Unregisters OnAudioPlayerActiveStateChangedListener.
+ */
+ public void unregisterOnAudioPlayerActiveStateChangedListener(
+ OnAudioPlayerActiveStateChangedListener listener) {
+ synchronized (mLock) {
+ mAudioPlayerActiveStateChangedListeners.remove(listener);
+ }
+ }
+
+ /**
* Returns the sorted list of UIDs that have had active audio playback. (i.e. playing an
* audio/video) The UID whose audio playback becomes active at the last comes first.
*/
@@ -167,7 +246,8 @@
if (mSortedAudioPlaybackClientUids.get(i) == mediaButtonSessionUid) {
break;
}
- if (userId == UserHandle.getUserId(mSortedAudioPlaybackClientUids.get(i))) {
+ int uid = mSortedAudioPlaybackClientUids.get(i);
+ if (userId == UserHandle.getUserId(uid) && !isPlaybackActive(uid)) {
// Clean up unnecessary UIDs.
// It doesn't need to be managed profile aware because it's just to prevent
// the list from increasing indefinitely. The media button session updating
@@ -198,4 +278,8 @@
}
}
}
+
+ private boolean isActiveState(Integer state) {
+ return state != null && state.equals(AudioPlaybackConfiguration.PLAYER_STATE_STARTED);
+ }
}
diff --git a/services/core/java/com/android/server/media/MediaRouterService.java b/services/core/java/com/android/server/media/MediaRouterService.java
index d1fa5ef..922df1e 100644
--- a/services/core/java/com/android/server/media/MediaRouterService.java
+++ b/services/core/java/com/android/server/media/MediaRouterService.java
@@ -18,6 +18,7 @@
import com.android.internal.util.DumpUtils;
import com.android.server.Watchdog;
+import com.android.server.media.AudioPlaybackMonitor.OnAudioPlayerActiveStateChangedListener;
import android.Manifest;
import android.app.ActivityManager;
@@ -26,7 +27,10 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
+import android.media.AudioRoutesInfo;
import android.media.AudioSystem;
+import android.media.IAudioRoutesObserver;
+import android.media.IAudioService;
import android.media.IMediaRouterClient;
import android.media.IMediaRouterService;
import android.media.MediaRouter;
@@ -39,9 +43,12 @@
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
+import android.os.ServiceManager;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.text.TextUtils;
import android.util.ArrayMap;
+import android.util.IntArray;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
@@ -89,10 +96,54 @@
private final ArrayMap<IBinder, ClientRecord> mAllClientRecords =
new ArrayMap<IBinder, ClientRecord>();
private int mCurrentUserId = -1;
+ private boolean mHasBluetoothRoute = false;
+ private final IAudioService mAudioService;
+ private final AudioPlaybackMonitor mAudioPlaybackMonitor;
public MediaRouterService(Context context) {
mContext = context;
Watchdog.getInstance().addMonitor(this);
+
+ mAudioService = IAudioService.Stub.asInterface(
+ ServiceManager.getService(Context.AUDIO_SERVICE));
+
+ mAudioPlaybackMonitor = AudioPlaybackMonitor.getInstance(context, mAudioService);
+ mAudioPlaybackMonitor.registerOnAudioPlayerActiveStateChangedListener(
+ new AudioPlaybackMonitor.OnAudioPlayerActiveStateChangedListener() {
+ @Override
+ public void onAudioPlayerActiveStateChanged(int uid, boolean active) {
+ if (active) {
+ restoreRoute(uid);
+ } else {
+ IntArray sortedAudioPlaybackClientUids =
+ mAudioPlaybackMonitor.getSortedAudioPlaybackClientUids();
+ boolean restored = false;
+ for (int i = 0; i < sortedAudioPlaybackClientUids.size(); i++) {
+ if (mAudioPlaybackMonitor.isPlaybackActive(
+ sortedAudioPlaybackClientUids.get(i))) {
+ restoreRoute(sortedAudioPlaybackClientUids.get(i));
+ restored = true;
+ break;
+ }
+ }
+ if (!restored) {
+ restoreBluetoothA2dp();
+ }
+ }
+ }
+ });
+ AudioRoutesInfo audioRoutes = null;
+ try {
+ audioRoutes = mAudioService.startWatchingRoutes(new IAudioRoutesObserver.Stub() {
+ @Override
+ public void dispatchAudioRoutesChanged(final AudioRoutesInfo newRoutes) {
+ mHasBluetoothRoute = newRoutes.bluetoothName != null;
+ }
+ });
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in the audio service.");
+ }
+ mHasBluetoothRoute = (audioRoutes != null && audioRoutes.bluetoothName != null);
}
public void systemRunning() {
@@ -135,7 +186,7 @@
final long token = Binder.clearCallingIdentity();
try {
synchronized (mLock) {
- registerClientLocked(client, pid, packageName, resolvedUserId, trusted);
+ registerClientLocked(client, uid, pid, packageName, resolvedUserId, trusted);
}
} finally {
Binder.restoreCallingIdentity(token);
@@ -178,6 +229,23 @@
// Binder call
@Override
+ public boolean isPlaybackActive(IMediaRouterClient client) {
+ if (client == null) {
+ throw new IllegalArgumentException("client must not be null");
+ }
+
+ final long token = Binder.clearCallingIdentity();
+ try {
+ synchronized (mLock) {
+ return isPlaybackActiveLocked(client);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ // Binder call
+ @Override
public void setDiscoveryRequest(IMediaRouterClient client,
int routeTypes, boolean activeScan) {
if (client == null) {
@@ -276,6 +344,36 @@
}
}
+ void restoreBluetoothA2dp() {
+ try {
+ mAudioService.setBluetoothA2dpOn(mHasBluetoothRoute);
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException while calling setBluetoothA2dpOn.");
+ }
+ }
+
+ void restoreRoute(int uid) {
+ ClientRecord clientRecord = null;
+ UserRecord userRecord = mUserRecords.get(UserHandle.getUserId(uid));
+ if (userRecord != null && userRecord.mClientRecords != null) {
+ for (ClientRecord cr : userRecord.mClientRecords) {
+ if (validatePackageName(uid, cr.mPackageName)) {
+ clientRecord = cr;
+ break;
+ }
+ }
+ }
+ if (clientRecord != null) {
+ try {
+ clientRecord.mClient.onRestoreRoute();
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Failed to call onRestoreRoute. Client probably died.");
+ }
+ } else {
+ restoreBluetoothA2dp();
+ }
+ }
+
void switchUser() {
synchronized (mLock) {
int userId = ActivityManager.getCurrentUser();
@@ -304,7 +402,7 @@
}
private void registerClientLocked(IMediaRouterClient client,
- int pid, String packageName, int userId, boolean trusted) {
+ int uid, int pid, String packageName, int userId, boolean trusted) {
final IBinder binder = client.asBinder();
ClientRecord clientRecord = mAllClientRecords.get(binder);
if (clientRecord == null) {
@@ -314,7 +412,7 @@
userRecord = new UserRecord(userId);
newUser = true;
}
- clientRecord = new ClientRecord(userRecord, client, pid, packageName, trusted);
+ clientRecord = new ClientRecord(userRecord, client, uid, pid, packageName, trusted);
try {
binder.linkToDeath(clientRecord, 0);
} catch (RemoteException ex) {
@@ -350,6 +448,14 @@
return null;
}
+ private boolean isPlaybackActiveLocked(IMediaRouterClient client) {
+ ClientRecord clientRecord = mAllClientRecords.get(client.asBinder());
+ if (clientRecord != null) {
+ return mAudioPlaybackMonitor.isPlaybackActive(clientRecord.mUid);
+ }
+ return false;
+ }
+
private void setDiscoveryRequestLocked(IMediaRouterClient client,
int routeTypes, boolean activeScan) {
final IBinder binder = client.asBinder();
@@ -489,6 +595,7 @@
final class ClientRecord implements DeathRecipient {
public final UserRecord mUserRecord;
public final IMediaRouterClient mClient;
+ public final int mUid;
public final int mPid;
public final String mPackageName;
public final boolean mTrusted;
@@ -498,9 +605,10 @@
public String mSelectedRouteId;
public ClientRecord(UserRecord userRecord, IMediaRouterClient client,
- int pid, String packageName, boolean trusted) {
+ int uid, int pid, String packageName, boolean trusted) {
mUserRecord = userRecord;
mClient = client;
+ mUid = uid;
mPid = pid;
mPackageName = packageName;
mTrusted = trusted;
@@ -997,7 +1105,7 @@
try {
mTempClients.get(i).onStateChanged();
} catch (RemoteException ex) {
- // ignore errors, client probably died
+ Slog.w(TAG, "Failed to call onStateChanged. Client probably died.");
}
}
} finally {
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index 38c6157..adb50f0 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -138,19 +138,20 @@
mKeyguardManager =
(KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
mAudioService = getAudioService();
- mAudioPlaybackMonitor = new AudioPlaybackMonitor(getContext(), mAudioService,
+ mAudioPlaybackMonitor = AudioPlaybackMonitor.getInstance(getContext(), mAudioService);
+ mAudioPlaybackMonitor.registerOnAudioPlaybackStartedListener(
new AudioPlaybackMonitor.OnAudioPlaybackStartedListener() {
- @Override
- public void onAudioPlaybackStarted(int uid) {
- synchronized (mLock) {
- FullUserRecord user =
- getFullUserRecordLocked(UserHandle.getUserId(uid));
- if (user != null) {
- user.mPriorityStack.updateMediaButtonSessionIfNeeded();
- }
- }
+ @Override
+ public void onAudioPlaybackStarted(int uid) {
+ synchronized (mLock) {
+ FullUserRecord user =
+ getFullUserRecordLocked(UserHandle.getUserId(uid));
+ if (user != null) {
+ user.mPriorityStack.updateMediaButtonSessionIfNeeded();
}
- });
+ }
+ }
+ });
mAudioManagerInternal = LocalServices.getService(AudioManagerInternal.class);
mContentResolver = getContext().getContentResolver();
mSettingsObserver = new SettingsObserver();
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java
index 56612ad..e894275 100644
--- a/services/core/java/com/android/server/power/ShutdownThread.java
+++ b/services/core/java/com/android/server/power/ShutdownThread.java
@@ -20,7 +20,10 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.IActivityManager;
+import android.app.KeyguardManager;
import android.app.ProgressDialog;
+import android.app.WallpaperColors;
+import android.app.WallpaperManager;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.IBluetoothManager;
import android.content.BroadcastReceiver;
@@ -28,7 +31,6 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.om.IOverlayManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioAttributes;
@@ -53,6 +55,7 @@
import android.view.WindowManager;
import android.widget.ProgressBar;
import android.widget.TextView;
+
import com.android.internal.telephony.ITelephony;
import com.android.server.pm.PackageManagerService;
@@ -300,17 +303,21 @@
d.setContentView(com.android.internal.R.layout.shutdown_dialog);
d.setCancelable(false);
- int color = Color.WHITE;
+ int color;
try {
- IOverlayManager service = IOverlayManager.Stub.asInterface(
- ServiceManager.getService(Context.OVERLAY_SERVICE));
- if (service.getOverlayInfo("com.android.systemui.theme.lightwallpaper", 0).isEnabled()) {
- color = Color.BLACK;
- }
+ boolean onKeyguard = context.getSystemService(
+ KeyguardManager.class).isKeyguardLocked();
+ WallpaperColors currentColors = context.getSystemService(WallpaperManager.class)
+ .getWallpaperColors(onKeyguard ?
+ WallpaperManager.FLAG_LOCK : WallpaperManager.FLAG_SYSTEM);
+ color = currentColors != null &&
+ (currentColors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT)
+ != 0 ?
+ Color.BLACK : Color.WHITE;
} catch (Exception e) {
- // Shutdown UI really shouldn't crash or have strict dependencies on other services.
- Log.w(TAG, "Problem getting overlay state", e);
+ color = Color.WHITE;
}
+
ProgressBar bar = d.findViewById(com.android.internal.R.id.progress);
bar.getIndeterminateDrawable().setTint(color);
((TextView) d.findViewById(com.android.internal.R.id.text1)).setTextColor(color);