Loading core/java/android/provider/Settings.java +18 −0 Original line number Diff line number Diff line Loading @@ -2613,6 +2613,24 @@ public final class Settings { */ public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; /** * Whether the lockscreen blurring is enabled. The value is boolean (1 or 0). * @hide */ public static final String BLUR_EFFECT_LOCKSCREEN = "blur_lockscreen"; /** * Whether the globalaction dialog background blurring is enabled. The value is boolean (1 or 0). * @hide */ public static final String BLUR_EFFECT_GLOBALACTION = "blur_globalaction"; /** * Whether the volumen control content area blurring is enabled. The value is boolean (1 or 0). * @hide */ public static final String BLUR_EFFECT_VOLUMECONTROL = "blur_volume"; /** * Show pointer location on screen? * 0 = no Loading core/java/android/view/SurfaceControl.java +33 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public class SurfaceControl { private static native void nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b); private static native void nativeSetLayerStack(long nativeObject, int layerStack); private static native void nativeSetBlur(long nativeObject, float blur); private static native void nativeSetBlurMaskSurface(long nativeObject, long maskLayerNativeObject); private static native void nativeSetBlurMaskSampling(long nativeObject, int blurMaskSampling); private static native void nativeSetBlurMaskAlphaThreshold(long nativeObject, float alpha); private static native boolean nativeClearContentFrameStats(long nativeObject); private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats); private static native boolean nativeClearAnimationFrameStats(); Loading Loading @@ -169,6 +174,11 @@ public class SurfaceControl { */ public static final int FX_SURFACE_NORMAL = 0x00000000; /** * Surface creation flag: Creates a blur surface. */ public static final int FX_SURFACE_BLUR = 0x00010000; /** * Surface creation flag: Creates a Dim surface. * Everything behind this surface is dimmed by the amount specified Loading Loading @@ -378,6 +388,29 @@ public class SurfaceControl { nativeSetSize(mNativeObject, w, h); } public void setBlur(float blur) { checkNotReleased(); nativeSetBlur(mNativeObject, blur); } public void setBlurMaskSurface(SurfaceControl maskSurface) { checkNotReleased(); if (maskSurface != null) { maskSurface.checkNotReleased(); } nativeSetBlurMaskSurface(mNativeObject, maskSurface == null ? 0:maskSurface.mNativeObject); } public void setBlurMaskSampling(int blurMaskSampling) { checkNotReleased(); nativeSetBlurMaskSampling(mNativeObject, blurMaskSampling); } public void setBlurMaskAlphaThreshold(float alpha) { checkNotReleased(); nativeSetBlurMaskAlphaThreshold(mNativeObject, alpha); } public void hide() { checkNotReleased(); nativeSetFlags(mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); Loading core/java/android/view/Window.java +12 −0 Original line number Diff line number Diff line Loading @@ -768,6 +768,13 @@ public abstract class Window { setPrivateFlags(flags, flags); } /** @hide */ public void setBlurMaskAlphaThreshold(float alpha) { final WindowManager.LayoutParams attrs = getAttributes(); attrs.blurMaskAlphaThreshold = alpha; dispatchWindowAttributesChanged(attrs); } /** * Convenience function to clear the flag bits as specified in flags, as * per {@link #setFlags}. Loading @@ -779,6 +786,11 @@ public abstract class Window { setFlags(0, flags); } /** @hide */ public void clearPrivateFlags(int flags) { setPrivateFlags(0, flags); } /** * Set the flags of the window, as per the * {@link WindowManager.LayoutParams WindowManager.LayoutParams} Loading core/java/android/view/WindowManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -1115,6 +1115,15 @@ public interface WindowManager extends ViewManager { */ public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400; /** Window flag: adding additional blur layer and set this as masking layer * {@hide} */ public static final int PRIVATE_FLAG_BLUR_WITH_MASKING = 0x40000000; /** Window flag: adding additional blur layer and set this as masking layer. * This is faster and ugglier than non-scaled version. * {@hide} */ public static final int PRIVATE_FLAG_BLUR_WITH_MASKING_SCALED = 0x80000000; /** * Control flags that are private to the platform. * @hide Loading Loading @@ -1505,6 +1514,14 @@ public interface WindowManager extends ViewManager { */ public long userActivityTimeout = -1; /** * Threshold value that blur masking layer uses to determine whether * to use or discard the blurred color. * Value should be between 0.0 and 1.0 * @hide */ public float blurMaskAlphaThreshold = 0.0f; public LayoutParams() { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = TYPE_APPLICATION; Loading Loading @@ -1596,6 +1613,7 @@ public interface WindowManager extends ViewManager { out.writeInt(surfaceInsets.top); out.writeInt(surfaceInsets.right); out.writeInt(surfaceInsets.bottom); out.writeFloat(blurMaskAlphaThreshold); } public static final Parcelable.Creator<LayoutParams> CREATOR Loading Loading @@ -1643,6 +1661,7 @@ public interface WindowManager extends ViewManager { surfaceInsets.top = in.readInt(); surfaceInsets.right = in.readInt(); surfaceInsets.bottom = in.readInt(); blurMaskAlphaThreshold = in.readFloat(); } @SuppressWarnings({"PointlessBitwiseExpression"}) Loading Loading @@ -1678,6 +1697,8 @@ public interface WindowManager extends ViewManager { /** {@hide} */ public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21; /** {@hide} */ public static final int BLUR_MASK_ALPHA_THRESHOLD_CHANGED = 1 << 30; /** {@hide} */ public static final int EVERYTHING_CHANGED = 0xffffffff; // internal buffer to backup/restore parameters under compatibility mode. Loading Loading @@ -1822,6 +1843,11 @@ public interface WindowManager extends ViewManager { changes |= SURFACE_INSETS_CHANGED; } if (blurMaskAlphaThreshold != o.blurMaskAlphaThreshold) { blurMaskAlphaThreshold = o.blurMaskAlphaThreshold; changes |= BLUR_MASK_ALPHA_THRESHOLD_CHANGED; } return changes; } Loading core/jni/android_view_SurfaceControl.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,39 @@ static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong nativeObject, j } } static void nativeSetBlur(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat blur) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t err = ctrl->setBlur(blur); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static void nativeSetBlurMaskSurface(JNIEnv* env, jclass clazz, jlong nativeObject, jlong maskLayerNativeObject) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); SurfaceControl* const maskLayer = reinterpret_cast<SurfaceControl *>(maskLayerNativeObject); status_t err = ctrl->setBlurMaskSurface(maskLayer); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static void nativeSetBlurMaskSampling(JNIEnv* env, jclass clazz, jlong nativeObject, jint blurMaskSampling) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t err = ctrl->setBlurMaskSampling(blurMaskSampling); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static void nativeSetBlurMaskAlphaThreshold(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat alpha) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t err = ctrl->setBlurMaskAlphaThreshold(alpha); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static jobject nativeGetBuiltInDisplay(JNIEnv* env, jclass clazz, jint id) { sp<IBinder> token(SurfaceComposerClient::getBuiltInDisplay(id)); return javaObjectForIBinder(env, token); Loading Loading @@ -613,6 +646,14 @@ static JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetWindowCrop }, {"nativeSetLayerStack", "(JI)V", (void*)nativeSetLayerStack }, {"nativeSetBlur", "(JF)V", (void*)nativeSetBlur }, {"nativeSetBlurMaskSurface", "(JJ)V", (void*)nativeSetBlurMaskSurface }, {"nativeSetBlurMaskSampling", "(JI)V", (void*)nativeSetBlurMaskSampling }, {"nativeSetBlurMaskAlphaThreshold", "(JF)V", (void*)nativeSetBlurMaskAlphaThreshold }, {"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;", (void*)nativeGetBuiltInDisplay }, {"nativeCreateDisplay", "(Ljava/lang/String;Z)Landroid/os/IBinder;", Loading Loading
core/java/android/provider/Settings.java +18 −0 Original line number Diff line number Diff line Loading @@ -2613,6 +2613,24 @@ public final class Settings { */ public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; /** * Whether the lockscreen blurring is enabled. The value is boolean (1 or 0). * @hide */ public static final String BLUR_EFFECT_LOCKSCREEN = "blur_lockscreen"; /** * Whether the globalaction dialog background blurring is enabled. The value is boolean (1 or 0). * @hide */ public static final String BLUR_EFFECT_GLOBALACTION = "blur_globalaction"; /** * Whether the volumen control content area blurring is enabled. The value is boolean (1 or 0). * @hide */ public static final String BLUR_EFFECT_VOLUMECONTROL = "blur_volume"; /** * Show pointer location on screen? * 0 = no Loading
core/java/android/view/SurfaceControl.java +33 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public class SurfaceControl { private static native void nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b); private static native void nativeSetLayerStack(long nativeObject, int layerStack); private static native void nativeSetBlur(long nativeObject, float blur); private static native void nativeSetBlurMaskSurface(long nativeObject, long maskLayerNativeObject); private static native void nativeSetBlurMaskSampling(long nativeObject, int blurMaskSampling); private static native void nativeSetBlurMaskAlphaThreshold(long nativeObject, float alpha); private static native boolean nativeClearContentFrameStats(long nativeObject); private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats); private static native boolean nativeClearAnimationFrameStats(); Loading Loading @@ -169,6 +174,11 @@ public class SurfaceControl { */ public static final int FX_SURFACE_NORMAL = 0x00000000; /** * Surface creation flag: Creates a blur surface. */ public static final int FX_SURFACE_BLUR = 0x00010000; /** * Surface creation flag: Creates a Dim surface. * Everything behind this surface is dimmed by the amount specified Loading Loading @@ -378,6 +388,29 @@ public class SurfaceControl { nativeSetSize(mNativeObject, w, h); } public void setBlur(float blur) { checkNotReleased(); nativeSetBlur(mNativeObject, blur); } public void setBlurMaskSurface(SurfaceControl maskSurface) { checkNotReleased(); if (maskSurface != null) { maskSurface.checkNotReleased(); } nativeSetBlurMaskSurface(mNativeObject, maskSurface == null ? 0:maskSurface.mNativeObject); } public void setBlurMaskSampling(int blurMaskSampling) { checkNotReleased(); nativeSetBlurMaskSampling(mNativeObject, blurMaskSampling); } public void setBlurMaskAlphaThreshold(float alpha) { checkNotReleased(); nativeSetBlurMaskAlphaThreshold(mNativeObject, alpha); } public void hide() { checkNotReleased(); nativeSetFlags(mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); Loading
core/java/android/view/Window.java +12 −0 Original line number Diff line number Diff line Loading @@ -768,6 +768,13 @@ public abstract class Window { setPrivateFlags(flags, flags); } /** @hide */ public void setBlurMaskAlphaThreshold(float alpha) { final WindowManager.LayoutParams attrs = getAttributes(); attrs.blurMaskAlphaThreshold = alpha; dispatchWindowAttributesChanged(attrs); } /** * Convenience function to clear the flag bits as specified in flags, as * per {@link #setFlags}. Loading @@ -779,6 +786,11 @@ public abstract class Window { setFlags(0, flags); } /** @hide */ public void clearPrivateFlags(int flags) { setPrivateFlags(0, flags); } /** * Set the flags of the window, as per the * {@link WindowManager.LayoutParams WindowManager.LayoutParams} Loading
core/java/android/view/WindowManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -1115,6 +1115,15 @@ public interface WindowManager extends ViewManager { */ public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400; /** Window flag: adding additional blur layer and set this as masking layer * {@hide} */ public static final int PRIVATE_FLAG_BLUR_WITH_MASKING = 0x40000000; /** Window flag: adding additional blur layer and set this as masking layer. * This is faster and ugglier than non-scaled version. * {@hide} */ public static final int PRIVATE_FLAG_BLUR_WITH_MASKING_SCALED = 0x80000000; /** * Control flags that are private to the platform. * @hide Loading Loading @@ -1505,6 +1514,14 @@ public interface WindowManager extends ViewManager { */ public long userActivityTimeout = -1; /** * Threshold value that blur masking layer uses to determine whether * to use or discard the blurred color. * Value should be between 0.0 and 1.0 * @hide */ public float blurMaskAlphaThreshold = 0.0f; public LayoutParams() { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = TYPE_APPLICATION; Loading Loading @@ -1596,6 +1613,7 @@ public interface WindowManager extends ViewManager { out.writeInt(surfaceInsets.top); out.writeInt(surfaceInsets.right); out.writeInt(surfaceInsets.bottom); out.writeFloat(blurMaskAlphaThreshold); } public static final Parcelable.Creator<LayoutParams> CREATOR Loading Loading @@ -1643,6 +1661,7 @@ public interface WindowManager extends ViewManager { surfaceInsets.top = in.readInt(); surfaceInsets.right = in.readInt(); surfaceInsets.bottom = in.readInt(); blurMaskAlphaThreshold = in.readFloat(); } @SuppressWarnings({"PointlessBitwiseExpression"}) Loading Loading @@ -1678,6 +1697,8 @@ public interface WindowManager extends ViewManager { /** {@hide} */ public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21; /** {@hide} */ public static final int BLUR_MASK_ALPHA_THRESHOLD_CHANGED = 1 << 30; /** {@hide} */ public static final int EVERYTHING_CHANGED = 0xffffffff; // internal buffer to backup/restore parameters under compatibility mode. Loading Loading @@ -1822,6 +1843,11 @@ public interface WindowManager extends ViewManager { changes |= SURFACE_INSETS_CHANGED; } if (blurMaskAlphaThreshold != o.blurMaskAlphaThreshold) { blurMaskAlphaThreshold = o.blurMaskAlphaThreshold; changes |= BLUR_MASK_ALPHA_THRESHOLD_CHANGED; } return changes; } Loading
core/jni/android_view_SurfaceControl.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,39 @@ static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong nativeObject, j } } static void nativeSetBlur(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat blur) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t err = ctrl->setBlur(blur); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static void nativeSetBlurMaskSurface(JNIEnv* env, jclass clazz, jlong nativeObject, jlong maskLayerNativeObject) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); SurfaceControl* const maskLayer = reinterpret_cast<SurfaceControl *>(maskLayerNativeObject); status_t err = ctrl->setBlurMaskSurface(maskLayer); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static void nativeSetBlurMaskSampling(JNIEnv* env, jclass clazz, jlong nativeObject, jint blurMaskSampling) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t err = ctrl->setBlurMaskSampling(blurMaskSampling); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static void nativeSetBlurMaskAlphaThreshold(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat alpha) { SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t err = ctrl->setBlurMaskAlphaThreshold(alpha); if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } static jobject nativeGetBuiltInDisplay(JNIEnv* env, jclass clazz, jint id) { sp<IBinder> token(SurfaceComposerClient::getBuiltInDisplay(id)); return javaObjectForIBinder(env, token); Loading Loading @@ -613,6 +646,14 @@ static JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetWindowCrop }, {"nativeSetLayerStack", "(JI)V", (void*)nativeSetLayerStack }, {"nativeSetBlur", "(JF)V", (void*)nativeSetBlur }, {"nativeSetBlurMaskSurface", "(JJ)V", (void*)nativeSetBlurMaskSurface }, {"nativeSetBlurMaskSampling", "(JI)V", (void*)nativeSetBlurMaskSampling }, {"nativeSetBlurMaskAlphaThreshold", "(JF)V", (void*)nativeSetBlurMaskAlphaThreshold }, {"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;", (void*)nativeGetBuiltInDisplay }, {"nativeCreateDisplay", "(Ljava/lang/String;Z)Landroid/os/IBinder;", Loading