diff --git a/packages/SystemUI/res/drawable/car_progress_bar.xml b/packages/SystemUI/res/drawable/car_progress_bar.xml
new file mode 100644
index 0000000000000..742fca7d19fdf
--- /dev/null
+++ b/packages/SystemUI/res/drawable/car_progress_bar.xml
@@ -0,0 +1,30 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/car_round_button.xml b/packages/SystemUI/res/drawable/car_round_button.xml
new file mode 100644
index 0000000000000..5f4deb3e6be30
--- /dev/null
+++ b/packages/SystemUI/res/drawable/car_round_button.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml b/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml
index a66f767d0ce72..e0438369762c9 100644
--- a/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml
+++ b/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml
@@ -20,6 +20,14 @@
android:layout_height="match_parent"
android:visibility="gone">
+
+
+
+
diff --git a/packages/SystemUI/res/values/colors_car.xml b/packages/SystemUI/res/values/colors_car.xml
new file mode 100644
index 0000000000000..4faf252817ee3
--- /dev/null
+++ b/packages/SystemUI/res/values/colors_car.xml
@@ -0,0 +1,24 @@
+
+
+
+ #00000000
+ #80CBC4
+ #FAFAFA
+ #212121
+
diff --git a/packages/SystemUI/res/values/dimens_car.xml b/packages/SystemUI/res/values/dimens_car.xml
index a0be999e5b1d9..d5d4e10d12ae0 100644
--- a/packages/SystemUI/res/values/dimens_car.xml
+++ b/packages/SystemUI/res/values/dimens_car.xml
@@ -22,11 +22,18 @@
24dp
192dp
192dp
- 40sp
+ 40sp
64dp
760dp
12dp
32dp
+
+ 6dp
+ @dimen/status_bar_height
+ 16dp
+ 30dp
+ 80dp
+ 32sp
diff --git a/packages/SystemUI/res/values/integers_car.xml b/packages/SystemUI/res/values/integers_car.xml
new file mode 100644
index 0000000000000..320ee9f66c790
--- /dev/null
+++ b/packages/SystemUI/res/values/integers_car.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ 15000
+
+ 60
+
diff --git a/packages/SystemUI/res/values/strings_car.xml b/packages/SystemUI/res/values/strings_car.xml
index e3f329a085e89..658eb4fb3a8cc 100644
--- a/packages/SystemUI/res/values/strings_car.xml
+++ b/packages/SystemUI/res/values/strings_car.xml
@@ -18,4 +18,5 @@
-->
Unknown
+ Start Driving
diff --git a/packages/SystemUI/res/values/styles_car.xml b/packages/SystemUI/res/values/styles_car.xml
new file mode 100644
index 0000000000000..c66792ca6a158
--- /dev/null
+++ b/packages/SystemUI/res/values/styles_car.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
index bcad78706a0a3..d84a731e232e3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
@@ -16,8 +16,11 @@
package com.android.systemui.statusbar.car;
+import android.content.res.Resources;
+import android.os.CountDownTimer;
import android.view.View;
import android.view.ViewStub;
+import android.widget.ProgressBar;
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -27,10 +30,14 @@ import com.android.systemui.statusbar.policy.UserSwitcherController;
* Manages the fullscreen user switcher.
*/
public class FullscreenUserSwitcher {
+ private final View mContainer;
+ private final UserGridView mUserGridView;
+ private final UserSwitcherController mUserSwitcherController;
+ private final ProgressBar mProgressBar;
+ private final int mLoginTimeoutMs;
+ private final int mAnimUpdateIntervalMs;
- private View mContainer;
- private UserGridView mUserGridView;
- private UserSwitcherController mUserSwitcherController;
+ private CountDownTimer mTimer;
public FullscreenUserSwitcher(StatusBar statusBar,
UserSwitcherController userSwitcherController,
@@ -42,6 +49,16 @@ public class FullscreenUserSwitcher {
PageIndicator pageIndicator = mContainer.findViewById(R.id.user_switcher_page_indicator);
pageIndicator.setupWithViewPager(mUserGridView);
+
+ mProgressBar = mContainer.findViewById(R.id.countdown_progress);
+ Resources res = mContainer.getResources();
+ mLoginTimeoutMs = res.getInteger(R.integer.car_user_switcher_timeout_ms);
+ mAnimUpdateIntervalMs = res.getInteger(R.integer.car_user_switcher_anim_update_ms);
+
+ mContainer.findViewById(R.id.start_driving).setOnClickListener(v -> {
+ cancelTimer();
+ automaticallySelectUser();
+ });
}
public void onUserSwitched(int newUserId) {
@@ -50,10 +67,38 @@ public class FullscreenUserSwitcher {
public void show() {
mContainer.setVisibility(View.VISIBLE);
+ cancelTimer();
+ mTimer = new CountDownTimer(mLoginTimeoutMs, mAnimUpdateIntervalMs) {
+ @Override
+ public void onTick(long msUntilFinished) {
+ int elapsed = mLoginTimeoutMs - (int) msUntilFinished;
+ mProgressBar.setProgress((int) elapsed, true /* animate */);
+ }
+
+ @Override
+ public void onFinish() {
+ mProgressBar.setProgress(mLoginTimeoutMs, true /* animate */);
+ automaticallySelectUser();
+ }
+ };
+ mTimer.start();
}
public void hide() {
+ cancelTimer();
mContainer.setVisibility(View.GONE);
}
-}
+ private void cancelTimer() {
+ if (mTimer != null) {
+ mTimer.cancel();
+ mTimer = null;
+ }
+ }
+
+ private void automaticallySelectUser() {
+ // TODO: Switch according to some policy. This implementation just tries to drop the
+ // keyguard for the current user.
+ mUserGridView.showOfflineAuthUi();
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java
index 972dc3708f906..46f55eeaae8fd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java
@@ -70,7 +70,7 @@ public class UserGridView extends ViewPager {
mPendingUserId = UserHandle.USER_NULL;
}
- private void showOfflineAuthUi() {
+ void showOfflineAuthUi() {
// TODO: Show keyguard UI in-place.
mStatusBar.executeRunnableDismissingKeyguard(null, null, true, true, true);
}