當前位置: 首頁>>代碼示例>>Java>>正文


Java Parcel.recycle方法代碼示例

本文整理匯總了Java中android.os.Parcel.recycle方法的典型用法代碼示例。如果您正苦於以下問題:Java Parcel.recycle方法的具體用法?Java Parcel.recycle怎麽用?Java Parcel.recycle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.os.Parcel的用法示例。


在下文中一共展示了Parcel.recycle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onNavigationEvent

import android.os.Parcel; //導入方法依賴的package包/類
public void onNavigationEvent(int navigationEvent, Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();

    try {
        _data.writeInterfaceToken("android.support.customtabs.ICustomTabsCallback");
        _data.writeInt(navigationEvent);
        if (extras != null) {
            _data.writeInt(1);
            extras.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }

        this.mRemote.transact(2, _data, null, 1);
    } finally {
        _data.recycle();
    }

}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:20,代碼來源:ICustomTabsCallback.java

示例2: extraCallback

import android.os.Parcel; //導入方法依賴的package包/類
public void extraCallback(String callbackName, Bundle args) throws RemoteException {
    Parcel _data = Parcel.obtain();

    try {
        _data.writeInterfaceToken("android.support.customtabs.ICustomTabsCallback");
        _data.writeString(callbackName);
        if (args != null) {
            _data.writeInt(1);
            args.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }

        this.mRemote.transact(3, _data, null, 1);
    } finally {
        _data.recycle();
    }

}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:20,代碼來源:ICustomTabsCallback.java

示例3: a

import android.os.Parcel; //導入方法依賴的package包/類
public boolean a(boolean z) throws RemoteException {
    boolean z2 = true;
    Parcel obtain = Parcel.obtain();
    Parcel obtain2 = Parcel.obtain();
    try {
        obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
        obtain.writeInt(z ? 1 : 0);
        this.a.transact(2, obtain, obtain2, 0);
        obtain2.readException();
        if (obtain2.readInt() == 0) {
            z2 = false;
        }
        obtain2.recycle();
        obtain.recycle();
        return z2;
    } catch (Throwable th) {
        obtain2.recycle();
        obtain.recycle();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:21,代碼來源:br.java

示例4: findService

import android.os.Parcel; //導入方法依賴的package包/類
private IBinder findService(String name){
	Parcel data = Parcel.obtain();
	data.writeString(name);
	Parcel reply = Parcel.obtain();
	try {
		mRemoteServiceManager.transact(ServiceContext.GET_SERVICE, data, reply, 0);
		IBinder service = reply.readStrongBinder();
		log("getService result binder = " + service);
		return service;
	} catch (RemoteException e) {
		e.printStackTrace();
		log("getService exception");
		return null;
	} finally {
		data.recycle();
		reply.recycle();
	}
}
 
開發者ID:devyok,項目名稱:DroidIPC,代碼行數:19,代碼來源:ServiceManagerImpl.java

示例5: parcelClone

import android.os.Parcel; //導入方法依賴的package包/類
public MasterSecret parcelClone() {
  Parcel thisParcel = Parcel.obtain();
  Parcel thatParcel = Parcel.obtain();
  byte[] bytes      = null;

  thisParcel.writeValue(this);
  bytes = thisParcel.marshall();

  thatParcel.unmarshall(bytes, 0, bytes.length);
  thatParcel.setDataPosition(0);

  MasterSecret that = (MasterSecret)thatParcel.readValue(MasterSecret.class.getClassLoader());

  thisParcel.recycle();
  thatParcel.recycle();

  return that;
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:19,代碼來源:MasterSecret.java

示例6: onEvent

import android.os.Parcel; //導入方法依賴的package包/類
public void onEvent(String event, Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeString(event);
        if (extras != null) {
            _data.writeInt(1);
            extras.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }
        this.mRemote.transact(1, _data, null, 1);
    } finally {
        _data.recycle();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:IMediaControllerCallback.java

示例7: shouldReadKeysAsStrings

import android.os.Parcel; //導入方法依賴的package包/類
/**
 * Checks whether {@link Parcel#readString()} or {@link Parcel#readValue(ClassLoader)} should be used to access
 * Bundle keys from a serialized Parcel. Commit https://android.googlesource.com/platform/frameworks/base/+
 * /9c3e74fI57bda9eb79ceaaa9c1b94ad49d9e462b52102149 (which only officially landed in Lollipop) changed from using
 * writeValue to writeString for Bundle keys. Some OEMs have pulled this change into their KitKat fork, so we can't
 * trust the SDK version check. Instead, we'll write a dummy Bundle to a Parcel and figure it out using that.
 *
 * The check is cached because the result doesn't change during runtime.
 */
private static synchronized boolean shouldReadKeysAsStrings() {
    // readString() should always be used on L+, but if the check is short-circuited there'd be no evidence that
    // this code is functioning correctly on KitKat devices that have the corresponding writeString() change.
    if (shouldReadKeysAsStrings == null) {
        Bundle testBundle = new Bundle();
        testBundle.putString("key", "value");
        Parcel testParcel = toParcel(testBundle);
        try {
            int entries = checkNonEmptyBundleHeader(testParcel);
            shouldReadKeysAsStrings = entries == 1 && "key".equals(testParcel.readString());
        } catch (RuntimeException e) {
            shouldReadKeysAsStrings = false;
        } finally {
            testParcel.recycle();
        }
    }

    return shouldReadKeysAsStrings;
}
 
開發者ID:Doist,項目名稱:JobSchedulerCompat,代碼行數:29,代碼來源:GcmIntentParser.java

示例8: playMedia

import android.os.Parcel; //導入方法依賴的package包/類
public int playMedia(String deviceId, Uri uri, int start) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    int _result = 1;
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeString(deviceId);
        if (uri != null) {
            _data.writeInt(1);
            uri.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }
        _data.writeInt(start);
        this.mRemote.transact(13, _data, _reply, 0);
        ExceptionUtils.readExceptionFromParcel(_reply);
        _result = _reply.readInt();
        return _result;
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:24,代碼來源:RemoteDeviceManager.java

示例9: warmup

import android.os.Parcel; //導入方法依賴的package包/類
public boolean warmup(long flags) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

    boolean _result;
    try {
        _data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
        _data.writeLong(flags);
        this.mRemote.transact(2, _data, _reply, 0);
        _reply.readException();
        _result = 0 != _reply.readInt();
    } finally {
        _reply.recycle();
        _data.recycle();
    }

    return _result;
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:19,代碼來源:ICustomTabsService.java

示例10: isTransportControlEnabled

import android.os.Parcel; //導入方法依賴的package包/類
public boolean isTransportControlEnabled() throws RemoteException {
    boolean _result = false;
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(5, _data, _reply, 0);
        _reply.readException();
        if (_reply.readInt() != 0) {
            _result = true;
        }
        _reply.recycle();
        _data.recycle();
        return _result;
    } catch (Throwable th) {
        _reply.recycle();
        _data.recycle();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:20,代碼來源:IMediaSession.java

示例11: bytes2Parcelable

import android.os.Parcel; //導入方法依賴的package包/類
private static <T> T bytes2Parcelable(final byte[] bytes, final Parcelable.Creator<T> creator) {
    if (bytes == null) return null;
    Parcel parcel = Parcel.obtain();
    parcel.unmarshall(bytes, 0, bytes.length);
    parcel.setDataPosition(0);
    T result = creator.createFromParcel(parcel);
    parcel.recycle();
    return result;
}
 
開發者ID:Wilshion,項目名稱:HeadlineNews,代碼行數:10,代碼來源:CacheUtils.java

示例12: onEncryptStartedError

import android.os.Parcel; //導入方法依賴的package包/類
public void onEncryptStartedError(int errorCode) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInt(errorCode);
        this.mRemote.transact(2, data, reply, 0);
        reply.readException();
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:EncryptListenerProxy.java

示例13: cancelAll

import android.os.Parcel; //導入方法依賴的package包/類
public void cancelAll(String packageName) throws RemoteException {
    Parcel _data = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeString(packageName);
        this.mRemote.transact(3, _data, null, 1);
    } finally {
        _data.recycle();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:11,代碼來源:INotificationSideChannel.java

示例14: readPendingIntent

import android.os.Parcel; //導入方法依賴的package包/類
public static PendingIntent readPendingIntent(IBinder binder) {
    Parcel parcel = Parcel.obtain();
    parcel.writeStrongBinder(binder);
    parcel.setDataPosition(0);
    try {
        return PendingIntent.readPendingIntentOrNullFromParcel(parcel);
    } finally {
        parcel.recycle();
    }
}
 
開發者ID:codehz,項目名稱:container,代碼行數:11,代碼來源:PendingIntentData.java

示例15: writeToEntropyPool

import android.os.Parcel; //導入方法依賴的package包/類
@Override
protected void writeToEntropyPool(DataOutputStream out) throws IOException {
	super.writeToEntropyPool(out);
	out.writeInt(android.os.Process.myPid());
	out.writeInt(android.os.Process.myTid());
	out.writeInt(android.os.Process.myUid());
	if (Build.FINGERPRINT != null) out.writeUTF(Build.FINGERPRINT);
	if (Build.SERIAL != null) out.writeUTF(Build.SERIAL);
	ContentResolver contentResolver = appContext.getContentResolver();
	String id = Settings.Secure.getString(contentResolver, ANDROID_ID);
	if (id != null) out.writeUTF(id);
	Parcel parcel = Parcel.obtain();
	WifiManager wm =
			(WifiManager) appContext.getSystemService(WIFI_SERVICE);
	List<WifiConfiguration> configs = wm.getConfiguredNetworks();
	if (configs != null) {
		for (WifiConfiguration config : configs)
			parcel.writeParcelable(config, 0);
	}
	BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
	if (bt != null) {
		for (BluetoothDevice device : bt.getBondedDevices())
			parcel.writeParcelable(device, 0);
	}
	out.write(parcel.marshall());
	parcel.recycle();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:28,代碼來源:AndroidSecureRandomProvider.java


注:本文中的android.os.Parcel.recycle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。