Skip to content
19 changes: 19 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -6844,6 +6844,12 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
@Readable
public static final String CUSTOM_RINGTONE_VIBRATION_PATTERN = "custom_ringtone_vibration_pattern";

/**
* Gesture navbar auto-hide mode.
* @hide
*/
public static final String GESTURE_NAVBAR_AUTO_HIDE = "gesture_navbar_auto_hide";

/**
* Whether to show seconds next to clock in status bar
* 0 - hide (default)
Expand Down Expand Up @@ -21522,12 +21528,25 @@ public static boolean putFloat(ContentResolver cr, String name, float value) {
*/
public static final String RESTRICTED_NETWORKING_MODE = "restricted_networking_mode";

/**
* Control whether FLAG_SECURE is ignored for all windows.
* @hide
*/
@Readable
public static final String WINDOW_IGNORE_SECURE = "window_ignore_secure";

/**
* Control whether application downgrade is allowed.
* @hide
*/
public static final String PM_DOWNGRADE_ALLOWED = "pm_downgrade_allowed";

/**
* Control whether to hide screen capture status from apps.
* @hide
*/
public static final String HIDE_SCREEN_CAPTURE_STATUS = "hide_screen_capture_status";

/**
* Setting indicating whether Low Power Standby is enabled, if supported.
*
Expand Down
5 changes: 4 additions & 1 deletion core/java/android/view/SurfaceView.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.AttributeSet;
Expand Down Expand Up @@ -953,7 +954,9 @@ public boolean setZOrderedOnTop(boolean onTop, boolean allowDynamicChange) {
* @param isSecure True if the surface view is secure.
*/
public void setSecure(boolean isSecure) {
if (isSecure) {
boolean ignoreSecure = Settings.Global.getInt(getContext().getContentResolver(),
Settings.Global.WINDOW_IGNORE_SECURE, 0) == 1;
if (isSecure && !ignoreSecure) {
mSurfaceFlags |= SurfaceControl.SECURE;
} else {
mSurfaceFlags &= ~SurfaceControl.SECURE;
Expand Down
6 changes: 6 additions & 0 deletions core/java/android/view/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static android.Manifest.permission.HIDE_OVERLAY_WINDOWS;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;

import android.annotation.ColorInt;
Expand Down Expand Up @@ -52,6 +53,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.provider.Settings;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionManager;
Expand Down Expand Up @@ -1364,6 +1366,10 @@ public void clearFlags(int flags) {
* @see #clearFlags
*/
public void setFlags(int flags, int mask) {
if ((mask & FLAG_SECURE) != 0 && Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.WINDOW_IGNORE_SECURE, 0) == 1) {
mask &= ~FLAG_SECURE;
}
final WindowManager.LayoutParams attrs = getAttributes();
attrs.flags = (attrs.flags&~mask) | (flags&mask);
mForcedWindowFlags |= mask;
Expand Down
17 changes: 17 additions & 0 deletions core/java/android/view/WindowManagerGlobal.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.AndroidRuntimeException;
import android.util.ArrayMap;
import android.util.ArraySet;
Expand Down Expand Up @@ -480,6 +481,14 @@ public void addView(View view, ViewGroup.LayoutParams params,
windowlessSession, new WindowlessWindowLayout());
}

boolean ignoreSecure = Settings.Global.getInt(
view.getContext().getContentResolver(),
Settings.Global.WINDOW_IGNORE_SECURE, 0) == 1;

if (ignoreSecure) {
wparams.flags &= ~WindowManager.LayoutParams.FLAG_SECURE;
}

view.setLayoutParams(wparams);

mViews.add(view);
Expand Down Expand Up @@ -510,6 +519,14 @@ public void updateViewLayout(View view, ViewGroup.LayoutParams params) {
throw new IllegalArgumentException("Params must be WindowManager.LayoutParams");
}

boolean ignoreSecure = Settings.Global.getInt(
view.getContext().getContentResolver(),
Settings.Global.WINDOW_IGNORE_SECURE, 0) == 1;

if (ignoreSecure) {
wparams.flags &= ~WindowManager.LayoutParams.FLAG_SECURE;
}

view.setLayoutParams(wparams);

synchronized (mLock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ object DebugLogger {
error: Throwable? = null,
message: () -> String,
) {
if (enabled) {
if (error == null) {
Log.println(priority, tag, message())
} else {
Log.printlns(LOG_ID_MAIN, priority, tag, message(), error)
}
}
// no-op.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.android.systemui.keyguard.ui.transitions.PrimaryBouncerTransition
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.scene.ui.composable.transitions.TO_BOUNCER_FADE_FRACTION
import com.android.systemui.util.settings.SecureSettings
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.flow.Flow
Expand All @@ -41,8 +42,11 @@ import kotlinx.coroutines.flow.emptyFlow
@SysUISingleton
class AlternateBouncerToPrimaryBouncerTransitionViewModel
@Inject
constructor(animationFlow: KeyguardTransitionAnimationFlow, blurConfig: BlurConfig) :
DeviceEntryIconTransition, PrimaryBouncerTransition {
constructor(
animationFlow: KeyguardTransitionAnimationFlow,
blurConfig: BlurConfig,
private val secureSettings: SecureSettings,
) : DeviceEntryIconTransition, PrimaryBouncerTransition {
private val transitionAnimation =
animationFlow
.setup(
Expand Down Expand Up @@ -88,12 +92,15 @@ constructor(animationFlow: KeyguardTransitionAnimationFlow, blurConfig: BlurConf
alphaFlow
}

val maxBlurRadius: Float
get() = secureSettings.getFloat("system_blur_radius", 34f)

override val notificationBlurRadius: Flow<Float> =
if (Flags.bouncerUiRevamp()) {
transitionAnimation.sharedFlowWithShade(
duration = 1.milliseconds,
onStep = { _, isShadeExpanded ->
if (isShadeExpanded) blurConfig.maxBlurRadiusPx else null
if (isShadeExpanded) maxBlurRadius else null
},
)
} else {
Expand All @@ -109,14 +116,14 @@ constructor(animationFlow: KeyguardTransitionAnimationFlow, blurConfig: BlurConf
onStep = { step, isShadeExpanded ->
if (isShadeExpanded) {
if (Flags.notificationShadeBlur()) {
blurConfig.maxBlurRadiusPx
maxBlurRadius
} else {
blurConfig.minBlurRadiusPx
}
} else {
transitionProgressToBlurRadius(
starBlurRadius = blurConfig.minBlurRadiusPx,
endBlurRadius = blurConfig.maxBlurRadiusPx,
endBlurRadius = maxBlurRadius,
transitionProgress = step,
)
}
Expand All @@ -125,7 +132,7 @@ constructor(animationFlow: KeyguardTransitionAnimationFlow, blurConfig: BlurConf
if (isShadeExpanded && !Flags.notificationShadeBlur()) {
blurConfig.minBlurRadiusPx
} else {
blurConfig.maxBlurRadiusPx
maxBlurRadius
}
},
)
Expand Down
Loading