Text color of "shutdown" after removing overlay
Bug: 63751714
Fixes: 64079315
Test: Visual, turn off device with white wallpaper set
Change-Id: I667d40135c8c7b4f498bc89f695cbfde5657588c
diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
index fe8373f..61cbc98 100644
--- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
+++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
@@ -134,6 +134,11 @@
* @return colors
*/
public GradientColors getColors(int which, int type, boolean ignoreWallpaperVisibility) {
+ // mWallpaperVisible only handles the "system wallpaper" and will be always set to false
+ // if we have different lock and system wallpapers.
+ if (which == WallpaperManager.FLAG_LOCK) {
+ ignoreWallpaperVisibility = true;
+ }
if (mWallpaperVisible || ignoreWallpaperVisibility) {
return super.getColors(which, type);
} else {
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java
index 56612ad..e894275 100644
--- a/services/core/java/com/android/server/power/ShutdownThread.java
+++ b/services/core/java/com/android/server/power/ShutdownThread.java
@@ -20,7 +20,10 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.IActivityManager;
+import android.app.KeyguardManager;
import android.app.ProgressDialog;
+import android.app.WallpaperColors;
+import android.app.WallpaperManager;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.IBluetoothManager;
import android.content.BroadcastReceiver;
@@ -28,7 +31,6 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.om.IOverlayManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioAttributes;
@@ -53,6 +55,7 @@
import android.view.WindowManager;
import android.widget.ProgressBar;
import android.widget.TextView;
+
import com.android.internal.telephony.ITelephony;
import com.android.server.pm.PackageManagerService;
@@ -300,17 +303,21 @@
d.setContentView(com.android.internal.R.layout.shutdown_dialog);
d.setCancelable(false);
- int color = Color.WHITE;
+ int color;
try {
- IOverlayManager service = IOverlayManager.Stub.asInterface(
- ServiceManager.getService(Context.OVERLAY_SERVICE));
- if (service.getOverlayInfo("com.android.systemui.theme.lightwallpaper", 0).isEnabled()) {
- color = Color.BLACK;
- }
+ boolean onKeyguard = context.getSystemService(
+ KeyguardManager.class).isKeyguardLocked();
+ WallpaperColors currentColors = context.getSystemService(WallpaperManager.class)
+ .getWallpaperColors(onKeyguard ?
+ WallpaperManager.FLAG_LOCK : WallpaperManager.FLAG_SYSTEM);
+ color = currentColors != null &&
+ (currentColors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT)
+ != 0 ?
+ Color.BLACK : Color.WHITE;
} catch (Exception e) {
- // Shutdown UI really shouldn't crash or have strict dependencies on other services.
- Log.w(TAG, "Problem getting overlay state", e);
+ color = Color.WHITE;
}
+
ProgressBar bar = d.findViewById(com.android.internal.R.id.progress);
bar.getIndeterminateDrawable().setTint(color);
((TextView) d.findViewById(com.android.internal.R.id.text1)).setTextColor(color);