Esempio n. 1
0
 public void writeToParcel(Parcel paramParcel, int paramInt) {
   int i = 1;
   paramParcel.writeString(this.mClassName);
   paramParcel.writeInt(this.mIndex);
   if (this.mFromLayout) {
     paramInt = 1;
     paramParcel.writeInt(paramInt);
     paramParcel.writeInt(this.mFragmentId);
     paramParcel.writeInt(this.mContainerId);
     paramParcel.writeString(this.mTag);
     if (!this.mRetainInstance) break label106;
     paramInt = 1;
     label65:
     paramParcel.writeInt(paramInt);
     if (!this.mDetached) break label111;
   }
   label106:
   label111:
   for (paramInt = i; ; paramInt = 0) {
     paramParcel.writeInt(paramInt);
     paramParcel.writeBundle(this.mArguments);
     paramParcel.writeBundle(this.mSavedFragmentState);
     return;
     paramInt = 0;
     break;
     paramInt = 0;
     break label65;
   }
 }
Esempio n. 2
0
 public void writeToParcel(Parcel paramParcel, int paramInt)
 {
   int i = 1;
   paramParcel.writeString(this.mClassName);
   paramParcel.writeInt(this.mIndex);
   int j;
   label28: int k;
   if (this.mFromLayout)
   {
     j = i;
     paramParcel.writeInt(j);
     paramParcel.writeInt(this.mFragmentId);
     paramParcel.writeInt(this.mContainerId);
     paramParcel.writeString(this.mTag);
     if (!this.mRetainInstance)
       break label109;
     k = i;
     label68: paramParcel.writeInt(k);
     if (!this.mDetached)
       break label115;
   }
   while (true)
   {
     paramParcel.writeInt(i);
     paramParcel.writeBundle(this.mArguments);
     paramParcel.writeBundle(this.mSavedFragmentState);
     return;
     j = 0;
     break label28:
     label109: k = 0;
     break label68:
     label115: i = 0;
   }
 }
    @Override
    protected synchronized boolean onTransact(int code, Parcel data, Parcel reply, int flags) {
      DATABASE_NAME = getString(R.string.db_name);
      DATABASE_TABLE = getString(R.string.db_table);
      if (code == BDB_SERVICE_CODE) {
        Bundle bundle = data.readBundle();
        String command = bundle.getString("COMMAND");
        Log.i(TAG, "COMMAND=" + command);
        if (command.equals("ADD")) {
          String title = bundle.getString("TITLE");
          String isbn = bundle.getString("ISBN");
          String price = bundle.getString("PRICE");
          Log.i(TAG, "TITLE=" + command);
          Log.i(TAG, "ISBN=" + isbn);
          Log.i(TAG, "PRICE=" + price);
          bundle = new Bundle();
          if (doAdd(title, isbn, price)) bundle.putString("STATUS", "succeed");
          else bundle.putString("STATUS", "failed");
          reply.writeBundle(bundle);
        } else if (command.equals("SUM")) {
          String[][] dbdata = getData();
          // int sumprice = sumPrice();
          bundle = new Bundle();
          if (dbdata == null) {
            bundle.putString("STATUS", "failed");
            bundle.putStringArray("ID", null);
            bundle.putStringArray("TITLE", null);
            bundle.putStringArray("ISBN", null);
            bundle.putStringArray("PRICE", null);
            bundle.putString("TOTAL", "0");
          } else { // if(sumprice!=0){
            bundle.putString("STATUS", "succeed");
            bundle.putStringArray("ID", dbdata[0]);
            bundle.putStringArray("TITLE", dbdata[1]);
            bundle.putStringArray("ISBN", dbdata[2]);
            bundle.putStringArray("PRICE", dbdata[3]);
            // bundle.putString("TOTAL", Integer.toString(sumprice));
          } /*else if(sumprice==0){
            	bundle.putString("STATUS", "no data");
            	bundle.putStringArray("ID", dbdata[0]);
            	bundle.putStringArray("TITLE", dbdata[1]);
            	bundle.putStringArray("ISBN", dbdata[2]);
            	bundle.putStringArray("PRICE", dbdata[3]);
            	bundle.putString("TOTAL", Integer.toString(sumprice));
            }*/
          reply.writeBundle(bundle);
        }

        return true;
      } else {
        Log.e(
            getClass().getSimpleName(),
            "Transaction code should be " + BDB_SERVICE_CODE + ";" + " received instead " + code);
        return false;
      }
    }
 public final void bindApplication(
     String packageName,
     ApplicationInfo info,
     List<ProviderInfo> providers,
     ComponentName testName,
     String profileName,
     ParcelFileDescriptor profileFd,
     boolean autoStopProfiler,
     Bundle testArgs,
     IInstrumentationWatcher testWatcher,
     int debugMode,
     boolean restrictedBackupMode,
     boolean persistent,
     Configuration config,
     CompatibilityInfo compatInfo,
     Map<String, IBinder> services,
     Bundle coreSettings)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   data.writeString(packageName);
   info.writeToParcel(data, 0);
   data.writeTypedList(providers);
   if (testName == null) {
     data.writeInt(0);
   } else {
     data.writeInt(1);
     testName.writeToParcel(data, 0);
   }
   data.writeString(profileName);
   if (profileFd != null) {
     data.writeInt(1);
     profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
   } else {
     data.writeInt(0);
   }
   data.writeInt(autoStopProfiler ? 1 : 0);
   data.writeBundle(testArgs);
   data.writeStrongInterface(testWatcher);
   data.writeInt(debugMode);
   data.writeInt(restrictedBackupMode ? 1 : 0);
   data.writeInt(persistent ? 1 : 0);
   config.writeToParcel(data, 0);
   compatInfo.writeToParcel(data, 0);
   data.writeMap(services);
   data.writeBundle(coreSettings);
   mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }
  @Test
  public void testReadWriteBundle() {
    Bundle b1 = new Bundle();
    b1.putString("hello", "world");
    parcel.writeBundle(b1);
    Bundle b2 = parcel.readBundle();

    assertEquals(b1, b2);
    assertEquals("world", b2.getString("hello"));

    parcel.writeBundle(b1);
    b2 = parcel.readBundle(null /* ClassLoader */);
    assertEquals(b1, b2);
    assertEquals("world", b2.getString("hello"));
  }
 @Override
 public void writeToParcel(Parcel out, int flags) {
   out.writeStringArray(mKeys);
   out.writeInt(mFirstAmbientIndex);
   out.writeStringArray(mInterceptedKeys);
   out.writeBundle(mVisibilityOverrides);
 }
Esempio n. 7
0
 @SuppressWarnings("Recycle")
 protected void writeSyncState() throws ContactsStorageException {
   @Cleanup("recycle")
   Parcel parcel = Parcel.obtain();
   parcel.writeBundle(syncState);
   setSyncState(parcel.marshall());
 }
  @Override
  public void writeToParcel(Parcel dest, int flags) {
    final Bundle bundle = new Bundle();
    bundle.putDouble(PARCELABLE_LATITUDE, latitude);
    bundle.putDouble(PARCELABLE_LONGITUDE, longitude);

    dest.writeBundle(bundle);
  }
Esempio n. 9
0
 /* (non-Javadoc)
  * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
  */
 @Override
 public void writeToParcel(final Parcel parcel, final int arg1) {
   final Bundle b = new Bundle();
   b.putString(LOCAL_NAME_COMPLETE, mLocalNameComplete);
   b.putString(LOCAL_NAME_SHORT, mLocalNameShort);
   b.putSparseParcelableArray(RECORDS_ARRAY, mAdRecords);
   parcel.writeBundle(b);
 }
 @Override
 public void writeToParcel(Parcel out, int flags) {
   out.writeString(mResultKey);
   out.writeCharSequence(mLabel);
   out.writeCharSequenceArray(mChoices);
   out.writeInt(mFlags);
   out.writeBundle(mExtras);
 }
 @Override
 public void writeToParcel(Parcel out, int flags) {
   super.writeToParcel(out, flags);
   Bundle bundle = new Bundle();
   bundle.putString(SAVED_STATE_DECIMAL, decimalPart);
   bundle.putString(SAVED_STATE_FLOATING, floatingPart);
   out.writeBundle(bundle);
 }
Esempio n. 12
0
 public void writeToParcel(Parcel parcel, int i) {
   parcel.writeString(packageName);
   parcel.writeString(value);
   parcel.writeInt(flag);
   parcel.writeString(desc);
   parcel.writeInt(type);
   parcel.writeBundle(bundle);
 }
  @Override
  public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    Bundle bundle = new Bundle();
    bundle.putStringArrayList(BUNDLE_KEY_LINES, lines);
    // Add more stuff here

    dest.writeBundle(bundle);
  }
  @Override
  public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    Bundle bundle = new Bundle();
    bundle.putString(BUNDLE_KEY_REFUND_ID, refundId);
    // Add more stuff here

    dest.writeBundle(bundle);
  }
Esempio n. 15
0
 // 写数据保存数据
 @Override
 public void writeToParcel(Parcel dest, int flags) {
   Bundle bundle = new Bundle();
   bundle.putString(KEY_ALBUM_NAME, album_name);
   bundle.putString(KEY_ALBUM_ART, album_art);
   bundle.putInt(KEY_NUMBER_OF_SONGS, number_of_songs);
   bundle.putInt(KEY_ALBUM_ID, album_id);
   dest.writeBundle(bundle);
 }
Esempio n. 16
0
 @Override
 public void writeToParcel(Parcel dest, int flags) {
   dest.writeInt(recordingMode ? 1 : 0);
   dest.writeInt(multiple ? 1 : 0);
   Bundle bundle = new Bundle();
   for (Entry<String, String> entry : lastLines.entrySet()) {
     bundle.putString(entry.getKey(), entry.getValue());
   }
   dest.writeBundle(bundle);
 }
 @Override
 public void writeToParcel(Parcel out, int flags) {
   Bundle bundle = new Bundle();
   for (String key : distribution.keySet()) {
     bundle.putDouble(key, distribution.get(key));
   }
   out.writeBundle(bundle);
   out.writeString(best);
   out.writeDouble(minDistance);
 }
Esempio n. 18
0
 @Override
 public void writeToParcel(Parcel dest, int flags) {
   super.writeToParcel(dest, flags);
   dest.writeByte((byte) (sendNotification ? 1 : 0));
   dest.writeString(notificationText);
   dest.writeByte((byte) (sendContent ? 1 : 0));
   dest.writeString(content);
   dest.writeString(contentUrl);
   dest.writeBundle(metadata);
 }
Esempio n. 19
0
  @Override
  public void writeToParcel(Parcel dest, int flags) {

    Bundle data = new Bundle();
    data.putString("title", title);
    data.putString("link", link);
    data.putString("description", description);
    data.putString("language", language);
    data.putParcelableArrayList("rssItems", rssItems);
    dest.writeBundle(data);
  }
Esempio n. 20
0
 @Override
 public void writeToParcel(Parcel dest, int flags) {
   Bundle bundle = new Bundle();
   bundle.putString(KEY_ID, this.ID);
   bundle.putString(KEY_TITLE_NAME, this.titleName);
   bundle.putString(KEY_POSTER_IMAGE, this.posterImage);
   bundle.putString(KEY_SYNOPSIS, this.synopsis);
   bundle.putFloat(KEY_USER_RATING, this.userRating);
   bundle.putString(KEY_RELEASE_DATE, this.releaseDate);
   dest.writeBundle(bundle);
 }
Esempio n. 21
0
  @Override
  public void writeToParcel(Parcel dest, int flags) {
    Bundle bundle = new Bundle();

    bundle.putString(FULL_NAME, getFullName());
    bundle.putString(TAG_LINE, getTagLine());
    bundle.putString(USER_ID, getUserId());
    bundle.putByteArray(USER_PHOTO_FILE, getUserPhotoByteArray());

    dest.writeBundle(bundle);
  }
 @Override
 public void writeToParcel(Parcel dest, int flags) {
   dest.writeString(name);
   dest.writeTypedArray(users, flags);
   final Bundle bundle = new Bundle();
   if (values != null) {
     for (Entry<String, ParcelableBindingValue> entry : values.entrySet()) {
       bundle.putParcelable(entry.getKey(), entry.getValue());
     }
   }
   dest.writeBundle(bundle);
 }
Esempio n. 23
0
    @Override
    public void writeToParcel(Parcel out, int flags) {
      super.writeToParcel(out, flags);

      Bundle state = new Bundle();
      state.putString(MESSAGE_KEY, message);
      state.putBoolean(REFRESHING_KEY, refreshing);
      state.putBoolean(LOADING_KEY, loading);
      state.putSerializable(RESOURCES_KEY, resources);

      out.writeBundle(state);
    }
Esempio n. 24
0
  @Override
  public void writeToParcel(Parcel parcel, int arg1) {
    Bundle objectBundle = new Bundle();
    objectBundle.putString("name", mName);
    objectBundle.putString("user", mUser);
    objectBundle.putString("status", mStatus);
    objectBundle.putString("type", mType);
    objectBundle.putString("presence_status", mPresenceStatus);
    objectBundle.putString("presence_mode", mPresenceMode);

    parcel.writeBundle(objectBundle);
  }
 @Override
 public void writeToParcel(Parcel dest, int arg1) {
   dest.writeString(baseUrl);
   dest.writeString(userIdentifier);
   dest.writeString(password);
   dest.writeParcelable(rootNode, PARCELABLE_WRITE_RETURN_VALUE);
   dest.writeSerializable(repositoryInfo);
   dest.writeSerializable(cmisSession);
   Bundle b = new Bundle();
   b.putSerializable("userParameters", (Serializable) userParameters);
   dest.writeBundle(b);
 }
 @Override
 public void writeToParcel(Parcel dest, int flags) {
   dest.writeLong(id);
   dest.writeInt(titleRes);
   TextUtils.writeToParcel(title, dest, flags);
   dest.writeInt(summaryRes);
   TextUtils.writeToParcel(summary, dest, flags);
   dest.writeInt(breadCrumbTitleRes);
   TextUtils.writeToParcel(breadCrumbTitle, dest, flags);
   dest.writeInt(breadCrumbShortTitleRes);
   TextUtils.writeToParcel(breadCrumbShortTitle, dest, flags);
   dest.writeInt(iconRes);
   dest.writeString(fragment);
   dest.writeBundle(fragmentArguments);
   if (intent != null) {
     dest.writeInt(1);
     intent.writeToParcel(dest, flags);
   } else {
     dest.writeInt(0);
   }
   dest.writeBundle(extras);
 }
 public void scheduleRegisteredReceiver(
     IIntentReceiver receiver,
     Intent intent,
     int resultCode,
     String dataStr,
     Bundle extras,
     boolean ordered,
     boolean sticky)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   data.writeStrongBinder(receiver.asBinder());
   intent.writeToParcel(data, 0);
   data.writeInt(resultCode);
   data.writeString(dataStr);
   data.writeBundle(extras);
   data.writeInt(ordered ? 1 : 0);
   data.writeInt(sticky ? 1 : 0);
   mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }
 public final void scheduleReceiver(
     Intent intent,
     ActivityInfo info,
     CompatibilityInfo compatInfo,
     int resultCode,
     String resultData,
     Bundle map,
     boolean sync)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   intent.writeToParcel(data, 0);
   info.writeToParcel(data, 0);
   compatInfo.writeToParcel(data, 0);
   data.writeInt(resultCode);
   data.writeString(resultData);
   data.writeBundle(map);
   data.writeInt(sync ? 1 : 0);
   mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedAppState) {
    super.onCreate(savedAppState);

    applicationState =
        (null == savedAppState)
            ? new AppState(/* ... */ )
            : (AppState) savedAppState.getSerializable(APP_STATE);

    setContentView(R.layout.main);

    Bundle bundle = new Bundle();
    bundle.putFloat(APP_STATE, 3.14159F);

    Parcel p = Parcel.obtain();
    p.writeBundle(bundle);

    p.setDataPosition(0);
    bundle = p.readBundle();
    bundle.getInt(APP_STATE);
  }
 @Override
 public void writeToParcel(Parcel parcel, int flags) {
   parcel.writeParcelable(mId, flags);
   parcel.writeString(mLabel);
   parcel.writeParcelable(mPrinterId, flags);
   parcel.writeString(mPrinterName);
   parcel.writeInt(mState);
   parcel.writeInt(mAppId);
   parcel.writeString(mTag);
   parcel.writeLong(mCreationTime);
   parcel.writeInt(mCopies);
   parcel.writeParcelableArray(mPageRanges, flags);
   parcel.writeParcelable(mAttributes, flags);
   parcel.writeParcelable(mDocumentInfo, 0);
   parcel.writeFloat(mProgress);
   parcel.writeCharSequence(mStatus);
   parcel.writeInt(mStatusRes);
   parcel.writeCharSequence(mStatusResAppPackageName);
   parcel.writeInt(mCanceling ? 1 : 0);
   parcel.writeBundle(mAdvancedOptions);
 }