Merge "Add a method to return the flags set for a PendingIntent"

This commit is contained in:
Ashwini Oruganti
2020-10-09 00:13:49 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 0 deletions

View File

@@ -102,6 +102,11 @@ public abstract class ActivityManagerInternal {
public abstract void setPendingIntentWhitelistDuration(IIntentSender target,
IBinder whitelistToken, long duration);
/**
* Returns the flags set for a {@link PendingIntent}.
*/
public abstract int getPendingIntentFlags(IIntentSender target);
/**
* Allows a {@link PendingIntent} to start activities from background.
*/

View File

@@ -15788,6 +15788,11 @@ public class ActivityManagerService extends IActivityManager.Stub
duration);
}
@Override
public int getPendingIntentFlags(IIntentSender target) {
return mPendingIntentController.getPendingIntentFlags(target);
}
@Override
public void setPendingIntentAllowBgActivityStarts(IIntentSender target,
IBinder whitelistToken, int flags) {

View File

@@ -311,6 +311,16 @@ public class PendingIntentController {
}
}
int getPendingIntentFlags(IIntentSender target) {
if (!(target instanceof PendingIntentRecord)) {
Slog.w(TAG, "markAsSentFromNotification(): not a PendingIntentRecord: " + target);
return 0;
}
synchronized (mLock) {
return ((PendingIntentRecord) target).key.flags;
}
}
private void makeIntentSenderCanceled(PendingIntentRecord rec) {
rec.canceled = true;
final RemoteCallbackList<IResultReceiver> callbacks = rec.detachCancelListenersLocked();