This source file includes following definitions.
- doInitializeAndInstallGenerator
- generateInvalidatorClientName
package org.chromium.chrome.browser.invalidation;
import android.content.Context;
import org.chromium.chrome.browser.identity.UniqueIdentificationGenerator;
import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator;
import org.chromium.sync.notifier.InvalidationClientNameGenerator;
import org.chromium.sync.notifier.InvalidationClientNameProvider;
public class UniqueIdInvalidationClientNameGenerator implements InvalidationClientNameGenerator {
private static final String INVALIDATIONS_UUID_PREF_KEY = "chromium.invalidations.uuid";
public static void doInitializeAndInstallGenerator(Context context) {
UniqueIdentificationGenerator idGenerator =
new UuidBasedUniqueIdentificationGenerator(
context, INVALIDATIONS_UUID_PREF_KEY);
InvalidationClientNameGenerator clientNameGenerator =
new UniqueIdInvalidationClientNameGenerator(idGenerator);
InvalidationClientNameProvider.get().setPreferredClientNameGenerator(clientNameGenerator);
}
private final UniqueIdentificationGenerator mGenerator;
UniqueIdInvalidationClientNameGenerator(UniqueIdentificationGenerator generator) {
mGenerator = generator;
}
@Override
public byte[] generateInvalidatorClientName() {
return mGenerator.getUniqueId(null).getBytes();
}
}