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:
@@ -54,13 +54,7 @@ public class BlockPreferenceController extends NotificationPreferenceController
|
||||
if (mAppRow == null) {
|
||||
return false;
|
||||
}
|
||||
if (mChannel != null) {
|
||||
return isChannelBlockable();
|
||||
} else if (mChannelGroup != null) {
|
||||
return isChannelGroupBlockable();
|
||||
} else {
|
||||
return !mAppRow.systemApp || (mAppRow.systemApp && mAppRow.banned);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateState(Preference preference) {
|
||||
@@ -78,6 +72,19 @@ public class BlockPreferenceController extends NotificationPreferenceController
|
||||
}
|
||||
bar.setDisabledByAdmin(mAdmin);
|
||||
|
||||
if (mChannel != null && !isChannelBlockable()) {
|
||||
bar.setEnabled(false);
|
||||
}
|
||||
|
||||
if (mChannelGroup != null && !isChannelGroupBlockable()) {
|
||||
bar.setEnabled(false);
|
||||
}
|
||||
|
||||
if (mChannel == null && mAppRow.systemApp
|
||||
&& (!mAppRow.banned || mAppRow.lockedImportance)) {
|
||||
bar.setEnabled(false);
|
||||
}
|
||||
|
||||
if (mChannel != null) {
|
||||
bar.setChecked(!mAppRow.banned
|
||||
&& mChannel.getImportance() != NotificationManager.IMPORTANCE_NONE);
|
||||
|
||||
Reference in New Issue
Block a user