本文整理了Java中android.os.Parcel.enforceInterface()
方法的一些代码示例,展示了Parcel.enforceInterface()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.enforceInterface()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:enforceInterface
暂无
代码示例来源:origin: stackoverflow.com
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
51 {
52 try {
53 switch (code) {
54 case IServiceManager.GET_SERVICE_TRANSACTION: {
55 data.enforceInterface(IServiceManager.descriptor);
56 String name = data.readString();
57 IBinder service = getService(name);
58 reply.writeStrongBinder(service);
59 return true;
60 }
61
62 case IServiceManager.CHECK_SERVICE_TRANSACTION: {
63 data.enforceInterface(IServiceManager.descriptor);
64 String name = data.readString();
65 IBinder service = checkService(name);
66 reply.writeStrongBinder(service);
67 return true;
68 }
69
//Rest has been discarded for brevity…………………..
………………….
………………….
…………………
代码示例来源:origin: LawnchairLauncher/Lawnchair
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
switch (code) {
case INTERFACE_TRANSACTION:
reply.writeString(ILauncherOverlay.class.getName());
return true;
case OVERLAY_SCROLL_CHANGED_TRANSACTION:
data.enforceInterface(ILauncherOverlayCallback.class.getName());
overlayScrollChanged(data.readFloat());
return true;
case OVERLAY_STATUS_CHANGED_TRANSACTION:
data.enforceInterface(ILauncherOverlayCallback.class.getName());
overlayStatusChanged(data.readInt());
default:
return super.onTransact(code, data, reply, flags);
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
return true;
case START_SCROLL_TRANSACTION:
data.enforceInterface(ILauncherOverlay.class.getName());
startScroll();
return true;
case ON_SCROLL_TRANSACTION:
data.enforceInterface(ILauncherOverlay.class.getName());
float _arg0 = data.readFloat();
onScroll(_arg0);
return true;
case END_SCROLL_TRANSACTION:
data.enforceInterface(ILauncherOverlay.class.getName());
endScroll();
return true;
case WINDOW_ATTACHED_TRANSACTION:
data.enforceInterface(ILauncherOverlay.class.getName());
WindowManager.LayoutParams layoutParams = null;
if (data.readInt() != 0) {
data.enforceInterface(ILauncherOverlay.class.getName());
windowDetached(data.readInt() != 0);
return true;
case CLOSE_OVERLAY_TRANSACTION:
data.enforceInterface(ILauncherOverlay.class.getName());
closeOverlay(data.readInt());
return true;
case ON_PAUSE_TRANSACTION:
data.enforceInterface(ILauncherOverlay.class.getName());
onPause();
代码示例来源:origin: android-hacker/VirtualXposed
data.enforceInterface(DESCRIPTOR);
JobInfo _arg0;
if ((0 != data.readInt())) {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
data.enforceInterface(DESCRIPTOR);
this.cancelAll();
reply.writeNoException();
data.enforceInterface(DESCRIPTOR);
List<JobInfo> _result = this.getAllPendingJobs();
reply.writeNoException();
data.enforceInterface(DESCRIPTOR);
JobInfo _arg0;
if ((0 != data.readInt())) {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
代码示例来源:origin: robolectric/robolectric
@Test
public void testWriteAndEnforceCompatibleInterface() {
parcel.writeInterfaceToken("com.example.IMyInterface");
parcel.setDataPosition(0);
parcel.enforceInterface("com.example.IMyInterface");
// Nothing explodes
}
代码示例来源: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
}
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
代码示例来源:origin: materialos/android-icon-pack
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_verifyLicense: {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
java.lang.String _arg1;
_arg1 = data.readString();
java.lang.String _arg2;
_arg2 = data.readString();
this.verifyLicense(_arg0, _arg1, _arg2);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
代码示例来源:origin: RooyeKhat-Media/iGap-Android
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_verifyLicense: {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
java.lang.String _arg1;
_arg1 = data.readString();
java.lang.String _arg2;
_arg2 = data.readString();
this.verifyLicense(_arg0, _arg1, _arg2);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
代码示例来源:origin: jamorham/xDrip-plus
@Override
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_addPowerSaveWhitelistApp: {
data.enforceInterface(DESCRIPTOR);
java.lang.String _arg0;
_arg0 = data.readString();
this.addPowerSaveWhitelistApp(_arg0);
reply.writeNoException();
return true;
}
}
return true;
}
代码示例来源:origin: mtotschnig/MyExpenses
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
{
switch (code)
{
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_verifyLicense:
{
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
java.lang.String _arg1;
_arg1 = data.readString();
java.lang.String _arg2;
_arg2 = data.readString();
this.verifyLicense(_arg0, _arg1, _arg2);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
private static class Proxy implements com.google.android.vending.licensing.ILicenseResultListener
代码示例来源:origin: Unity-Technologies/unity-ads-android
@SuppressWarnings("NullableProblems")
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
switch (code) {
case 1:
data.enforceInterface(ADVERTISING_ID_SERVICE_NAME);
String str1 = getId();
reply.writeNoException();
reply.writeString(str1);
return true;
case 2:
data.enforceInterface(ADVERTISING_ID_SERVICE_NAME);
boolean bool1 = 0 != data.readInt();
boolean bool2 = getEnabled(bool1);
reply.writeNoException();
reply.writeInt(bool2 ? 1 : 0);
return true;
}
return super.onTransact(code, data, reply, flags);
}
代码示例来源:origin: stackoverflow.com
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
switch (code) {
case START_ACTIVITY_TRANSACTION:
{
data.enforceInterface(IActivityManager.descriptor);
IBinder b = data.readStrongBinder();
IApplicationThread app = ApplicationThreadNative.asInterface(b);
Intent intent = Intent.CREATOR.createFromParcel(data);
String resolvedType = data.readString();
Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
int grantedMode = data.readInt();
IBinder resultTo = data.readStrongBinder();
String resultWho = data.readString();
int requestCode = data.readInt();
boolean onlyIfNeeded = data.readInt() != 0;
boolean debug = data.readInt() != 0;
int result = startActivity(app, intent, resolvedType,
grantedUriPermissions, grantedMode, resultTo, resultWho,
requestCode, onlyIfNeeded, debug);
reply.writeNoException();
reply.writeInt(result);
return true;
}
.....
代码示例来源:origin: materialos/android-icon-pack
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_checkLicense: {
data.enforceInterface(DESCRIPTOR);
long _arg0;
_arg0 = data.readLong();
java.lang.String _arg1;
_arg1 = data.readString();
com.google.android.vending.licensing.ILicenseResultListener _arg2;
_arg2 = com.google.android.vending.licensing.ILicenseResultListener.Stub.asInterface(data.readStrongBinder());
this.checkLicense(_arg0, _arg1, _arg2);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
代码示例来源:origin: RooyeKhat-Media/iGap-Android
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_checkLicense: {
data.enforceInterface(DESCRIPTOR);
long _arg0;
_arg0 = data.readLong();
java.lang.String _arg1;
_arg1 = data.readString();
com.google.android.vending.licensing.ILicenseResultListener _arg2;
_arg2 = com.google.android.vending.licensing.ILicenseResultListener.Stub.asInterface(data.readStrongBinder());
this.checkLicense(_arg0, _arg1, _arg2);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
代码示例来源:origin: mtotschnig/MyExpenses
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
{
switch (code)
{
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_checkLicense:
{
data.enforceInterface(DESCRIPTOR);
long _arg0;
_arg0 = data.readLong();
java.lang.String _arg1;
_arg1 = data.readString();
com.google.android.vending.licensing.ILicenseResultListener _arg2;
_arg2 = com.google.android.vending.licensing.ILicenseResultListener.Stub.asInterface(data.readStrongBinder());
this.checkLicense(_arg0, _arg1, _arg2);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
private static class Proxy implements com.google.android.vending.licensing.ILicensingService
代码示例来源:origin: bzsome/VirtualApp-x326
public void handleTransact(Object server, Parcel data, Parcel reply) {
data.enforceInterface(interfaceName);
Object[] parameters = data.readArray(getClass().getClassLoader());
if (parameters != null && parameters.length > 0) {
for (int i = 0; i < parameters.length; i++) {
if (converters[i] != null) {
parameters[i] = converters[i].convert(parameters[i]);
}
}
}
try {
Object res = method.invoke(server, parameters);
reply.writeNoException();
reply.writeValue(res);
} catch (IllegalAccessException e) {
e.printStackTrace();
reply.writeException(e);
} catch (InvocationTargetException e) {
e.printStackTrace();
reply.writeException(e);
}
}
代码示例来源:origin: codezjx/AndLinker
@Override
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_callback: {
data.enforceInterface(DESCRIPTOR);
Request _arg0;
if ((0 != data.readInt())) {
_arg0 = Request.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
Response _result = this.callback(_arg0);
reply.writeNoException();
if ((_result != null)) {
reply.writeInt(1);
_result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} else {
reply.writeInt(0);
}
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
代码示例来源:origin: limpoxe/Android-ServiceManager
@Override
public final boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case FIRST_CODE: {
data.enforceInterface(DESCRIPTOR);
Bundle param;
if ((0 != data.readInt())) {
param = Bundle.CREATOR.createFromParcel(data);
} else {
param = null;
}
Bundle result = MethodRouter.routerToInstance(param);
reply.writeNoException();
if ((result != null)) {
reply.writeInt(1);
result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} else {
reply.writeInt(0);
}
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
代码示例来源:origin: shyluo/CrashImmuneDecoder
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
switch (code) {
case CREATE_H264_HARDWARE_DECODER_TRANSACTION: {
data.enforceInterface(DESCRIPTION);
IVideoDecoder decoder = createH264HardwareDecoder();
reply.writeNoException();
reply.writeInt(1);
reply.writeStrongBinder(decoder.asBinder());
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
}
内容来源于网络,如有侵权,请联系作者删除!