am 2997285f: Merge "Disable circular display mask with color inversion" into lmp-sprout-dev
* commit '2997285f362349097882d1b31eb23cb867227192': Disable circular display mask with color inversion
This commit is contained in:
@@ -73,6 +73,7 @@ import android.graphics.RectF;
|
|||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.hardware.display.DisplayManager;
|
import android.hardware.display.DisplayManager;
|
||||||
import android.hardware.display.DisplayManagerInternal;
|
import android.hardware.display.DisplayManagerInternal;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Debug;
|
import android.os.Debug;
|
||||||
@@ -558,16 +559,26 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
SettingsObserver mSettingsObserver;
|
SettingsObserver mSettingsObserver;
|
||||||
|
|
||||||
private final class SettingsObserver extends ContentObserver {
|
private final class SettingsObserver extends ContentObserver {
|
||||||
|
private final Uri mShowImeWithHardKeyboardUri =
|
||||||
|
Settings.Secure.getUriFor(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD);
|
||||||
|
|
||||||
|
private final Uri mDisplayInversionEnabledUri =
|
||||||
|
Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
|
||||||
|
|
||||||
public SettingsObserver() {
|
public SettingsObserver() {
|
||||||
super(new Handler());
|
super(new Handler());
|
||||||
ContentResolver resolver = mContext.getContentResolver();
|
ContentResolver resolver = mContext.getContentResolver();
|
||||||
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
resolver.registerContentObserver(mShowImeWithHardKeyboardUri, false, this);
|
||||||
Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD), false, this);
|
resolver.registerContentObserver(mDisplayInversionEnabledUri, false, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange) {
|
public void onChange(boolean selfChange, Uri uri) {
|
||||||
updateShowImeWithHardKeyboard();
|
if (mShowImeWithHardKeyboardUri.equals(uri)) {
|
||||||
|
updateShowImeWithHardKeyboard();
|
||||||
|
} else if (mDisplayInversionEnabledUri.equals(uri)) {
|
||||||
|
updateCircularDisplayMaskIfNeeded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,7 +914,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
SurfaceControl.closeTransaction();
|
SurfaceControl.closeTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
showCircularDisplayMaskIfNeeded();
|
updateCircularDisplayMaskIfNeeded();
|
||||||
showEmulatorDisplayOverlayIfNeeded();
|
showEmulatorDisplayOverlayIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5842,13 +5853,21 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showCircularDisplayMaskIfNeeded() {
|
public void updateCircularDisplayMaskIfNeeded() {
|
||||||
// we're fullscreen and not hosted in an ActivityView
|
// we're fullscreen and not hosted in an ActivityView
|
||||||
if (mContext.getResources().getBoolean(
|
if (mContext.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_windowIsRound)
|
com.android.internal.R.bool.config_windowIsRound)
|
||||||
&& mContext.getResources().getBoolean(
|
&& mContext.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_windowShowCircularMask)) {
|
com.android.internal.R.bool.config_windowShowCircularMask)) {
|
||||||
mH.sendMessage(mH.obtainMessage(H.SHOW_CIRCULAR_DISPLAY_MASK));
|
// Device configuration calls for a circular display mask, but we only enable the mask
|
||||||
|
// if the accessibility color inversion feature is disabled, as the inverted mask
|
||||||
|
// causes artifacts.
|
||||||
|
int inversionState = Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, mCurrentUserId);
|
||||||
|
int showMask = (inversionState == 1) ? 0 : 1;
|
||||||
|
Message m = mH.obtainMessage(H.SHOW_CIRCULAR_DISPLAY_MASK);
|
||||||
|
m.arg1 = showMask;
|
||||||
|
mH.sendMessage(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5861,30 +5880,35 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showCircularMask() {
|
public void showCircularMask(boolean visible) {
|
||||||
synchronized(mWindowMap) {
|
synchronized(mWindowMap) {
|
||||||
|
|
||||||
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
|
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
|
||||||
">>> OPEN TRANSACTION showCircularMask");
|
">>> OPEN TRANSACTION showCircularMask(visible=" + visible + ")");
|
||||||
SurfaceControl.openTransaction();
|
SurfaceControl.openTransaction();
|
||||||
try {
|
try {
|
||||||
// TODO(multi-display): support multiple displays
|
if (visible) {
|
||||||
if (mCircularDisplayMask == null) {
|
// TODO(multi-display): support multiple displays
|
||||||
int screenOffset = mContext.getResources().getDimensionPixelSize(
|
if (mCircularDisplayMask == null) {
|
||||||
com.android.internal.R.dimen.circular_display_mask_offset);
|
int screenOffset = mContext.getResources().getDimensionPixelSize(
|
||||||
|
com.android.internal.R.dimen.circular_display_mask_offset);
|
||||||
|
|
||||||
mCircularDisplayMask = new CircularDisplayMask(
|
mCircularDisplayMask = new CircularDisplayMask(
|
||||||
getDefaultDisplayContentLocked().getDisplay(),
|
getDefaultDisplayContentLocked().getDisplay(),
|
||||||
mFxSession,
|
mFxSession,
|
||||||
mPolicy.windowTypeToLayerLw(
|
mPolicy.windowTypeToLayerLw(
|
||||||
WindowManager.LayoutParams.TYPE_POINTER)
|
WindowManager.LayoutParams.TYPE_POINTER)
|
||||||
* TYPE_LAYER_MULTIPLIER + 10, screenOffset);
|
* TYPE_LAYER_MULTIPLIER + 10, screenOffset);
|
||||||
|
}
|
||||||
|
mCircularDisplayMask.setVisibility(true);
|
||||||
|
} else if (mCircularDisplayMask != null) {
|
||||||
|
mCircularDisplayMask.setVisibility(false);
|
||||||
|
mCircularDisplayMask = null;
|
||||||
}
|
}
|
||||||
mCircularDisplayMask.setVisibility(true);
|
|
||||||
} finally {
|
} finally {
|
||||||
SurfaceControl.closeTransaction();
|
SurfaceControl.closeTransaction();
|
||||||
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
|
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
|
||||||
"<<< CLOSE TRANSACTION showCircularMask");
|
"<<< CLOSE TRANSACTION showCircularMask(visible=" + visible + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7955,7 +7979,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
case SHOW_CIRCULAR_DISPLAY_MASK: {
|
case SHOW_CIRCULAR_DISPLAY_MASK: {
|
||||||
showCircularMask();
|
showCircularMask(msg.arg1 == 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user