Loading core/java/android/accounts/Account.java +7 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; import java.util.Objects; import java.util.Set; /** Loading Loading @@ -85,6 +86,12 @@ public class Account implements Parcelable { if (TextUtils.isEmpty(type)) { throw new IllegalArgumentException("the type must not be empty: " + type); } if (name.length() > 200) { throw new IllegalArgumentException("account name is longer than 200 characters"); } if (type.length() > 200) { throw new IllegalArgumentException("account type is longer than 200 characters"); } this.name = name; this.type = type; this.accessId = accessId; Loading packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -126,11 +126,11 @@ public class StatusBarStateControllerImpl implements SysuiStatusBarStateControll } @Override public boolean setState(int state) { public boolean setState(int state, boolean force) { if (state > MAX_STATE || state < MIN_STATE) { throw new IllegalArgumentException("Invalid state " + state); } if (state == mState) { if (!force && state == mState) { return false; } Loading packages/SystemUI/src/com/android/systemui/statusbar/SysuiStatusBarStateController.java +13 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,19 @@ public interface SysuiStatusBarStateController extends StatusBarStateController * @param state see {@link StatusBarState} for valid options * @return {@code true} if the state changed, else {@code false} */ boolean setState(int state); default boolean setState(int state) { return setState(state, false /* force */); } /** * Update the status bar state * @param state see {@link StatusBarState} for valid options * @param force whether to set the state even if it's the same as the current state. This will * dispatch the state to all StatusBarStateListeners, ensuring that all listening * components are reset to this state. * @return {@code true} if the state was changed or set forcefully */ boolean setState(int state, boolean force); /** * Update the dozing state from {@link StatusBar}'s perspective Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +10 −5 Original line number Diff line number Diff line Loading @@ -3271,7 +3271,11 @@ public class StatusBar extends SystemUI implements DemoMode, && mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); } private boolean updateIsKeyguard() { boolean updateIsKeyguard() { return updateIsKeyguard(false /* force */); } boolean updateIsKeyguard(boolean force) { boolean wakeAndUnlocking = mBiometricUnlockController.getMode() == BiometricUnlockController.MODE_WAKE_AND_UNLOCK; Loading Loading @@ -3300,7 +3304,7 @@ public class StatusBar extends SystemUI implements DemoMode, showKeyguardImpl(); } } else { return hideKeyguardImpl(); return hideKeyguardImpl(force); } return false; } Loading Loading @@ -3442,11 +3446,11 @@ public class StatusBar extends SystemUI implements DemoMode, /** * @return true if we would like to stay in the shade, false if it should go away entirely */ public boolean hideKeyguardImpl() { public boolean hideKeyguardImpl(boolean force) { mIsKeyguard = false; Trace.beginSection("StatusBar#hideKeyguard"); boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); if (!(mStatusBarStateController.setState(StatusBarState.SHADE))) { if (!(mStatusBarStateController.setState(StatusBarState.SHADE, force))) { //TODO: StatusBarStateController should probably know about hiding the keyguard and // notify listeners. Loading Loading @@ -3949,7 +3953,8 @@ public class StatusBar extends SystemUI implements DemoMode, // is correct. mHandler.post(() -> onCameraLaunchGestureDetected(mLastCameraLaunchSource)); } updateIsKeyguard(); // When finished going to sleep, force the status bar state to avoid stale state. updateIsKeyguard(true /* force */); } @Override Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -715,13 +715,15 @@ public class StatusBarTest extends SysuiTestCase { // By default, showKeyguardImpl sets state to KEYGUARD. mStatusBar.showKeyguardImpl(); verify(mStatusBarStateController).setState(eq(StatusBarState.KEYGUARD)); verify(mStatusBarStateController).setState( eq(StatusBarState.KEYGUARD), eq(false) /* force */); // If useFullscreenUserSwitcher is true, state is set to FULLSCREEN_USER_SWITCHER. mStatusBar.mUserSwitcherController = mock(UserSwitcherController.class); when(mStatusBar.mUserSwitcherController.useFullscreenUserSwitcher()).thenReturn(true); mStatusBar.showKeyguardImpl(); verify(mStatusBarStateController).setState(eq(StatusBarState.FULLSCREEN_USER_SWITCHER)); verify(mStatusBarStateController).setState( eq(StatusBarState.FULLSCREEN_USER_SWITCHER), eq(false) /* force */); } @Test Loading Loading
core/java/android/accounts/Account.java +7 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; import java.util.Objects; import java.util.Set; /** Loading Loading @@ -85,6 +86,12 @@ public class Account implements Parcelable { if (TextUtils.isEmpty(type)) { throw new IllegalArgumentException("the type must not be empty: " + type); } if (name.length() > 200) { throw new IllegalArgumentException("account name is longer than 200 characters"); } if (type.length() > 200) { throw new IllegalArgumentException("account type is longer than 200 characters"); } this.name = name; this.type = type; this.accessId = accessId; Loading
packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -126,11 +126,11 @@ public class StatusBarStateControllerImpl implements SysuiStatusBarStateControll } @Override public boolean setState(int state) { public boolean setState(int state, boolean force) { if (state > MAX_STATE || state < MIN_STATE) { throw new IllegalArgumentException("Invalid state " + state); } if (state == mState) { if (!force && state == mState) { return false; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/SysuiStatusBarStateController.java +13 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,19 @@ public interface SysuiStatusBarStateController extends StatusBarStateController * @param state see {@link StatusBarState} for valid options * @return {@code true} if the state changed, else {@code false} */ boolean setState(int state); default boolean setState(int state) { return setState(state, false /* force */); } /** * Update the status bar state * @param state see {@link StatusBarState} for valid options * @param force whether to set the state even if it's the same as the current state. This will * dispatch the state to all StatusBarStateListeners, ensuring that all listening * components are reset to this state. * @return {@code true} if the state was changed or set forcefully */ boolean setState(int state, boolean force); /** * Update the dozing state from {@link StatusBar}'s perspective Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +10 −5 Original line number Diff line number Diff line Loading @@ -3271,7 +3271,11 @@ public class StatusBar extends SystemUI implements DemoMode, && mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); } private boolean updateIsKeyguard() { boolean updateIsKeyguard() { return updateIsKeyguard(false /* force */); } boolean updateIsKeyguard(boolean force) { boolean wakeAndUnlocking = mBiometricUnlockController.getMode() == BiometricUnlockController.MODE_WAKE_AND_UNLOCK; Loading Loading @@ -3300,7 +3304,7 @@ public class StatusBar extends SystemUI implements DemoMode, showKeyguardImpl(); } } else { return hideKeyguardImpl(); return hideKeyguardImpl(force); } return false; } Loading Loading @@ -3442,11 +3446,11 @@ public class StatusBar extends SystemUI implements DemoMode, /** * @return true if we would like to stay in the shade, false if it should go away entirely */ public boolean hideKeyguardImpl() { public boolean hideKeyguardImpl(boolean force) { mIsKeyguard = false; Trace.beginSection("StatusBar#hideKeyguard"); boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); if (!(mStatusBarStateController.setState(StatusBarState.SHADE))) { if (!(mStatusBarStateController.setState(StatusBarState.SHADE, force))) { //TODO: StatusBarStateController should probably know about hiding the keyguard and // notify listeners. Loading Loading @@ -3949,7 +3953,8 @@ public class StatusBar extends SystemUI implements DemoMode, // is correct. mHandler.post(() -> onCameraLaunchGestureDetected(mLastCameraLaunchSource)); } updateIsKeyguard(); // When finished going to sleep, force the status bar state to avoid stale state. updateIsKeyguard(true /* force */); } @Override Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -715,13 +715,15 @@ public class StatusBarTest extends SysuiTestCase { // By default, showKeyguardImpl sets state to KEYGUARD. mStatusBar.showKeyguardImpl(); verify(mStatusBarStateController).setState(eq(StatusBarState.KEYGUARD)); verify(mStatusBarStateController).setState( eq(StatusBarState.KEYGUARD), eq(false) /* force */); // If useFullscreenUserSwitcher is true, state is set to FULLSCREEN_USER_SWITCHER. mStatusBar.mUserSwitcherController = mock(UserSwitcherController.class); when(mStatusBar.mUserSwitcherController.useFullscreenUserSwitcher()).thenReturn(true); mStatusBar.showKeyguardImpl(); verify(mStatusBarStateController).setState(eq(StatusBarState.FULLSCREEN_USER_SWITCHER)); verify(mStatusBarStateController).setState( eq(StatusBarState.FULLSCREEN_USER_SWITCHER), eq(false) /* force */); } @Test Loading