diff options
author | meek <meek@chromium.org> | 2015-07-21 13:32:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-21 20:32:35 +0000 |
commit | da5e1028314db976871b1f746172b99889e0e64b (patch) | |
tree | e052027015fdb2a6596e61cc9e1a249d44c173b6 /third_party/cacheinvalidation | |
parent | 43c0916a502dc87c79e59754b37e79a4fe00acea (diff) | |
download | chromium_src-da5e1028314db976871b1f746172b99889e0e64b.zip chromium_src-da5e1028314db976871b1f746172b99889e0e64b.tar.gz chromium_src-da5e1028314db976871b1f746172b99889e0e64b.tar.bz2 |
Roll cacheinvalidation to 20150720
* Defend against SecurityException in AlarmManager (allow retries in Clank to drive to completion when under quota again)
* Misc. code cleanup: removing deprecated fields, removing unused fields, standard template type names, deterministic member order for generated proto code
* Manifest cleanup
BUG=483695
Review URL: https://codereview.chromium.org/1246033002
Cr-Commit-Position: refs/heads/master@{#339738}
Diffstat (limited to 'third_party/cacheinvalidation')
21 files changed, 97 insertions, 149 deletions
diff --git a/third_party/cacheinvalidation/README.chromium b/third_party/cacheinvalidation/README.chromium index 4259807..b1ad99e 100644 --- a/third_party/cacheinvalidation/README.chromium +++ b/third_party/cacheinvalidation/README.chromium @@ -11,3 +11,5 @@ This is the API to talk to the Google Cache Invalidation service, used by the invalidations consumed by Sync, Enterprise Policy, and other services. It was previously hosted at http://code.google.com/p/google-cache-invalidation-api/ but was merged into the Chromium repository at r342. + +2015-07-21: merging client library version 20150720 diff --git a/third_party/cacheinvalidation/src/example-app-build/AndroidManifest.xml b/third_party/cacheinvalidation/src/example-app-build/AndroidManifest.xml index 9a2a4db..4c0dce8 100644 --- a/third_party/cacheinvalidation/src/example-app-build/AndroidManifest.xml +++ b/third_party/cacheinvalidation/src/example-app-build/AndroidManifest.xml @@ -7,7 +7,6 @@ Merger manifest: java/com/google/ipc/invalidation/examples/android2/AndroidManifest.xml Mergee manifests: - blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/> <!-- Declare and use permission allowing this application to receive GCM @@ -37,13 +36,10 @@ <action android:name="com.google.ipc.invalidation.AUTH_TOKEN_REQUEST"/> </intent-filter> </service> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Receiver for scheduler alarms. --> <receiver android:exported="false" android:name="com.google.ipc.invalidation.external.client.contrib.AndroidListener$AlarmReceiver"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Receiver for scheduler alarms. --> <receiver android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.AndroidInternalScheduler$AlarmReceiver"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM Broadcast Receiver --> <receiver android:exported="true" android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener$GCMReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> @@ -52,41 +48,31 @@ <category android:name="com.google.ipc.invalidation.ticl.android2"/> </intent-filter> </receiver> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Merged from file: java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml --> <receiver android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService$Receiver"> <intent-filter> <action android:name="com.google.ipc.invalidation.gcmmplex.EVENT"/> </intent-filter> </receiver> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Ticl service. --> <service android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.TiclService"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Ticl sender. --> <service android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageSenderService"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM multiplexer --> <service android:exported="false" android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener"> <meta-data android:name="sender_ids" android:value="ipc.invalidation@gmail.com"/> </service> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Invalidation service multiplexed GCM receiver --> <service android:enabled="true" android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService"/> </application> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- App receives GCM messages. --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM connects to Google Services. --> <uses-permission android:name="android.permission.INTERNET"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM requires a Google account. --> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Merged from file: java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml --> <uses-permission android:name="android.permission.USE_CREDENTIALS"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Keeps the processor from sleeping when a message is received. --> <uses-permission android:name="android.permission.WAKE_LOCK"/> </manifest> diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/common/BuildConstants.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/common/BuildConstants.java index a8a3a65..4bc9d50 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/common/BuildConstants.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/common/BuildConstants.java @@ -33,5 +33,5 @@ package com.google.ipc.invalidation.common; /** Build constant definitions. */ class BuildConstants { - static final int BUILD_DATESTAMP = 20140825; + static final int BUILD_DATESTAMP = 20150720; } diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/AndroidListenerIntents.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/AndroidListenerIntents.java index d799ef6..c0a39fc 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/AndroidListenerIntents.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/AndroidListenerIntents.java @@ -146,7 +146,11 @@ class AndroidListenerIntents { // Schedule the pending intent after the appropriate delay. AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); long executeMs = clock.nowMs() + delayMs; - alarmManager.set(AlarmManager.RTC, executeMs, pendingIntent); + try { + alarmManager.set(AlarmManager.RTC, executeMs, pendingIntent); + } catch (SecurityException exception) { + logger.warning("Unable to schedule delayed registration: %s", exception); + } } /** Creates a 'start-client' intent. */ diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/types/SimplePair.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/types/SimplePair.java index aa5cb76..72bdea6 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/types/SimplePair.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/types/SimplePair.java @@ -22,11 +22,11 @@ package com.google.ipc.invalidation.external.client.types; * accessed using the {@link #getFirst} and {@link #getSecond} methods. Equality * and hashing are defined in the natural way. * - * @param <FirstType> The type of the first element - * @param <SecondType> The type of the second element + * @param <T1> The type of the first element + * @param <T2> The type of the second element * */ -public final class SimplePair<FirstType, SecondType> { +public final class SimplePair<T1, T2> { /** * Creates a new pair containing the given elements in order. */ @@ -38,17 +38,17 @@ public final class SimplePair<FirstType, SecondType> { /** * The first element of the pair; see also {@link #getFirst}. */ - public final FirstType first; + public final T1 first; /** * The second element of the pair; see also {@link #getSecond}. */ - public final SecondType second; + public final T2 second; /** * Constructor. It is usually easier to call {@link #of}. */ - public SimplePair(FirstType first, SecondType second) { + public SimplePair(T1 first, T2 second) { this.first = first; this.second = second; } @@ -56,14 +56,14 @@ public final class SimplePair<FirstType, SecondType> { /** * Returns the first element of this pair; see also {@link #first}. */ - public FirstType getFirst() { + public T1 getFirst() { return first; } /** * Returns the second element of this pair; see also {@link #second}. */ - public SecondType getSecond() { + public T2 getSecond() { return second; } diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/DigestStore.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/DigestStore.java index 05bde24..c926c2f 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/DigestStore.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/DigestStore.java @@ -22,16 +22,16 @@ import java.util.Collection; * Interface for a store that allows objects to be added/removed along with * the ability to get the digest for the whole or partial set of those objects. * - * @param <ElementType> the type of the element stored in this + * @param <T> the type of the element stored in this * */ -public interface DigestStore<ElementType> { +public interface DigestStore<T> { /** Returns the number of elements. */ int size(); /** Returns whether {@code element} is in the store. */ - boolean contains(ElementType element); + boolean contains(T element); /** * Returns a digest of the desired objects. @@ -48,34 +48,34 @@ public interface DigestStore<ElementType> { * than what has been specified by {@code digestPrefix}, e.g., it could return all the objects * in the store. */ - Collection<ElementType> getElements(byte[] digestPrefix, int prefixLen); + Collection<T> getElements(byte[] digestPrefix, int prefixLen); /** * Adds {@code element} to the store. No-op if {@code element} is already present. * @return whether the element was added */ - boolean add(ElementType element); + boolean add(T element); /** * Adds {@code elements} to the store. If any element in {@code elements} is already present, * the addition is a no-op for that element. * @return the elements that were added */ - Collection<ElementType> add(Collection<ElementType> elements); + Collection<T> add(Collection<T> elements); /** * Removes {@code element} from the store. No-op if {@code element} is not present. * @return whether the element was removed */ - boolean remove(ElementType element); + boolean remove(T element); /** * Remove {@code elements} to the store. If any element in {@code elements} is not present, the * removal is a no-op for that element. * @return the elements that were removed */ - Collection<ElementType> remove(Collection<ElementType> elements); + Collection<T> remove(Collection<T> elements); /** Removes all elements in this and returns them. */ - Collection<ElementType> removeAll(); + Collection<T> removeAll(); } diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RecurringTask.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RecurringTask.java index 8973854..57925a1 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RecurringTask.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RecurringTask.java @@ -211,6 +211,7 @@ public abstract class RecurringTask extends InternalBase private void ensureScheduled(boolean isRetry, String debugReason) { Preconditions.checkState(scheduler.isRunningOnThread()); if (isScheduled) { + logger.fine("[%s] Not scheduling task that is already scheduled", debugReason); return; } final int delayMs; diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RunState.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RunState.java index 6e022b0..f9e6830 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RunState.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RunState.java @@ -27,7 +27,7 @@ import com.google.ipc.invalidation.util.Marshallable; public class RunState implements Marshallable<RunStateP> { /** Current run state ({@link RunStateP}). */ private Integer currentState; - private Object lock = new Object(); + private final Object lock = new Object(); /** Constructs a new instance in the {@code NOT_STARTED} state. */ public RunState() { diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInternalScheduler.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInternalScheduler.java index f867d6c..91b4eac 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInternalScheduler.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInternalScheduler.java @@ -125,7 +125,11 @@ public final class AndroidInternalScheduler implements Scheduler { // Schedule the pending intent after the appropriate delay. AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); long executeMs = clock.nowMs() + delayMs; - alarmManager.set(AlarmManager.RTC, executeMs, sender); + try { + alarmManager.set(AlarmManager.RTC, executeMs, sender); + } catch (SecurityException exception) { + logger.warning("Unable to schedule delayed registration: %s", exception); + } } /** diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationClientStub.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationClientStub.java index 1683eda..6a54f9d 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationClientStub.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationClientStub.java @@ -17,7 +17,6 @@ package com.google.ipc.invalidation.ticl.android2; import com.google.ipc.invalidation.external.client.InvalidationClient; -import com.google.ipc.invalidation.external.client.SystemResources.Logger; import com.google.ipc.invalidation.external.client.types.AckHandle; import com.google.ipc.invalidation.external.client.types.ObjectId; import com.google.ipc.invalidation.ticl.ProtoWrapperConverter; @@ -43,13 +42,9 @@ class AndroidInvalidationClientStub implements InvalidationClient { /** Class implementing the Ticl service. */ private final String serviceClass; - /** logger. */ - private final Logger logger; - - /** Creates an instance from {@code context} and {@code logger}. */ - AndroidInvalidationClientStub(Context context, Logger logger) { + /** Creates an instance from {@code context}. */ + AndroidInvalidationClientStub(Context context) { this.context = Preconditions.checkNotNull(context.getApplicationContext()); - this.logger = Preconditions.checkNotNull(logger); this.serviceClass = new AndroidTiclManifest(context).getTiclServiceClass(); } diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationListenerIntentMapper.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationListenerIntentMapper.java index ed1ec51..cda64d2 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationListenerIntentMapper.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/AndroidInvalidationListenerIntentMapper.java @@ -60,7 +60,7 @@ public final class AndroidInvalidationListenerIntentMapper { * @param context the context used by the listener to issue downcalls to the TICL */ public AndroidInvalidationListenerIntentMapper(InvalidationListener listener, Context context) { - client = new AndroidInvalidationClientStub(context, logger); + client = new AndroidInvalidationClientStub(context); this.listener = listener; } diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/AndroidService.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/AndroidService.java index 0acdd52..2f59c1f 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/AndroidService.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/AndroidService.java @@ -355,20 +355,14 @@ public interface AndroidService { this.registrations = registrations; this.__hazzerBits = hazzerBits; String existingOneOfField = null; - if (hasStop()) { - existingOneOfField = "stop"; - } - if (hasStart()) { - if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "start"); - } - existingOneOfField = "start"; - } if (hasSerial()) { + existingOneOfField = "serial"; + } + if (this.ack != null) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "serial"); + oneOfViolation(existingOneOfField, "ack"); } - existingOneOfField = "serial"; + existingOneOfField = "ack"; } if (this.registrations != null) { if (existingOneOfField != null) { @@ -376,11 +370,17 @@ public interface AndroidService { } existingOneOfField = "registrations"; } - if (this.ack != null) { + if (hasStart()) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "ack"); + oneOfViolation(existingOneOfField, "start"); } - existingOneOfField = "ack"; + existingOneOfField = "start"; + } + if (hasStop()) { + if (existingOneOfField != null) { + oneOfViolation(existingOneOfField, "stop"); + } + existingOneOfField = "stop"; } if (existingOneOfField == null) { oneOfViolation(); } } @@ -748,26 +748,26 @@ public interface AndroidService { this.createClient = createClient; this.__hazzerBits = hazzerBits; String existingOneOfField = null; - if (hasNetworkAddrChange()) { - existingOneOfField = "network_addr_change"; - } if (this.networkStatus != null) { + existingOneOfField = "network_status"; + } + if (this.serverMessage != null) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "network_status"); + oneOfViolation(existingOneOfField, "server_message"); } - existingOneOfField = "network_status"; + existingOneOfField = "server_message"; } - if (this.createClient != null) { + if (hasNetworkAddrChange()) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "create_client"); + oneOfViolation(existingOneOfField, "network_addr_change"); } - existingOneOfField = "create_client"; + existingOneOfField = "network_addr_change"; } - if (this.serverMessage != null) { + if (this.createClient != null) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "server_message"); + oneOfViolation(existingOneOfField, "create_client"); } - existingOneOfField = "server_message"; + existingOneOfField = "create_client"; } if (existingOneOfField == null) { oneOfViolation(); } } @@ -958,7 +958,13 @@ public interface AndroidService { } this.__hazzerBits = hazzerBits; String existingOneOfField = null; + if (hasInvalidateAll()) { + existingOneOfField = "invalidate_all"; + } if (this.invalidateUnknown != null) { + if (existingOneOfField != null) { + oneOfViolation(existingOneOfField, "invalidate_unknown"); + } existingOneOfField = "invalidate_unknown"; } if (this.invalidation != null) { @@ -967,12 +973,6 @@ public interface AndroidService { } existingOneOfField = "invalidation"; } - if (hasInvalidateAll()) { - if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "invalidate_all"); - } - existingOneOfField = "invalidate_all"; - } if (existingOneOfField == null) { oneOfViolation(); } } @@ -1436,20 +1436,20 @@ public interface AndroidService { this.error = error; this.__hazzerBits = hazzerBits; String existingOneOfField = null; - if (this.reissueRegistrations != null) { - existingOneOfField = "reissue_registrations"; - } if (hasSerial()) { + existingOneOfField = "serial"; + } + if (this.error != null) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "serial"); + oneOfViolation(existingOneOfField, "error"); } - existingOneOfField = "serial"; + existingOneOfField = "error"; } - if (this.registrationFailure != null) { + if (this.invalidate != null) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "registration_failure"); + oneOfViolation(existingOneOfField, "invalidate"); } - existingOneOfField = "registration_failure"; + existingOneOfField = "invalidate"; } if (hasReady()) { if (existingOneOfField != null) { @@ -1457,11 +1457,11 @@ public interface AndroidService { } existingOneOfField = "ready"; } - if (this.invalidate != null) { + if (this.registrationFailure != null) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "invalidate"); + oneOfViolation(existingOneOfField, "registration_failure"); } - existingOneOfField = "invalidate"; + existingOneOfField = "registration_failure"; } if (this.registrationStatus != null) { if (existingOneOfField != null) { @@ -1469,11 +1469,11 @@ public interface AndroidService { } existingOneOfField = "registration_status"; } - if (this.error != null) { + if (this.reissueRegistrations != null) { if (existingOneOfField != null) { - oneOfViolation(existingOneOfField, "error"); + oneOfViolation(existingOneOfField, "reissue_registrations"); } - existingOneOfField = "error"; + existingOneOfField = "reissue_registrations"; } if (existingOneOfField == null) { oneOfViolation(); } } diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ChannelCommon.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ChannelCommon.java index bed01e6c..549f6fc 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ChannelCommon.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ChannelCommon.java @@ -33,7 +33,6 @@ public interface ChannelCommon { public static final class ChannelMessageEncoding extends ProtoWrapper { public interface MessageEncoding { public static final int PROTOBUF_BINARY_FORMAT = 1; - public static final int PROTOBUF_JSON_FORMAT = 2; } public static ChannelMessageEncoding create() { @@ -92,11 +91,8 @@ public interface ChannelCommon { public static final class NetworkEndpointId extends ProtoWrapper { public interface NetworkAddress { public static final int TEST = 1; - public static final int BUZZ = 111; - public static final int STUBBY = 112; public static final int ANDROID = 113; public static final int LCS = 114; - public static final int TIPS_STUBBY = 115; } public static NetworkEndpointId create(Integer networkAddress, diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ClientProtocol.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ClientProtocol.java index 501e580..852bbc9 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ClientProtocol.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/ClientProtocol.java @@ -510,7 +510,6 @@ public interface ClientProtocol { public boolean isKnownVersion; public long version; public Bytes payload; - public Long bridgeArrivalTimeMsDeprecated; public Boolean isTrickleRestart; public Builder(com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP objectId, boolean isKnownVersion, @@ -518,7 +517,7 @@ public interface ClientProtocol { this.objectId = objectId;this.isKnownVersion = isKnownVersion;this.version = version;} public InvalidationP build() { - return new InvalidationP(objectId, isKnownVersion, version, payload, bridgeArrivalTimeMsDeprecated, isTrickleRestart); + return new InvalidationP(objectId, isKnownVersion, version, payload, isTrickleRestart); } } @@ -526,9 +525,8 @@ public interface ClientProtocol { boolean isKnownVersion, long version, Bytes payload, - Long bridgeArrivalTimeMsDeprecated, Boolean isTrickleRestart) { - return new InvalidationP(objectId, isKnownVersion, version, payload, bridgeArrivalTimeMsDeprecated, isTrickleRestart); + return new InvalidationP(objectId, isKnownVersion, version, payload, isTrickleRestart); } private final long __hazzerBits; @@ -536,14 +534,12 @@ public interface ClientProtocol { private final boolean isKnownVersion; private final long version; private final Bytes payload; - private final long bridgeArrivalTimeMsDeprecated; private final boolean isTrickleRestart; private InvalidationP(com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP objectId, Boolean isKnownVersion, Long version, Bytes payload, - Long bridgeArrivalTimeMsDeprecated, Boolean isTrickleRestart) throws ValidationArgumentException { int hazzerBits = 0; required("object_id", objectId); @@ -559,14 +555,8 @@ public interface ClientProtocol { } else { this.payload = Bytes.EMPTY_BYTES; } - if (bridgeArrivalTimeMsDeprecated != null) { - hazzerBits |= 0x2; - this.bridgeArrivalTimeMsDeprecated = bridgeArrivalTimeMsDeprecated; - } else { - this.bridgeArrivalTimeMsDeprecated = 0; - } if (isTrickleRestart != null) { - hazzerBits |= 0x4; + hazzerBits |= 0x2; this.isTrickleRestart = isTrickleRestart; } else { this.isTrickleRestart = true; @@ -585,20 +575,14 @@ public interface ClientProtocol { public Bytes getPayload() { return payload; } public boolean hasPayload() { return (0x1 & __hazzerBits) != 0; } - public long getBridgeArrivalTimeMsDeprecated() { return bridgeArrivalTimeMsDeprecated; } - public boolean hasBridgeArrivalTimeMsDeprecated() { return (0x2 & __hazzerBits) != 0; } - public boolean getIsTrickleRestart() { return isTrickleRestart; } - public boolean hasIsTrickleRestart() { return (0x4 & __hazzerBits) != 0; } + public boolean hasIsTrickleRestart() { return (0x2 & __hazzerBits) != 0; } public Builder toBuilder() { Builder builder = new Builder(objectId, isKnownVersion, version); if (hasPayload()) { builder.payload = payload; } - if (hasBridgeArrivalTimeMsDeprecated()) { - builder.bridgeArrivalTimeMsDeprecated = bridgeArrivalTimeMsDeprecated; - } if (hasIsTrickleRestart()) { builder.isTrickleRestart = isTrickleRestart; } @@ -614,7 +598,6 @@ public interface ClientProtocol { && isKnownVersion == other.isKnownVersion && version == other.version && (!hasPayload() || equals(payload, other.payload)) - && (!hasBridgeArrivalTimeMsDeprecated() || bridgeArrivalTimeMsDeprecated == other.bridgeArrivalTimeMsDeprecated) && (!hasIsTrickleRestart() || isTrickleRestart == other.isTrickleRestart); } @@ -626,9 +609,6 @@ public interface ClientProtocol { if (hasPayload()) { result = result * 31 + payload.hashCode(); } - if (hasBridgeArrivalTimeMsDeprecated()) { - result = result * 31 + hash(bridgeArrivalTimeMsDeprecated); - } if (hasIsTrickleRestart()) { result = result * 31 + hash(isTrickleRestart); } @@ -643,9 +623,6 @@ public interface ClientProtocol { if (hasPayload()) { builder.append(" payload=").append(payload); } - if (hasBridgeArrivalTimeMsDeprecated()) { - builder.append(" bridge_arrival_time_ms_deprecated=").append(bridgeArrivalTimeMsDeprecated); - } if (hasIsTrickleRestart()) { builder.append(" is_trickle_restart=").append(isTrickleRestart); } @@ -668,7 +645,6 @@ public interface ClientProtocol { message.isKnownVersion, message.version, Bytes.fromByteArray(message.payload), - message.bridgeArrivalTimeMsDeprecated, message.isTrickleRestart); } @@ -682,7 +658,6 @@ public interface ClientProtocol { msg.isKnownVersion = isKnownVersion; msg.version = version; msg.payload = hasPayload() ? payload.getByteArray() : null; - msg.bridgeArrivalTimeMsDeprecated = hasBridgeArrivalTimeMsDeprecated() ? bridgeArrivalTimeMsDeprecated : null; msg.isTrickleRestart = hasIsTrickleRestart() ? isTrickleRestart : null; return msg; } diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/CommonProtos.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/CommonProtos.java index 456aa6e..1a7e47fd 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/CommonProtos.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/proto/CommonProtos.java @@ -85,14 +85,13 @@ public class CommonProtos { public static InvalidationP newInvalidationP(ObjectIdP objectId, long version, boolean isTrickleRestart, byte[] payload) { return InvalidationP.create(objectId, /* isKnownVersion */ true, - version, Bytes.fromByteArray(payload), /* bridgeArrivalTimeMsDeprecated */ null, - isTrickleRestart); + version, Bytes.fromByteArray(payload), isTrickleRestart); } public static InvalidationP newInvalidationPForUnknownVersion(ObjectIdP oid, long sequenceNumber) { return InvalidationP.create(oid, /* isKnownVersion */ false, sequenceNumber, /* payload */ null, - /* bridgeArrivalTimeMsDeprecated */ null, /* isTrickleRestart */ true); + /* isTrickleRestart */ true); } public static RegistrationP newRegistrationP(ObjectIdP oid, boolean isReg) { diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/Smearer.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/Smearer.java index f95f365..3fcfa25 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/Smearer.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/Smearer.java @@ -30,12 +30,11 @@ public class Smearer { private final Random random; - /** The percentage (0, 1.0] for smearing the delay. */ + /** The percentage [0, 1.0] for smearing the delay. */ private double smearFraction; /** - * Creates a smearer with the given random number generator. If {@code smearPercent} is 0, uses an - * internal default for smearing. + * Creates a smearer with the given random number generator. * <p> * REQUIRES: 0 < smearPercent <= 100 */ diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/TextBuilder.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/TextBuilder.java index 6d55d52..6b204cd 100644 --- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/TextBuilder.java +++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/util/TextBuilder.java @@ -107,8 +107,12 @@ public class TextBuilder { * Appends the toString representation of {@code object} to this builder. */ public TextBuilder append(Object object) { - builder.append(object); - return this; + if (object instanceof InternalBase) { + return append((InternalBase) object); + } else { + builder.append(object); + return this; + } } /** diff --git a/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/AndroidManifest.xml b/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/AndroidManifest.xml index 9a2a4db..4c0dce8 100644 --- a/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/AndroidManifest.xml +++ b/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/AndroidManifest.xml @@ -7,7 +7,6 @@ Merger manifest: java/com/google/ipc/invalidation/examples/android2/AndroidManifest.xml Mergee manifests: - blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/> <!-- Declare and use permission allowing this application to receive GCM @@ -37,13 +36,10 @@ <action android:name="com.google.ipc.invalidation.AUTH_TOKEN_REQUEST"/> </intent-filter> </service> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Receiver for scheduler alarms. --> <receiver android:exported="false" android:name="com.google.ipc.invalidation.external.client.contrib.AndroidListener$AlarmReceiver"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Receiver for scheduler alarms. --> <receiver android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.AndroidInternalScheduler$AlarmReceiver"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM Broadcast Receiver --> <receiver android:exported="true" android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener$GCMReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> @@ -52,41 +48,31 @@ <category android:name="com.google.ipc.invalidation.ticl.android2"/> </intent-filter> </receiver> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Merged from file: java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml --> <receiver android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService$Receiver"> <intent-filter> <action android:name="com.google.ipc.invalidation.gcmmplex.EVENT"/> </intent-filter> </receiver> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Ticl service. --> <service android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.TiclService"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Ticl sender. --> <service android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageSenderService"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM multiplexer --> <service android:exported="false" android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener"> <meta-data android:name="sender_ids" android:value="ipc.invalidation@gmail.com"/> </service> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Invalidation service multiplexed GCM receiver --> <service android:enabled="true" android:exported="false" android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService"/> </application> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- App receives GCM messages. --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM connects to Google Services. --> <uses-permission android:name="android.permission.INTERNET"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- GCM requires a Google account. --> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Merged from file: java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml --> <uses-permission android:name="android.permission.USE_CREDENTIALS"/> - <!-- Merged from file: blaze-out/gcc-4.X.Y-crosstool-v17-hybrid-grtev3-k8-opt/bin/java/com/google/ipc/invalidation/external/client/contrib/android_listener_manifest/AndroidManifest.xml --> <!-- Keeps the processor from sleeping when a message is received. --> <uses-permission android:name="android.permission.WAKE_LOCK"/> </manifest> diff --git a/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/example_listener.proto b/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/example_listener.proto index bb6d91e..ace973e 100644 --- a/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/example_listener.proto +++ b/third_party/cacheinvalidation/src/javaexample/com/google/ipc/invalidation/examples/android2/example_listener.proto @@ -1,5 +1,6 @@ syntax = "proto2"; package ipc.invalidation.examples.android2; +option javanano_use_deprecated_package = true; option java_package = "com.google.ipc.invalidation.examples.android2"; option java_outer_classname = "ExampleListenerProto"; diff --git a/third_party/cacheinvalidation/src/proto/channel_common.proto b/third_party/cacheinvalidation/src/proto/channel_common.proto index c68ac74..b1feb8a 100644 --- a/third_party/cacheinvalidation/src/proto/channel_common.proto +++ b/third_party/cacheinvalidation/src/proto/channel_common.proto @@ -31,7 +31,7 @@ option java_package = "com.google.protos.ipc.invalidation"; message ChannelMessageEncoding { - // What kind of encoding is used for network_message + // What kind of encoding is used for network_message enum MessageEncoding { // Raw proto encoding PROTOBUF_BINARY_FORMAT = 1; @@ -40,6 +40,7 @@ message ChannelMessageEncoding { } message NetworkEndpointId { + // Identifies which sender/receiver the gateway uses. enum NetworkAddress { TEST = 1; // A delivery service for testing diff --git a/third_party/cacheinvalidation/src/proto/client_protocol.proto b/third_party/cacheinvalidation/src/proto/client_protocol.proto index dabbc05..bc531de 100644 --- a/third_party/cacheinvalidation/src/proto/client_protocol.proto +++ b/third_party/cacheinvalidation/src/proto/client_protocol.proto @@ -211,11 +211,6 @@ message InvalidationP { // Optional payload associated with this invalidation. optional bytes payload = 4; - - // DEPRECATED: bridge arrival time is now maintained by - // InvalidationMetadataP in the SourcedInvalidation, InvalidationContents and - // ClientInvalidation containers. - optional int64 bridge_arrival_time_ms_deprecated = 5 [deprecated=true]; } // Specifies the intention to change a registration on a specific object. To |