本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}