Fix visibility and editability of importance fields

- Block field should always be visible
- Locked by OEM: cannot block or change importance
- Locked by default app: cannot block, can change importance
- Locked by system app: cannot block, can change importance
- system app but blockable: can block, can change importance

Test: robotests
Fixes: 131248127
Change-Id: Ifa718c84573dd5125aefa4f672a79dc4f267d515
This commit is contained in:
Julia Reynolds
2019-04-26 12:56:50 -04:00
parent 2f2a3c4055
commit a540fa56d4
24 changed files with 293 additions and 194 deletions

View File

@@ -110,27 +110,13 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc
}
}
private boolean isChannelConfigurable() {
if (mAppRow != null && mAppRow.lockedImportance) {
return false;
}
if (mChannel != null && mAppRow != null) {
return !Objects.equals(mChannel.getId(), mAppRow.lockedChannelId);
}
return false;
}
protected boolean isChannelBlockable() {
if (mChannel != null && mAppRow != null) {
if (!isChannelConfigurable()) {
if (mChannel.isImportanceLockedByCriticalDeviceFunction()
|| mChannel.isImportanceLockedByOEM()) {
return mChannel.getImportance() == IMPORTANCE_NONE;
}
if (mChannel.isImportanceLockedByOEM()
|| mChannel.isImportanceLockedByCriticalDeviceFunction()) {
return false;
}
return mChannel.isBlockableSystem() || !mAppRow.systemApp
|| mChannel.getImportance() == IMPORTANCE_NONE;
}