Update text of blocking activity.
Bug: 78662095
Test: m -j
Change-Id: I0c4887e5ef456ef80d13ce14e0222a33ea28fdc6
diff --git a/service/res/values/strings.xml b/service/res/values/strings.xml
index c87561d..2de39f1 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+<resources>
<string name="app_title">Car service</string>
<!-- For permissions -->
@@ -103,8 +103,8 @@
<string name="car_can_bus_failure_desc">CAN bus does not respond. Unplug and plug back headunit
box and restart the car</string>
- <!-- Blocking activity: Message to show to user when a feature of current application is not allowed. [CHAR LIMIT=60] -->
- <string name="activity_blocked_string">This <xliff:g id="app_name" example="Google Maps">%1$s</xliff:g> feature can\'t be used while driving.</string>
+ <!-- Blocking activity: Message to show to user when an activity is not allowed during driving. [CHAR LIMIT=120] -->
+ <string name="activity_blocked_string">For your safety, this activity isn’t available while you’re driving</string>
<!-- Blocking activity: Button text that restarts the current blocked application. [CHAR LIMIT=10] -->
<string name="exit_button">OK</string>
diff --git a/service/src/com/android/car/pm/ActivityBlockingActivity.java b/service/src/com/android/car/pm/ActivityBlockingActivity.java
index 3e55405..b39910e 100644
--- a/service/src/com/android/car/pm/ActivityBlockingActivity.java
+++ b/service/src/com/android/car/pm/ActivityBlockingActivity.java
@@ -24,11 +24,8 @@
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.IBinder;
-import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
@@ -107,8 +104,7 @@
// blockedActivity is expected to be always passed in as the topmost activity of task.
String blockedActivity = getIntent().getStringExtra(INTENT_KEY_BLOCKED_ACTIVITY);
- mBlockedTitle.setText(getString(R.string.activity_blocked_string,
- findHumanReadableLabel(blockedActivity)));
+ mBlockedTitle.setText(getString(R.string.activity_blocked_string));
if (Log.isLoggable(CarLog.TAG_AM, Log.DEBUG)) {
Log.d(CarLog.TAG_AM, "Blocking activity " + blockedActivity);
}
@@ -153,35 +149,6 @@
}
}
- /**
- * Returns a human-readable string for {@code flattenComponentName}.
- *
- * <p>It first attempts to return the application label for this activity. If that fails,
- * it will return the last part in the activity name.
- */
- private String findHumanReadableLabel(String flattenComponentName) {
- ComponentName componentName = ComponentName.unflattenFromString(flattenComponentName);
- String label = null;
- // Attempt to find application label.
- try {
- ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(
- componentName.getPackageName(), 0);
- CharSequence appLabel = getPackageManager().getApplicationLabel(applicationInfo);
- if (appLabel != null) {
- label = appLabel.toString();
- }
- } catch (PackageManager.NameNotFoundException e) {
- if (Log.isLoggable(CarLog.TAG_AM, Log.INFO)) {
- Log.i(CarLog.TAG_AM, "Could not find package for component name "
- + componentName.toString());
- }
- }
- if (TextUtils.isEmpty(label)) {
- label = componentName.getClass().getSimpleName();
- }
- return label;
- }
-
private void handleFinish() {
if (!mCar.isConnected()) {
mExitRequested = true;