[automerger skipped] DO NOT MERGE Integrate Assistant Actions.
am: 0645601833 -s ours
am skip reason: subject contains skip directive
Change-Id: Id31206603c09065cb50dbecd0dcb265709985466
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..f15be25
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,157 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_app {
+ name: "CarNotification",
+
+ srcs: ["src/**/*.java"],
+
+ resource_dirs: ["res"],
+
+ platform_apis: true,
+
+ optimize: {
+ enabled: false,
+ },
+
+ dex_preopt: {
+ enabled: false,
+ },
+
+ static_libs: [
+ "androidx.car_car",
+ "androidx.palette_palette",
+ "car-theme-lib-bp",
+ "android.car.userlib",
+ "androidx-constraintlayout_constraintlayout-solver"
+ ],
+
+ libs: ["android.car"],
+
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ },
+}
+
+// As Lib
+android_library {
+ name: "CarNotificationLib",
+ srcs: ["src/**/*.java"],
+
+ resource_dirs: ["res"],
+
+ manifest: "AndroidManifest-withoutActivity.xml",
+
+ platform_apis: true,
+
+ optimize: {
+ enabled: false,
+ },
+
+ dex_preopt: {
+ enabled: false,
+ },
+
+ static_libs: [
+ "androidx.car_car",
+ "androidx.palette_palette",
+ "car-theme-lib-bp",
+ "android.car.userlib",
+ "androidx-constraintlayout_constraintlayout-solver"
+ ],
+
+ libs: ["android.car"],
+
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ },
+}
+
+// Duplicate of CarNotification which includes testing only resources for Robolectric
+
+android_app {
+ name: "CarNotificationForTesting",
+
+ srcs: ["src/**/*.java"],
+
+ resource_dirs: ["res"],
+
+ platform_apis: true,
+
+ optimize: {
+ enabled: false,
+ },
+
+ dex_preopt: {
+ enabled: false,
+ },
+
+ static_libs: [
+ "androidx.car_car",
+ "androidx.palette_palette",
+ "car-theme-lib-bp",
+ "android.car.userlib",
+ "androidx-constraintlayout_constraintlayout-solver"
+ ],
+
+ libs: ["android.car"],
+
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ },
+}
+
+// As Lib
+android_library {
+ name: "CarNotificationModuleForTesting",
+ srcs: ["src/**/*.java"],
+
+ resource_dirs: ["res"],
+
+ manifest: "AndroidManifest-withoutActivity.xml",
+
+ platform_apis: true,
+
+ optimize: {
+ enabled: false,
+ },
+
+ dex_preopt: {
+ enabled: false,
+ },
+
+ static_libs: [
+ "androidx.car_car",
+ "androidx.palette_palette",
+ "car-theme-lib-bp",
+ "android.car.userlib",
+ "androidx-constraintlayout_constraintlayout-solver"
+ ],
+
+ libs: ["android.car"],
+
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ },
+}
+
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index d4f777c..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,177 +0,0 @@
-# Copyright (C) 2018 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifneq ($(TARGET_BUILD_PDK), true)
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CarNotification
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_STATIC_ANDROID_LIBRARIES += \
- androidx.car_car \
- androidx.palette_palette \
- car-assist-client-lib \
- car-theme-lib \
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
- android.car.userlib \
- androidx-constraintlayout_constraintlayout-solver
-
-LOCAL_JAVA_LIBRARIES += \
- android.car
-
-include $(BUILD_PACKAGE)
-
-# As Lib
-include $(CLEAR_VARS)
-LOCAL_MODULE := CarNotificationLib
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_USE_AAPT2 := true
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_STATIC_ANDROID_LIBRARIES += \
- androidx.car_car \
- androidx-constraintlayout_constraintlayout \
- androidx.palette_palette \
- car-assist-client-lib \
- car-theme-lib \
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
- android.car.userlib \
- androidx-constraintlayout_constraintlayout-solver
-
-LOCAL_JAVA_LIBRARIES += \
- android.car
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-###################################################################################
-# Duplicate of CarNotification which includes testing only resources for Robolectric #
-###################################################################################
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CarNotificationForTesting
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_STATIC_ANDROID_LIBRARIES += \
- androidx.car_car \
- androidx.palette_palette \
- car-assist-client-lib \
- car-theme-lib \
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
- android.car.userlib \
- androidx-constraintlayout_constraintlayout-solver
-
-LOCAL_JAVA_LIBRARIES += \
- android.car
-
-include $(BUILD_PACKAGE)
-
-# As Lib
-include $(CLEAR_VARS)
-LOCAL_MODULE := CarNotificationModuleForTesting
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_USE_AAPT2 := true
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_STATIC_ANDROID_LIBRARIES += \
- androidx.car_car \
- androidx-constraintlayout_constraintlayout \
- androidx.palette_palette \
- car-assist-client-lib \
- car-theme-lib \
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
- android.car.userlib \
- androidx-constraintlayout_constraintlayout-solver
-
-LOCAL_JAVA_LIBRARIES += \
- android.car
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-# Use the following include to make our test apk.
-ifeq (,$(ONE_SHOT_MAKEFILE))
- include $(call first-makefiles-under, $(LOCAL_PATH))
-endif
-
-endif
-
diff --git a/AndroidManifest-withoutActivity.xml b/AndroidManifest-withoutActivity.xml
new file mode 100644
index 0000000..133d222
--- /dev/null
+++ b/AndroidManifest-withoutActivity.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+** Copyright (C) 2018 The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.car.notification">
+ <!-- Permission to show display overlay window for heads-up notifications -->
+ <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
+ <!-- Permission to get the current user id to cancel a notification -->
+ <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"/>
+ <!--Permission to talk to the Status bar service which proxies the calls to remove
+ notifications to the notification service -->
+ <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
+
+</manifest>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index adb9e27..d3456cb 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -28,8 +28,6 @@
<!--Permission to talk to the Status bar service which proxies the calls to remove
notifications to the notification service -->
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
- <!--Permission to start a voice interaction service-->
- <uses-permission android:name="android.permission.ACCESS_VOICE_INTERACTION_SERVICE"/>
<application android:label="@string/application_label"
android:name=".NotificationApplication">
@@ -55,5 +53,6 @@
<action android:name="android.service.notification.NotificationListenerService"/>
</intent-filter>
</service>
+
</application>
</manifest>
diff --git a/res/values/integers.xml b/res/values/integers.xml
index e555a12..074aea0 100644
--- a/res/values/integers.xml
+++ b/res/values/integers.xml
@@ -22,6 +22,10 @@
<!-- Duration of heads-up notifications in milliseconds -->
<integer name="headsup_notification_duration_ms">5000</integer>
+ <!-- The number of milliseconds after a heads up notification is dismissed
+ before the app can interrupt again. -->
+ <integer name="heads_up_snooze_time_ms">6000</integer>
+
<!-- Duration of fly-in animation for heads-up notifications in milliseconds -->
<integer name="headsup_enter_duration_ms">300</integer>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f2893d7..fd39847 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -19,12 +19,6 @@
<!-- The Application label that appears in app launcher [CHAR_LIMIT=25] -->
<string name="application_label">Car Notification Center</string>
- <!-- The Action label displayed for Assistant Reply actions [CHAR_LIMIT=20]-->
- <string name="assist_action_reply_label">Reply</string>
-
- <!-- The Action label displayed for Assistant Read actions [CHAR_LIMIT=20]-->
- <string name="assist_action_read_label">Read</string>
-
<!-- The label for the NotificationListenerService [CHAR_LIMIT=NONE] -->
<string name="notification_service_label">Car Notification Listener Service</string>
diff --git a/src/com/android/car/notification/CarHeadsUpNotificationManager.java b/src/com/android/car/notification/CarHeadsUpNotificationManager.java
index 6d2cf5d..cfc033b 100644
--- a/src/com/android/car/notification/CarHeadsUpNotificationManager.java
+++ b/src/com/android/car/notification/CarHeadsUpNotificationManager.java
@@ -66,10 +66,14 @@
private StatusBarNotification mCurrentNotification;
private boolean mShouldRestrictMessagePreview;
private NotificationClickHandlerFactory mClickHandlerFactory;
- private long mPostedTimeStampMs;
+ private boolean mIsHeadsUpNotificationActive;
+ private long mLastHeadsUpDismissTimeMs;
+ private long mHeadsUpSnoozeTimeMs;
private CarHeadsUpNotificationManager(Context context) {
mContext = context.getApplicationContext();
+ mHeadsUpSnoozeTimeMs = mContext.getResources().getInteger(
+ R.integer.heads_up_snooze_time_ms);
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
mEnableMediaNotification =
@@ -130,19 +134,19 @@
if (!shouldShowHeadsUp(statusBarNotification, rankingMap)) {
return;
}
- boolean isUpdate = CarNotificationDiff.sameNotificationKeyAndFlags(
+ boolean isUpdate = CarNotificationDiff.sameNotificationKey(
mCurrentNotification, statusBarNotification);
- if (isUpdate && !canUpdate()) {
+ // Validates if the same notification is being posted again within the heads up snooze time.
+ if (isUpdate && hasNotPassedSnoozeTime()) {
return;
}
showHeadsUp(mPreprocessingManager.optimizeForDriving(statusBarNotification), isUpdate);
}
- /**
- * Updates only when the notification is being displayed.
- */
- private boolean canUpdate() {
- return System.currentTimeMillis() - mPostedTimeStampMs < mDuration;
+ private boolean hasNotPassedSnoozeTime() {
+ long currentTimeMs = System.currentTimeMillis();
+ long timeDiffMs = currentTimeMs - mLastHeadsUpDismissTimeMs;
+ return timeDiffMs < mHeadsUpSnoozeTimeMs;
}
private void showHeadsUp(StatusBarNotification statusBarNotification, boolean isUpdate) {
@@ -150,11 +154,12 @@
mWrapper.removeAllViews();
mCurrentNotification = statusBarNotification;
// Show animations only when there is no active HUN and notification is new.
- boolean shouldShowAnimation = !isUpdate;
+ boolean shouldShowAnimation = !(mIsHeadsUpNotificationActive && isUpdate);
+ mIsHeadsUpNotificationActive = true;
if (shouldShowAnimation) {
- mPostedTimeStampMs = System.currentTimeMillis();
mTimer.removeCallbacksAndMessages(null);
mTimer.postDelayed(() -> clearViews(), mDuration);
+ mLastHeadsUpDismissTimeMs = 0;
}
View notificationView;
@@ -275,6 +280,7 @@
statusBarNotification.getUser().getIdentifier(),
statusBarNotification.getKey(),
NotificationStats.DISMISSAL_SHADE,
+ NotificationStats.DISMISS_SENTIMENT_NEUTRAL,
notificationVisibility
);
@@ -290,6 +296,8 @@
mTimer.removeCallbacksAndMessages(null);
mScrimView.setVisibility(View.GONE);
mWrapper.removeAllViews();
+ mIsHeadsUpNotificationActive = false;
+ mLastHeadsUpDismissTimeMs = System.currentTimeMillis();
}
/**
diff --git a/src/com/android/car/notification/CarNotificationDiff.java b/src/com/android/car/notification/CarNotificationDiff.java
index 93aa035..1bd98c6 100644
--- a/src/com/android/car/notification/CarNotificationDiff.java
+++ b/src/com/android/car/notification/CarNotificationDiff.java
@@ -130,18 +130,6 @@
}
/**
- * Shallow comparison for {@link StatusBarNotification}: comparing the unique IDs and the
- * notification Flags.
- *
- * <p> Returns true if two notifications have the same key and notification flags.
- */
- static boolean sameNotificationKeyAndFlags(
- StatusBarNotification oldItem, StatusBarNotification newItem) {
- return sameNotificationKey(oldItem, newItem)
- && oldItem.getNotification().flags == newItem.getNotification().flags;
- }
-
- /**
* Deep comparison for {@link NotificationGroup}.
*
* <p> Compare the content of each StatusBarNotification inside the NotificationGroup.
@@ -207,7 +195,7 @@
|| !Objects.equals(oldNotification.deleteIntent, newNotification.deleteIntent)
|| !Objects.equals(
oldNotification.fullScreenIntent, newNotification.fullScreenIntent)
- || !Objects.deepEquals(oldNotification.actions, newNotification.actions)) {
+ || !Objects.deepEquals(oldNotification.actions, newNotification.actions)){
return false;
}
diff --git a/src/com/android/car/notification/CarNotificationItemTouchListener.java b/src/com/android/car/notification/CarNotificationItemTouchListener.java
index 6817475..8aa8c3e 100644
--- a/src/com/android/car/notification/CarNotificationItemTouchListener.java
+++ b/src/com/android/car/notification/CarNotificationItemTouchListener.java
@@ -118,6 +118,7 @@
notification.getUser().getIdentifier(),
notification.getKey(),
NotificationStats.DISMISSAL_SHADE,
+ NotificationStats.DISMISS_SENTIMENT_NEUTRAL,
notificationVisibility
);
diff --git a/src/com/android/car/notification/NotificationClickHandlerFactory.java b/src/com/android/car/notification/NotificationClickHandlerFactory.java
index 7b1b2d9..b781e70 100644
--- a/src/com/android/car/notification/NotificationClickHandlerFactory.java
+++ b/src/com/android/car/notification/NotificationClickHandlerFactory.java
@@ -20,20 +20,17 @@
import android.app.ActivityManager;
import android.app.Notification;
import android.app.PendingIntent;
-import android.content.Context;
import android.os.RemoteException;
import android.service.notification.NotificationStats;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.view.View;
-import android.widget.Toast;
-import com.android.car.assist.client.CarAssistUtils;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.NotificationVisibility;
/**
- * Factory that builds a {@link View.OnClickListener} to handle the logic of what to do when a
+ * Factory that builds a {@link View.OnClickListener} to handle the logic of what to do when a
* notification is clicked
*/
public class NotificationClickHandlerFactory {
@@ -41,13 +38,11 @@
private final IStatusBarService mBarService;
private final Callback mCallback;
- private CarAssistUtils mCarAssistUtils;
public NotificationClickHandlerFactory(IStatusBarService barService,
@Nullable Callback callback) {
mBarService = barService;
mCallback = callback != null ? callback : launchResult -> { };
- mCarAssistUtils = null;
}
/**
@@ -79,8 +74,8 @@
statusBarNotification.getKey(),
/* rank= */ -1, /* count= */ -1, /* visible= */ true);
try {
- mBarService.onNotificationClick
- (statusBarNotification.getKey(), notificationVisibility);
+ mBarService.onNotificationClick(statusBarNotification.getKey(),
+ notificationVisibility);
if (shouldAutoCancel(statusBarNotification)){
mBarService.onNotificationClear(
statusBarNotification.getPackageName(),
@@ -89,6 +84,7 @@
statusBarNotification.getUser().getIdentifier(),
statusBarNotification.getKey(),
NotificationStats.DISMISSAL_SHADE,
+ NotificationStats.DISMISS_SENTIMENT_NEUTRAL,
notificationVisibility);
}
} catch (RemoteException ex) {
@@ -112,52 +108,32 @@
Notification notification = statusBarNotification.getNotification();
Notification.Action[] actions = notification.actions;
int result = ActivityManager.START_ABORTED;
+ final PendingIntent intent = actions[index].actionIntent;
NotificationVisibility notificationVisibility = NotificationVisibility.obtain(
statusBarNotification.getKey(),
/* rank= */ -1, /* count= */ -1, /* visible= */ true);
- boolean canceledExceptionThrown = false;
- int semanticAction = actions[index].getSemanticAction();
- if (CarAssistUtils.isCarCompatibleMessagingNotification(statusBarNotification)
- && CarAssistUtils.isSupportedSemanticAction(semanticAction)) {
- Context context = v.getContext().getApplicationContext();
- if (mCarAssistUtils == null) {
- mCarAssistUtils = new CarAssistUtils(context);
- }
- if (mCarAssistUtils.requestAssistantVoiceAction(statusBarNotification,
- semanticAction)) {
- result = ActivityManager.START_SUCCESS;
- } else {
- showToast(context, R.string.assist_action_failed_toast);
- }
- } else {
- PendingIntent intent = actions[index].actionIntent;
- try {
- result = intent.sendAndReturnResult(/* context= */ null, /* code= */ 0,
- /* intent= */ null, /* onFinished= */null,
- /* handler= */ null, /* requiredPermissions= */ null,
- /* options= */ null);
- } catch (PendingIntent.CanceledException e) {
- // Do not take down the app over this
- Log.w(TAG, "Sending contentIntent failed: " + e);
- canceledExceptionThrown = true;
- }
- }
- if (!canceledExceptionThrown) {
- try {
- mBarService.onNotificationActionClick(statusBarNotification.getKey(), index,
- notificationVisibility);
- } catch (RemoteException e) {
- // system process is dead if we're here.
- }
+ try {
+ result = intent.sendAndReturnResult(/* context= */ null, /* code= */ 0,
+ /* intent= */ null, /* onFinished= */null,
+ /* handler= */ null, /* requiredPermissions= */ null,
+ /* options= */ null);
+
+ mBarService.onNotificationActionClick(
+ statusBarNotification.getKey(),
+ index,
+ actions[index],
+ notificationVisibility,
+ /* generatedByAssistant= */ false);
+ } catch (PendingIntent.CanceledException e) {
+ // Do not take down the app over this
+ Log.w(TAG, "Sending contentIntent failed: " + e);
+ } catch (RemoteException ex) {
+ // system process is dead if we're here.
}
mCallback.onNotificationClicked(result);
};
}
- private void showToast(Context context, int resourceId) {
- Toast.makeText(context, context.getString(resourceId), Toast.LENGTH_LONG).show();
- }
-
private boolean shouldAutoCancel(StatusBarNotification sbn) {
int flags = sbn.getNotification().flags;
if ((flags & Notification.FLAG_AUTO_CANCEL) != Notification.FLAG_AUTO_CANCEL) {
@@ -175,12 +151,9 @@
public interface Callback {
/**
- * A notification was clicked and an onClickListener was fired.
+ * A notification was clicked and a PendingIntent was fired.
*
- * @param launchResult For non-Assistant actions, returned from
- * {@link PendingIntent#sendAndReturnResult}; for Assistant actions,
- * returns {@link ActivityManager#START_SUCCESS} on success;
- * {@link ActivityManager#START_ABORTED} otherwise.
+ * @param launchResult returned from {@link PendingIntent#sendAndReturnResult}
*/
void onNotificationClicked(int launchResult);
}
diff --git a/src/com/android/car/notification/template/CarNotificationActionsView.java b/src/com/android/car/notification/template/CarNotificationActionsView.java
index 2d97d55..32ad868 100644
--- a/src/com/android/car/notification/template/CarNotificationActionsView.java
+++ b/src/com/android/car/notification/template/CarNotificationActionsView.java
@@ -24,7 +24,6 @@
import android.widget.Button;
import android.widget.RelativeLayout;
-import com.android.car.assist.client.CarAssistUtils;
import com.android.car.notification.NotificationClickHandlerFactory;
import com.android.car.notification.R;
import com.android.car.theme.Themes;
@@ -94,10 +93,6 @@
return;
}
- if (CarAssistUtils.isCarCompatibleMessagingNotification(statusBarNotification)) {
- mapActionLabels(statusBarNotification);
- }
-
int length = Math.min(actions.length, MAX_NUM_ACTIONS);
for (int i = 0; i < length; i++) {
Notification.Action action = actions[i];
@@ -107,41 +102,13 @@
button.setText(action.title.toString());
if (action.actionIntent != null) {
- button.setOnClickListener(clickHandlerFactory.getActionClickHandler(
- statusBarNotification, i));
+ button.setOnClickListener(
+ clickHandlerFactory.getActionClickHandler(statusBarNotification, i));
}
}
}
/**
- * Replaces the action labels of the Assistant callbacks with the corresponding
- * Assistant action labels.
- * This method has no effect if the notification is not a Car-Compatible Messaging Notification.
- *
- * @param sbn the notification whose action labels should be mapped
- */
- private void mapActionLabels(StatusBarNotification sbn) {
- if (CarAssistUtils.isCarCompatibleMessagingNotification(sbn)) {
- for (Notification.Action action : sbn.getNotification().actions) {
- mapActionLabels(action);
- }
- }
- }
-
- private void mapActionLabels(Notification.Action action) {
- switch (action.getSemanticAction()) {
- case Notification.Action.SEMANTIC_ACTION_REPLY:
- action.title = mContext.getString(R.string.assist_action_reply_label);
- break;
- case Notification.Action.SEMANTIC_ACTION_MARK_AS_READ:
- action.title = mContext.getString(R.string.assist_action_read_label);
- default:
- // no effect
- break;
- }
- }
-
- /**
* Sets the text color for action buttons.
*/
void setActionTextColor(@ColorInt int color) {
diff --git a/tests/robotests/src/com/android/car/notification/CarNotificationRobolectricTestRunner.java b/tests/robotests/src/com/android/car/notification/CarNotificationRobolectricTestRunner.java
index 721c5fc..44beb3a 100644
--- a/tests/robotests/src/com/android/car/notification/CarNotificationRobolectricTestRunner.java
+++ b/tests/robotests/src/com/android/car/notification/CarNotificationRobolectricTestRunner.java
@@ -55,9 +55,9 @@
static {
AAR_VERSIONS = new HashMap<>();
AAR_VERSIONS.put("car", "1.0.0-alpha6");
- AAR_VERSIONS.put("appcompat", "1.1.0-alpha01");
+ AAR_VERSIONS.put("appcompat", "1.1.0-alpha02");
AAR_VERSIONS.put("constraintlayout", "1.1.2");
- AAR_VERSIONS.put("preference", "1.1.0-alpha01");
+ AAR_VERSIONS.put("preference", "1.1.0-alpha02");
}
public CarNotificationRobolectricTestRunner(Class<?> testClass) throws InitializationError {