Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -9603,6 +9603,14 @@ public final class Settings { */ public static final String LOCKSCREEN_SHOW_WALLET = "lockscreen_show_wallet"; /** * Whether to use the lockscreen double-line clock * * @hide */ public static final String LOCKSCREEN_USE_DOUBLE_LINE_CLOCK = "lockscreen_use_double_line_clock"; /** * Specifies whether the web action API is enabled. * Loading packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -191,5 +191,6 @@ public class SecureSettings { Settings.Secure.LOCATION_TIME_ZONE_DETECTION_ENABLED, Settings.Secure.LOCKSCREEN_SHOW_CONTROLS, Settings.Secure.LOCKSCREEN_SHOW_WALLET, Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, }; } packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.POWER_MENU_LOCKED_SHOW_CONTENT, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.LOCKSCREEN_SHOW_CONTROLS, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.LOCKSCREEN_SHOW_WALLET, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_ALWAYS_ON, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_PICK_UP_GESTURE, BOOLEAN_VALIDATOR); Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +7 −17 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ import android.util.AttributeSet; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver.OnPreDrawListener; import android.widget.FrameLayout; import android.widget.RelativeLayout; Loading Loading @@ -89,7 +88,6 @@ public class KeyguardClockSwitch extends RelativeLayout { private int mClockSwitchYAmount; @VisibleForTesting boolean mChildrenAreLaidOut = false; private OnPreDrawListener mPreDrawListener; public KeyguardClockSwitch(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -284,30 +282,21 @@ public class KeyguardClockSwitch extends RelativeLayout { // translate them properly if (mChildrenAreLaidOut) { animateClockChange(clockSize == LARGE); mDisplayedClockSize = clockSize; } else if (mPreDrawListener == null) { mPreDrawListener = () -> { switchToClock(clockSize); getViewTreeObserver().removeOnPreDrawListener(mPreDrawListener); mPreDrawListener = null; return true; }; getViewTreeObserver().addOnPreDrawListener(mPreDrawListener); } mDisplayedClockSize = clockSize; return true; } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); mChildrenAreLaidOut = true; } void onViewDetached() { if (mPreDrawListener != null) { getViewTreeObserver().removeOnPreDrawListener(mPreDrawListener); mPreDrawListener = null; if (mDisplayedClockSize != null && !mChildrenAreLaidOut) { animateClockChange(mDisplayedClockSize == LARGE); } mChildrenAreLaidOut = true; } public Paint getPaint() { Loading Loading @@ -368,5 +357,6 @@ public class KeyguardClockSwitch extends RelativeLayout { pw.println(" mDarkAmount: " + mDarkAmount); pw.println(" mSupportsDarkText: " + mSupportsDarkText); pw.println(" mColorPalette: " + Arrays.toString(mColorPalette)); pw.println(" mDisplayedClockSize: " + mDisplayedClockSize); } } packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +40 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.keyguard.KeyguardClockSwitch.LARGE; import android.app.WallpaperManager; import android.content.res.Resources; import android.database.ContentObserver; import android.provider.Settings; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; Loading @@ -49,11 +51,13 @@ import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.NotificationIconContainer; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.util.ViewController; import com.android.systemui.util.settings.SecureSettings; import java.util.HashSet; import java.util.Locale; import java.util.Set; import java.util.TimeZone; import java.util.concurrent.Executor; import javax.inject.Inject; Loading @@ -72,6 +76,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private final BatteryController mBatteryController; private final LockscreenSmartspaceController mSmartspaceController; private final Resources mResources; private final SecureSettings mSecureSettings; /** * Clock for both small and large sizes Loading Loading @@ -109,6 +114,14 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private SmartspaceTransitionController mSmartspaceTransitionController; private boolean mOnlyClock = false; private Executor mUiExecutor; private boolean mCanShowDoubleLineClock = true; private ContentObserver mDoubleLineClockObserver = new ContentObserver(null) { @Override public void onChange(boolean change) { updateDoubleLineClock(); } }; @Inject public KeyguardClockSwitchController( Loading @@ -125,6 +138,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS LockscreenSmartspaceController smartspaceController, KeyguardUnlockAnimationController keyguardUnlockAnimationController, SmartspaceTransitionController smartspaceTransitionController, SecureSettings secureSettings, @Main Executor uiExecutor, @Main Resources resources) { super(keyguardClockSwitch); mStatusBarStateController = statusBarStateController; Loading @@ -138,7 +153,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mBypassController = bypassController; mSmartspaceController = smartspaceController; mResources = resources; mSecureSettings = secureSettings; mUiExecutor = uiExecutor; mKeyguardUnlockAnimationController = keyguardUnlockAnimationController; mSmartspaceTransitionController = smartspaceTransitionController; } Loading Loading @@ -223,6 +239,14 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS updateClockLayout(); mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceView); } mSecureSettings.registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK), false, /* notifyForDescendants */ mDoubleLineClockObserver ); updateDoubleLineClock(); } int getNotificationIconAreaHeight() { Loading @@ -236,7 +260,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } mColorExtractor.removeOnColorsChangedListener(mColorsListener); mView.setClockPlugin(null, mStatusBarStateController.getState()); mView.onViewDetached(); mSecureSettings.unregisterContentObserver(mDoubleLineClockObserver); } /** Loading Loading @@ -268,6 +293,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS * hidden. */ public void displayClock(@KeyguardClockSwitch.ClockSize int clockSize) { if (!mCanShowDoubleLineClock && clockSize == KeyguardClockSwitch.LARGE) { return; } boolean appeared = mView.switchToClock(clockSize); if (appeared && clockSize == LARGE) { mLargeClockViewController.animateAppear(); Loading Loading @@ -410,4 +439,13 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private int getCurrentLayoutDirection() { return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } private void updateDoubleLineClock() { mCanShowDoubleLineClock = mSecureSettings.getInt( Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1) != 0; if (!mCanShowDoubleLineClock) { mUiExecutor.execute(() -> displayClock(KeyguardClockSwitch.SMALL)); } } } Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -9603,6 +9603,14 @@ public final class Settings { */ public static final String LOCKSCREEN_SHOW_WALLET = "lockscreen_show_wallet"; /** * Whether to use the lockscreen double-line clock * * @hide */ public static final String LOCKSCREEN_USE_DOUBLE_LINE_CLOCK = "lockscreen_use_double_line_clock"; /** * Specifies whether the web action API is enabled. * Loading
packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -191,5 +191,6 @@ public class SecureSettings { Settings.Secure.LOCATION_TIME_ZONE_DETECTION_ENABLED, Settings.Secure.LOCKSCREEN_SHOW_CONTROLS, Settings.Secure.LOCKSCREEN_SHOW_WALLET, Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, }; }
packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.POWER_MENU_LOCKED_SHOW_CONTENT, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.LOCKSCREEN_SHOW_CONTROLS, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.LOCKSCREEN_SHOW_WALLET, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_ALWAYS_ON, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_PICK_UP_GESTURE, BOOLEAN_VALIDATOR); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +7 −17 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ import android.util.AttributeSet; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver.OnPreDrawListener; import android.widget.FrameLayout; import android.widget.RelativeLayout; Loading Loading @@ -89,7 +88,6 @@ public class KeyguardClockSwitch extends RelativeLayout { private int mClockSwitchYAmount; @VisibleForTesting boolean mChildrenAreLaidOut = false; private OnPreDrawListener mPreDrawListener; public KeyguardClockSwitch(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -284,30 +282,21 @@ public class KeyguardClockSwitch extends RelativeLayout { // translate them properly if (mChildrenAreLaidOut) { animateClockChange(clockSize == LARGE); mDisplayedClockSize = clockSize; } else if (mPreDrawListener == null) { mPreDrawListener = () -> { switchToClock(clockSize); getViewTreeObserver().removeOnPreDrawListener(mPreDrawListener); mPreDrawListener = null; return true; }; getViewTreeObserver().addOnPreDrawListener(mPreDrawListener); } mDisplayedClockSize = clockSize; return true; } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); mChildrenAreLaidOut = true; } void onViewDetached() { if (mPreDrawListener != null) { getViewTreeObserver().removeOnPreDrawListener(mPreDrawListener); mPreDrawListener = null; if (mDisplayedClockSize != null && !mChildrenAreLaidOut) { animateClockChange(mDisplayedClockSize == LARGE); } mChildrenAreLaidOut = true; } public Paint getPaint() { Loading Loading @@ -368,5 +357,6 @@ public class KeyguardClockSwitch extends RelativeLayout { pw.println(" mDarkAmount: " + mDarkAmount); pw.println(" mSupportsDarkText: " + mSupportsDarkText); pw.println(" mColorPalette: " + Arrays.toString(mColorPalette)); pw.println(" mDisplayedClockSize: " + mDisplayedClockSize); } }
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +40 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.keyguard.KeyguardClockSwitch.LARGE; import android.app.WallpaperManager; import android.content.res.Resources; import android.database.ContentObserver; import android.provider.Settings; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; Loading @@ -49,11 +51,13 @@ import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.NotificationIconContainer; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.util.ViewController; import com.android.systemui.util.settings.SecureSettings; import java.util.HashSet; import java.util.Locale; import java.util.Set; import java.util.TimeZone; import java.util.concurrent.Executor; import javax.inject.Inject; Loading @@ -72,6 +76,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private final BatteryController mBatteryController; private final LockscreenSmartspaceController mSmartspaceController; private final Resources mResources; private final SecureSettings mSecureSettings; /** * Clock for both small and large sizes Loading Loading @@ -109,6 +114,14 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private SmartspaceTransitionController mSmartspaceTransitionController; private boolean mOnlyClock = false; private Executor mUiExecutor; private boolean mCanShowDoubleLineClock = true; private ContentObserver mDoubleLineClockObserver = new ContentObserver(null) { @Override public void onChange(boolean change) { updateDoubleLineClock(); } }; @Inject public KeyguardClockSwitchController( Loading @@ -125,6 +138,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS LockscreenSmartspaceController smartspaceController, KeyguardUnlockAnimationController keyguardUnlockAnimationController, SmartspaceTransitionController smartspaceTransitionController, SecureSettings secureSettings, @Main Executor uiExecutor, @Main Resources resources) { super(keyguardClockSwitch); mStatusBarStateController = statusBarStateController; Loading @@ -138,7 +153,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mBypassController = bypassController; mSmartspaceController = smartspaceController; mResources = resources; mSecureSettings = secureSettings; mUiExecutor = uiExecutor; mKeyguardUnlockAnimationController = keyguardUnlockAnimationController; mSmartspaceTransitionController = smartspaceTransitionController; } Loading Loading @@ -223,6 +239,14 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS updateClockLayout(); mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceView); } mSecureSettings.registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK), false, /* notifyForDescendants */ mDoubleLineClockObserver ); updateDoubleLineClock(); } int getNotificationIconAreaHeight() { Loading @@ -236,7 +260,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } mColorExtractor.removeOnColorsChangedListener(mColorsListener); mView.setClockPlugin(null, mStatusBarStateController.getState()); mView.onViewDetached(); mSecureSettings.unregisterContentObserver(mDoubleLineClockObserver); } /** Loading Loading @@ -268,6 +293,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS * hidden. */ public void displayClock(@KeyguardClockSwitch.ClockSize int clockSize) { if (!mCanShowDoubleLineClock && clockSize == KeyguardClockSwitch.LARGE) { return; } boolean appeared = mView.switchToClock(clockSize); if (appeared && clockSize == LARGE) { mLargeClockViewController.animateAppear(); Loading Loading @@ -410,4 +439,13 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private int getCurrentLayoutDirection() { return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } private void updateDoubleLineClock() { mCanShowDoubleLineClock = mSecureSettings.getInt( Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1) != 0; if (!mCanShowDoubleLineClock) { mUiExecutor.execute(() -> displayClock(KeyguardClockSwitch.SMALL)); } } }