Commit d0327310 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

[FCM] Delete persisted message when token gets deleted

Bug: 882887
Change-Id: Id2b3c2c6d80b30552fd94face69b32223f455c68
Reviewed-on: https://chromium-review.googlesource.com/c/1296543
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610180}
parent 95cc1e2b
......@@ -194,8 +194,6 @@ public class LazySubscriptionsManager {
* @return The messages stored. Returns an empty list in case of failure.
*/
public static GCMMessage[] readMessages(String subscriptionId) {
// TODO(https://crbug.com/882887): Make sure to delete subscription
// information when the token goes.
Context context = ContextUtils.getApplicationContext();
SharedPreferences sharedPrefs =
context.getSharedPreferences(PREF_PACKAGE, Context.MODE_PRIVATE);
......
......@@ -137,6 +137,12 @@ public class InstanceIDBridge {
protected Boolean doBackgroundWork() {
try {
mInstanceID.deleteToken(authorizedEntity, scope);
String subscriptionId = LazySubscriptionsManager.buildSubscriptionUniqueId(
mSubtype, authorizedEntity);
if (LazySubscriptionsManager.isSubscriptionLazy(subscriptionId)) {
LazySubscriptionsManager.deletePersistedMessagesForSubscriptionId(
subscriptionId);
}
return true;
} catch (IOException ex) {
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment