Merge "Remove unneeded methods" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9a8f641801
@@ -40359,7 +40359,6 @@ package android.service.notification {
|
||||
method public int getUser();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
|
||||
field public static final java.lang.String KEY_CHANNEL_ID = "key_channel_id";
|
||||
field public static final java.lang.String KEY_PEOPLE = "key_people";
|
||||
field public static final java.lang.String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
|
||||
}
|
||||
@@ -40414,14 +40413,10 @@ package android.service.notification {
|
||||
ctor public NotificationAssistantService();
|
||||
method public final void adjustNotification(android.service.notification.Adjustment);
|
||||
method public final void adjustNotifications(java.util.List<android.service.notification.Adjustment>);
|
||||
method public void createNotificationChannel(java.lang.String, android.app.NotificationChannel);
|
||||
method public void deleteNotificationChannel(java.lang.String, java.lang.String);
|
||||
method public java.util.List<android.app.NotificationChannel> getNotificationChannels(java.lang.String);
|
||||
method public final android.os.IBinder onBind(android.content.Intent);
|
||||
method public abstract android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification);
|
||||
method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, java.lang.String);
|
||||
method public final void unsnoozeNotification(java.lang.String);
|
||||
method public void updateNotificationChannel(java.lang.String, android.app.NotificationChannel);
|
||||
field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
|
||||
}
|
||||
|
||||
|
||||
@@ -37455,7 +37455,6 @@ package android.service.notification {
|
||||
method public int getUser();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
|
||||
field public static final java.lang.String KEY_CHANNEL_ID = "key_channel_id";
|
||||
field public static final java.lang.String KEY_PEOPLE = "key_people";
|
||||
field public static final java.lang.String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
|
||||
}
|
||||
@@ -37510,14 +37509,10 @@ package android.service.notification {
|
||||
ctor public NotificationAssistantService();
|
||||
method public final void adjustNotification(android.service.notification.Adjustment);
|
||||
method public final void adjustNotifications(java.util.List<android.service.notification.Adjustment>);
|
||||
method public void createNotificationChannel(java.lang.String, android.app.NotificationChannel);
|
||||
method public void deleteNotificationChannel(java.lang.String, java.lang.String);
|
||||
method public java.util.List<android.app.NotificationChannel> getNotificationChannels(java.lang.String);
|
||||
method public final android.os.IBinder onBind(android.content.Intent);
|
||||
method public abstract android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification);
|
||||
method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, java.lang.String);
|
||||
method public final void unsnoozeNotification(java.lang.String);
|
||||
method public void updateNotificationChannel(java.lang.String, android.app.NotificationChannel);
|
||||
field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
|
||||
}
|
||||
|
||||
|
||||
@@ -104,10 +104,6 @@ interface INotificationManager
|
||||
void applyEnqueuedAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment);
|
||||
void applyAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment);
|
||||
void applyAdjustmentsFromAssistant(in INotificationListener token, in List<Adjustment> adjustments);
|
||||
void createNotificationChannelFromAssistant(in INotificationListener token, String pkg, in NotificationChannel channel);
|
||||
void updateNotificationChannelFromAssistant(in INotificationListener token, String pkg, in NotificationChannel channel);
|
||||
void deleteNotificationChannelFromAssistant(in INotificationListener token, String pkg, String channelId);
|
||||
ParceledListSlice getNotificationChannelsFromAssistant(in INotificationListener token, String pkg);
|
||||
void unsnoozeNotificationFromAssistant(in INotificationListener token, String key);
|
||||
|
||||
ComponentName getEffectsSuppressor();
|
||||
|
||||
@@ -35,10 +35,6 @@ public final class Adjustment implements Parcelable {
|
||||
private final Bundle mSignals;
|
||||
private final int mUser;
|
||||
|
||||
/**
|
||||
* Data type: {@code String}. See {@link NotificationChannel#getId()}.
|
||||
*/
|
||||
public static final String KEY_CHANNEL_ID = "key_channel_id";
|
||||
/**
|
||||
* Data type: ArrayList of {@code String}, where each is a representation of a
|
||||
* {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}.
|
||||
|
||||
@@ -138,69 +138,6 @@ public abstract class NotificationAssistantService extends NotificationListenerS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a notification channel that notifications can be posted to for a given package.
|
||||
*
|
||||
* @param pkg The package to create a channel for.
|
||||
* @param channel the channel to attempt to create.
|
||||
*/
|
||||
public void createNotificationChannel(@NonNull String pkg,
|
||||
@NonNull NotificationChannel channel) {
|
||||
if (!isBound()) return;
|
||||
try {
|
||||
getNotificationInterface().createNotificationChannelFromAssistant(
|
||||
mWrapper, pkg, channel);
|
||||
} catch (RemoteException e) {
|
||||
Log.v(TAG, "Unable to contact notification manager", e);
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a notification channel for a given package.
|
||||
*
|
||||
* @param pkg The package to the channel belongs to.
|
||||
* @param channel the channel to attempt to update.
|
||||
*/
|
||||
public void updateNotificationChannel(@NonNull String pkg,
|
||||
@NonNull NotificationChannel channel) {
|
||||
if (!isBound()) return;
|
||||
try {
|
||||
getNotificationInterface().updateNotificationChannelFromAssistant(
|
||||
mWrapper, pkg, channel);
|
||||
} catch (RemoteException e) {
|
||||
Log.v(TAG, "Unable to contact notification manager", e);
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all notification channels belonging to the given package.
|
||||
*/
|
||||
public List<NotificationChannel> getNotificationChannels(@NonNull String pkg) {
|
||||
if (!isBound()) return null;
|
||||
try {
|
||||
return getNotificationInterface().getNotificationChannelsFromAssistant(
|
||||
mWrapper, pkg).getList();
|
||||
} catch (RemoteException e) {
|
||||
Log.v(TAG, "Unable to contact notification manager", e);
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given notification channel.
|
||||
*/
|
||||
public void deleteNotificationChannel(@NonNull String pkg, @NonNull String channelId) {
|
||||
if (!isBound()) return;
|
||||
try {
|
||||
getNotificationInterface().deleteNotificationChannelFromAssistant(
|
||||
mWrapper, pkg, channelId);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class NotificationAssistantServiceWrapper extends NotificationListenerWrapper {
|
||||
@Override
|
||||
|
||||
@@ -1294,19 +1294,14 @@ public class NotificationManagerService extends SystemService {
|
||||
sendRegisteredOnlyBroadcast(NotificationManager.ACTION_EFFECTS_SUPPRESSOR_CHANGED);
|
||||
}
|
||||
|
||||
private void updateNotificationChannelInt(String pkg, int uid, NotificationChannel channel,
|
||||
boolean fromAssistant) {
|
||||
private void updateNotificationChannelInt(String pkg, int uid, NotificationChannel channel) {
|
||||
if (channel.getImportance() == NotificationManager.IMPORTANCE_NONE) {
|
||||
// cancel
|
||||
cancelAllNotificationsInt(MY_UID, MY_PID, pkg, channel.getId(), 0, 0, true,
|
||||
UserHandle.getUserId(Binder.getCallingUid()), REASON_CHANNEL_BANNED,
|
||||
null);
|
||||
}
|
||||
if (fromAssistant) {
|
||||
mRankingHelper.updateNotificationChannelFromAssistant(pkg, uid, channel);
|
||||
} else {
|
||||
mRankingHelper.updateNotificationChannel(pkg, uid, channel);
|
||||
}
|
||||
mRankingHelper.updateNotificationChannel(pkg, uid, channel);
|
||||
|
||||
synchronized (mNotificationLock) {
|
||||
final int N = mNotificationList.size();
|
||||
@@ -1709,7 +1704,7 @@ public class NotificationManagerService extends SystemService {
|
||||
NotificationChannel channel) {
|
||||
enforceSystemOrSystemUI("Caller not system or systemui");
|
||||
Preconditions.checkNotNull(channel);
|
||||
updateNotificationChannelInt(pkg, uid, channel, false);
|
||||
updateNotificationChannelInt(pkg, uid, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2646,47 +2641,6 @@ public class NotificationManagerService extends SystemService {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createNotificationChannelFromAssistant(INotificationListener token, String pkg,
|
||||
NotificationChannel channel) throws RemoteException {
|
||||
ManagedServiceInfo info = mNotificationAssistants.checkServiceTokenLocked(token);
|
||||
int uid = mPackageManager.getPackageUid(pkg, 0, info.userid);
|
||||
mRankingHelper.createNotificationChannel(pkg, uid, channel, false /* fromTargetApp */);
|
||||
savePolicyFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteNotificationChannelFromAssistant(INotificationListener token, String pkg,
|
||||
String channelId) throws RemoteException {
|
||||
ManagedServiceInfo info = mNotificationAssistants.checkServiceTokenLocked(token);
|
||||
if (NotificationChannel.DEFAULT_CHANNEL_ID.equals(channelId)) {
|
||||
throw new IllegalArgumentException("Cannot delete default channel");
|
||||
}
|
||||
|
||||
int uid = mPackageManager.getPackageUid(pkg, 0, info.userid);
|
||||
cancelAllNotificationsInt(MY_UID, MY_PID, pkg, channelId, 0, 0, true,
|
||||
info.userid, REASON_CHANNEL_BANNED, null);
|
||||
mRankingHelper.deleteNotificationChannel(pkg, uid, channelId);
|
||||
savePolicyFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNotificationChannelFromAssistant(INotificationListener token, String pkg,
|
||||
NotificationChannel channel) throws RemoteException {
|
||||
ManagedServiceInfo info = mNotificationAssistants.checkServiceTokenLocked(token);
|
||||
Preconditions.checkNotNull(channel);
|
||||
int uid = mPackageManager.getPackageUid(pkg, 0, info.userid);
|
||||
updateNotificationChannelInt(pkg, uid, channel, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParceledListSlice<NotificationChannel> getNotificationChannelsFromAssistant(
|
||||
INotificationListener token, String pkg) throws RemoteException {
|
||||
ManagedServiceInfo info = mNotificationAssistants.checkServiceTokenLocked(token);
|
||||
int uid = mPackageManager.getPackageUid(pkg, 0, info.userid);
|
||||
return mRankingHelper.getNotificationChannels(pkg, uid, false /* includeDeleted */);
|
||||
}
|
||||
};
|
||||
|
||||
private void applyAdjustment(NotificationRecord n, Adjustment adjustment) {
|
||||
@@ -2695,17 +2649,10 @@ public class NotificationManagerService extends SystemService {
|
||||
}
|
||||
if (adjustment.getSignals() != null) {
|
||||
Bundle.setDefusable(adjustment.getSignals(), true);
|
||||
final String overrideChannelId =
|
||||
adjustment.getSignals().getString(Adjustment.KEY_CHANNEL_ID, null);
|
||||
final ArrayList<String> people =
|
||||
adjustment.getSignals().getStringArrayList(Adjustment.KEY_PEOPLE);
|
||||
final ArrayList<SnoozeCriterion> snoozeCriterionList =
|
||||
adjustment.getSignals().getParcelableArrayList(Adjustment.KEY_SNOOZE_CRITERIA);
|
||||
if (!TextUtils.isEmpty(overrideChannelId)) {
|
||||
n.updateNotificationChannel(mRankingHelper.getNotificationChannel(
|
||||
n.sbn.getPackageName(), n.sbn.getUid(), overrideChannelId,
|
||||
false /* includeDeleted */));
|
||||
}
|
||||
n.setPeopleOverride(people);
|
||||
n.setSnoozeCriteria(snoozeCriterionList);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public interface RankingConfig {
|
||||
void createNotificationChannel(String pkg, int uid, NotificationChannel channel,
|
||||
boolean fromTargetApp);
|
||||
void updateNotificationChannel(String pkg, int uid, NotificationChannel channel);
|
||||
void updateNotificationChannelFromAssistant(String pkg, int uid, NotificationChannel channel);
|
||||
NotificationChannel getNotificationChannel(String pkg, int uid, String channelId, boolean includeDeleted);
|
||||
void deleteNotificationChannel(String pkg, int uid, String channelId);
|
||||
void permanentlyDeleteNotificationChannel(String pkg, int uid, String channelId);
|
||||
|
||||
@@ -608,55 +608,6 @@ public class RankingHelper implements RankingConfig {
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNotificationChannelFromAssistant(String pkg, int uid,
|
||||
NotificationChannel updatedChannel) {
|
||||
Record r = getOrCreateRecord(pkg, uid);
|
||||
if (r == null) {
|
||||
throw new IllegalArgumentException("Invalid package");
|
||||
}
|
||||
NotificationChannel channel = r.channels.get(updatedChannel.getId());
|
||||
if (channel == null || channel.isDeleted()) {
|
||||
throw new IllegalArgumentException("Channel does not exist");
|
||||
}
|
||||
|
||||
if ((channel.getUserLockedFields() & NotificationChannel.USER_LOCKED_IMPORTANCE) == 0) {
|
||||
channel.setImportance(updatedChannel.getImportance());
|
||||
}
|
||||
if ((channel.getUserLockedFields() & NotificationChannel.USER_LOCKED_LIGHTS) == 0) {
|
||||
channel.enableLights(updatedChannel.shouldShowLights());
|
||||
channel.setLightColor(updatedChannel.getLightColor());
|
||||
}
|
||||
if ((channel.getUserLockedFields() & NotificationChannel.USER_LOCKED_PRIORITY) == 0) {
|
||||
channel.setBypassDnd(updatedChannel.canBypassDnd());
|
||||
}
|
||||
if ((channel.getUserLockedFields() & NotificationChannel.USER_LOCKED_SOUND) == 0) {
|
||||
channel.setSound(updatedChannel.getSound(), updatedChannel.getAudioAttributes());
|
||||
}
|
||||
if ((channel.getUserLockedFields() & NotificationChannel.USER_LOCKED_VIBRATION) == 0) {
|
||||
channel.enableVibration(updatedChannel.shouldVibrate());
|
||||
channel.setVibrationPattern(updatedChannel.getVibrationPattern());
|
||||
}
|
||||
if ((channel.getUserLockedFields() & NotificationChannel.USER_LOCKED_VISIBILITY) == 0) {
|
||||
if (updatedChannel.getLockscreenVisibility() == Notification.VISIBILITY_PUBLIC) {
|
||||
channel.setLockscreenVisibility(Ranking.VISIBILITY_NO_OVERRIDE);
|
||||
} else {
|
||||
channel.setLockscreenVisibility(updatedChannel.getLockscreenVisibility());
|
||||
}
|
||||
}
|
||||
if ((channel.getUserLockedFields() & NotificationChannel.USER_LOCKED_SHOW_BADGE) == 0) {
|
||||
channel.setShowBadge(updatedChannel.canShowBadge());
|
||||
}
|
||||
if (updatedChannel.isDeleted()) {
|
||||
channel.setDeleted(true);
|
||||
}
|
||||
// Assistant cannot change the group
|
||||
|
||||
MetricsLogger.action(getChannelLog(channel, pkg));
|
||||
r.channels.put(channel.getId(), channel);
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NotificationChannel getNotificationChannel(String pkg, int uid, String channelId,
|
||||
boolean includeDeleted) {
|
||||
|
||||
@@ -497,149 +497,6 @@ public class RankingHelperTest {
|
||||
new NotificationChannel("bananas", "bananas", IMPORTANCE_LOW), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_userLockedImportance() throws Exception {
|
||||
// all fields locked by user
|
||||
final NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
channel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
|
||||
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, false);
|
||||
|
||||
// same id, try to update
|
||||
final NotificationChannel channel2 =
|
||||
new NotificationChannel("id2", "name2", NotificationManager.IMPORTANCE_HIGH);
|
||||
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel2);
|
||||
|
||||
// no fields should be changed
|
||||
assertEquals(channel, mHelper.getNotificationChannel(PKG, UID, channel.getId(), false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_userLockedVisibility() throws Exception {
|
||||
// all fields locked by user
|
||||
final NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
|
||||
channel.lockFields(NotificationChannel.USER_LOCKED_VISIBILITY);
|
||||
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, false);
|
||||
|
||||
// same id, try to update
|
||||
final NotificationChannel channel2 =
|
||||
new NotificationChannel("id2", "name2", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel2.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
|
||||
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel2);
|
||||
|
||||
// no fields should be changed
|
||||
assertEquals(channel, mHelper.getNotificationChannel(PKG, UID, channel.getId(), false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_userLockedVibration() throws Exception {
|
||||
// all fields locked by user
|
||||
final NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
channel.enableLights(false);
|
||||
channel.lockFields(NotificationChannel.USER_LOCKED_VIBRATION);
|
||||
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, false);
|
||||
|
||||
// same id, try to update
|
||||
final NotificationChannel channel2 =
|
||||
new NotificationChannel("id2", "name2", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel2.enableVibration(true);
|
||||
channel2.setVibrationPattern(new long[]{100});
|
||||
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel2);
|
||||
|
||||
// no fields should be changed
|
||||
assertEquals(channel, mHelper.getNotificationChannel(PKG, UID, channel.getId(), false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_userLockedLights() throws Exception {
|
||||
// all fields locked by user
|
||||
final NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
channel.enableLights(false);
|
||||
channel.lockFields(NotificationChannel.USER_LOCKED_LIGHTS);
|
||||
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, false);
|
||||
|
||||
// same id, try to update
|
||||
final NotificationChannel channel2 =
|
||||
new NotificationChannel("id2", "name2", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel2.enableLights(true);
|
||||
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel2);
|
||||
|
||||
// no fields should be changed
|
||||
assertEquals(channel, mHelper.getNotificationChannel(PKG, UID, channel.getId(), false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_userLockedPriority() throws Exception {
|
||||
// all fields locked by user
|
||||
final NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
channel.setBypassDnd(true);
|
||||
channel.lockFields(NotificationChannel.USER_LOCKED_PRIORITY);
|
||||
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, false);
|
||||
|
||||
// same id, try to update all fields
|
||||
final NotificationChannel channel2 =
|
||||
new NotificationChannel("id2", "name2", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel2.setBypassDnd(false);
|
||||
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel2);
|
||||
|
||||
// no fields should be changed
|
||||
assertEquals(channel, mHelper.getNotificationChannel(PKG, UID, channel.getId(), false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_userLockedRingtone() throws Exception {
|
||||
// all fields locked by user
|
||||
final NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
channel.setSound(new Uri.Builder().scheme("test").build(), mAudioAttributes);
|
||||
channel.lockFields(NotificationChannel.USER_LOCKED_SOUND);
|
||||
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, false);
|
||||
|
||||
// same id, try to update all fields
|
||||
final NotificationChannel channel2 =
|
||||
new NotificationChannel("id2", "name2", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel2.setSound(new Uri.Builder().scheme("test2").build(), mAudioAttributes);
|
||||
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel2);
|
||||
|
||||
// no fields should be changed
|
||||
assertEquals(channel, mHelper.getNotificationChannel(PKG, UID, channel.getId(), false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_userLockedBadge() throws Exception {
|
||||
final NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
channel.setShowBadge(true);
|
||||
channel.lockFields(NotificationChannel.USER_LOCKED_SHOW_BADGE);
|
||||
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, false);
|
||||
|
||||
final NotificationChannel channel2 =
|
||||
new NotificationChannel("id2", "name2", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel2.setShowBadge(false);
|
||||
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel2);
|
||||
|
||||
// no fields should be changed
|
||||
assertEquals(channel, mHelper.getNotificationChannel(PKG, UID, channel.getId(), false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate() throws Exception {
|
||||
@@ -815,30 +672,6 @@ public class RankingHelperTest {
|
||||
assertEquals(0, mHelper.getDeletedChannelCount("pkg2", UID2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDeletedChannels() throws Exception {
|
||||
NotificationChannel channel =
|
||||
new NotificationChannel("id2", "name2", IMPORTANCE_LOW);
|
||||
mHelper.createNotificationChannel(PKG, UID, channel, true);
|
||||
|
||||
mHelper.deleteNotificationChannel(PKG, UID, channel.getId());
|
||||
|
||||
channel.setSound(new Uri.Builder().scheme("test").build(), mAudioAttributes);
|
||||
try {
|
||||
mHelper.updateNotificationChannel(PKG, UID, channel);
|
||||
fail("Updated deleted channel");
|
||||
} catch (IllegalArgumentException e) {
|
||||
// :)
|
||||
}
|
||||
|
||||
try {
|
||||
mHelper.updateNotificationChannelFromAssistant(PKG, UID, channel);
|
||||
fail("Updated deleted channel");
|
||||
} catch (IllegalArgumentException e) {
|
||||
// :)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateDeletedChannel() throws Exception {
|
||||
long[] vibration = new long[]{100, 67, 145, 156};
|
||||
|
||||
Reference in New Issue
Block a user