Java 类com.google.protobuf.nano.MessageNano 实例源码

项目:science-journal    文件:ConnectableSensor.java   
@Override
public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    ConnectableSensor that = (ConnectableSensor) o;

    if (!MessageNano.messageNanoEquals(mSpec, that.mSpec)) return false;

    if (mConnectedSensorId != null ? !mConnectedSensorId.equals(that.mConnectedSensorId)
            : that.mConnectedSensorId != null) {
        return false;
    }

    return true;
}
项目:science-journal    文件:UserMetadataManager.java   
/**
 * Adds a device to the user's list of devices if it is not yet added.
 */
public void addMyDevice(GoosciDeviceSpec.DeviceSpec device) {
    GoosciUserMetadata.UserMetadata userMetadata = getUserMetadata();

    if (userMetadata == null) {
        return;
    }

    GoosciDeviceSpec.DeviceSpec[] myDevices = userMetadata.myDevices;
    for (GoosciDeviceSpec.DeviceSpec myDevice : myDevices) {
        if (MessageNano.messageNanoEquals(myDevice, device)) {
            return;
        }
    }

    GoosciDeviceSpec.DeviceSpec[] newSpecs = Arrays.copyOf(myDevices, myDevices.length + 1);
    newSpecs[newSpecs.length - 1] = device;
    userMetadata.myDevices = newSpecs;

    // TODO: capture this pattern (read, null check, write) in a helper method?
    startWriteTimer();
}
项目:science-journal    文件:LabelTest.java   
@Test
public void testParcelableBehavior() {
    GoosciLabel.Label goosciLabel = new GoosciLabel.Label();
    goosciLabel.timestampMs = 10;
    goosciLabel.type = GoosciLabel.Label.SENSOR_TRIGGER;
    SensorTrigger trigger = SensorTrigger.newNoteTypeTrigger("sensorId",
            GoosciSensorTriggerInformation.TriggerInformation.TRIGGER_WHEN_DROPS_BELOW, "note",
            7.5);
    GoosciSensorTriggerLabelValue.SensorTriggerLabelValue labelValue =
            new GoosciSensorTriggerLabelValue.SensorTriggerLabelValue();
    labelValue.triggerInformation = trigger.getTriggerProto().triggerInformation;
    goosciLabel.protoData = MessageNano.toByteArray(labelValue);
    Label label = Label.fromLabel(goosciLabel);

    label.setTimestamp(20);

    Parcel parcel = Parcel.obtain();
    label.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    Label result = Label.CREATOR.createFromParcel(parcel);

    assertEquals(GoosciLabel.Label.SENSOR_TRIGGER, result.getType());
    assertEquals(20, result.getTimeStamp());
    assertEquals("note", result.getSensorTriggerLabelValue().triggerInformation.noteText);
}
项目:science-journal    文件:ExperimentCacheTest.java   
public void testExperimentWriteRead() {
    Experiment experiment = Experiment.newExperiment(10, "exp_localId", 0);
    ExperimentCache cache = new ExperimentCache(getInstrumentation().getContext(),
            getFailureFailsListener(), 0);
    cache.createNewExperiment(experiment);
    cache.writeActiveExperimentFile();

    // Was it set correctly in the ExperimentCache?
    assertTrue(MessageNano.messageNanoEquals(
            cache.getActiveExperimentForTests().getExperimentProto(),
            experiment.getExperimentProto()));

    // Force a load, make sure that's equal too.
    cache.loadActiveExperimentFromFile(experiment.getExperimentOverview());
    assertTrue(MessageNano.messageNanoEquals(
            cache.getActiveExperimentForTests().getExperimentProto(),
            experiment.getExperimentProto()));

    // Clean up.
    cache.deleteExperiment("exp_localId");
    assertNull(cache.getActiveExperimentForTests());
}
项目:FMTech    文件:DfeRequest.java   
private void stripForCache(Response.ResponseWrapper paramResponseWrapper, Cache.Entry paramEntry)
{
  if ((paramResponseWrapper.preFetch.length <= 0) && (paramResponseWrapper.commands == null) && (paramResponseWrapper.notification.length <= 0) && (paramResponseWrapper.serverCookies == null)) {
    return;
  }
  Cache localCache = this.mApiContext.mCache;
  long l = System.currentTimeMillis();
  for (PreFetch localPreFetch : paramResponseWrapper.preFetch)
  {
    Cache.Entry localEntry = new Cache.Entry();
    localEntry.data = localPreFetch.response;
    localEntry.etag = localPreFetch.etag;
    localEntry.serverDate = paramEntry.serverDate;
    localEntry.ttl = (l + localPreFetch.ttl);
    localEntry.softTtl = (l + localPreFetch.softTtl);
    localCache.put(makeCacheKey(Uri.withAppendedPath(DfeApi.BASE_URI, localPreFetch.url).toString()), localEntry);
  }
  paramResponseWrapper.preFetch = PreFetch.emptyArray();
  paramResponseWrapper.commands = null;
  paramResponseWrapper.notification = Notification.emptyArray();
  paramResponseWrapper.serverCookies = null;
  paramEntry.data = MessageNano.toByteArray(paramResponseWrapper);
}
项目:FMTech    文件:ContentFiltersActivity2.java   
private boolean launchChoiceConfirmationDialog(ContentFilters.FilterRange paramFilterRange, int paramInt1, int paramInt2)
{
  if (((paramFilterRange.confirmationDialogTitle.isEmpty()) && (paramFilterRange.confirmationDialogContent.isEmpty())) || (this.mConfirmationDialogsShown.contains(Integer.valueOf(paramInt2)))) {
    return false;
  }
  SimpleAlertDialog.Builder localBuilder = new SimpleAlertDialog.Builder();
  if (!TextUtils.isEmpty(paramFilterRange.confirmationDialogTitle)) {
    localBuilder.setTitle(paramFilterRange.confirmationDialogTitle);
  }
  if (!TextUtils.isEmpty(paramFilterRange.confirmationDialogContent)) {
    localBuilder.setMessage(paramFilterRange.confirmationDialogContent);
  }
  localBuilder.setEventLog(322, null, -1, -1, null);
  localBuilder.setPositiveId(2131362418).setCanceledOnTouchOutside(true);
  Bundle localBundle = new Bundle();
  localBundle.putInt("ContentFiltersActivity2.selectedChoiceIndex", paramInt1);
  localBundle.putByteArray("ContentFiltersActivity2.filterRange", MessageNano.toByteArray(paramFilterRange));
  localBundle.putInt("ContentFiltersActivity2.filterRangeIndex", paramInt2);
  localBuilder.setCallback(null, 1, localBundle);
  localBuilder.build().show(getSupportFragmentManager(), "ContentFiltersActivity2.confirmationDialog");
  return true;
}
项目:FMTech    文件:FinskyEventLog.java   
private static void writeLogToListener(String paramString, byte[] paramArrayOfByte)
{
  try
  {
    if (sLogTestListener != null)
    {
      ClientAnalytics.LogEvent localLogEvent = new ClientAnalytics.LogEvent();
      localLogEvent.eventTimeMs = System.currentTimeMillis();
      localLogEvent.tag = paramString;
      if (paramArrayOfByte != null) {
        localLogEvent.sourceExtension = paramArrayOfByte;
      }
      MessageNano.toByteArray(localLogEvent);
    }
    return;
  }
  finally {}
}
项目:FMTech    文件:DfeRequest.java   
private void stripForCache(PlayResponse.PlayResponseWrapper paramPlayResponseWrapper, Cache.Entry paramEntry)
{
  if ((paramPlayResponseWrapper.preFetch.length <= 0) && (paramPlayResponseWrapper.commands == null)) {
    return;
  }
  Cache localCache = this.mApiContext.mCache;
  long l = System.currentTimeMillis();
  for (PreFetch localPreFetch : paramPlayResponseWrapper.preFetch)
  {
    Cache.Entry localEntry = new Cache.Entry();
    localEntry.data = localPreFetch.response;
    localEntry.etag = localPreFetch.etag;
    localEntry.serverDate = paramEntry.serverDate;
    localEntry.ttl = (l + localPreFetch.ttl);
    localEntry.softTtl = (l + localPreFetch.softTtl);
    localCache.put(makeCacheKey(Uri.withAppendedPath(PlayDfeApi.BASE_URI, localPreFetch.url).toString()), localEntry);
  }
  paramPlayResponseWrapper.preFetch = PreFetch.emptyArray();
  paramPlayResponseWrapper.commands = null;
  paramEntry.data = MessageNano.toByteArray(paramPlayResponseWrapper);
}
项目:FMTech    文件:SecureRequest.java   
protected final Response<Pair<RequestT, ResponseT>> parseNetworkResponse(NetworkResponse paramNetworkResponse)
{
  try
  {
    Class localClass = this.mResponseClass;
    MessageNano localMessageNano1 = (MessageNano)this.mResponseClass.newInstance();
    byte[] arrayOfByte = paramNetworkResponse.data;
    MessageNano localMessageNano2 = (MessageNano)localClass.cast(MessageNano.mergeFrom$1ec43da(localMessageNano1, arrayOfByte, arrayOfByte.length));
    ProtoUtils.logResponse(localMessageNano2, getUrl());
    Cache.Entry localEntry = HttpHeaderParser.parseCacheHeaders(paramNetworkResponse);
    return Response.success(Pair.create(this, localMessageNano2), localEntry);
  }
  catch (InstantiationException localInstantiationException)
  {
    throw new RuntimeException("Failed to instantiate proto object.", localInstantiationException);
  }
  catch (IllegalAccessException localIllegalAccessException)
  {
    throw new RuntimeException("Failed to access proto constructor.", localIllegalAccessException);
  }
  catch (IOException localIOException)
  {
    Log.e("SecureRequest", "Couldn't parse proto response for url=" + getUrl());
  }
  return Response.error(new ParseError(paramNetworkResponse));
}
项目:FMTech    文件:ProtoUtils.java   
public static <T extends MessageNano> T parseFrom(byte[] paramArrayOfByte, Class<T> paramClass)
{
  try
  {
    MessageNano localMessageNano = MessageNano.mergeFrom$1ec43da((MessageNano)paramClass.newInstance(), paramArrayOfByte, paramArrayOfByte.length);
    return localMessageNano;
  }
  catch (InstantiationException localInstantiationException)
  {
    throw new RuntimeException("Failed to parse a known parcelable proto " + paramClass.getName());
  }
  catch (IllegalAccessException localIllegalAccessException)
  {
    throw new RuntimeException("Failed to parse a known parcelable proto " + paramClass.getName());
  }
  catch (IOException localIOException)
  {
    throw new RuntimeException("Failed to parse a known parcelable proto " + paramClass.getName());
  }
}
项目:FMTech    文件:ParcelableProto.java   
private static ParcelableProto<MessageNano> createFromParcel(Parcel paramAnonymousParcel)
{
  int i = paramAnonymousParcel.readInt();
  if (i == -1) {
    return new ParcelableProto(null, (byte)0);
  }
  byte[] arrayOfByte = new byte[i];
  paramAnonymousParcel.readByteArray(arrayOfByte);
  String str = paramAnonymousParcel.readString();
  try
  {
    MessageNano localMessageNano = (MessageNano)Class.forName(str).getConstructor(null).newInstance(null);
    localMessageNano.mergeFrom(CodedInputByteBufferNano.newInstance(arrayOfByte, 0, i));
    ParcelableProto localParcelableProto = new ParcelableProto(localMessageNano, (byte)0);
    return localParcelableProto;
  }
  catch (Exception localException)
  {
    throw new IllegalArgumentException("Exception when unmarshalling: " + str, localException);
  }
}
项目:FMTech    文件:ParcelableProto.java   
public static <T extends MessageNano> ArrayList<ParcelableProto<T>> forProtoArray(T[] paramArrayOfT)
{
  Object localObject;
  if (paramArrayOfT == null) {
    localObject = null;
  }
  for (;;)
  {
    return localObject;
    localObject = new ArrayList(paramArrayOfT.length);
    int i = paramArrayOfT.length;
    for (int j = 0; j < i; j++) {
      ((ArrayList)localObject).add(forProto(paramArrayOfT[j]));
    }
  }
}
项目:FMTech    文件:ParcelableProto.java   
public static <T extends MessageNano> ArrayList<T> getProtoArrayListFromBundle(Bundle paramBundle, String paramString)
{
  ArrayList localArrayList = paramBundle.getParcelableArrayList(paramString);
  Object localObject;
  if (localArrayList == null) {
    localObject = null;
  }
  for (;;)
  {
    return localObject;
    int i = localArrayList.size();
    localObject = new ArrayList(i);
    for (int j = 0; j < i; j++) {
      ((ArrayList)localObject).add(((ParcelableProto)localArrayList.get(j)).mPayload);
    }
  }
}
项目:chromium-for-android-56-debug-video    文件:StorageDelegate.java   
/**
 * Update tab entries based on metadata.
 * @param metadataBytes Metadata from last time Chrome was alive.
 * @param entryMap Map to fill with {@link DocumentTabModel.Entry}s about Tabs.
 * @param recentlyClosedTabIdList List to fill with IDs of recently closed tabs.
 */
private void updateTabEntriesFromMetadata(byte[] metadataBytes, SparseArray<Entry> entryMap,
        List<Integer> recentlyClosedTabIdList) {
    if (metadataBytes != null) {
        DocumentList list = null;
        try {
            list = MessageNano.mergeFrom(new DocumentList(), metadataBytes);
        } catch (IOException e) {
            Log.e(TAG, "I/O exception", e);
        }
        if (list == null) return;

        for (int i = 0; i < list.entries.length; i++) {
            DocumentEntry savedEntry = list.entries[i];
            int tabId = savedEntry.tabId;

            // If the tab ID isn't in the list, it must have been closed after Chrome died.
            if (entryMap.indexOfKey(tabId) < 0) {
                recentlyClosedTabIdList.add(tabId);
                continue;
            }

            // Restore information about the Tab.
            entryMap.get(tabId).canGoBack = savedEntry.canGoBack;
        }
    }
}
项目:science-journal    文件:UserMetadataManager.java   
public void removeMyDevice(GoosciDeviceSpec.DeviceSpec device) {
    GoosciUserMetadata.UserMetadata userMetadata = getUserMetadata();

    if (userMetadata == null) {
        return;
    }

    GoosciDeviceSpec.DeviceSpec[] myDevices = userMetadata.myDevices;
    for (int i = 0; i < myDevices.length; i++) {
        if (MessageNano.messageNanoEquals(myDevices[i], device)) {
            removeMyDeviceAtIndex(userMetadata, i);
            return;
        }
    }
}
项目:science-journal    文件:Label.java   
/**
 * Creates a new label with the specified label value.
 */
public static Label newLabelWithValue(long creationTimeMs, int type, MessageNano data,
        GoosciCaption.Caption caption) {
    Label result = new Label(creationTimeMs, java.util.UUID.randomUUID().toString(), type);
    result.setLabelProtoData(data);
    result.setCaption(caption);
    return result;
}
项目:science-journal    文件:ExternalSensorSpec.java   
public static byte[] getBytes(MessageNano config) {
    byte[] output = new byte[config.getSerializedSize()];

    CodedOutputByteBufferNano buffer = CodedOutputByteBufferNano.newInstance(output);
    try {
        config.writeTo(buffer);
    } catch (IOException e) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "Could not serialize config", e);
        }
    }
    return output;
}
项目:science-journal    文件:SensorCardPresenter.java   
private GoosciSensorLayout.SensorLayout copyLayout(GoosciSensorLayout.SensorLayout layout) {
    try {
        return GoosciSensorLayout.SensorLayout.parseFrom(MessageNano.toByteArray(layout));
    } catch (InvalidProtocolBufferNanoException e) {
        throw new RuntimeException("Should be impossible", e);
    }
}
项目:science-journal    文件:ProtoUtils.java   
public static byte[] makeBlob(MessageNano proto) {
    int serializedSize = proto.getSerializedSize();
    byte[] output = new byte[serializedSize];

    CodedOutputByteBufferNano buffer = CodedOutputByteBufferNano.newInstance(output);
    try {
        proto.writeTo(buffer);
    } catch (IOException e) {
        Log.e(TAG, "Could not serialize config", e);
    }

    return output;
}
项目:SimplOS    文件:LauncherBackupHelper.java   
/**
 * Deserialize a proto after verifying checksum wrapper.
 */
private <T extends MessageNano> T unpackProto(T proto, byte[] buffer, int dataSize)
        throws InvalidProtocolBufferNanoException {
    MessageNano.mergeFrom(proto, readCheckedBytes(buffer, dataSize));
    if (DEBUG) Log.d(TAG, "unpacked proto " + proto);
    return proto;
}
项目:SimplOS    文件:LauncherBackupHelper.java   
private void writeRowToBackup(String backupKey, MessageNano proto,
        BackupDataOutput data) throws IOException {
    byte[] blob = writeCheckedBytes(proto);
    data.writeEntityHeader(backupKey, blob.length);
    data.writeEntityData(blob, blob.length);
    mBackupDataWasUpdated = true;
    if (VERBOSE) Log.v(TAG, "Writing New entry " + backupKey);
}
项目:SimplOS    文件:LauncherBackupHelper.java   
/** Wrap a proto in a CheckedMessage and compute the checksum. */
private byte[] writeCheckedBytes(MessageNano proto) {
    CheckedMessage wrapper = new CheckedMessage();
    wrapper.payload = MessageNano.toByteArray(proto);
    CRC32 checksum = new CRC32();
    checksum.update(wrapper.payload);
    wrapper.checksum = checksum.getValue();
    return MessageNano.toByteArray(wrapper);
}
项目:SimplOS    文件:LauncherBackupHelper.java   
/** Unwrap a proto message from a CheckedMessage, verifying the checksum. */
private static byte[] readCheckedBytes(byte[] buffer, int dataSize)
        throws InvalidProtocolBufferNanoException {
    CheckedMessage wrapper = new CheckedMessage();
    MessageNano.mergeFrom(wrapper, buffer, 0, dataSize);
    CRC32 checksum = new CRC32();
    checksum.update(wrapper.payload);
    if (wrapper.checksum != checksum.getValue()) {
        throw new InvalidProtocolBufferNanoException("checksum does not match");
    }
    return wrapper.payload;
}
项目:AndroidChromium    文件:StorageDelegate.java   
/**
 * Update tab entries based on metadata.
 * @param metadataBytes Metadata from last time Chrome was alive.
 * @param entryMap Map to fill with {@link DocumentTabModel.Entry}s about Tabs.
 * @param recentlyClosedTabIdList List to fill with IDs of recently closed tabs.
 */
private void updateTabEntriesFromMetadata(byte[] metadataBytes, SparseArray<Entry> entryMap,
        List<Integer> recentlyClosedTabIdList) {
    if (metadataBytes != null) {
        DocumentList list = null;
        try {
            list = MessageNano.mergeFrom(new DocumentList(), metadataBytes);
        } catch (IOException e) {
            Log.e(TAG, "I/O exception", e);
        }
        if (list == null) return;

        for (int i = 0; i < list.entries.length; i++) {
            DocumentEntry savedEntry = list.entries[i];
            int tabId = savedEntry.tabId;

            // If the tab ID isn't in the list, it must have been closed after Chrome died.
            if (entryMap.indexOfKey(tabId) < 0) {
                recentlyClosedTabIdList.add(tabId);
                continue;
            }

            // Restore information about the Tab.
            entryMap.get(tabId).canGoBack = savedEntry.canGoBack;
        }
    }
}
项目:Trebuchet    文件:LauncherBackupHelper.java   
/**
 * Deserialize a proto after verifying checksum wrapper.
 */
private <T extends MessageNano> T unpackProto(T proto, byte[] buffer, int dataSize)
        throws InvalidProtocolBufferNanoException {
    MessageNano.mergeFrom(proto, readCheckedBytes(buffer, dataSize));
    if (DEBUG) Log.d(TAG, "unpacked proto " + proto);
    return proto;
}
项目:Trebuchet    文件:LauncherBackupHelper.java   
private void writeRowToBackup(String backupKey, MessageNano proto,
        BackupDataOutput data) throws IOException {
    byte[] blob = writeCheckedBytes(proto);
    data.writeEntityHeader(backupKey, blob.length);
    data.writeEntityData(blob, blob.length);
    mBackupDataWasUpdated = true;
    if (VERBOSE) Log.v(TAG, "Writing New entry " + backupKey);
}
项目:Trebuchet    文件:LauncherBackupHelper.java   
/** Wrap a proto in a CheckedMessage and compute the checksum. */
private byte[] writeCheckedBytes(MessageNano proto) {
    CheckedMessage wrapper = new CheckedMessage();
    wrapper.payload = MessageNano.toByteArray(proto);
    CRC32 checksum = new CRC32();
    checksum.update(wrapper.payload);
    wrapper.checksum = checksum.getValue();
    return MessageNano.toByteArray(wrapper);
}
项目:Trebuchet    文件:LauncherBackupHelper.java   
/** Unwrap a proto message from a CheckedMessage, verifying the checksum. */
private static byte[] readCheckedBytes(byte[] buffer, int dataSize)
        throws InvalidProtocolBufferNanoException {
    CheckedMessage wrapper = new CheckedMessage();
    MessageNano.mergeFrom(wrapper, buffer, 0, dataSize);
    CRC32 checksum = new CRC32();
    checksum.update(wrapper.payload);
    if (wrapper.checksum != checksum.getValue()) {
        throw new InvalidProtocolBufferNanoException("checksum does not match");
    }
    return wrapper.payload;
}
项目:Vafrinn    文件:StorageDelegate.java   
/**
 * Update tab entries based on metadata.
 * @param metadataBytes Metadata from last time Chrome was alive.
 * @param entryMap Map to fill with {@link DocumentTabModel.Entry}s about Tabs.
 * @param recentlyClosedTabIdList List to fill with IDs of recently closed tabs.
 */
private void updateTabEntriesFromMetadata(byte[] metadataBytes, SparseArray<Entry> entryMap,
        List<Integer> recentlyClosedTabIdList) {
    if (metadataBytes != null) {
        DocumentList list = null;
        try {
            list = MessageNano.mergeFrom(new DocumentList(), metadataBytes);
        } catch (IOException e) {
            Log.e(TAG, "I/O exception", e);
        }
        if (list == null) return;

        for (int i = 0; i < list.entries.length; i++) {
            DocumentEntry savedEntry = list.entries[i];
            int tabId = savedEntry.tabId;

            // If the tab ID isn't in the list, it must have been closed after Chrome died.
            if (entryMap.indexOfKey(tabId) < 0) {
                recentlyClosedTabIdList.add(tabId);
                continue;
            }

            // Restore information about the Tab.
            entryMap.get(tabId).canGoBack = savedEntry.canGoBack;
        }
    }
}
项目:PainlessMusicPlayer    文件:ProtoUtils.java   
public static void writeToFile(@NonNull final Context context,
        @NonNull final String fileName,
        @NonNull final MessageNano messageNano) {
    final byte[] output;
    try {
        output = toByteArray(messageNano);
    } catch (IOException e) {
        Log.w(TAG, e);
        return;
    }
    FileUtils.writeOrDeletePrivateFile(context, fileName, output);
}
项目:PainlessMusicPlayer    文件:ProtoUtils.java   
@Nullable
public static <T extends MessageNano> T readFromFile(@NonNull final Context context,
        @NonNull final String fileName,
        @NonNull final T obj) {
    T message = null;
    try {
        final byte[] bytes = FileUtils.readPrivateFile(context, fileName);
        message = MessageNano.mergeFrom(obj, bytes);
    } catch (IOException e) {
        Log.w(TAG, e);
    }

    return message;
}
项目:PainlessMusicPlayer    文件:ProtoUtils.java   
@NonNull
public static <T extends MessageNano> T readFromFileNonNull(@NonNull final Context context,
        @NonNull final String fileName,
        @NonNull final T obj) {
    final T message = readFromFile(context, fileName, obj);
    return message != null ? message : obj;
}
项目:PainlessMusicPlayer    文件:ProtoUtilsTest.java   
@Test
public void testToByteArray() throws Exception {
    final WearPlaybackData.PlaybackPosition message = new WearPlaybackData.PlaybackPosition();
    message.mediaId = 666L;
    message.position = 5;

    final byte[] data = ProtoUtils.toByteArray(message);
    assertNotNull(data);

    final WearPlaybackData.PlaybackPosition fromBytes = MessageNano.mergeFrom(
            new WearPlaybackData.PlaybackPosition(), data);

    assertEquals(message.mediaId, fromBytes.mediaId);
    assertEquals(message.position, fromBytes.position);
}
项目:PainlessMusicPlayer    文件:WearableMediaPlaybackReporter.java   
@NonNull
private static MessageNano toWearablePlaybackState(
        @PlaybackState.State final int state) {
    final WearPlaybackData.PlaybackState m = new WearPlaybackData.PlaybackState();
    m.state = state;
    return m;
}
项目:PainlessMusicPlayer    文件:WearableMediaPlaybackReporter.java   
@NonNull
private static MessageNano toWearablePlaybackPosition(final long mediaId,
        final long position) {
    final WearPlaybackData.PlaybackPosition m = new WearPlaybackData.PlaybackPosition();
    m.mediaId = mediaId;
    m.position = position;
    return m;
}
项目:FMTech    文件:VendingRequest.java   
public final Map<String, String> getParams()
  throws AuthFailureError
{
  HashMap localHashMap = new HashMap();
  MessageNano localMessageNano = this.mRequest;
  VendingProtos.RequestProto.Request localRequest = new VendingProtos.RequestProto.Request();
  NanoProtoHelper.setRequestInWrapper(localRequest, VendingProtos.RequestProto.Request.class, localMessageNano, this.mRequestClass);
  VendingProtos.RequestProto localRequestProto = new VendingProtos.RequestProto();
  localRequestProto.requestProperties = this.mApiContext.getRequestProperties(this.mUseSecureAuthToken);
  localRequestProto.request = new VendingProtos.RequestProto.Request[] { localRequest };
  localHashMap.put("request", Base64.encodeToString(MessageNano.toByteArray(localRequestProto), 11));
  localHashMap.put("version", "2");
  return localHashMap;
}
项目:FMTech    文件:PackageVerificationLoggingService.java   
public static void reportUserResponse(Context paramContext, CsdClient.VerifyAppsReport paramVerifyAppsReport)
{
  byte[] arrayOfByte = MessageNano.toByteArray(paramVerifyAppsReport);
  Intent localIntent = new Intent("log_user_response");
  localIntent.setClass(paramContext, PackageVerificationLoggingService.class);
  localIntent.putExtra("proto_bytes", arrayOfByte);
  paramContext.startService(localIntent);
}
项目:FMTech    文件:PackageVerificationRequest.java   
protected final Response<PackageVerificationResult> parseNetworkResponse(NetworkResponse paramNetworkResponse)
{
  try
  {
    byte[] arrayOfByte = paramNetworkResponse.data;
    CsdClient.ClientDownloadResponse localClientDownloadResponse = (CsdClient.ClientDownloadResponse)MessageNano.mergeFrom$1ec43da(new CsdClient.ClientDownloadResponse(), arrayOfByte, arrayOfByte.length);
    return Response.success(PackageVerificationResult.fromResponse(localClientDownloadResponse), null);
  }
  catch (InvalidProtocolBufferNanoException localInvalidProtocolBufferNanoException)
  {
    return Response.error(new VolleyError(localInvalidProtocolBufferNanoException));
  }
}
项目:FMTech    文件:ProtoDfeRequest.java   
public ProtoDfeRequest(String paramString, MessageNano paramMessageNano, DfeApiContext paramDfeApiContext, Class<T> paramClass, Response.Listener<T> paramListener, Response.ErrorListener paramErrorListener)
{
  super(paramString, paramDfeApiContext, paramClass, paramListener, paramErrorListener, (byte)0);
  this.mRequest = paramMessageNano;
  this.mShouldCache = false;
  this.mIncludeCheckinConsistencyToken = true;
  this.mAvoidBulkCancel = true;
}
项目:FMTech    文件:UserSettingsCache.java   
private static boolean decodeFromString(String paramString, MessageNano paramMessageNano)
{
  try
  {
    byte[] arrayOfByte = Base64.decode(paramString, 3);
    MessageNano.mergeFrom$1ec43da(paramMessageNano, arrayOfByte, arrayOfByte.length);
    return true;
  }
  catch (InvalidProtocolBufferNanoException localInvalidProtocolBufferNanoException)
  {
    FinskyLog.e(localInvalidProtocolBufferNanoException, "Error parsing string into proto", new Object[0]);
  }
  return false;
}