Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 616b728a authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Text color of "shutdown" after removing overlay" into oc-dr1-dev am:...

Merge "Text color of "shutdown" after removing overlay" into oc-dr1-dev am: c1edefc0 am: 679f7e40
am: f198fa41

Change-Id: If2870a8099ff3a8c19400414d0d93adeacb613e4
parents 737553c9 f198fa41
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -134,6 +134,11 @@ public class SysuiColorExtractor extends ColorExtractor {
     * @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 {
+16 −9
Original line number Diff line number Diff line
@@ -20,7 +20,10 @@ package com.android.server.power;
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.Context;
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.ViewGroup;
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 @@ public final class ShutdownThread extends Thread {
            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);