Merge "Fixed a bug where shelf notifications were interactable" into oc-dr1-dev
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 46e597a..d59e993 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -33,6 +33,7 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ShortcutInfo;
import android.content.res.ColorStateList;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -1090,6 +1091,11 @@
public static final String EXTRA_CONTAINS_CUSTOM_VIEW = "android.contains.customView";
/**
+ * @hide
+ */
+ public static final String EXTRA_REDUCED_IMAGES = "android.reduced.images";
+
+ /**
* {@link #extras} key: the audio contents of this notification.
*
* This is for use when rendering the notification on an audio-focused interface;
@@ -4943,9 +4949,13 @@
buildUnstyled();
if (mStyle != null) {
+ mStyle.reduceImageSizes(mContext);
+ mStyle.purgeResources();
mStyle.buildStyled(mN);
}
+ mN.reduceImageSizes(mContext);
+
if (mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N
&& (useExistingRemoteView())) {
if (mN.contentView == null) {
@@ -5135,6 +5145,52 @@
}
/**
+ * Reduces the image sizes to conform to a maximum allowed size. This also processes all custom
+ * remote views.
+ *
+ * @hide
+ */
+ void reduceImageSizes(Context context) {
+ if (extras.getBoolean(EXTRA_REDUCED_IMAGES)) {
+ return;
+ }
+ if (mLargeIcon != null || largeIcon != null) {
+ Resources resources = context.getResources();
+ Class<? extends Style> style = getNotificationStyle();
+ int maxWidth = resources.getDimensionPixelSize(R.dimen.notification_right_icon_size);
+ int maxHeight = maxWidth;
+ if (MediaStyle.class.equals(style)
+ || DecoratedMediaCustomViewStyle.class.equals(style)) {
+ maxHeight = resources.getDimensionPixelSize(
+ R.dimen.notification_media_image_max_height);
+ maxWidth = resources.getDimensionPixelSize(
+ R.dimen.notification_media_image_max_width);
+ }
+ if (mLargeIcon != null) {
+ mLargeIcon.scaleDownIfNecessary(maxWidth, maxHeight);
+ }
+ if (largeIcon != null) {
+ largeIcon = Icon.scaleDownIfNecessary(largeIcon, maxWidth, maxHeight);
+ }
+ }
+ reduceImageSizesForRemoteView(contentView, context);
+ reduceImageSizesForRemoteView(headsUpContentView, context);
+ reduceImageSizesForRemoteView(bigContentView, context);
+ extras.putBoolean(EXTRA_REDUCED_IMAGES, true);
+ }
+
+ private void reduceImageSizesForRemoteView(RemoteViews remoteView, Context context) {
+ if (remoteView != null) {
+ Resources resources = context.getResources();
+ int maxWidth = resources.getDimensionPixelSize(
+ R.dimen.notification_custom_view_max_image_width);
+ int maxHeight = resources.getDimensionPixelSize(
+ R.dimen.notification_custom_view_max_image_height);
+ remoteView.reduceImageSizes(maxWidth, maxHeight);
+ }
+ }
+
+ /**
* @return whether this notification is a foreground service notification
*/
private boolean isForegroundService() {
@@ -5435,6 +5491,14 @@
public boolean displayCustomViewInline() {
return false;
}
+
+ /**
+ * Reduces the image sizes contained in this style.
+ *
+ * @hide
+ */
+ public void reduceImageSizes(Context context) {
+ }
}
/**
@@ -5533,6 +5597,27 @@
/**
* @hide
*/
+ @Override
+ public void reduceImageSizes(Context context) {
+ super.reduceImageSizes(context);
+ Resources resources = context.getResources();
+ if (mPicture != null) {
+ int maxPictureWidth = resources.getDimensionPixelSize(
+ R.dimen.notification_big_picture_max_height);
+ int maxPictureHeight = resources.getDimensionPixelSize(
+ R.dimen.notification_big_picture_max_width);
+ mPicture = Icon.scaleDownIfNecessary(mPicture, maxPictureWidth, maxPictureHeight);
+ }
+ if (mBigLargeIcon != null) {
+ int rightIconSize = resources.getDimensionPixelSize(
+ R.dimen.notification_right_icon_size);
+ mBigLargeIcon.scaleDownIfNecessary(rightIconSize, rightIconSize);
+ }
+ }
+
+ /**
+ * @hide
+ */
public RemoteViews makeBigContentView() {
// Replace mN.mLargeIcon with mBigLargeIcon if mBigLargeIconSet
// This covers the following cases:
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 235b8d4..fe2168b 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -18,14 +18,12 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.annotation.SdkConstant;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.app.Notification.Builder;
import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
import android.content.pm.ParceledListSlice;
import android.graphics.drawable.Icon;
import android.net.Uri;
@@ -33,7 +31,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
-import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
@@ -41,7 +38,6 @@
import android.os.StrictMode;
import android.os.UserHandle;
import android.provider.Settings.Global;
-import android.service.notification.NotificationListenerService.Ranking;
import android.service.notification.StatusBarNotification;
import android.service.notification.ZenModeConfig;
import android.util.ArraySet;
@@ -312,6 +308,7 @@
}
}
if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
+ notification.reduceImageSizes(mContext);
final Notification copy = Builder.maybeCloneStrippedForDelivery(notification);
try {
service.enqueueNotificationWithTag(pkg, mContext.getOpPackageName(), tag, id,
@@ -418,12 +415,16 @@
* Creates a notification channel that notifications can be posted to.
*
* This can also be used to restore a deleted channel and to update an existing channel's
- * name and description.
+ * name, description, and/or importance.
*
* <p>The name and description should only be changed if the locale changes
* or in response to the user renaming this channel. For example, if a user has a channel
* named 'John Doe' that represents messages from a 'John Doe', and 'John Doe' changes his name
* to 'John Smith,' the channel can be renamed to match.
+ *
+ * <p>The importance of an existing channel will only be changed if the new importance is lower
+ * than the current value and the user has not altered any settings on this channel.
+ *
* All other fields are ignored for channels that already exist.
*
* @param channel the channel to create. Note that the created channel may differ from this
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index b178d81..19fb15c 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -5606,8 +5606,10 @@
pw.print(',');
if (rec.stepDetails.statPlatformIdleState != null) {
pw.print(rec.stepDetails.statPlatformIdleState);
+ if (rec.stepDetails.statSubsystemPowerState != null) {
+ pw.print(',');
+ }
}
- pw.println();
if (rec.stepDetails.statSubsystemPowerState != null) {
pw.print(rec.stepDetails.statSubsystemPowerState);
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 7fa1c5a..673a8ba 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -24,11 +24,11 @@
import android.annotation.SystemService;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
-import android.os.UserManager;
import android.provider.Settings;
import android.telephony.euicc.EuiccManager;
import android.text.TextUtils;
@@ -751,9 +751,7 @@
// Block until the ordered broadcast has completed.
condition.block();
- // TODO(b/63693573): Uncomment this once the pSIM slot is restored as needed
- // after the ensuing boot. Currently you end up stuck on the eSIM.
- // wipeEuiccData(context, wipeEuicc);
+ wipeEuiccData(context, wipeEuicc);
String shutdownArg = null;
if (shutdown) {
@@ -770,6 +768,14 @@
}
private static void wipeEuiccData(Context context, final boolean isWipeEuicc) {
+ ContentResolver cr = context.getContentResolver();
+ if (Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) == 0) {
+ // If the eUICC isn't provisioned, there's no reason to either wipe or retain profiles,
+ // as there's nothing to wipe nor retain.
+ Log.d(TAG, "Skipping eUICC wipe/retain as it is not provisioned");
+ return;
+ }
+
EuiccManager euiccManager = (EuiccManager) context.getSystemService(
Context.EUICC_SERVICE);
if (euiccManager != null && euiccManager.isEnabled()) {
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 3337def..12013fc 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -389,10 +389,13 @@
public static final String DISALLOW_ADD_MANAGED_PROFILE = "no_add_managed_profile";
/**
- * Specifies if a user is disallowed from disabling application verification.
- * Starting from {@link android.os.Build.VERSION_CODES#O}, application verification
- * is enforced across all users on the device if a profile owner or device owner sets
- * this restriction to <code>true</code>. The default value is <code>false</code>.
+ * Specifies if a user is disallowed from disabling application verification. The default
+ * value is <code>false</code>.
+ *
+ * <p>In Android 8.0 ({@linkplain android.os.Build.VERSION_CODES#O API level 26}) and higher,
+ * this is a global user restriction. If a device owner or profile owner sets this restriction,
+ * the system enforces app verification across all users on the device. Running in earlier
+ * Android versions, this restriction affects only the profile that sets it.
*
* <p>Key for user restrictions.
* <p>Type: Boolean
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index a19f05c..cac27af 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -729,7 +729,7 @@
mLocation[1] = getHeight();
mScreenRect.set(mWindowSpaceLeft, mWindowSpaceTop,
- mLocation[0], mLocation[1]);
+ mWindowSpaceLeft + mLocation[0], mWindowSpaceTop + mLocation[1]);
if (mTranslator != null) {
mTranslator.translateRectInAppWindowToScreen(mScreenRect);
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index ba9e05c..668d25e 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -74,7 +74,6 @@
import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
-import android.os.PowerManager;
import android.os.RemoteException;
import android.util.Slog;
import android.view.animation.Animation;
@@ -1317,12 +1316,12 @@
public boolean isScreenOn();
/**
- * @return whether the device is currently {@link PowerManager#isInteractive() interactive}.
+ * @return whether the device is currently allowed to animate.
*
- * Note: the screen can be on while the device is not interactive, e.g. when the device is
- * showing Ambient Display.
+ * Note: this can be true even if it is not appropriate to animate for reasons that are outside
+ * of the policy's authority.
*/
- boolean isInteractive();
+ boolean okToAnimate();
/**
* Tell the policy that the lid switch has changed state.
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 7761dca..6e62351 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -199,6 +199,22 @@
}
/**
+ * Reduces all images and ensures that they are all below the given sizes.
+ *
+ * @param maxWidth the maximum width allowed
+ * @param maxHeight the maximum height allowed
+ *
+ * @hide
+ */
+ public void reduceImageSizes(int maxWidth, int maxHeight) {
+ ArrayList<Bitmap> cache = mBitmapCache.mBitmaps;
+ for (int i = 0; i < cache.size(); i++) {
+ Bitmap bitmap = cache.get(i);
+ cache.set(i, Icon.scaleDownIfNecessary(bitmap, maxWidth, maxHeight));
+ }
+ }
+
+ /**
* Handle with care!
*/
static class MutablePair<F, S> {
diff --git a/core/java/com/android/internal/app/MediaRouteControllerDialog.java b/core/java/com/android/internal/app/MediaRouteControllerDialog.java
index 5ce3e54..635a868 100644
--- a/core/java/com/android/internal/app/MediaRouteControllerDialog.java
+++ b/core/java/com/android/internal/app/MediaRouteControllerDialog.java
@@ -142,7 +142,11 @@
@Override
public void onClick(DialogInterface dialogInterface, int id) {
if (mRoute.isSelected()) {
- mRouter.getDefaultRoute().select();
+ if (mRoute.isBluetooth()) {
+ mRouter.getDefaultRoute().select();
+ } else {
+ mRouter.getFallbackRoute().select();
+ }
}
dismiss();
}
diff --git a/core/java/com/android/internal/policy/IKeyguardService.aidl b/core/java/com/android/internal/policy/IKeyguardService.aidl
index 3f35c91..69184c3 100644
--- a/core/java/com/android/internal/policy/IKeyguardService.aidl
+++ b/core/java/com/android/internal/policy/IKeyguardService.aidl
@@ -64,6 +64,11 @@
void onStartedWakingUp();
/**
+ * Called when the device has finished waking up.
+ */
+ void onFinishedWakingUp();
+
+ /**
* Called when the device screen is turning on.
*/
void onScreenTurningOn(IKeyguardDrawnCallback callback);
@@ -74,6 +79,11 @@
void onScreenTurnedOn();
/**
+ * Called when the screen starts turning off.
+ */
+ void onScreenTurningOff();
+
+ /**
* Called when the screen has turned off.
*/
void onScreenTurnedOff();
diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl
index 7d9538f..40ecc8c 100644
--- a/core/java/com/android/internal/statusbar/IStatusBar.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl
@@ -114,5 +114,5 @@
void addQsTile(in ComponentName tile);
void remQsTile(in ComponentName tile);
void clickQsTile(in ComponentName tile);
- void handleSystemNavigationKey(in int key);
+ void handleSystemKey(in int key);
}
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index 20db499..22eef07 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -75,5 +75,5 @@
void addTile(in ComponentName tile);
void remTile(in ComponentName tile);
void clickTile(in ComponentName tile);
- void handleSystemNavigationKey(in int key);
+ void handleSystemKey(in int key);
}
diff --git a/core/res/res/layout/notification_template_right_icon.xml b/core/res/res/layout/notification_template_right_icon.xml
index fbf7538..d379256 100644
--- a/core/res/res/layout/notification_template_right_icon.xml
+++ b/core/res/res/layout/notification_template_right_icon.xml
@@ -21,8 +21,8 @@
android:layout_height="wrap_content"
android:layout_gravity="top|end">
<ImageView android:id="@+id/right_icon"
- android:layout_width="40dp"
- android:layout_height="40dp"
+ android:layout_width="@dimen/notification_right_icon_size"
+ android:layout_height="@dimen/notification_right_icon_size"
android:layout_gravity="top|end"
android:layout_marginTop="36dp"
android:layout_marginEnd="@dimen/notification_content_margin_end"
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index 279d382..97da53d 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -245,7 +245,7 @@
<string name="global_action_assist" msgid="3892832961594295030">"دستیار"</string>
<string name="global_action_voice_assist" msgid="7751191495200504480">"دستیار صوتی"</string>
<string name="global_action_lockdown" msgid="8751542514724332873">"اکنون قفل شود"</string>
- <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"بیشتر از 999"</string>
+ <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"۹۹۹+"</string>
<string name="notification_hidden_text" msgid="1135169301897151909">"محتواها پنهان هستند"</string>
<string name="notification_hidden_by_policy_text" msgid="9004631276932584600">"محتوا بر اساس خطمشی پنهان شده است"</string>
<string name="notification_channel_virtual_keyboard" msgid="6969925135507955575">"صفحهکلید مجازی"</string>
diff --git a/core/res/res/values-kn/strings.xml b/core/res/res/values-kn/strings.xml
index 0cabce8..8c8fe6c 100644
--- a/core/res/res/values-kn/strings.xml
+++ b/core/res/res/values-kn/strings.xml
@@ -1106,7 +1106,7 @@
<item quantity="one">ಮುಕ್ತ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ಗಳು ಲಭ್ಯವಿವೆ</item>
<item quantity="other">ಮುಕ್ತ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ಗಳು ಲಭ್ಯವಿವೆ</item>
</plurals>
- <string name="wifi_available_title" msgid="3817100557900599505">"ಮುಕ್ತ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ಗೆ ಸಂಪರ್ಕಪಡಿಸಿ"</string>
+ <string name="wifi_available_title" msgid="3817100557900599505">"ಮುಕ್ತ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ಗೆ ಸಂಪರ್ಕಿಸಿ"</string>
<string name="wifi_available_title_connecting" msgid="1557292688310330032">"ಮುಕ್ತ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ಗೆ ಸಂಪರ್ಕಪಡಿಸಲಾಗುತ್ತಿದೆ"</string>
<string name="wifi_available_title_connected" msgid="7542672851522241548">"ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ಗೆ ಸಂಪರ್ಕಪಡಿಸಲಾಗಿದೆ"</string>
<string name="wifi_available_title_failed_to_connect" msgid="6861772233582618132">"ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ಗೆ ಸಂಪರ್ಕಿಸಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ"</string>
@@ -1431,7 +1431,7 @@
<string name="bluetooth_a2dp_audio_route_name" msgid="8575624030406771015">"ಬ್ಲೂಟೂತ್ ಆಡಿಯೊ"</string>
<string name="wireless_display_route_description" msgid="9070346425023979651">"ವಯರ್ಲೆಸ್ ಪ್ರದರ್ಶನ"</string>
<string name="media_route_button_content_description" msgid="591703006349356016">"ಪಾತ್ರ"</string>
- <string name="media_route_chooser_title" msgid="1751618554539087622">"ಸಾಧನಕ್ಕೆ ಸಂಪರ್ಕಪಡಿಸಿ"</string>
+ <string name="media_route_chooser_title" msgid="1751618554539087622">"ಸಾಧನಕ್ಕೆ ಸಂಪರ್ಕಿಸಿ"</string>
<string name="media_route_chooser_title_for_remote_display" msgid="3395541745872017583">"ಸಾಧನಕ್ಕೆ ಬಿತ್ತರಿಸುವ ಪರದೆ"</string>
<string name="media_route_chooser_searching" msgid="4776236202610828706">"ಸಾಧನಗಳನ್ನು ಹುಡುಕಲಾಗುತ್ತಿದೆ…"</string>
<string name="media_route_chooser_extended_settings" msgid="87015534236701604">"ಸೆಟ್ಟಿಂಗ್ಗಳು"</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index e90fec3..d8ecd1e 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">You have <xliff:g id="NUMBER_1">%d</xliff:g> remaining attempts before SIM is locked.</item>
+ <item quantity="one">Tem mais <xliff:g id="NUMBER_1">%d</xliff:g> tentativas 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>
@@ -176,7 +176,7 @@
<string name="low_memory" product="tv" msgid="516619861191025923">"O armazenamento da TV está cheio. Elimine alguns ficheiros para libertar espaço."</string>
<string name="low_memory" product="default" msgid="3475999286680000541">"O armazenamento do telemóvel está cheio. Elimine alguns ficheiros para libertar espaço."</string>
<plurals name="ssl_ca_cert_warning" formatted="false" msgid="5106721205300213569">
- <item quantity="one">Certificate authorities installed</item>
+ <item quantity="one">Autoridades de certificação instaladas</item>
<item quantity="other">Autoridades de certificação instaladas</item>
</plurals>
<string name="ssl_ca_cert_noti_by_unknown" msgid="4475437862189850602">"Por um terceiro desconhecido"</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">Taking screenshot for bug report in <xliff:g id="NUMBER_1">%d</xliff:g> seconds.</item>
+ <item quantity="one">A tirar uma captura de ecrã do relatório de erro dentro de <xliff:g id="NUMBER_1">%d</xliff:g> segundos…</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">Last <xliff:g id="COUNT_1">%d</xliff:g> days</item>
+ <item quantity="one">Últimos <xliff:g id="COUNT_1">%d</xliff:g> dias</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="other"><xliff:g id="COUNT_1">%d</xliff:g>m</item>
+ <item quantity="one"><xliff:g id="COUNT_1">%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="other"><xliff:g id="COUNT_1">%d</xliff:g>h</item>
+ <item quantity="one"><xliff:g id="COUNT_1">%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="other"><xliff:g id="COUNT_1">%d</xliff:g>d</item>
+ <item quantity="one"><xliff:g id="COUNT_1">%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>y</item>
- <item quantity="other"><xliff:g id="COUNT_1">%d</xliff:g>a</item>
+ <item quantity="one"><xliff:g id="COUNT_1">%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">in <xliff:g id="COUNT_1">%d</xliff:g>m</item>
- <item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g>m</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%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">in <xliff:g id="COUNT_1">%d</xliff:g>h</item>
- <item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g>h</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%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">in <xliff:g id="COUNT_1">%d</xliff:g>d</item>
- <item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g>d</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%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">in <xliff:g id="COUNT_1">%d</xliff:g>y</item>
- <item quantity="other">dentro de <xliff:g id="COUNT_1">%d</xliff:g>a</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%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"><xliff:g id="COUNT_1">%d</xliff:g> minutes ago</item>
+ <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> minutos</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"><xliff:g id="COUNT_1">%d</xliff:g> hours ago</item>
+ <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> horas</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"><xliff:g id="COUNT_1">%d</xliff:g> days ago</item>
+ <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> dias</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"><xliff:g id="COUNT_1">%d</xliff:g> years ago</item>
+ <item quantity="one">há <xliff:g id="COUNT_1">%d</xliff:g> anos</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">in <xliff:g id="COUNT_1">%d</xliff:g> minutes</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> minutos</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">in <xliff:g id="COUNT_1">%d</xliff:g> hours</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> horas</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">in <xliff:g id="COUNT_1">%d</xliff:g> days</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> dias</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">in <xliff:g id="COUNT_1">%d</xliff:g> years</item>
+ <item quantity="one">dentro de <xliff:g id="COUNT_1">%d</xliff:g> anos</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>
@@ -1099,11 +1099,11 @@
<string name="ringtone_picker_title_notification" msgid="4837740874822788802">"Sons de notificação"</string>
<string name="ringtone_unknown" msgid="3914515995813061520">"Desconhecido"</string>
<plurals name="wifi_available" formatted="false" msgid="7900333017752027322">
- <item quantity="one">Wi-Fi networks available</item>
+ <item quantity="one">Redes Wi-Fi disponíveis</item>
<item quantity="other">Redes Wi-Fi disponíveis</item>
</plurals>
<plurals name="wifi_available_detailed" formatted="false" msgid="1140699367193975606">
- <item quantity="one">Open Wi-Fi networks available</item>
+ <item quantity="one">Redes Wi-Fi abertas disponíveis</item>
<item quantity="other">Redes Wi-Fi abertas disponíveis</item>
</plurals>
<string name="wifi_available_title" msgid="3817100557900599505">"Ligar à rede Wi-Fi aberta"</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> of <xliff:g id="TOTAL">%d</xliff:g></item>
+ <item quantity="one"><xliff:g id="INDEX">%d</xliff:g> de <xliff:g id="TOTAL">%d</xliff:g></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">Try again in <xliff:g id="COUNT">%d</xliff:g> seconds</item>
+ <item quantity="one">Tente novamente dentro de <xliff:g id="COUNT">%d</xliff:g> segundos</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">For %1$d minutes (until <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
- <item quantity="other">Durante %1$d minutos (até às <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante %1$d minutos (até à(s) <xliff:g id="FORMATTEDTIME_1">%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">For %1$d min (until <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
- <item quantity="other">Durante %1$d min (até às <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante %1$d min (até à(s) <xliff:g id="FORMATTEDTIME_1">%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">For %1$d hours (until <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
- <item quantity="other">Durante %1$d horas (até às <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante %1$d horas (até à(s) <xliff:g id="FORMATTEDTIME_1">%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">For %1$d hr (until <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
- <item quantity="other">Durante %1$d h (até às <xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g>)</item>
+ <item quantity="one">Durante %1$d h (até à(s) <xliff:g id="FORMATTEDTIME_1">%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">For %d minutes</item>
+ <item quantity="one">Durante %d minutos</item>
<item quantity="other">Durante %d minutos</item>
</plurals>
<plurals name="zen_mode_duration_minutes_short" formatted="false" msgid="2199350154433426128">
- <item quantity="one">For %d min</item>
+ <item quantity="one">Durante %d min</item>
<item quantity="other">Durante %d min</item>
</plurals>
<plurals name="zen_mode_duration_hours" formatted="false" msgid="3938821308277433854">
- <item quantity="one">For %d hours</item>
+ <item quantity="one">Durante %d horas</item>
<item quantity="other">Durante %d horas</item>
</plurals>
<plurals name="zen_mode_duration_hours_short" formatted="false" msgid="6748277774662434217">
- <item quantity="one">For %d hr</item>
+ <item quantity="one">Durante %d 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> selected</item>
+ <item quantity="one"><xliff:g id="COUNT_1">%1$d</xliff:g> selecionados</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>
@@ -1763,7 +1763,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> autofill suggestions</item>
+ <item quantity="one"><xliff:g id="COUNT">%1$s</xliff:g> sugestões 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/dimens.xml b/core/res/res/values/dimens.xml
index 9f9c883..743f4ad 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -580,6 +580,21 @@
<dimen name="item_touch_helper_swipe_escape_velocity">120dp</dimen>
<dimen name="item_touch_helper_swipe_escape_max_velocity">800dp</dimen>
+ <!-- The maximum height of any image in a remote view. This is applied to all images in custom remoteviews. This value is determined by the maximum notification height -->
+ <dimen name="notification_custom_view_max_image_height">284dp</dimen>
+ <!-- The maximum height of any image in a remote view. This is applied to all images in custom remoteviews. This value is determined a maximum notification width -->
+ <dimen name="notification_custom_view_max_image_width">450dp</dimen>
+ <!-- The maximum height of a big picture in a notification. The images will be reduced to that height in case they are bigger. This value is determined by the maximum notification height -->
+ <dimen name="notification_big_picture_max_height">284dp</dimen>
+ <!-- The maximum width of a big picture in a notification. The images will be reduced to that width in case they are bigger. This value is determined by the standard panel size -->
+ <dimen name="notification_big_picture_max_width">416dp</dimen>
+ <!-- The maximum height of a image in a media notification. The images will be reduced to that height in case they are bigger. This value is determined by the expanded media template-->
+ <dimen name="notification_media_image_max_height">140dp</dimen>
+ <!-- The maximum width of a image in a media notification. The images will be reduced to that width in case they are bigger.-->
+ <dimen name="notification_media_image_max_width">280dp</dimen>
+ <!-- The size of the right icon -->
+ <dimen name="notification_right_icon_size">40dp</dimen>
+
<!-- Max width/height of the autofill data set picker as a fraction of the screen width/height -->
<dimen name="autofill_dataset_picker_max_size">90%</dimen>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 58c653b..c49763f 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1166,6 +1166,7 @@
<java-symbol type="string" name="lockscreen_transport_pause_description" />
<java-symbol type="string" name="config_ethernet_tcp_buffers" />
<java-symbol type="string" name="config_wifi_tcp_buffers" />
+ <java-symbol type="string" name="config_demoModePackage" />
<java-symbol type="string" name="config_demoModeLauncherComponent" />
<java-symbol type="string" name="config_carrierDemoModePassword" />
<java-symbol type="string" name="config_carrierDemoModeSetting" />
@@ -2946,6 +2947,14 @@
<java-symbol type="style" name="AutofillDatasetPicker" />
<java-symbol type="dimen" name="autofill_dataset_picker_max_size"/>
+ <java-symbol type="dimen" name="notification_big_picture_max_height"/>
+ <java-symbol type="dimen" name="notification_big_picture_max_width"/>
+ <java-symbol type="dimen" name="notification_media_image_max_width"/>
+ <java-symbol type="dimen" name="notification_media_image_max_height"/>
+ <java-symbol type="dimen" name="notification_right_icon_size"/>
+ <java-symbol type="dimen" name="notification_custom_view_max_image_height"/>
+ <java-symbol type="dimen" name="notification_custom_view_max_image_width"/>
+
<!-- Accessibility fingerprint gestures -->
<java-symbol type="string" name="capability_title_canCaptureFingerprintGestures" />
<java-symbol type="string" name="capability_desc_canCaptureFingerprintGestures" />
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index aa38f31..c329918 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -805,6 +805,43 @@
};
/**
+ * Scale down a bitmap to a given max width and max height. The scaling will be done in a uniform way
+ * @param bitmap the bitmap to scale down
+ * @param maxWidth the maximum width allowed
+ * @param maxHeight the maximum height allowed
+ *
+ * @return the scaled bitmap if necessary or the original bitmap if no scaling was needed
+ * @hide
+ */
+ public static Bitmap scaleDownIfNecessary(Bitmap bitmap, int maxWidth, int maxHeight) {
+ int bitmapWidth = bitmap.getWidth();
+ int bitmapHeight = bitmap.getHeight();
+ if (bitmapWidth > maxWidth || bitmapHeight > maxHeight) {
+ float scale = Math.min((float) maxWidth / bitmapWidth,
+ (float) maxHeight / bitmapHeight);
+ bitmap = Bitmap.createScaledBitmap(bitmap, (int) (scale * bitmapWidth),
+ (int) (scale * bitmapHeight), true /* filter */);
+ }
+ return bitmap;
+ }
+
+ /**
+ * Scale down this icon to a given max width and max height.
+ * The scaling will be done in a uniform way and currently only bitmaps are supported.
+ * @param maxWidth the maximum width allowed
+ * @param maxHeight the maximum height allowed
+ *
+ * @hide
+ */
+ public void scaleDownIfNecessary(int maxWidth, int maxHeight) {
+ if (mType != TYPE_BITMAP && mType != TYPE_ADAPTIVE_BITMAP) {
+ return;
+ }
+ Bitmap bitmap = getBitmap();
+ setBitmap(scaleDownIfNecessary(bitmap, maxWidth, maxHeight));
+ }
+
+ /**
* Implement this interface to receive a callback when
* {@link #loadDrawableAsync(Context, OnDrawableLoadedListener, Handler) loadDrawableAsync}
* is finished and your Drawable is ready.
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index d5509c1..8caba81 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -732,6 +732,15 @@
}
/**
+ * Returns a Bluetooth route if available, otherwise the default route.
+ * @hide
+ */
+ public RouteInfo getFallbackRoute() {
+ return (sStatic.mBluetoothA2dpRoute != null)
+ ? sStatic.mBluetoothA2dpRoute : sStatic.mDefaultAudioVideo;
+ }
+
+ /**
* @hide for use by framework routing UI
*/
public RouteCategory getSystemCategory() {
@@ -913,6 +922,19 @@
(route == btRoute || route == sStatic.mDefaultAudioVideo)) {
try {
sStatic.mAudioService.setBluetoothA2dpOn(route == btRoute);
+ // TODO: Remove the following logging when no longer needed.
+ if (route != btRoute) {
+ StackTraceElement[] callStack = Thread.currentThread().getStackTrace();
+ StringBuffer sb = new StringBuffer();
+ // callStack[3] is the caller of this method.
+ for (int i = 3; i < callStack.length; i++) {
+ StackTraceElement caller = callStack[i];
+ sb.append(caller.getClassName() + "." + caller.getMethodName()
+ + ":" + caller.getLineNumber()).append(" ");
+ }
+ Log.w(TAG, "Default route is selected while a BT route is available: pkgName="
+ + sStatic.mPackageName + ", callers=" + sb.toString());
+ }
} catch (RemoteException e) {
Log.e(TAG, "Error changing Bluetooth A2DP state", e);
}
@@ -1999,6 +2021,11 @@
}
/** @hide */
+ public boolean isBluetooth() {
+ return this == sStatic.mBluetoothA2dpRoute;
+ }
+
+ /** @hide */
public void select() {
selectRouteStatic(mSupportedTypes, this, true);
}
diff --git a/packages/SettingsLib/res/values-hi/strings.xml b/packages/SettingsLib/res/values-hi/strings.xml
index dd9ad33..f0da2f7 100644
--- a/packages/SettingsLib/res/values-hi/strings.xml
+++ b/packages/SettingsLib/res/values-hi/strings.xml
@@ -220,7 +220,7 @@
<string name="mobile_data_always_on_summary" msgid="8149773901431697910">"वाई-फ़ाई के सक्रिय रहने पर भी, हमेशा मोबाइल डेटा सक्रिय रखें (तेज़ी से नेटवर्क स्विच करने के लिए)."</string>
<string name="tethering_hardware_offload_summary" msgid="7726082075333346982">"हार्डवेयर त्वरण को टेदर करना उपलब्ध होने पर उसका उपयोग करें"</string>
<string name="adb_warning_title" msgid="6234463310896563253">"USB डीबग करने की अनुमति दें?"</string>
- <string name="adb_warning_message" msgid="7316799925425402244">"USB डीबग डीबग करने का उद्देश्य केवल विकास है. इसका उपयोग आपके कंप्यूटर और आपके डिवाइस के बीच डेटा की प्रतिलिपि बनाने, बिना नोटिफिकेशन के आपके डिवाइस पर ऐप्स इंस्टॉल करने और लॉग डेटा पढ़ने के लिए करें."</string>
+ <string name="adb_warning_message" msgid="7316799925425402244">"USB डीबग करने का उद्देश्य केवल विकास है. इसका इस्तेमाल आपके कंप्यूटर और आपके डिवाइस के बीच डेटा को कॉपी करने, बिना नोटिफिकेशन के आपके डिवाइस पर ऐप इंस्टॉल करने और लॉग डेटा पढ़ने के लिए करें."</string>
<string name="adb_keys_warning_message" msgid="5659849457135841625">"आपके द्वारा पूर्व में प्राधिकृत सभी कंप्यूटर से USB डीबगिंग की पहुंच निरस्त करें?"</string>
<string name="dev_settings_warning_title" msgid="7244607768088540165">"विकास सेटिंग की अनुमति दें?"</string>
<string name="dev_settings_warning_message" msgid="2298337781139097964">"ये सेटिंग केवल विकास संबंधी उपयोग के प्रयोजन से हैं. वे आपके डिवाइस और उस पर स्थित ऐप्स को खराब कर सकती हैं या उनके दुर्व्यवहार का कारण हो सकती हैं."</string>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
index ef16eba..138733e 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
@@ -76,6 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/date_owner_info_margin"
+ android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:textColor="?attr/wallpaperTextColorSecondary"
android:textSize="@dimen/widget_label_font_size"
diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml
index 06325eb..7d7c9c6 100644
--- a/packages/SystemUI/res/values-pt-rBR/strings.xml
+++ b/packages/SystemUI/res/values-pt-rBR/strings.xml
@@ -214,10 +214,10 @@
<string name="accessibility_quick_settings_bluetooth_connected" msgid="4306637793614573659">"Bluetooth conectado."</string>
<string name="accessibility_quick_settings_bluetooth_changed_off" msgid="2730003763480934529">"O Bluetooth foi desativado."</string>
<string name="accessibility_quick_settings_bluetooth_changed_on" msgid="8722351798763206577">"O Bluetooth foi ativado."</string>
- <string name="accessibility_quick_settings_location_off" msgid="5119080556976115520">"Relatório de Localização desativado."</string>
- <string name="accessibility_quick_settings_location_on" msgid="5809937096590102036">"Relatório de Localização ativado."</string>
- <string name="accessibility_quick_settings_location_changed_off" msgid="8526845571503387376">"O Relatório de Localização foi desativado."</string>
- <string name="accessibility_quick_settings_location_changed_on" msgid="339403053079338468">"O Relatório de Localização foi ativado."</string>
+ <string name="accessibility_quick_settings_location_off" msgid="5119080556976115520">"Relatório de localização desativado."</string>
+ <string name="accessibility_quick_settings_location_on" msgid="5809937096590102036">"Relatório de localização ativado."</string>
+ <string name="accessibility_quick_settings_location_changed_off" msgid="8526845571503387376">"O Relatório de localização foi desativado."</string>
+ <string name="accessibility_quick_settings_location_changed_on" msgid="339403053079338468">"O Relatório de localização foi ativado."</string>
<string name="accessibility_quick_settings_alarm" msgid="3959908972897295660">"Alarme definido para <xliff:g id="TIME">%s</xliff:g>."</string>
<string name="accessibility_quick_settings_close" msgid="3115847794692516306">"Fechar painel."</string>
<string name="accessibility_quick_settings_more_time" msgid="3659274935356197708">"Mais tempo."</string>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml
index 53196cd..9f03e50 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 screens in Overview</item>
+ <item quantity="one">%d ecrãs 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"><xliff:g id="NUMBER_1">%s</xliff:g> more notifications inside.</item>
+ <item quantity="one">Mais <xliff:g id="NUMBER_1">%s</xliff:g> notificações 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 out of <xliff:g id="NUMBER_1">%d</xliff:g> notification categories from this app</item>
+ <item quantity="one">1 de <xliff:g id="NUMBER_1">%d</xliff:g> categorias 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>, and <xliff:g id="NUMBER_5">%3$d</xliff:g> others</item>
+ <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="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>
diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml
index 06325eb..7d7c9c6 100644
--- a/packages/SystemUI/res/values-pt/strings.xml
+++ b/packages/SystemUI/res/values-pt/strings.xml
@@ -214,10 +214,10 @@
<string name="accessibility_quick_settings_bluetooth_connected" msgid="4306637793614573659">"Bluetooth conectado."</string>
<string name="accessibility_quick_settings_bluetooth_changed_off" msgid="2730003763480934529">"O Bluetooth foi desativado."</string>
<string name="accessibility_quick_settings_bluetooth_changed_on" msgid="8722351798763206577">"O Bluetooth foi ativado."</string>
- <string name="accessibility_quick_settings_location_off" msgid="5119080556976115520">"Relatório de Localização desativado."</string>
- <string name="accessibility_quick_settings_location_on" msgid="5809937096590102036">"Relatório de Localização ativado."</string>
- <string name="accessibility_quick_settings_location_changed_off" msgid="8526845571503387376">"O Relatório de Localização foi desativado."</string>
- <string name="accessibility_quick_settings_location_changed_on" msgid="339403053079338468">"O Relatório de Localização foi ativado."</string>
+ <string name="accessibility_quick_settings_location_off" msgid="5119080556976115520">"Relatório de localização desativado."</string>
+ <string name="accessibility_quick_settings_location_on" msgid="5809937096590102036">"Relatório de localização ativado."</string>
+ <string name="accessibility_quick_settings_location_changed_off" msgid="8526845571503387376">"O Relatório de localização foi desativado."</string>
+ <string name="accessibility_quick_settings_location_changed_on" msgid="339403053079338468">"O Relatório de localização foi ativado."</string>
<string name="accessibility_quick_settings_alarm" msgid="3959908972897295660">"Alarme definido para <xliff:g id="TIME">%s</xliff:g>."</string>
<string name="accessibility_quick_settings_close" msgid="3115847794692516306">"Fechar painel."</string>
<string name="accessibility_quick_settings_more_time" msgid="3659274935356197708">"Mais tempo."</string>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index 820a773..a9d583f 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -333,6 +333,10 @@
}
child.setAlpha(dark ? 0 : 1);
}
+ if (mOwnerInfo != null) {
+ mOwnerInfo.setAlpha(dark ? 0 : 1);
+ }
+
updateDozeVisibleViews();
mBatteryDoze.setDark(dark);
mClockView.setTextColor(ColorUtils.blendARGB(mTextColor, Color.WHITE, darkAmount));
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 14d6b59..5a02178 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -154,13 +154,19 @@
/**
* Called when the device has started waking up.
+ *
+ * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
*/
+ @Deprecated
public void onStartedWakingUp() { }
/**
* Called when the device has started going to sleep.
* @param why see {@link #onFinishedGoingToSleep(int)}
+ *
+ * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
*/
+ @Deprecated
public void onStartedGoingToSleep(int why) { }
/**
@@ -168,17 +174,26 @@
* @param why either {@link WindowManagerPolicy#OFF_BECAUSE_OF_ADMIN},
* {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER}, or
* {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT}.
+ *
+ * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
*/
+ @Deprecated
public void onFinishedGoingToSleep(int why) { }
/**
* Called when the screen has been turned on.
+ *
+ * @deprecated use {@link com.android.systemui.keyguard.ScreenLifecycle}.
*/
+ @Deprecated
public void onScreenTurnedOn() { }
/**
* Called when the screen has been turned off.
+ *
+ * @deprecated use {@link com.android.systemui.keyguard.ScreenLifecycle}.
*/
+ @Deprecated
public void onScreenTurnedOff() { }
/**
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index 776d076..e5c729f 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -30,6 +30,8 @@
import com.android.systemui.assist.AssistManager;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.fragments.FragmentService;
+import com.android.systemui.keyguard.ScreenLifecycle;
+import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.PluginActivityManager;
import com.android.systemui.plugins.PluginDependencyProvider;
@@ -248,6 +250,12 @@
mProviders.put(StatusBarIconController.class, () ->
new StatusBarIconControllerImpl(mContext));
+ mProviders.put(ScreenLifecycle.class, () ->
+ new ScreenLifecycle());
+
+ mProviders.put(WakefulnessLifecycle.class, () ->
+ new WakefulnessLifecycle());
+
mProviders.put(FragmentService.class, () ->
new FragmentService(mContext));
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardLifecyclesDispatcher.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardLifecyclesDispatcher.java
new file mode 100644
index 0000000..4c98c08
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardLifecyclesDispatcher.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.systemui.keyguard;
+
+import android.os.Handler;
+import android.os.Message;
+
+import com.android.internal.policy.IKeyguardDrawnCallback;
+
+/**
+ * Dispatches the lifecycles keyguard gets from WindowManager on the main thread.
+ */
+public class KeyguardLifecyclesDispatcher {
+
+ static final int SCREEN_TURNING_ON = 0;
+ static final int SCREEN_TURNED_ON = 1;
+ static final int SCREEN_TURNING_OFF = 2;
+ static final int SCREEN_TURNED_OFF = 3;
+
+ static final int STARTED_WAKING_UP = 4;
+ static final int FINISHED_WAKING_UP = 5;
+ static final int STARTED_GOING_TO_SLEEP = 6;
+ static final int FINISHED_GOING_TO_SLEEP = 7;
+
+ private final ScreenLifecycle mScreenLifecycle;
+ private final WakefulnessLifecycle mWakefulnessLifecycle;
+
+ public KeyguardLifecyclesDispatcher(ScreenLifecycle screenLifecycle,
+ WakefulnessLifecycle wakefulnessLifecycle) {
+ mScreenLifecycle = screenLifecycle;
+ mWakefulnessLifecycle = wakefulnessLifecycle;
+ }
+
+ void dispatch(int what) {
+ mHandler.obtainMessage(what).sendToTarget();
+ }
+
+ private Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case SCREEN_TURNING_ON:
+ mScreenLifecycle.dispatchScreenTurningOn();
+ break;
+ case SCREEN_TURNED_ON:
+ mScreenLifecycle.dispatchScreenTurnedOn();
+ break;
+ case SCREEN_TURNING_OFF:
+ mScreenLifecycle.dispatchScreenTurningOff();
+ break;
+ case SCREEN_TURNED_OFF:
+ mScreenLifecycle.dispatchScreenTurnedOff();
+ break;
+ case STARTED_WAKING_UP:
+ mWakefulnessLifecycle.dispatchStartedWakingUp();
+ break;
+ case FINISHED_WAKING_UP:
+ mWakefulnessLifecycle.dispatchFinishedWakingUp();
+ break;
+ case STARTED_GOING_TO_SLEEP:
+ mWakefulnessLifecycle.dispatchStartedGoingToSleep();
+ break;
+ case FINISHED_GOING_TO_SLEEP:
+ mWakefulnessLifecycle.dispatchFinishedGoingToSleep();
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown message: " + msg);
+ }
+ }
+ };
+
+}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
index 2d5d198..2a5ae0d 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
@@ -31,6 +31,7 @@
import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardService;
import com.android.internal.policy.IKeyguardStateCallback;
+import com.android.systemui.Dependency;
import com.android.systemui.SystemUIApplication;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
@@ -40,12 +41,17 @@
static final String PERMISSION = android.Manifest.permission.CONTROL_KEYGUARD;
private KeyguardViewMediator mKeyguardViewMediator;
+ private KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher;
@Override
public void onCreate() {
((SystemUIApplication) getApplication()).startServicesIfNeeded();
mKeyguardViewMediator =
((SystemUIApplication) getApplication()).getComponent(KeyguardViewMediator.class);
+ mKeyguardLifecyclesDispatcher = new KeyguardLifecyclesDispatcher(
+ Dependency.get(ScreenLifecycle.class),
+ Dependency.get(WakefulnessLifecycle.class));
+
}
@Override
@@ -111,12 +117,16 @@
public void onStartedGoingToSleep(int reason) {
checkPermission();
mKeyguardViewMediator.onStartedGoingToSleep(reason);
+ mKeyguardLifecyclesDispatcher.dispatch(
+ KeyguardLifecyclesDispatcher.STARTED_GOING_TO_SLEEP);
}
@Override // Binder interface
public void onFinishedGoingToSleep(int reason, boolean cameraGestureTriggered) {
checkPermission();
mKeyguardViewMediator.onFinishedGoingToSleep(reason, cameraGestureTriggered);
+ mKeyguardLifecyclesDispatcher.dispatch(
+ KeyguardLifecyclesDispatcher.FINISHED_GOING_TO_SLEEP);
}
@Override // Binder interface
@@ -124,6 +134,15 @@
Trace.beginSection("KeyguardService.mBinder#onStartedWakingUp");
checkPermission();
mKeyguardViewMediator.onStartedWakingUp();
+ mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.STARTED_WAKING_UP);
+ Trace.endSection();
+ }
+
+ @Override // Binder interface
+ public void onFinishedWakingUp() {
+ Trace.beginSection("KeyguardService.mBinder#onFinishedWakingUp");
+ checkPermission();
+ mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.FINISHED_WAKING_UP);
Trace.endSection();
}
@@ -132,6 +151,7 @@
Trace.beginSection("KeyguardService.mBinder#onScreenTurningOn");
checkPermission();
mKeyguardViewMediator.onScreenTurningOn(callback);
+ mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.SCREEN_TURNING_ON);
Trace.endSection();
}
@@ -140,13 +160,21 @@
Trace.beginSection("KeyguardService.mBinder#onScreenTurnedOn");
checkPermission();
mKeyguardViewMediator.onScreenTurnedOn();
+ mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.SCREEN_TURNED_ON);
Trace.endSection();
}
@Override // Binder interface
+ public void onScreenTurningOff() {
+ checkPermission();
+ mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.SCREEN_TURNING_OFF);
+ }
+
+ @Override // Binder interface
public void onScreenTurnedOff() {
checkPermission();
mKeyguardViewMediator.onScreenTurnedOff();
+ mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.SCREEN_TURNED_OFF);
}
@Override // Binder interface
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/Lifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/Lifecycle.java
new file mode 100644
index 0000000..1b20cfb
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/Lifecycle.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.systemui.keyguard;
+
+import java.util.ArrayList;
+import java.util.function.Consumer;
+
+/**
+ * Base class for lifecycles with observers.
+ */
+public class Lifecycle<T> {
+
+ private ArrayList<T> mObservers = new ArrayList<>();
+
+ public void addObserver(T observer) {
+ mObservers.add(observer);
+ }
+
+ public void removeObserver(T observer) {
+ mObservers.remove(observer);
+ }
+
+ public void dispatch(Consumer<T> consumer) {
+ for (int i = 0; i < mObservers.size(); i++) {
+ consumer.accept(mObservers.get(i));
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java
new file mode 100644
index 0000000..3f39dfe
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.systemui.keyguard;
+
+import com.android.systemui.Dumpable;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
+/**
+ * Tracks the screen lifecycle.
+ */
+public class ScreenLifecycle extends Lifecycle<ScreenLifecycle.Observer> implements Dumpable {
+
+ public static final int SCREEN_OFF = 0;
+ public static final int SCREEN_TURNING_ON = 1;
+ public static final int SCREEN_ON = 2;
+ public static final int SCREEN_TURNING_OFF = 3;
+
+ private int mScreenState = SCREEN_OFF;
+
+ public int getScreenState() {
+ return mScreenState;
+ }
+
+ public void dispatchScreenTurningOn() {
+ mScreenState = SCREEN_TURNING_ON;
+ dispatch(Observer::onScreenTurningOn);
+ }
+
+ public void dispatchScreenTurnedOn() {
+ mScreenState = SCREEN_ON;
+ dispatch(Observer::onScreenTurnedOn);
+ }
+
+ public void dispatchScreenTurningOff() {
+ mScreenState = SCREEN_TURNING_OFF;
+ dispatch(Observer::onScreenTurningOff);
+ }
+
+ public void dispatchScreenTurnedOff() {
+ mScreenState = SCREEN_OFF;
+ dispatch(Observer::onScreenTurnedOff);
+ }
+
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("ScreenLifecycle:");
+ pw.println(" mScreenState=" + mScreenState);
+ }
+
+ public interface Observer {
+ default void onScreenTurningOn() {}
+ default void onScreenTurnedOn() {}
+ default void onScreenTurningOff() {}
+ default void onScreenTurnedOff() {}
+ }
+
+}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
new file mode 100644
index 0000000..578e6fb
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.systemui.keyguard;
+
+import com.android.systemui.Dumpable;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
+/**
+ * Tracks the wakefulness lifecycle.
+ */
+public class WakefulnessLifecycle extends Lifecycle<WakefulnessLifecycle.Observer> implements
+ Dumpable {
+
+ public static final int WAKEFULNESS_ASLEEP = 0;
+ public static final int WAKEFULNESS_WAKING = 1;
+ public static final int WAKEFULNESS_AWAKE = 2;
+ public static final int WAKEFULNESS_GOING_TO_SLEEP = 3;
+
+ private int mWakefulness = WAKEFULNESS_ASLEEP;
+
+ public int getWakefulness() {
+ return mWakefulness;
+ }
+
+ public void dispatchStartedWakingUp() {
+ mWakefulness = WAKEFULNESS_WAKING;
+ dispatch(Observer::onStartedWakingUp);
+ }
+
+ public void dispatchFinishedWakingUp() {
+ mWakefulness = WAKEFULNESS_AWAKE;
+ dispatch(Observer::onFinishedWakingUp);
+ }
+
+ public void dispatchStartedGoingToSleep() {
+ mWakefulness = WAKEFULNESS_GOING_TO_SLEEP;
+ dispatch(Observer::onStartedGoingToSleep);
+ }
+
+ public void dispatchFinishedGoingToSleep() {
+ mWakefulness = WAKEFULNESS_ASLEEP;
+ dispatch(Observer::onFinishedGoingToSleep);
+ }
+
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("WakefulnessLifecycle:");
+ pw.println(" mWakefulness=" + mWakefulness);
+ }
+
+ public interface Observer {
+ default void onStartedWakingUp() {}
+ default void onFinishedWakingUp() {}
+ default void onStartedGoingToSleep() {}
+ default void onFinishedGoingToSleep() {}
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index bf89b01..f9407dd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -77,7 +77,7 @@
private static final int MSG_TOGGLE_APP_SPLIT_SCREEN = 30 << MSG_SHIFT;
private static final int MSG_APP_TRANSITION_FINISHED = 31 << MSG_SHIFT;
private static final int MSG_DISMISS_KEYBOARD_SHORTCUTS = 32 << MSG_SHIFT;
- private static final int MSG_HANDLE_SYSNAV_KEY = 33 << MSG_SHIFT;
+ private static final int MSG_HANDLE_SYSTEM_KEY = 33 << MSG_SHIFT;
private static final int MSG_SHOW_GLOBAL_ACTIONS = 34 << MSG_SHIFT;
public static final int FLAG_EXCLUDE_NONE = 0;
@@ -134,7 +134,7 @@
default void remQsTile(ComponentName tile) { }
default void clickTile(ComponentName tile) { }
- default void handleSystemNavigationKey(int arg1) { }
+ default void handleSystemKey(int arg1) { }
default void handleShowGlobalActionsMenu() { }
}
@@ -415,9 +415,9 @@
}
@Override
- public void handleSystemNavigationKey(int key) {
+ public void handleSystemKey(int key) {
synchronized (mLock) {
- mHandler.obtainMessage(MSG_HANDLE_SYSNAV_KEY, key, 0).sendToTarget();
+ mHandler.obtainMessage(MSG_HANDLE_SYSTEM_KEY, key, 0).sendToTarget();
}
}
@@ -600,9 +600,9 @@
mCallbacks.get(i).toggleSplitScreen();
}
break;
- case MSG_HANDLE_SYSNAV_KEY:
+ case MSG_HANDLE_SYSTEM_KEY:
for (int i = 0; i < mCallbacks.size(); i++) {
- mCallbacks.get(i).handleSystemNavigationKey(msg.arg1);
+ mCallbacks.get(i).handleSystemKey(msg.arg1);
}
break;
case MSG_SHOW_GLOBAL_ACTIONS:
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
index 23a67e2..54d622b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
@@ -329,4 +329,8 @@
public boolean isExposed() {
return mExposed;
}
+
+ public boolean isLeavebehind() {
+ return mGutsContent != null && mGutsContent.isLeavebehind();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java
index f859124..fddc446 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java
@@ -100,6 +100,7 @@
private boolean mShouldShowMenu;
private NotificationSwipeActionHelper mSwipeHelper;
+ private boolean mIsUserTouching;
public NotificationMenuRow(Context context) {
mContext = context;
@@ -202,8 +203,11 @@
} else {
mIconsPlaced = false;
setMenuLocation();
- // If the # of items showing changed we need to update the snap position
- showMenu(mParent, mOnLeft ? getSpaceForMenu() : -getSpaceForMenu(), 0 /* velocity */);
+ if (!mIsUserTouching) {
+ // If the # of items showing changed we need to update the snap position
+ showMenu(mParent, mOnLeft ? getSpaceForMenu() : -getSpaceForMenu(),
+ 0 /* velocity */);
+ }
}
}
@@ -233,6 +237,7 @@
mHandler.removeCallbacks(mCheckForDrag);
mCheckForDrag = null;
mPrevX = ev.getRawX();
+ mIsUserTouching = true;
break;
case MotionEvent.ACTION_MOVE:
@@ -265,7 +270,12 @@
break;
case MotionEvent.ACTION_UP:
+ mIsUserTouching = false;
return handleUpEvent(ev, view, velocity);
+ case MotionEvent.ACTION_CANCEL:
+ mIsUserTouching = false;
+ cancelDrag();
+ return false;
}
return false;
}
@@ -354,23 +364,24 @@
}
private void snapBack(View animView, float velocity) {
- if (mFadeAnimator != null) {
- mFadeAnimator.cancel();
- }
- mHandler.removeCallbacks(mCheckForDrag);
+ cancelDrag();
mMenuSnappedTo = false;
mSnapping = true;
mSwipeHelper.snap(animView, 0 /* leftTarget */, velocity);
}
private void dismiss(View animView, float velocity) {
+ cancelDrag();
+ mMenuSnappedTo = false;
+ mDismissing = true;
+ mSwipeHelper.dismiss(animView, velocity);
+ }
+
+ private void cancelDrag() {
if (mFadeAnimator != null) {
mFadeAnimator.cancel();
}
mHandler.removeCallbacks(mCheckForDrag);
- mMenuSnappedTo = false;
- mDismissing = true;
- mSwipeHelper.dismiss(animView, velocity);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index c1581c8..881de67 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -334,16 +334,18 @@
public void onOverlayChanged() {
@ColorInt int textColor = Utils.getColorAttr(mContext, R.attr.wallpaperTextColor);
- mCarrierLabel.setTextColor(textColor);
- mBatteryView.setFillColor(textColor);
- mIconManager.setTint(textColor);
-
+ @ColorInt int iconColor = Utils.getDefaultColor(mContext, Color.luminance(textColor) < 0.5 ?
+ R.color.dark_mode_icon_color_single_tone :
+ R.color.light_mode_icon_color_single_tone);
float intensity = textColor == Color.WHITE ? 0 : 1;
+ mCarrierLabel.setTextColor(iconColor);
+ mBatteryView.setFillColor(iconColor);
+ mIconManager.setTint(iconColor);
Rect tintArea = new Rect(0, 0, 0, 0);
- applyDarkness(R.id.signal_cluster, tintArea, intensity, textColor);
- applyDarkness(R.id.battery, tintArea, intensity, textColor);
- applyDarkness(R.id.clock, tintArea, intensity, textColor);
+ applyDarkness(R.id.signal_cluster, tintArea, intensity, iconColor);
+ applyDarkness(R.id.battery, tintArea, intensity, iconColor);
+ applyDarkness(R.id.clock, tintArea, intensity, iconColor);
}
private void applyDarkness(int id, Rect tintArea, float intensity, int color) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
index 417bef8..b0ac6ec 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
@@ -167,7 +167,7 @@
animation -> setIconTintInternal((Float) animation.getAnimatedValue()));
mTintAnimator.setDuration(duration);
mTintAnimator.setStartDelay(delay);
- mTintAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
+ mTintAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
mTintAnimator.start();
}
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 23969f9..e90d1c1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -175,6 +175,8 @@
import com.android.systemui.fragments.ExtensionFragmentListener;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
+import com.android.systemui.keyguard.ScreenLifecycle;
+import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;
@@ -422,8 +424,6 @@
private DozeServiceHost mDozeServiceHost;
private boolean mWakeUpComingFromTouch;
private PointF mWakeUpTouchLocation;
- private boolean mScreenTurningOn;
- private boolean mScreenFullyOff;
int mPixelFormat;
Object mQueueLock = new Object();
@@ -634,11 +634,6 @@
// Fingerprint (as computed by getLoggingFingerprint() of the last logged state.
private int mLastLoggedStateFingerprint;
- /**
- * If set, the device has started going to sleep but isn't fully non-interactive yet.
- */
- protected boolean mStartedGoingToSleep;
-
private final OnChildLocationsChangedListener mNotificationLocationsChangedListener =
new OnChildLocationsChangedListener() {
@Override
@@ -737,6 +732,8 @@
private String mKeyToRemoveOnGutsClosed;
private SysuiColorExtractor mColorExtractor;
private ForegroundServiceController mForegroundServiceController;
+ private ScreenLifecycle mScreenLifecycle;
+ private WakefulnessLifecycle mWakefulnessLifecycle;
private void recycleAllVisibilityObjects(ArraySet<NotificationVisibility> array) {
final int N = array.size();
@@ -775,6 +772,10 @@
mNetworkController = Dependency.get(NetworkController.class);
mUserSwitcherController = Dependency.get(UserSwitcherController.class);
mKeyguardMonitor = (KeyguardMonitorImpl) Dependency.get(KeyguardMonitor.class);
+ mScreenLifecycle = Dependency.get(ScreenLifecycle.class);
+ mScreenLifecycle.addObserver(mScreenObserver);
+ mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);
+ mWakefulnessLifecycle.addObserver(mWakefulnessObserver);
mBatteryController = Dependency.get(BatteryController.class);
mAssistManager = Dependency.get(AssistManager.class);
mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
@@ -1790,7 +1791,8 @@
return;
}
if (entry != null && mNotificationGutsExposed != null
- && mNotificationGutsExposed == entry.row.getGuts()) {
+ && mNotificationGutsExposed == entry.row.getGuts() && entry.row.getGuts() != null
+ && !entry.row.getGuts().isLeavebehind()) {
Log.w(TAG, "Keeping notification because it's showing guts. " + key);
mLatestRankingMap = ranking;
mKeyToRemoveOnGutsClosed = key;
@@ -2829,12 +2831,6 @@
mRemoteInputEntriesToRemoveOnCollapse.clear();
}
- public void onScreenTurnedOff() {
- mScreenFullyOff = true;
- mFalsingManager.onScreenOff();
- updateIsKeyguard();
- }
-
public NotificationStackScrollLayout getNotificationScrollLayout() {
return mStackScroller;
}
@@ -2944,8 +2940,8 @@
* settings. Down action closes the entire panel.
*/
@Override
- public void handleSystemNavigationKey(int key) {
- if (SPEW) Log.d(TAG, "handleSystemNavigationKey: " + key);
+ public void handleSystemKey(int key) {
+ if (SPEW) Log.d(TAG, "handleNavigationKey: " + key);
if (!panelsEnabled() || !mKeyguardMonitor.isDeviceInteractive()
|| mKeyguardMonitor.isShowing() && !mKeyguardMonitor.isOccluded()) {
return;
@@ -4203,10 +4199,7 @@
public void showKeyguard() {
mKeyguardRequested = true;
- // Unconditionally show keyguard again. There's some logic that relies on this
- // being called even when the keyguard is already showing, e.g. for updating
- // sensitiveness of notifications and making sure the panels are expanded.
- showKeyguardImpl();
+ updateIsKeyguard();
}
public boolean hideKeyguard() {
@@ -4220,13 +4213,18 @@
// late in the transition, so we also allow the device to start dozing once the screen has
// turned off fully.
boolean keyguardForDozing = mDozingRequested &&
- (!mDeviceInteractive || mStartedGoingToSleep && (mScreenFullyOff || mIsKeyguard));
+ (!mDeviceInteractive || isGoingToSleep() && (isScreenFullyOff() || mIsKeyguard));
boolean shouldBeKeyguard = mKeyguardRequested || keyguardForDozing;
if (keyguardForDozing) {
updatePanelExpansionForKeyguard();
}
if (shouldBeKeyguard) {
- showKeyguardImpl();
+ if (isGoingToSleep()
+ && mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_TURNING_OFF) {
+ // Delay showing the keyguard until screen turned off.
+ } else {
+ showKeyguardImpl();
+ }
} else {
return hideKeyguardImpl();
}
@@ -5109,78 +5107,84 @@
recomputeDisableFlags(true /* animate */);
}
- public void onStartedGoingToSleep() {
- mStartedGoingToSleep = true;
- }
-
- public void onFinishedGoingToSleep() {
- mNotificationPanel.onAffordanceLaunchEnded();
- releaseGestureWakeLock();
- mLaunchCameraOnScreenTurningOn = false;
- mStartedGoingToSleep = false;
- mDeviceInteractive = false;
- mWakeUpComingFromTouch = false;
- mWakeUpTouchLocation = null;
- mStackScroller.setAnimationsEnabled(false);
- mVisualStabilityManager.setScreenOn(false);
- updateVisibleToUser();
-
- // We need to disable touch events because these might
- // collapse the panel after we expanded it, and thus we would end up with a blank
- // Keyguard.
- mNotificationPanel.setTouchDisabled(true);
- mStatusBarWindow.cancelCurrentTouch();
- if (mLaunchCameraOnFinishedGoingToSleep) {
- mLaunchCameraOnFinishedGoingToSleep = false;
-
- // This gets executed before we will show Keyguard, so post it in order that the state
- // is correct.
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- onCameraLaunchGestureDetected(mLastCameraLaunchSource);
- }
- });
- }
- updateIsKeyguard();
- }
-
- public void onStartedWakingUp() {
- mDeviceInteractive = true;
- mStackScroller.setAnimationsEnabled(true);
- mVisualStabilityManager.setScreenOn(true);
- mNotificationPanel.setTouchDisabled(false);
- updateVisibleToUser();
- updateIsKeyguard();
- }
-
- public void onScreenTurningOn() {
- mScreenFullyOff = false;
- mScreenTurningOn = true;
- mFalsingManager.onScreenTurningOn();
- mNotificationPanel.onScreenTurningOn();
- if (mLaunchCameraOnScreenTurningOn) {
- mNotificationPanel.launchCamera(false, mLastCameraLaunchSource);
+ WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() {
+ @Override
+ public void onFinishedGoingToSleep() {
+ mNotificationPanel.onAffordanceLaunchEnded();
+ releaseGestureWakeLock();
mLaunchCameraOnScreenTurningOn = false;
+ mDeviceInteractive = false;
+ mWakeUpComingFromTouch = false;
+ mWakeUpTouchLocation = null;
+ mStackScroller.setAnimationsEnabled(false);
+ mVisualStabilityManager.setScreenOn(false);
+ updateVisibleToUser();
+
+ // We need to disable touch events because these might
+ // collapse the panel after we expanded it, and thus we would end up with a blank
+ // Keyguard.
+ mNotificationPanel.setTouchDisabled(true);
+ mStatusBarWindow.cancelCurrentTouch();
+ if (mLaunchCameraOnFinishedGoingToSleep) {
+ mLaunchCameraOnFinishedGoingToSleep = false;
+
+ // This gets executed before we will show Keyguard, so post it in order that the state
+ // is correct.
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ onCameraLaunchGestureDetected(mLastCameraLaunchSource);
+ }
+ });
+ }
+ updateIsKeyguard();
}
- }
+
+ @Override
+ public void onStartedWakingUp() {
+ mDeviceInteractive = true;
+ mStackScroller.setAnimationsEnabled(true);
+ mVisualStabilityManager.setScreenOn(true);
+ mNotificationPanel.setTouchDisabled(false);
+ updateVisibleToUser();
+ updateIsKeyguard();
+ }
+ };
+
+ ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() {
+ @Override
+ public void onScreenTurningOn() {
+ mFalsingManager.onScreenTurningOn();
+ mNotificationPanel.onScreenTurningOn();
+ if (mLaunchCameraOnScreenTurningOn) {
+ mNotificationPanel.launchCamera(false, mLastCameraLaunchSource);
+ mLaunchCameraOnScreenTurningOn = false;
+ }
+ }
+
+ @Override
+ public void onScreenTurnedOn() {
+ mDozeScrimController.onScreenTurnedOn();
+ }
+
+ @Override
+ public void onScreenTurnedOff() {
+ mFalsingManager.onScreenOff();
+ updateIsKeyguard();
+ }
+ };
private void vibrateForCameraGesture() {
// Make sure to pass -1 for repeat so VibratorService doesn't stop us when going to sleep.
mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */);
}
- public void onScreenTurnedOn() {
- mScreenTurningOn = false;
- mDozeScrimController.onScreenTurnedOn();
- }
-
/**
* @return true if the screen is currently fully off, i.e. has finished turning off and has
* since not started turning on.
*/
public boolean isScreenFullyOff() {
- return mScreenFullyOff;
+ return mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_OFF;
}
@Override
@@ -5227,7 +5231,7 @@
@Override
public void onCameraLaunchGestureDetected(int source) {
mLastCameraLaunchSource = source;
- if (mStartedGoingToSleep) {
+ if (isGoingToSleep()) {
if (DEBUG_CAMERA_LIFT) Slog.d(TAG, "Finish going to sleep before launching camera");
mLaunchCameraOnFinishedGoingToSleep = true;
return;
@@ -5254,7 +5258,7 @@
mScrimController.dontAnimateBouncerChangesUntilNextFrame();
mGestureWakeLock.acquire(LAUNCH_TRANSITION_TIMEOUT_MS + 1000L);
}
- if (mScreenTurningOn || mStatusBarKeyguardViewManager.isScreenTurnedOn()) {
+ if (isScreenTurningOnOrOn()) {
if (DEBUG_CAMERA_LIFT) Slog.d(TAG, "Launching camera");
mNotificationPanel.launchCamera(mDeviceInteractive /* animate */, source);
} else {
@@ -5280,6 +5284,16 @@
return true;
}
+ private boolean isGoingToSleep() {
+ return mWakefulnessLifecycle.getWakefulness()
+ == WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP;
+ }
+
+ private boolean isScreenTurningOnOrOn() {
+ return mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_TURNING_ON
+ || mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_ON;
+ }
+
public void notifyFpAuthModeChanged() {
updateDozing();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 191b7a2..252df17 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -80,7 +80,6 @@
private ViewGroup mContainer;
- private boolean mDeviceInteractive = false;
private boolean mScreenTurnedOn;
protected KeyguardBouncer mBouncer;
protected boolean mShowing;
@@ -100,7 +99,6 @@
private OnDismissAction mAfterKeyguardGoneAction;
private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
- private boolean mDeviceWillWakeUp;
private boolean mDeferScrimFadeOut;
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
@@ -213,31 +211,19 @@
}
public void onStartedGoingToSleep() {
- mStatusBar.onStartedGoingToSleep();
+ // TODO: remove
}
public void onFinishedGoingToSleep() {
- mDeviceInteractive = false;
- mStatusBar.onFinishedGoingToSleep();
mBouncer.onScreenTurnedOff();
}
public void onStartedWakingUp() {
- Trace.beginSection("StatusBarKeyguardViewManager#onStartedWakingUp");
- mDeviceInteractive = true;
- mDeviceWillWakeUp = false;
- mStatusBar.onStartedWakingUp();
- Trace.endSection();
+ // TODO: remove
}
public void onScreenTurningOn() {
- Trace.beginSection("StatusBarKeyguardViewManager#onScreenTurningOn");
- mStatusBar.onScreenTurningOn();
- Trace.endSection();
- }
-
- public boolean isScreenTurnedOn() {
- return mScreenTurnedOn;
+ // TODO: remove
}
public void onScreenTurnedOn() {
@@ -249,7 +235,6 @@
true /* skipFirstFrame */);
updateStates();
}
- mStatusBar.onScreenTurnedOn();
Trace.endSection();
}
@@ -269,11 +254,10 @@
public void onScreenTurnedOff() {
mScreenTurnedOn = false;
- mStatusBar.onScreenTurnedOff();
}
public void notifyDeviceWakeUpRequested() {
- mDeviceWillWakeUp = !mDeviceInteractive;
+ // TODO: remove
}
public void setNeedsInput(boolean needsInput) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java
index b89a77b..2bf62bb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java
@@ -182,7 +182,7 @@
Log.w(TAG, "Projection is no longer active: " + projection);
}
} else {
- mMediaRouter.getDefaultRoute().select();
+ mMediaRouter.getFallbackRoute().select();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
index 728005d..ccfbb26 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
@@ -21,12 +21,13 @@
boolean isSecure();
boolean canSkipBouncer();
boolean isShowing();
+ boolean isOccluded();
boolean isKeyguardFadingAway();
boolean isKeyguardGoingAway();
long getKeyguardFadingAwayDuration();
long getKeyguardFadingAwayDelay();
- public interface Callback {
+ interface Callback {
void onKeyguardShowingChanged();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index eef5368..42cebe2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -4349,10 +4349,10 @@
@Override
public void onDownUpdate(View currView, MotionEvent ev) {
mTranslatingParentView = currView;
- mCurrMenuRow = null;
if (mCurrMenuRow != null) {
mCurrMenuRow.onTouchEvent(currView, ev, 0 /* velocity */);
}
+ mCurrMenuRow = null;
mHandler.removeCallbacks(mFalsingCheck);
// Slide back any notifications that might be showing a menu
@@ -4363,6 +4363,7 @@
mCurrMenuRow = row.createMenu();
mCurrMenuRow.setSwipeActionHelper(NotificationSwipeHelper.this);
mCurrMenuRow.setMenuClickListener(NotificationStackScrollLayout.this);
+ mCurrMenuRow.onTouchEvent(currView, ev, 0 /* velocity */);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/LifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/LifecycleTest.java
new file mode 100644
index 0000000..e0807d6
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/LifecycleTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.systemui.keyguard;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.support.test.filters.SmallTest;
+import android.testing.AndroidTestingRunner;
+
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+
+@RunWith(AndroidTestingRunner.class)
+@SmallTest
+public class LifecycleTest extends SysuiTestCase {
+
+ private final Object mObj1 = new Object();
+ private final Object mObj2 = new Object();
+
+ private Lifecycle<Object> mLifecycle;
+ private ArrayList<Object> mDispatchedObjects;
+
+ @Before
+ public void setUp() throws Exception {
+ mLifecycle = new Lifecycle<>();
+ mDispatchedObjects = new ArrayList<>();
+ }
+
+ @Test
+ public void addObserver_addsObserver() throws Exception {
+ mLifecycle.addObserver(mObj1);
+
+ mLifecycle.dispatch(mDispatchedObjects::add);
+
+ assertTrue(mDispatchedObjects.contains(mObj1));
+ }
+
+ @Test
+ public void removeObserver() throws Exception {
+ mLifecycle.addObserver(mObj1);
+ mLifecycle.removeObserver(mObj1);
+
+ mLifecycle.dispatch(mDispatchedObjects::add);
+
+ assertFalse(mDispatchedObjects.contains(mObj1));
+ }
+
+ @Test
+ public void dispatch() throws Exception {
+ mLifecycle.addObserver(mObj1);
+ mLifecycle.addObserver(mObj2);
+
+ mLifecycle.dispatch(mDispatchedObjects::add);
+
+ assertTrue(mDispatchedObjects.contains(mObj1));
+ assertTrue(mDispatchedObjects.contains(mObj2));
+ }
+
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java
new file mode 100644
index 0000000..8c918f6
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.systemui.keyguard;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import android.support.test.filters.SmallTest;
+import android.testing.AndroidTestingRunner;
+
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+
+@RunWith(AndroidTestingRunner.class)
+@SmallTest
+public class ScreenLifecycleTest extends SysuiTestCase {
+
+ private ScreenLifecycle mScreen;
+ private ScreenLifecycle.Observer mScreenObserverMock;
+
+ @Before
+ public void setUp() throws Exception {
+ mScreen = new ScreenLifecycle();
+ mScreenObserverMock = mock(ScreenLifecycle.Observer.class);
+ mScreen.addObserver(mScreenObserverMock);
+ }
+
+ @Test
+ public void baseState() throws Exception {
+ assertEquals(ScreenLifecycle.SCREEN_OFF, mScreen.getScreenState());
+ verifyNoMoreInteractions(mScreenObserverMock);
+ }
+
+ @Test
+ public void screenTurningOn() throws Exception {
+ mScreen.dispatchScreenTurningOn();
+
+ assertEquals(ScreenLifecycle.SCREEN_TURNING_ON, mScreen.getScreenState());
+ verify(mScreenObserverMock).onScreenTurningOn();
+ }
+
+ @Test
+ public void screenTurnedOn() throws Exception {
+ mScreen.dispatchScreenTurningOn();
+ mScreen.dispatchScreenTurnedOn();
+
+ assertEquals(ScreenLifecycle.SCREEN_ON, mScreen.getScreenState());
+ verify(mScreenObserverMock).onScreenTurnedOn();
+ }
+
+ @Test
+ public void screenTurningOff() throws Exception {
+ mScreen.dispatchScreenTurningOn();
+ mScreen.dispatchScreenTurnedOn();
+ mScreen.dispatchScreenTurningOff();
+
+ assertEquals(ScreenLifecycle.SCREEN_TURNING_OFF, mScreen.getScreenState());
+ verify(mScreenObserverMock).onScreenTurningOff();
+ }
+
+ @Test
+ public void screenTurnedOff() throws Exception {
+ mScreen.dispatchScreenTurningOn();
+ mScreen.dispatchScreenTurnedOn();
+ mScreen.dispatchScreenTurningOff();
+ mScreen.dispatchScreenTurnedOff();
+
+ assertEquals(ScreenLifecycle.SCREEN_OFF, mScreen.getScreenState());
+ verify(mScreenObserverMock).onScreenTurnedOff();
+ }
+
+ @Test
+ public void dump() throws Exception {
+ mScreen.dump(null, new PrintWriter(new ByteArrayOutputStream()), new String[0]);
+ }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java
new file mode 100644
index 0000000..e15e0b4
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.systemui.keyguard;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import android.support.test.filters.SmallTest;
+import android.testing.AndroidTestingRunner;
+
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+
+@RunWith(AndroidTestingRunner.class)
+@SmallTest
+public class WakefulnessLifecycleTest extends SysuiTestCase {
+
+ private WakefulnessLifecycle mWakefulness;
+ private WakefulnessLifecycle.Observer mWakefulnessObserver;
+
+ @Before
+ public void setUp() throws Exception {
+ mWakefulness = new WakefulnessLifecycle();
+ mWakefulnessObserver = mock(WakefulnessLifecycle.Observer.class);
+ mWakefulness.addObserver(mWakefulnessObserver);
+ }
+
+ @Test
+ public void baseState() throws Exception {
+ assertEquals(WakefulnessLifecycle.WAKEFULNESS_ASLEEP, mWakefulness.getWakefulness());
+
+ verifyNoMoreInteractions(mWakefulnessObserver);
+ }
+
+ @Test
+ public void dispatchStartedWakingUp() throws Exception {
+ mWakefulness.dispatchStartedWakingUp();
+
+ assertEquals(WakefulnessLifecycle.WAKEFULNESS_WAKING, mWakefulness.getWakefulness());
+
+ verify(mWakefulnessObserver).onStartedWakingUp();
+ }
+
+ @Test
+ public void dispatchFinishedWakingUp() throws Exception {
+ mWakefulness.dispatchStartedWakingUp();
+ mWakefulness.dispatchFinishedWakingUp();
+
+ assertEquals(WakefulnessLifecycle.WAKEFULNESS_AWAKE, mWakefulness.getWakefulness());
+
+ verify(mWakefulnessObserver).onFinishedWakingUp();
+ }
+
+ @Test
+ public void dispatchStartedGoingToSleep() throws Exception {
+ mWakefulness.dispatchStartedWakingUp();
+ mWakefulness.dispatchFinishedWakingUp();
+ mWakefulness.dispatchStartedGoingToSleep();
+
+ assertEquals(WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP,
+ mWakefulness.getWakefulness());
+
+ verify(mWakefulnessObserver).onStartedGoingToSleep();
+ }
+
+ @Test
+ public void dispatchFinishedGoingToSleep() throws Exception {
+ mWakefulness.dispatchStartedWakingUp();
+ mWakefulness.dispatchFinishedWakingUp();
+ mWakefulness.dispatchStartedGoingToSleep();
+ mWakefulness.dispatchFinishedGoingToSleep();
+
+ assertEquals(WakefulnessLifecycle.WAKEFULNESS_ASLEEP,
+ mWakefulness.getWakefulness());
+
+ verify(mWakefulnessObserver).onFinishedGoingToSleep();
+ }
+
+ @Test
+ public void dump() throws Exception {
+ mWakefulness.dump(null, new PrintWriter(new ByteArrayOutputStream()), new String[0]);
+ }
+
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
index 8cacb4b..9603207 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
@@ -269,9 +269,9 @@
}
@Test
- public void testHandleSysnavKey() {
- mCommandQueue.handleSystemNavigationKey(1);
+ public void testHandleSysKey() {
+ mCommandQueue.handleSystemKey(1);
waitForIdleSync();
- verify(mCallbacks).handleSystemNavigationKey(eq(1));
+ verify(mCallbacks).handleSystemKey(eq(1));
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java
index 51e35cc..3f952c3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java
@@ -47,6 +47,11 @@
}
@Override
+ public boolean isOccluded() {
+ return false;
+ }
+
+ @Override
public boolean isKeyguardFadingAway() {
return false;
}
diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto
index 93fae58..52f721b 100644
--- a/proto/src/system_messages.proto
+++ b/proto/src/system_messages.proto
@@ -183,6 +183,10 @@
// Inform the user that the connected audio accessory is not supported
NOTE_USB_AUDIO_ACCESSORY_NOT_SUPPORTED = 41;
+ // Inform the user that a wrong password was detected while attempting to connect
+ // to a Wi-Fi network
+ NOTE_WIFI_WRONG_PASSWORD = 42;
+
// ADD_NEW_IDS_ABOVE_THIS_LINE
// Legacy IDs with arbitrary values appear below
// Legacy IDs existed as stable non-conflicting constants prior to the O release
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
index 9d92cbc..a6ea6b2 100644
--- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
+++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
@@ -111,7 +111,7 @@
mProjectionGrant.stop();
}
if (mMediaRouteInfo != null) {
- mMediaRouter.getDefaultRoute().select();
+ mMediaRouter.getFallbackRoute().select();
}
mProjectionToken = projection.asBinder();
mProjectionGrant = projection;
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 1f684aa..5a8ebc2 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -3828,13 +3828,6 @@
return true;
}
- // Suppressed for being too recently noisy
- final String pkg = record.sbn.getPackageName();
- if (mUsageStats.isAlertRateLimited(pkg)) {
- Slog.e(TAG, "Muting recently noisy " + record.getKey());
- return true;
- }
-
// muted by listener
final String disableEffects = disableNotificationEffects(record);
if (disableEffects != null) {
@@ -3852,6 +3845,13 @@
return notification.suppressAlertingDueToGrouping();
}
+ // Suppressed for being too recently noisy
+ final String pkg = record.sbn.getPackageName();
+ if (mUsageStats.isAlertRateLimited(pkg)) {
+ Slog.e(TAG, "Muting recently noisy " + record.getKey());
+ return true;
+ }
+
return false;
}
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index d7b36aa..8420c90 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -567,6 +567,13 @@
existing.setDescription(channel.getDescription());
existing.setBlockableSystem(channel.isBlockableSystem());
+ // Apps are allowed to downgrade channel importance if the user has not changed any
+ // fields on this channel yet.
+ if (existing.getUserLockedFields() == 0 &&
+ channel.getImportance() < existing.getImportance()) {
+ existing.setImportance(channel.getImportance());
+ }
+
updateConfig();
return;
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 7e0b950..8e2097a 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -1278,6 +1278,16 @@
}
}
+ // Inform the StatusBar; but do not allow it to consume the event.
+ IStatusBarService statusBar = getStatusBarService();
+ if (statusBar != null) {
+ try {
+ statusBar.handleSystemKey(event.getKeyCode());
+ } catch (RemoteException e) {
+ // Oh well.
+ }
+ }
+
// If the power key has still not yet been handled, then detect short
// press, long press, or multi press and decide what to do.
mPowerKeyHandled = hungUp || mScreenshotChordVolumeDownKeyTriggered
@@ -3158,10 +3168,18 @@
@Override
public void selectRotationAnimationLw(int anim[]) {
+ // If the screen is off or non-interactive, force a jumpcut.
+ final boolean forceJumpcut = !mScreenOnFully || !mAwake;
if (PRINT_ANIM) Slog.i(TAG, "selectRotationAnimation mTopFullscreen="
+ mTopFullscreenOpaqueWindowState + " rotationAnimation="
+ (mTopFullscreenOpaqueWindowState == null ?
- "0" : mTopFullscreenOpaqueWindowState.getAttrs().rotationAnimation));
+ "0" : mTopFullscreenOpaqueWindowState.getAttrs().rotationAnimation)
+ + " forceJumpcut=" + forceJumpcut);
+ if (forceJumpcut) {
+ anim[0] = R.anim.rotation_animation_jump_exit;
+ anim[1] = R.anim.rotation_animation_enter;
+ return;
+ }
if (mTopFullscreenOpaqueWindowState != null) {
int animationHint = mTopFullscreenOpaqueWindowState.getRotationAnimationHint();
if (animationHint < 0 && mTopIsFullscreen) {
@@ -6221,7 +6239,7 @@
IStatusBarService sbar = getStatusBarService();
if (sbar != null) {
try {
- sbar.handleSystemNavigationKey(event.getKeyCode());
+ sbar.handleSystemKey(event.getKeyCode());
} catch (RemoteException e1) {
// oops, no statusbar. Ignore event.
}
@@ -6606,6 +6624,10 @@
@Override
public void finishedWakingUp() {
if (DEBUG_WAKEUP) Slog.i(TAG, "Finished waking up...");
+
+ if (mKeyguardDelegate != null) {
+ mKeyguardDelegate.onFinishedWakingUp();
+ }
}
private void wakeUpFromPowerKey(long eventTime) {
@@ -6714,6 +6736,11 @@
@Override
public void screenTurningOff(ScreenOffListener screenOffListener) {
mWindowManagerFuncs.screenTurningOff(screenOffListener);
+ synchronized (mLock) {
+ if (mKeyguardDelegate != null) {
+ mKeyguardDelegate.onScreenTurningOff();
+ }
+ }
}
private void reportScreenStateToVrManager(boolean isScreenOn) {
@@ -6810,8 +6837,8 @@
}
@Override
- public boolean isInteractive() {
- return mAwake;
+ public boolean okToAnimate() {
+ return mAwake && !mGoingToSleep;
}
/** {@inheritDoc} */
diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
index 0121ee1..50e5e7b 100644
--- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
+++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
@@ -35,10 +35,12 @@
private static final int SCREEN_STATE_OFF = 0;
private static final int SCREEN_STATE_TURNING_ON = 1;
private static final int SCREEN_STATE_ON = 2;
+ private static final int SCREEN_STATE_TURNING_OFF = 3;
private static final int INTERACTIVE_STATE_SLEEP = 0;
- private static final int INTERACTIVE_STATE_AWAKE = 1;
- private static final int INTERACTIVE_STATE_GOING_TO_SLEEP = 2;
+ private static final int INTERACTIVE_STATE_WAKING = 1;
+ private static final int INTERACTIVE_STATE_AWAKE = 2;
+ private static final int INTERACTIVE_STATE_GOING_TO_SLEEP = 3;
protected KeyguardServiceWrapper mKeyguardService;
private final Context mContext;
@@ -164,9 +166,13 @@
mKeyguardService.setCurrentUser(mKeyguardState.currentUser);
}
// This is used to hide the scrim once keyguard displays.
- if (mKeyguardState.interactiveState == INTERACTIVE_STATE_AWAKE) {
+ if (mKeyguardState.interactiveState == INTERACTIVE_STATE_AWAKE
+ || mKeyguardState.interactiveState == INTERACTIVE_STATE_WAKING) {
mKeyguardService.onStartedWakingUp();
}
+ if (mKeyguardState.interactiveState == INTERACTIVE_STATE_AWAKE) {
+ mKeyguardService.onFinishedWakingUp();
+ }
if (mKeyguardState.screenState == SCREEN_STATE_ON
|| mKeyguardState.screenState == SCREEN_STATE_TURNING_ON) {
mKeyguardService.onScreenTurningOn(
@@ -277,9 +283,25 @@
if (DEBUG) Log.v(TAG, "onStartedWakingUp()");
mKeyguardService.onStartedWakingUp();
}
+ mKeyguardState.interactiveState = INTERACTIVE_STATE_WAKING;
+ }
+
+ public void onFinishedWakingUp() {
+ if (mKeyguardService != null) {
+ if (DEBUG) Log.v(TAG, "onFinishedWakingUp()");
+ mKeyguardService.onFinishedWakingUp();
+ }
mKeyguardState.interactiveState = INTERACTIVE_STATE_AWAKE;
}
+ public void onScreenTurningOff() {
+ if (mKeyguardService != null) {
+ if (DEBUG) Log.v(TAG, "onScreenTurningOff()");
+ mKeyguardService.onScreenTurningOff();
+ }
+ mKeyguardState.screenState = SCREEN_STATE_TURNING_OFF;
+ }
+
public void onScreenTurnedOff() {
if (mKeyguardService != null) {
if (DEBUG) Log.v(TAG, "onScreenTurnedOff()");
diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
index 425be54..952e0b0 100644
--- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
+++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
@@ -128,6 +128,15 @@
}
@Override
+ public void onFinishedWakingUp() {
+ try {
+ mService.onFinishedWakingUp();
+ } catch (RemoteException e) {
+ Slog.w(TAG , "Remote Exception", e);
+ }
+ }
+
+ @Override
public void onScreenTurningOn(IKeyguardDrawnCallback callback) {
try {
mService.onScreenTurningOn(callback);
@@ -146,6 +155,15 @@
}
@Override
+ public void onScreenTurningOff() {
+ try {
+ mService.onScreenTurningOff();
+ } catch (RemoteException e) {
+ Slog.w(TAG , "Remote Exception", e);
+ }
+ }
+
+ @Override
public void onScreenTurnedOff() {
try {
mService.onScreenTurnedOff();
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index 984b40f..2df0f10 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -404,12 +404,12 @@
}
@Override
- public void handleSystemNavigationKey(int key) throws RemoteException {
+ public void handleSystemKey(int key) throws RemoteException {
enforceExpandStatusBar();
if (mBar != null) {
try {
- mBar.handleSystemNavigationKey(key);
+ mBar.handleSystemKey(key);
} catch (RemoteException ex) {
}
}
diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java
index a6ffe83..84fafe2 100644
--- a/services/core/java/com/android/server/wm/AppWindowContainerController.java
+++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java
@@ -115,41 +115,6 @@
mListener.onWindowsGone();
};
- private final Runnable mRemoveStartingWindow = () -> {
- StartingSurface surface = null;
- synchronized (mWindowMap) {
- if (mContainer == null) {
- if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "mContainer was null while trying to"
- + " remove starting window");
- return;
- }
- if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Remove starting " + mContainer
- + ": startingWindow=" + mContainer.startingWindow
- + " startingView=" + mContainer.startingSurface);
- if (mContainer.startingData != null) {
- surface = mContainer.startingSurface;
- mContainer.startingData = null;
- mContainer.startingSurface = null;
- mContainer.startingWindow = null;
- mContainer.startingDisplayed = false;
- if (surface == null && DEBUG_STARTING_WINDOW) {
- Slog.v(TAG_WM, "startingWindow was set but startingSurface==null, couldn't "
- + "remove");
- }
- } else if (DEBUG_STARTING_WINDOW) {
- Slog.v(TAG_WM, "Tried to remove starting window but startingWindow was null:"
- + mContainer);
- }
- }
- if (surface != null) {
- try {
- surface.remove();
- } catch (Exception e) {
- Slog.w(TAG_WM, "Exception when removing starting window", e);
- }
- }
- };
-
private final Runnable mAddStartingWindow = () -> {
final StartingData startingData;
final AppWindowToken container;
@@ -665,13 +630,6 @@
void removeStartingWindow() {
synchronized (mWindowMap) {
- if (mHandler.hasCallbacks(mRemoveStartingWindow)) {
- // Already scheduled.
- if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Trying to remove starting window but "
- + "already scheduled");
- return;
- }
-
if (mContainer.startingWindow == null) {
if (mContainer.startingData != null) {
// Starting window has not been added yet, but it is scheduled to be added.
@@ -683,12 +641,39 @@
return;
}
+ final StartingSurface surface;
+ if (mContainer.startingData != null) {
+ surface = mContainer.startingSurface;
+ mContainer.startingData = null;
+ mContainer.startingSurface = null;
+ mContainer.startingWindow = null;
+ mContainer.startingDisplayed = false;
+ if (surface == null && DEBUG_STARTING_WINDOW) {
+ Slog.v(TAG_WM, "startingWindow was set but startingSurface==null, couldn't "
+ + "remove");
+ }
+ } else {
+ if (DEBUG_STARTING_WINDOW) {
+ Slog.v(TAG_WM, "Tried to remove starting window but startingWindow was null:"
+ + mContainer);
+ }
+ return;
+ }
+
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Schedule remove starting " + mContainer
- + " startingWindow=" + mContainer.startingWindow);
+ + " startingWindow=" + mContainer.startingWindow
+ + " startingView=" + mContainer.startingSurface);
// Use the same thread to remove the window as we used to add it, as otherwise we end up
// with things in the view hierarchy being called from different threads.
- mService.mAnimationHandler.post(mRemoveStartingWindow);
+ mHandler.post(() -> {
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Removing startingView=" + surface);
+ try {
+ surface.remove();
+ } catch (Exception e) {
+ Slog.w(TAG_WM, "Exception when removing starting window", e);
+ }
+ });
}
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index b9d02a9..63890bf 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -431,11 +431,18 @@
mEnteringAnimation = true;
mService.mActivityManagerAppTransitionNotifier.onAppTransitionFinishedLocked(token);
}
+
// If we are hidden but there is no delay needed we immediately
// apply the Surface transaction so that the ActivityManager
- // can have some guarantee on the Surface state
- // following setting the visibility.
- if (hidden && !delayed) {
+ // can have some guarantee on the Surface state following
+ // setting the visibility. This captures cases like dismissing
+ // the docked or pinned stack where there is no app transition.
+ //
+ // In the case of a "Null" animation, there will be
+ // no animation but there will still be a transition set.
+ // We still need to delay hiding the surface such that it
+ // can be synchronized with showing the next surface in the transition.
+ if (hidden && !delayed && !mService.mAppTransition.isTransitionSet()) {
SurfaceControl.openTransaction();
for (int i = mChildren.size() - 1; i >= 0; i--) {
mChildren.get(i).mWinAnimator.hide("immediately hidden");
diff --git a/services/core/java/com/android/server/wm/TaskWindowContainerController.java b/services/core/java/com/android/server/wm/TaskWindowContainerController.java
index 9f02485..54a6cc0 100644
--- a/services/core/java/com/android/server/wm/TaskWindowContainerController.java
+++ b/services/core/java/com/android/server/wm/TaskWindowContainerController.java
@@ -80,7 +80,9 @@
final Task task = createTask(taskId, stack, userId, bounds, overrideConfig, resizeMode,
supportsPictureInPicture, homeTask, taskDescription);
final int position = toTop ? POSITION_TOP : POSITION_BOTTOM;
- stack.addTask(task, position, showForAllUsers, true /* moveParents */);
+ // We only want to move the parents to the parents if we are creating this task at the
+ // top of its stack.
+ stack.addTask(task, position, showForAllUsers, toTop /* moveParents */);
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 17e87a0..5bd5e21 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2403,7 +2403,7 @@
}
boolean okToAnimate() {
- return okToDisplay() && mPolicy.isInteractive();
+ return okToDisplay() && mPolicy.okToAnimate();
}
@Override
diff --git a/services/core/jni/com_android_server_am_BatteryStatsService.cpp b/services/core/jni/com_android_server_am_BatteryStatsService.cpp
index 2dfd8b9..413f430 100644
--- a/services/core/jni/com_android_server_am_BatteryStatsService.cpp
+++ b/services/core/jni/com_android_server_am_BatteryStatsService.cpp
@@ -301,30 +301,17 @@
if (status != Status::SUCCESS)
return;
- for (size_t i = 0; i < subsystems.size(); i++) {
- int added;
- const PowerStateSubsystem &subsystem = subsystems[i];
-
- added = snprintf(offset, remaining,
- "subsystem_%zu name=%s ", i + 1, subsystem.name.c_str());
- if (added < 0) {
- break;
- }
-
- if (added > remaining) {
- added = remaining;
- }
-
+ if (subsystems.size() > 0) {
+ int added = snprintf(offset, remaining, "SubsystemPowerState ");
offset += added;
remaining -= added;
total_added += added;
- for (size_t j = 0; j < subsystem.states.size(); j++) {
- const PowerStateSubsystemSleepState& state = subsystem.states[j];
+ for (size_t i = 0; i < subsystems.size(); i++) {
+ const PowerStateSubsystem &subsystem = subsystems[i];
+
added = snprintf(offset, remaining,
- "state_%zu name=%s time=%" PRIu64 " count=%" PRIu64 " last entry TS(ms)=%" PRIu64 " ",
- j + 1, state.name.c_str(), state.residencyInMsecSinceBoot,
- state.totalTransitions, state.lastEntryTimestampMs);
+ "subsystem_%zu name=%s ", i + 1, subsystem.name.c_str());
if (added < 0) {
break;
}
@@ -336,14 +323,33 @@
offset += added;
remaining -= added;
total_added += added;
- }
- if (remaining <= 0) {
- /* rewrite NULL character*/
- offset--;
- total_added--;
- ALOGE("PowerHal: buffer not enough");
- break;
+ for (size_t j = 0; j < subsystem.states.size(); j++) {
+ const PowerStateSubsystemSleepState& state = subsystem.states[j];
+ added = snprintf(offset, remaining,
+ "state_%zu name=%s time=%" PRIu64 " count=%" PRIu64 " last entry=%" PRIu64 " ",
+ j + 1, state.name.c_str(), state.residencyInMsecSinceBoot,
+ state.totalTransitions, state.lastEntryTimestampMs);
+ if (added < 0) {
+ break;
+ }
+
+ if (added > remaining) {
+ added = remaining;
+ }
+
+ offset += added;
+ remaining -= added;
+ total_added += added;
+ }
+
+ if (remaining <= 0) {
+ /* rewrite NULL character*/
+ offset--;
+ total_added--;
+ ALOGE("PowerHal: buffer not enough");
+ break;
+ }
}
}
}
diff --git a/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java b/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java
index 807703b..b023126 100644
--- a/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java
+++ b/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java
@@ -831,6 +831,16 @@
}
@Test
+ public void testPostingGroupSuppressedDoesNotAffectRateLimiting() throws Exception {
+ NotificationRecord summary = getBeepyNotificationRecord("a", GROUP_ALERT_CHILDREN);
+ summary.getNotification().flags |= Notification.FLAG_GROUP_SUMMARY;
+
+ mService.buzzBeepBlinkLocked(summary);
+
+ verify(mUsageStats, never()).isAlertRateLimited(any());
+ }
+
+ @Test
public void testCrossUserSoundMuted() throws Exception {
final Notification n = new Builder(getContext(), "test")
.setSmallIcon(android.R.drawable.sym_def_app_icon).build();
diff --git a/services/tests/notification/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/notification/src/com/android/server/notification/NotificationManagerServiceTest.java
index 8b3fb18..bbec98c 100644
--- a/services/tests/notification/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/notification/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -81,7 +81,7 @@
@RunWithLooper
public class NotificationManagerServiceTest extends NotificationTestCase {
private static final String TEST_CHANNEL_ID = "NotificationManagerServiceTestChannelId";
- private final int uid = Binder.getCallingUid();
+ private final int mUid = Binder.getCallingUid();
private NotificationManagerService mNotificationManagerService;
private INotificationManager mBinderService;
private NotificationManagerInternal mInternalService;
@@ -133,13 +133,13 @@
// most tests assume badging is enabled
Secure.putIntForUser(getContext().getContentResolver(),
Secure.NOTIFICATION_BADGING, 1,
- UserHandle.getUserHandleForUid(uid).getIdentifier());
+ UserHandle.getUserHandleForUid(mUid).getIdentifier());
mNotificationManagerService = new TestableNotificationManagerService(mContext);
// MockPackageManager - default returns ApplicationInfo with matching calling UID
final ApplicationInfo applicationInfo = new ApplicationInfo();
- applicationInfo.uid = uid;
+ applicationInfo.uid = mUid;
when(mPackageManager.getApplicationInfo(anyString(), anyInt(), anyInt()))
.thenReturn(applicationInfo);
when(mPackageManagerClient.getApplicationInfoAsUser(anyString(), anyInt(), anyInt()))
@@ -151,7 +151,7 @@
mTestableLooper = TestableLooper.get(this);
mListener = mNotificationListeners.new ManagedServiceInfo(
- null, new ComponentName(PKG, "test_class"), uid, true, null, 0);
+ null, new ComponentName(PKG, "test_class"), mUid, true, null, 0);
when(mNotificationListeners.checkServiceTokenLocked(any())).thenReturn(mListener);
try {
mNotificationManagerService.init(mTestableLooper.getLooper(), mPackageManager,
@@ -183,8 +183,8 @@
.setGroup(groupKey)
.setGroupSummary(isSummary);
- StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, id, "tag", uid, 0,
- nb.build(), new UserHandle(uid), null, 0);
+ StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, id, "tag", mUid, 0,
+ nb.build(), new UserHandle(mUid), null, 0);
return new NotificationRecord(mContext, sbn, channel);
}
private NotificationRecord generateNotificationRecord(NotificationChannel channel) {
@@ -202,8 +202,8 @@
if (extender != null) {
nb.extend(extender);
}
- StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, "tag", uid, 0,
- nb.build(), new UserHandle(uid), null, 0);
+ StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, "tag", mUid, 0,
+ nb.build(), new UserHandle(mUid), null, 0);
return new NotificationRecord(mContext, sbn, channel);
}
@@ -211,17 +211,17 @@
public void testCreateNotificationChannels_SingleChannel() throws Exception {
final NotificationChannel channel =
new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_DEFAULT);
- mBinderService.createNotificationChannels("test_pkg",
+ mBinderService.createNotificationChannels(PKG,
new ParceledListSlice(Arrays.asList(channel)));
final NotificationChannel createdChannel =
- mBinderService.getNotificationChannel("test_pkg", "id");
+ mBinderService.getNotificationChannel(PKG, "id");
assertTrue(createdChannel != null);
}
@Test
public void testCreateNotificationChannels_NullChannelThrowsException() throws Exception {
try {
- mBinderService.createNotificationChannels("test_pkg",
+ mBinderService.createNotificationChannels(PKG,
new ParceledListSlice(Arrays.asList(null)));
fail("Exception should be thrown immediately.");
} catch (NullPointerException e) {
@@ -235,10 +235,10 @@
new NotificationChannel("id1", "name", NotificationManager.IMPORTANCE_DEFAULT);
final NotificationChannel channel2 =
new NotificationChannel("id2", "name", NotificationManager.IMPORTANCE_DEFAULT);
- mBinderService.createNotificationChannels("test_pkg",
+ mBinderService.createNotificationChannels(PKG,
new ParceledListSlice(Arrays.asList(channel1, channel2)));
- assertTrue(mBinderService.getNotificationChannel("test_pkg", "id1") != null);
- assertTrue(mBinderService.getNotificationChannel("test_pkg", "id2") != null);
+ assertTrue(mBinderService.getNotificationChannel(PKG, "id1") != null);
+ assertTrue(mBinderService.getNotificationChannel(PKG, "id2") != null);
}
@Test
@@ -246,30 +246,71 @@
throws Exception {
final NotificationChannel channel =
new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_DEFAULT);
- mBinderService.createNotificationChannels("test_pkg",
+ mBinderService.createNotificationChannels(PKG,
new ParceledListSlice(Arrays.asList(channel)));
// Recreating the channel doesn't throw, but ignores importance.
final NotificationChannel dupeChannel =
new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_HIGH);
- mBinderService.createNotificationChannels("test_pkg",
+ mBinderService.createNotificationChannels(PKG,
new ParceledListSlice(Arrays.asList(dupeChannel)));
final NotificationChannel createdChannel =
- mBinderService.getNotificationChannel("test_pkg", "id");
+ mBinderService.getNotificationChannel(PKG, "id");
assertEquals(NotificationManager.IMPORTANCE_DEFAULT, createdChannel.getImportance());
}
@Test
+ public void testCreateNotificationChannels_SecondCreateAllowedToDowngradeImportance()
+ throws Exception {
+ final NotificationChannel channel =
+ new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_DEFAULT);
+ mBinderService.createNotificationChannels(PKG,
+ new ParceledListSlice(Arrays.asList(channel)));
+
+ // Recreating with a lower importance is allowed to modify the channel.
+ final NotificationChannel dupeChannel =
+ new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_LOW);
+ mBinderService.createNotificationChannels(PKG,
+ new ParceledListSlice(Arrays.asList(dupeChannel)));
+ final NotificationChannel createdChannel =
+ mBinderService.getNotificationChannel(PKG, "id");
+ assertEquals(NotificationManager.IMPORTANCE_LOW, createdChannel.getImportance());
+ }
+
+ @Test
+ public void testCreateNotificationChannels_CannotDowngradeImportanceIfAlreadyUpdated()
+ throws Exception {
+ final NotificationChannel channel =
+ new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_DEFAULT);
+ mBinderService.createNotificationChannels(PKG,
+ new ParceledListSlice(Arrays.asList(channel)));
+
+ // The user modifies importance directly, can no longer be changed by the app.
+ final NotificationChannel updatedChannel =
+ new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_HIGH);
+ mBinderService.updateNotificationChannelForPackage(PKG, mUid, updatedChannel);
+
+ // Recreating with a lower importance leaves channel unchanged.
+ final NotificationChannel dupeChannel =
+ new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_LOW);
+ mBinderService.createNotificationChannels(PKG,
+ new ParceledListSlice(Arrays.asList(dupeChannel)));
+ final NotificationChannel createdChannel =
+ mBinderService.getNotificationChannel(PKG, "id");
+ assertEquals(NotificationManager.IMPORTANCE_HIGH, createdChannel.getImportance());
+ }
+
+ @Test
public void testCreateNotificationChannels_IdenticalChannelsInListIgnoresSecond()
throws Exception {
final NotificationChannel channel1 =
new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_DEFAULT);
final NotificationChannel channel2 =
new NotificationChannel("id", "name", NotificationManager.IMPORTANCE_HIGH);
- mBinderService.createNotificationChannels("test_pkg",
+ mBinderService.createNotificationChannels(PKG,
new ParceledListSlice(Arrays.asList(channel1, channel2)));
final NotificationChannel createdChannel =
- mBinderService.getNotificationChannel("test_pkg", "id");
+ mBinderService.getNotificationChannel(PKG, "id");
assertEquals(NotificationManager.IMPORTANCE_DEFAULT, createdChannel.getImportance());
}
@@ -300,7 +341,7 @@
public void testEnqueuedBlockedNotifications_blockedApp() throws Exception {
when(mPackageManager.isPackageSuspendedForUser(anyString(), anyInt())).thenReturn(false);
- mBinderService.setNotificationsEnabledForPackage(PKG, uid, false);
+ mBinderService.setNotificationsEnabledForPackage(PKG, mUid, false);
final StatusBarNotification sbn = generateNotificationRecord(null).sbn;
mBinderService.enqueueNotificationWithTag(PKG, "opPkg", "tag",
@@ -381,7 +422,7 @@
n.sbn.getId(), n.sbn.getNotification(), n.sbn.getUserId());
waitForIdle();
- mNotificationManagerService.mNotificationDelegate.onClearAll(uid, Binder.getCallingPid(),
+ mNotificationManagerService.mNotificationDelegate.onClearAll(mUid, Binder.getCallingPid(),
n.getUserId());
waitForIdle();
StatusBarNotification[] notifs =
@@ -607,7 +648,7 @@
public void testCreateChannelNotifyListener() throws Exception {
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mNotificationManagerService.setRankingHelper(mRankingHelper);
when(mRankingHelper.getNotificationChannel(eq(PKG), anyInt(),
eq(mTestNotificationChannel.getId()), anyBoolean()))
@@ -632,7 +673,7 @@
public void testCreateChannelGroupNotifyListener() throws Exception {
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mNotificationManagerService.setRankingHelper(mRankingHelper);
NotificationChannelGroup group1 = new NotificationChannelGroup("a", "b");
NotificationChannelGroup group2 = new NotificationChannelGroup("n", "m");
@@ -652,7 +693,7 @@
public void testUpdateChannelNotifyListener() throws Exception {
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mNotificationManagerService.setRankingHelper(mRankingHelper);
mTestNotificationChannel.setLightColor(Color.CYAN);
when(mRankingHelper.getNotificationChannel(eq(PKG), anyInt(),
@@ -670,7 +711,7 @@
public void testDeleteChannelNotifyListener() throws Exception {
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mNotificationManagerService.setRankingHelper(mRankingHelper);
when(mRankingHelper.getNotificationChannel(eq(PKG), anyInt(),
eq(mTestNotificationChannel.getId()), anyBoolean()))
@@ -686,7 +727,7 @@
public void testDeleteChannelGroupNotifyListener() throws Exception {
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
NotificationChannelGroup ncg = new NotificationChannelGroup("a", "b/c");
mNotificationManagerService.setRankingHelper(mRankingHelper);
when(mRankingHelper.getNotificationChannelGroup(eq(ncg.getId()), eq(PKG), anyInt()))
@@ -703,7 +744,7 @@
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mBinderService.updateNotificationChannelFromPrivilegedListener(
null, PKG, Process.myUserHandle(), mTestNotificationChannel);
@@ -719,7 +760,7 @@
public void testUpdateNotificationChannelFromPrivilegedListener_noAccess() throws Exception {
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
try {
mBinderService.updateNotificationChannelFromPrivilegedListener(
@@ -741,7 +782,7 @@
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mListener = mock(ManagedServices.ManagedServiceInfo.class);
mListener.component = new ComponentName(PKG, PKG);
when(mListener.enabledAndUserMatches(anyInt())).thenReturn(false);
@@ -767,7 +808,7 @@
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mBinderService.getNotificationChannelsFromPrivilegedListener(
null, PKG, Process.myUserHandle());
@@ -780,7 +821,7 @@
public void testGetNotificationChannelFromPrivilegedListener_noAccess() throws Exception {
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
try {
mBinderService.getNotificationChannelsFromPrivilegedListener(
@@ -799,7 +840,7 @@
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mListener = mock(ManagedServices.ManagedServiceInfo.class);
when(mListener.enabledAndUserMatches(anyInt())).thenReturn(false);
when(mNotificationListeners.checkServiceTokenLocked(any())).thenReturn(mListener);
@@ -821,7 +862,7 @@
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
associations.add("a");
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mBinderService.getNotificationChannelGroupsFromPrivilegedListener(
null, PKG, Process.myUserHandle());
@@ -833,7 +874,7 @@
public void testGetNotificationChannelGroupsFromPrivilegedListener_noAccess() throws Exception {
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
try {
mBinderService.getNotificationChannelGroupsFromPrivilegedListener(
@@ -850,7 +891,7 @@
public void testGetNotificationChannelGroupsFromPrivilegedListener_badUser() throws Exception {
mNotificationManagerService.setRankingHelper(mRankingHelper);
List<String> associations = new ArrayList<>();
- when(mCompanionMgr.getAssociations(PKG, uid)).thenReturn(associations);
+ when(mCompanionMgr.getAssociations(PKG, mUid)).thenReturn(associations);
mListener = mock(ManagedServices.ManagedServiceInfo.class);
when(mListener.enabledAndUserMatches(anyInt())).thenReturn(false);
when(mNotificationListeners.checkServiceTokenLocked(any())).thenReturn(mListener);
@@ -1020,8 +1061,8 @@
.setColorized(true)
.setFlag(Notification.FLAG_CAN_COLORIZE, true)
.setSmallIcon(android.R.drawable.sym_def_app_icon);
- StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, "tag", uid, 0,
- nb.build(), new UserHandle(uid), null, 0);
+ StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, "tag", mUid, 0,
+ nb.build(), new UserHandle(mUid), null, 0);
NotificationRecord nr = new NotificationRecord(mContext, sbn, mTestNotificationChannel);
mBinderService.enqueueNotificationWithTag(PKG, PKG, null,
@@ -1037,11 +1078,13 @@
@Test
public void testGetNotificationCountLocked() throws Exception {
for (int i = 0; i < 20; i++) {
- NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, i, null, false);
+ NotificationRecord r =
+ generateNotificationRecord(mTestNotificationChannel, i, null, false);
mNotificationManagerService.addEnqueuedNotification(r);
}
for (int i = 0; i < 20; i++) {
- NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, i, null, false);
+ NotificationRecord r =
+ generateNotificationRecord(mTestNotificationChannel, i, null, false);
mNotificationManagerService.addNotification(r);
}
@@ -1051,19 +1094,23 @@
.setSmallIcon(android.R.drawable.sym_def_app_icon)
.build();
- StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "tag", uid, 0,
- n, new UserHandle(uid), null, 0);
+ StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "tag", mUid, 0,
+ n, new UserHandle(mUid), null, 0);
NotificationRecord otherPackage =
new NotificationRecord(mContext, sbn, mTestNotificationChannel);
mNotificationManagerService.addEnqueuedNotification(otherPackage);
mNotificationManagerService.addNotification(otherPackage);
// Same notifications are enqueued as posted, everything counts b/c id and tag don't match
- assertEquals(40, mNotificationManagerService.getNotificationCountLocked(PKG, new UserHandle(uid).getIdentifier(), 0, null));
- assertEquals(40, mNotificationManagerService.getNotificationCountLocked(PKG, new UserHandle(uid).getIdentifier(), 0, "tag2"));
- assertEquals(2, mNotificationManagerService.getNotificationCountLocked("a", new UserHandle(uid).getIdentifier(), 0, "banana"));
+ assertEquals(40, mNotificationManagerService.getNotificationCountLocked(
+ PKG, new UserHandle(mUid).getIdentifier(), 0, null));
+ assertEquals(40, mNotificationManagerService.getNotificationCountLocked(
+ PKG, new UserHandle(mUid).getIdentifier(), 0, "tag2"));
+ assertEquals(2, mNotificationManagerService.getNotificationCountLocked(
+ "a", new UserHandle(mUid).getIdentifier(), 0, "banana"));
// exclude a known notification - it's excluded from only the posted list, not enqueued
- assertEquals(39, mNotificationManagerService.getNotificationCountLocked(PKG, new UserHandle(uid).getIdentifier(), 0, "tag"));
+ assertEquals(39, mNotificationManagerService.getNotificationCountLocked(
+ PKG, new UserHandle(mUid).getIdentifier(), 0, "tag"));
}
}
diff --git a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
index 0a7a5f2..828d405 100644
--- a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
+++ b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
@@ -382,7 +382,7 @@
}
@Override
- public boolean isInteractive() {
+ public boolean okToAnimate() {
return true;
}
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index e48f7bdb..25c1a8b 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -105,34 +105,43 @@
private boolean mEphemeral;
/**
+ * Running total count of lost (not ACKed) transmitted unicast data packets.
* @hide
*/
public long txBad;
/**
+ * Running total count of transmitted unicast data retry packets.
* @hide
*/
public long txRetries;
/**
+ * Running total count of successfully transmitted (ACKed) unicast data packets.
* @hide
*/
public long txSuccess;
/**
+ * Running total count of received unicast data packets.
* @hide
*/
public long rxSuccess;
+
/**
+ * Average rate of lost transmitted packets, in units of packets per 5 seconds.
* @hide
*/
public double txBadRate;
/**
+ * Average rate of transmitted retry packets, in units of packets per 5 seconds.
* @hide
*/
public double txRetriesRate;
/**
+ * Average rate of successfully transmitted unicast packets, in units of packets per 5 seconds.
* @hide
*/
public double txSuccessRate;
/**
+ * Average rate of received unicast data packets, in units of packets per 5 seconds.
* @hide
*/
public double rxSuccessRate;