当前位置: 首页>>代码示例>>Java>>正文


Java AndroidTiclState类代码示例

本文整理汇总了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;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:26,代码来源:TiclStateManager.java

示例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);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:AndroidServiceAccessor.java

示例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);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:AndroidServiceAccessor.java

示例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();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:AndroidInvalidationClientImpl.java

示例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;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:TiclStateManager.java


注:本文中的com.google.protos.ipc.invalidation.AndroidService.AndroidTiclState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。