Specify temp-allowlist reasonCode while calling setPendingIntentAllowlistDuration().
Delete the overloaded version of setPendingIntentAllowlistDuration() without reasonCode. Bug: 171305836 Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java Reboot device, observe "tempAllowListReason" in logcat. Change-Id: Ib8bd22eefb5d5f308d2bcca17221499c2a6adc79
This commit is contained in:
@@ -113,10 +113,6 @@ public abstract class ActivityManagerInternal {
|
||||
IBinder allowlistToken, long duration, @TempAllowListType int type,
|
||||
@ReasonCode int reasonCode, @Nullable String reason);
|
||||
|
||||
@Deprecated
|
||||
public abstract void setPendingIntentWhitelistDuration(IIntentSender target,
|
||||
IBinder allowlistToken, long duration, @TempAllowListType int type);
|
||||
|
||||
/**
|
||||
* Returns the flags set for a {@link PendingIntent}.
|
||||
*/
|
||||
|
||||
@@ -15126,13 +15126,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
duration, type, reasonCode, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPendingIntentWhitelistDuration(IIntentSender target, IBinder allowlistToken,
|
||||
long duration, int type) {
|
||||
mPendingIntentController.setPendingIntentAllowlistDuration(target, allowlistToken,
|
||||
duration, type, REASON_UNKNOWN, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPendingIntentFlags(IIntentSender target) {
|
||||
return mPendingIntentController.getPendingIntentFlags(target);
|
||||
|
||||
@@ -64,6 +64,8 @@ import static android.media.AudioAttributes.FLAG_BYPASS_INTERRUPTION_POLICY;
|
||||
import static android.media.AudioAttributes.USAGE_NOTIFICATION_RINGTONE;
|
||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
|
||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
|
||||
import static android.os.PowerWhitelistManager.REASON_NOTIFICATION_SERVICE;
|
||||
import static android.os.PowerWhitelistManager.TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED;
|
||||
import static android.os.UserHandle.USER_NULL;
|
||||
import static android.os.UserHandle.USER_SYSTEM;
|
||||
import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING;
|
||||
@@ -6001,10 +6003,11 @@ public class NotificationManagerService extends SystemService {
|
||||
for (int i = 0; i < intentCount; i++) {
|
||||
PendingIntent pendingIntent = notification.allPendingIntents.valueAt(i);
|
||||
if (pendingIntent != null) {
|
||||
am.setPendingIntentWhitelistDuration(pendingIntent.getTarget(),
|
||||
am.setPendingIntentAllowlistDuration(pendingIntent.getTarget(),
|
||||
ALLOWLIST_TOKEN, duration,
|
||||
BroadcastOptions.TEMPORARY_WHITELIST_TYPE_FOREGROUND_SERVICE_ALLOWED
|
||||
);
|
||||
TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
|
||||
REASON_NOTIFICATION_SERVICE,
|
||||
"NotificationManagerService");
|
||||
am.setPendingIntentAllowBgActivityStarts(pendingIntent.getTarget(),
|
||||
ALLOWLIST_TOKEN, (FLAG_ACTIVITY_SENDER | FLAG_BROADCAST_SENDER
|
||||
| FLAG_SERVICE_SENDER));
|
||||
|
||||
Reference in New Issue
Block a user