本文整理汇总了Java中com.google.protos.ipc.invalidation.AndroidService.AndroidTiclState类的典型用法代码示例。如果您正苦于以下问题:Java AndroidTiclState类的具体用法?Java AndroidTiclState怎么用?Java AndroidTiclState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidTiclState类属于com.google.protos.ipc.invalidation.AndroidService包,在下文中一共展示了AndroidTiclState类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDigestedState
import com.google.protos.ipc.invalidation.AndroidService.AndroidTiclState; //导入依赖的package包/类
/**
* Returns a {@link AndroidTiclStateWithDigest} containing {@code ticlState} and its computed
* digest.
*/
private static AndroidTiclStateWithDigest createDigestedState(
AndroidInvalidationClientImpl ticl) {
Sha1DigestFunction digester = new Sha1DigestFunction();
ApplicationClientIdP ticlAppId = ticl.getApplicationClientIdP();
Metadata metaData = Metadata.newBuilder()
.setClientConfig(ticl.getConfig())
.setClientName(ticlAppId.getClientName())
.setClientType(ticlAppId.getClientType())
.setTiclId(ticl.getSchedulingId())
.build();
AndroidTiclState state = AndroidTiclState.newBuilder()
.setMetadata(metaData)
.setTiclState(ticl.marshal())
.setVersion(ProtocolIntents.ANDROID_PROTOCOL_VERSION_VALUE).build();
digester.update(state.toByteArray());
AndroidTiclStateWithDigest verifiedState = AndroidTiclStateWithDigest.newBuilder()
.setState(state)
.setDigest(ByteString.copyFrom(digester.getDigest()))
.build();
return verifiedState;
}
示例2: hasField
import com.google.protos.ipc.invalidation.AndroidService.AndroidTiclState; //导入依赖的package包/类
/** Returns whether {@code field} is present in {@code message}. */
@Override
@SuppressWarnings("unchecked")
public boolean hasField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
AndroidTiclState message = (AndroidTiclState) rawMessage;
if (field == VERSION) {
return message.hasVersion();
}
if (field == TICL_STATE) {
return message.hasTiclState();
}
if (field == METADATA) {
return message.hasMetadata();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例3: getField
import com.google.protos.ipc.invalidation.AndroidService.AndroidTiclState; //导入依赖的package包/类
/** Returns the {@code field} from {@code message}. */
@Override
@SuppressWarnings("unchecked")
public Object getField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
AndroidTiclState message = (AndroidTiclState) rawMessage;
if (field == VERSION) {
return message.getVersion();
}
if (field == TICL_STATE) {
return message.getTiclState();
}
if (field == METADATA) {
return message.getMetadata();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例4: AndroidInvalidationClientImpl
import com.google.protos.ipc.invalidation.AndroidService.AndroidTiclState; //导入依赖的package包/类
/**
* Creates an instance with state restored from {@code marshalledState}. Other parameters are as
* in {@link InvalidationClientCore}.
*/
AndroidInvalidationClientImpl(Context context, SystemResources resources, Random random,
AndroidTiclState marshalledState) {
super(resources,
random,
marshalledState.getMetadata().getClientType(),
marshalledState.getMetadata().getClientName().toByteArray(),
marshalledState.getMetadata().getClientConfig(),
getApplicationName(context),
marshalledState.getTiclState(),
new IntentForwardingListener(context, resources.getLogger()));
this.schedulingId = marshalledState.getMetadata().getTiclId();
initializeSchedulerWithRecurringTasks();
}
示例5: restoreTicl
import com.google.protos.ipc.invalidation.AndroidService.AndroidTiclState; //导入依赖的package包/类
/**
* Restores the Ticl from persistent storage if it exists. Otherwise, returns {@code null}.
* @param context Android system context
* @param resources resources to use for the Ticl
*/
static AndroidInvalidationClientImpl restoreTicl(Context context,
SystemResources resources) {
AndroidTiclState state = readTiclState(context, resources.getLogger());
if (state == null) {
return null;
}
AndroidInvalidationClientImpl ticl = new AndroidInvalidationClientImpl(context, resources,
random, state);
setSchedulerId(resources, ticl);
return ticl;
}