Merge "Update UI of blocking screen."
diff --git a/service/res/layout/activity_blocking.xml b/service/res/layout/activity_blocking.xml
index 5eddbf9..0c10016 100644
--- a/service/res/layout/activity_blocking.xml
+++ b/service/res/layout/activity_blocking.xml
@@ -20,16 +20,9 @@
android:orientation="vertical"
android:background="@color/activity_blocking_activity_background"
android:gravity="center">
- <TextView
- android:id="@+id/blocking_text"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:textAppearance="@style/ActivityBlockingActivityText" />
-
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:layout_marginTop="@dimen/common_margin"
android:orientation="horizontal"
android:gravity="center">
<ImageView
@@ -45,8 +38,23 @@
android:textAppearance="@style/ActivityBlockingActivityText" />
</LinearLayout>
+ <TextView
+ android:id="@+id/blocking_text"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_marginTop="@dimen/common_margin"
+ android:gravity="center"
+ android:textAppearance="@style/ActivityBlockingActivityText" />
+
+ <!-- Show exit button if we need to (and are able to) restart the blocked task -->
+ <TextView
+ android:id="@+id/exit_button_message"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_marginTop="@dimen/common_margin"
+ android:textAppearance="@style/ActivityBlockingActivityText" />
<Button
- android:id="@+id/exit"
+ android:id="@+id/exit_button"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/common_margin"
diff --git a/service/res/values/strings.xml b/service/res/values/strings.xml
index 69b9467..6508e34 100644
--- a/service/res/values/strings.xml
+++ b/service/res/values/strings.xml
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<resources>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_title" translatable="false">Car service</string>
<!-- For permissions -->
<!-- Permission text: can access your car's information [CHAR LIMIT=NONE] -->
@@ -105,11 +105,13 @@
box and restart the car</string>
<!-- Blocking activity: Message to show to user when a feature of current application is not allowed. [CHAR LIMIT=120] -->
- <string name="activity_blocked_text">For your safety, this activity isn’t available while you’re driving</string>
+ <string name="activity_blocked_text">For your safety, this activity isn\'t available while driving.\nTo continue, wait until you\'re parked.</string>
+ <!-- Blocking activity: Message to accompany the exit_button that restarts the blocked app. [CHAR LIMIT=120] -->
+ <string name="exit_button_message">To start over with app features that can be used safely, select <xliff:g id="exit_button" example="Back">%s</xliff:g>.</string>
+ <!-- Blocking activity: Text for button that restarts the current blocked application. [CHAR LIMIT=15] -->
+ <string name="exit_button">Back</string>
<!-- Blocking activity: Text for button that shows debug info for non-user build. [CHAR LIMIT=10] -->
<string name="debug_button_text">Debug Info</string>
- <!-- Blocking activity: Text for button that restarts the current blocked application. [CHAR LIMIT=15] -->
- <string name="exit_button">Restart App</string>
<!-- Permission text: apps can control diagnostic data [CHAR LIMIT=NONE] -->
<string name="car_permission_label_diag_read">Diagnostic Data</string>
diff --git a/service/src/com/android/car/pm/ActivityBlockingActivity.java b/service/src/com/android/car/pm/ActivityBlockingActivity.java
index aabdb72..15126a7 100644
--- a/service/src/com/android/car/pm/ActivityBlockingActivity.java
+++ b/service/src/com/android/car/pm/ActivityBlockingActivity.java
@@ -57,9 +57,10 @@
private Car mCar;
private CarUxRestrictionsManager mUxRManager;
- private TextView mBlockingText;
private TextView mBlockedAppName;
private ImageView mBlockedAppIcon;
+ private TextView mBlockingText;
+ private TextView mExitButtonMessage;
private Button mExitButton;
// Exiting depends on Car connection, which might not be available at the time exit was
@@ -76,7 +77,8 @@
mBlockingText = findViewById(R.id.blocking_text);
mBlockedAppName = findViewById(R.id.blocked_app_name);
mBlockedAppIcon = findViewById(R.id.blocked_app_icon);
- mExitButton = findViewById(R.id.exit);
+ mExitButton = findViewById(R.id.exit_button);
+ mExitButtonMessage = findViewById(R.id.exit_button_message);
mBlockingText.setText(getString(R.string.activity_blocked_text));
@@ -143,6 +145,9 @@
boolean showButton = mBlockedTaskId != INVALID_TASK_ID && isRootDO;
mExitButton.setVisibility(showButton ? View.VISIBLE : View.GONE);
mExitButton.setOnClickListener(v -> handleRestartingTask());
+ mExitButtonMessage.setVisibility(showButton ? View.VISIBLE : View.GONE);
+ mExitButtonMessage.setText(
+ getString(R.string.exit_button_message, getString(R.string.exit_button)));
// Show more debug info for non-user build.
if (Build.IS_ENG || Build.IS_USERDEBUG) {