Don't reset channel field when loading the app

Only save data that's changed.

Change-Id: Iaa8265f543a7c1ec418d9d016986e0a253f28df6
Fixes: 79216856
Test: robo tests
This commit is contained in:
Julia Reynolds
2018-05-22 09:07:46 -04:00
parent 5c99a41a9c
commit 306e2d9f84
2 changed files with 5 additions and 4 deletions

View File

@@ -103,9 +103,11 @@ public class BlockPreferenceController extends NotificationPreferenceController
saveChannel();
}
if (mBackend.onlyHasDefaultChannel(mAppRow.pkg, mAppRow.uid)) {
if (mAppRow.banned != blocked) {
mAppRow.banned = blocked;
mBackend.setNotificationsEnabledForPackage(mAppRow.pkg, mAppRow.uid, !blocked);
}
}
} else if (mChannelGroup != null) {
mChannelGroup.setBlocked(blocked);
mBackend.updateChannelGroup(mAppRow.pkg, mAppRow.uid, mChannelGroup);

View File

@@ -250,8 +250,7 @@ public class BlockPreferenceControllerTest {
verify(mBackend, times(2)).updateChannel(any(), anyInt(), any());
// 2 calls for onSwitchChanged + once when calling updateState originally
verify(mBackend, times(3)).setNotificationsEnabledForPackage(
verify(mBackend, times(2)).setNotificationsEnabledForPackage(
anyString(), anyInt(), anyBoolean());
}