Create a page to manage dnd permission for individual app
- Change the original ZenAccessPage to - Remove the inline switch - Make the preference click target go into the new detail page - Some formatting/style change. - Create a new detail page for zen access. - Exit if app didn't declare this permission - Preset the switch toggle to their current permission grant state - Move the warning dialog logic from ZenAccessSettings to here. - Move some common functionality into ZenAccessController, a static helper class Bug: 128547723 Test: robotest Change-Id: I1ebb32396869d07ff4283b300bd716506298c9b5
This commit is contained in:
@@ -19,15 +19,19 @@ package com.android.settings.testutils.shadow;
|
||||
import android.app.NotificationManager;
|
||||
import android.net.Uri;
|
||||
import android.service.notification.ZenModeConfig;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import org.robolectric.annotation.Implementation;
|
||||
import org.robolectric.annotation.Implements;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Implements(NotificationManager.class)
|
||||
public class ShadowNotificationManager {
|
||||
|
||||
private int mZenMode;
|
||||
private ZenModeConfig mZenModeConfig;
|
||||
private Set<String> mNotificationPolicyGrantedPackages = new ArraySet<>();
|
||||
|
||||
@Implementation
|
||||
protected void setZenMode(int mode, Uri conditionId, String reason) {
|
||||
@@ -39,6 +43,11 @@ public class ShadowNotificationManager {
|
||||
return mZenMode;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
protected boolean isNotificationPolicyAccessGrantedForPackage(String pkg) {
|
||||
return mNotificationPolicyGrantedPackages.contains(pkg);
|
||||
}
|
||||
|
||||
@Implementation
|
||||
public ZenModeConfig getZenModeConfig() {
|
||||
return mZenModeConfig;
|
||||
@@ -47,4 +56,8 @@ public class ShadowNotificationManager {
|
||||
public void setZenModeConfig(ZenModeConfig config) {
|
||||
mZenModeConfig = config;
|
||||
}
|
||||
|
||||
public void setNotificationPolicyAccessGrantedForPackage(String pkg) {
|
||||
mNotificationPolicyGrantedPackages.add(pkg);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user