Create settings screen for Notification Assistant
Test: this atest Test: manual: change assistant and "adb shell dumpsys notification" Test: manual: verify persistance through reboot (including none) Fixes:120852765 Change-Id: Ie4516c3339246d66d7b6719ac5dd1d65c4d03b57
This commit is contained in:
@@ -23,6 +23,7 @@ import android.app.NotificationChannel;
|
||||
import android.app.NotificationChannelGroup;
|
||||
import android.app.usage.IUsageStatsManager;
|
||||
import android.app.usage.UsageEvents;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -410,6 +411,29 @@ public class NotificationBackend {
|
||||
}
|
||||
}
|
||||
|
||||
public ComponentName getAllowedNotificationAssistant() {
|
||||
try {
|
||||
return sINM.getAllowedNotificationAssistant();
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setNotificationAssistantGranted(ComponentName cn) {
|
||||
try {
|
||||
sINM.setNotificationAssistantAccessGranted(cn, true);
|
||||
if (cn == null) {
|
||||
return sINM.getAllowedNotificationAssistant() == null;
|
||||
} else {
|
||||
return cn.equals(sINM.getAllowedNotificationAssistant());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* NotificationsSentState contains how often an app sends notifications and how recently it sent
|
||||
* one.
|
||||
|
Reference in New Issue
Block a user