本文整理了Java中android.os.Parcel.writeInterfaceToken()
方法的一些代码示例,展示了Parcel.writeInterfaceToken()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.writeInterfaceToken()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:writeInterfaceToken
[英]Store or read an IBinder interface token in the parcel at the current #dataPosition. This is used to validate that the marshalled transaction is intended for the target interface.
[中]在当前#数据位置的包裹中存储或读取IBinder接口令牌。这用于验证封送的事务是否用于目标接口。
代码示例来源:origin: LawnchairLauncher/Lawnchair
public void overlayStatusChanged(int status) throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlayCallback.class.getName());
data.writeInt(status);
mRemote.transact(OVERLAY_STATUS_CHANGED_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void openOverlay(int options) throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
data.writeInt(options);
mRemote.transact(OPEN_OVERLAY_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void closeOverlay(int options) throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
data.writeInt(options);
mRemote.transact(CLOSE_OVERLAY_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void windowDetached(boolean isChangingConfigurations) throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
data.writeInt(isChangingConfigurations ? 1 : 0);
mRemote.transact(WINDOW_DETACHED_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
}
代码示例来源:origin: stackoverflow.com
public IBinder getService(String name) throws RemoteException {
116 Parcel data = Parcel.obtain();
117 Parcel reply = Parcel.obtain();
118 data.writeInterfaceToken(IServiceManager.descriptor);
119 data.writeString(name);
120 mRemote.transact(GET_SERVICE_TRANSACTION, data, reply, 0);
121 IBinder binder = reply.readStrongBinder();
122 reply.recycle();
123 data.recycle();
124 return binder;
125 }
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void endScroll() throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
mRemote.transact(END_SCROLL_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void setActivityState(int activityState) throws RemoteException {
Parcel obtain = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.libraries.launcherclient.ILauncherOverlay");
obtain.writeInt(activityState);
this.mRemote.transact(16, obtain, null, FLAG_ONEWAY);
} finally {
obtain.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void startScroll() throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
mRemote.transact(START_SCROLL_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void onPause() throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
mRemote.transact(ON_PAUSE_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void onResume() throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
mRemote.transact(ON_RESUME_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
public void onScroll(float progress) throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlay.class.getName());
data.writeFloat(progress);
mRemote.transact(ON_SCROLL_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
public void overlayScrollChanged(float progress) throws RemoteException {
Parcel data = Parcel.obtain();
try {
data.writeInterfaceToken(ILauncherOverlayCallback.class.getName());
data.writeFloat(progress);
mRemote.transact(OVERLAY_SCROLL_CHANGED_TRANSACTION, data, null, FLAG_ONEWAY);
} finally {
data.recycle();
}
}
代码示例来源:origin: facebook/facebook-android-sdk
public boolean isTrackingLimited() throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
boolean limitAdTracking;
try {
data.writeInterfaceToken(
"com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
data.writeInt(1);
binder.transact(SECOND_TRANSACTION_CODE, data, reply, 0);
reply.readException();
limitAdTracking = 0 != reply.readInt();
} finally {
reply.recycle();
data.recycle();
}
return limitAdTracking;
}
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public void cancel(int jobId) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(jobId);
mRemote.transact(Stub.TRANSACTION_cancel, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
代码示例来源:origin: facebook/facebook-android-sdk
public String getAdvertiserId() throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
String id;
try {
data.writeInterfaceToken(
"com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
binder.transact(FIRST_TRANSACTION_CODE, data, reply, 0);
reply.readException();
id = reply.readString();
} finally {
reply.recycle();
data.recycle();
}
return id;
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public android.app.job.JobInfo getPendingJob(int i) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
android.app.job.JobInfo _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(i);
mRemote.transact(Stub.TRANSACTION_getPendingJob, _data, _reply, 0);
_reply.readException();
if ((0 != _reply.readInt())) {
_result = android.app.job.JobInfo.CREATOR.createFromParcel(_reply);
} else {
_result = null;
}
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public void cancelAll() throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_cancelAll, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testWriteAndEnforceCompatibleInterface() {
parcel.writeInterfaceToken("com.example.IMyInterface");
parcel.setDataPosition(0);
parcel.enforceInterface("com.example.IMyInterface");
// Nothing explodes
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public java.util.List<android.app.job.JobInfo> getAllPendingJobs() throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
java.util.List<android.app.job.JobInfo> _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_getAllPendingJobs, _data, _reply, 0);
_reply.readException();
_result = _reply.createTypedArrayList(android.app.job.JobInfo.CREATOR);
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testWriteAndEnforceIncompatibleInterface() {
parcel.writeInterfaceToken("com.example.Derp");
parcel.setDataPosition(0);
try {
parcel.enforceInterface("com.example.IMyInterface");
fail("Expected SecurityException");
} catch (SecurityException e) {
// Expected
}
}
内容来源于网络,如有侵权,请联系作者删除!