Java Code Examples for android.os.Parcel.writeNoException()

The following are Jave code examples for showing how to use writeNoException() of the android.os.Parcel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: letv   File: TmsCallbackStub.java   View Source Code Vote up 6 votes
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch (code) {
        case 1:
            int err = data.readInt();
            DataEntity result = null;
            try {
                result = new DataEntity(data);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            onResultGot(err, result);
            reply.writeNoException();
            break;
        case 2:
            onArrayResultGot(data.readInt(), DataEntity.readFromParcel(data));
            reply.writeNoException();
            break;
    }
    return true;
}
 
Example 2
Project: boohee_v5.6   File: RemoteSSO.java   View Source Code Vote up 6 votes
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) {
    String packageName;
    switch (i) {
        case 1:
            parcel.enforceInterface(DESCRIPTOR);
            packageName = getPackageName();
            parcel2.writeNoException();
            parcel2.writeString(packageName);
            return true;
        case 2:
            parcel.enforceInterface(DESCRIPTOR);
            packageName = getActivityName();
            parcel2.writeNoException();
            parcel2.writeString(packageName);
            return true;
        case 1598968902:
            parcel2.writeString(DESCRIPTOR);
            return true;
        default:
            return super.onTransact(i, parcel, parcel2, i2);
    }
}
 
Example 3
Project: MiPushFramework   File: IHttpService.java   View Source Code Vote up 5 votes
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
    switch (i) {
        case 1:
            parcel.enforceInterface("com.xiaomi.xmsf.push.service.IHttpService");
            String doHttpPost = doHttpPost(parcel.readString(), parcel.readHashMap(getClass().getClassLoader()));
            parcel2.writeNoException();
            parcel2.writeString(doHttpPost);
            return true;
        case 1598968902:
            parcel2.writeString("com.xiaomi.xmsf.push.service.IHttpService");
            return true;
        default:
            return super.onTransact(i, parcel, parcel2, i2);
    }
}
 
Example 4
Project: letv   File: IDownloadService.java   View Source Code Vote up 5 votes
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch (code) {
        case 1:
            data.enforceInterface(DESCRIPTOR);
            synRemoveDownload(data.readLong());
            reply.writeNoException();
            return true;
        case 1598968902:
            reply.writeString(DESCRIPTOR);
            return true;
        default:
            return super.onTransact(code, data, reply, flags);
    }
}
 
Example 5
Project: letv   File: RubbishScanListenerStub.java   View Source Code Vote up 5 votes
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch (code) {
        case 1:
            onScanStarted();
            reply.writeNoException();
            break;
        case 2:
            int type = data.readInt();
            DataEntity result = null;
            try {
                result = new DataEntity(data);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            onRubbishFound(type, result);
            reply.writeNoException();
            break;
        case 3:
            onScanProgressChanged(data.readInt());
            reply.writeNoException();
            break;
        case 4:
            onScanCanceled();
            reply.writeNoException();
            break;
        case 10:
            onScanFinished();
            reply.writeNoException();
            break;
    }
    return true;
}
 
Example 6
Project: VirtualAPK   File: BookManagerImpl.java   View Source Code Vote up 5 votes
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
        throws RemoteException {
    switch (code) {
    case INTERFACE_TRANSACTION: {
        reply.writeString(DESCRIPTOR);
        return true;
    }
    case TRANSACTION_getBookList: {
        data.enforceInterface(DESCRIPTOR);
        List<Book> result = this.getBookList();
        reply.writeNoException();
        reply.writeTypedList(result);
        return true;
    }
    case TRANSACTION_addBook: {
        data.enforceInterface(DESCRIPTOR);
        Book arg0;
        if ((0 != data.readInt())) {
            arg0 = Book.CREATOR.createFromParcel(data);
        } else {
            arg0 = null;
        }
        this.addBook(arg0);
        reply.writeNoException();
        return true;
    }
    }
    return super.onTransact(code, data, reply, flags);
}
 
Example 7
Project: AIDLExample   File: LibraryServer.java   View Source Code Vote up 5 votes
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch (code){
        case IBinder.FIRST_CALL_TRANSACTION + 0:
            data.enforceInterface("token10086");
            if(data.readInt()==1){//表示客户端传过来的bookName不为空
                reply.writeNoException();
                reply.writeString(getBookInfo(data.readString()));
            }else{
                reply.writeNoException();
                reply.writeString("您输入的书名为空!");
            }
            return true;

        case IBinder.FIRST_CALL_TRANSACTION + 1:
            data.enforceInterface("token10000");
            if(data.readInt()==1){
                reply.writeNoException();
                reply.writeString(getBookList());
            }else{
                reply.writeNoException();
                reply.writeString("查询不到图书列表!");
            }
            return true;
    }
    return super.onTransact(code, data, reply, flags);
}
 
Example 8
Project: boohee_v5.6   File: IAlixPay.java   View Source Code Vote up 5 votes
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
    String Pay;
    switch (i) {
        case 1:
            parcel.enforceInterface(DESCRIPTOR);
            Pay = Pay(parcel.readString());
            parcel2.writeNoException();
            parcel2.writeString(Pay);
            return true;
        case 2:
            parcel.enforceInterface(DESCRIPTOR);
            Pay = test();
            parcel2.writeNoException();
            parcel2.writeString(Pay);
            return true;
        case 3:
            parcel.enforceInterface(DESCRIPTOR);
            registerCallback(com.alipay.android.app.IRemoteServiceCallback.Stub.asInterface(parcel.readStrongBinder()));
            parcel2.writeNoException();
            return true;
        case 4:
            parcel.enforceInterface(DESCRIPTOR);
            unregisterCallback(com.alipay.android.app.IRemoteServiceCallback.Stub.asInterface(parcel.readStrongBinder()));
            parcel2.writeNoException();
            return true;
        case 5:
            parcel.enforceInterface(DESCRIPTOR);
            Pay = prePay(parcel.readString());
            parcel2.writeNoException();
            parcel2.writeString(Pay);
            return true;
        case 1598968902:
            parcel2.writeString(DESCRIPTOR);
            return true;
        default:
            return super.onTransact(i, parcel, parcel2, i2);
    }
}
 
Example 9
Project: airgram   File: ICustomTabsService.java   View Source Code Vote up 4 votes
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    ICustomTabsCallback _arg0;
    Bundle _arg1;
    boolean _result;
    Bundle _result2;
    switch (code) {
        case 2:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            long _arg02 = data.readLong();
            _result = this.warmup(_arg02);
            reply.writeNoException();
            reply.writeInt(_result ? 1 : 0);
            return true;
        case 3:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            _arg0 = ICustomTabsCallback.Stub.asInterface(data.readStrongBinder());
            boolean _arg12 = this.newSession(_arg0);
            reply.writeNoException();
            reply.writeInt(_arg12 ? 1 : 0);
            return true;
        case 4:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            _arg0 = ICustomTabsCallback.Stub.asInterface(data.readStrongBinder());
            Uri _arg11;
            if (0 != data.readInt()) {
                _arg11 = Uri.CREATOR.createFromParcel(data);
            } else {
                _arg11 = null;
            }

            if (0 != data.readInt()) {
                _result2 = Bundle.CREATOR.createFromParcel(data);
            } else {
                _result2 = null;
            }

            ArrayList _arg3 = data.createTypedArrayList(Bundle.CREATOR);
            boolean _result1 = this.mayLaunchUrl(_arg0, _arg11, _result2, _arg3);
            reply.writeNoException();
            reply.writeInt(_result1 ? 1 : 0);
            return true;
        case 5:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            String _arg01 = data.readString();
            if (0 != data.readInt()) {
                _arg1 = Bundle.CREATOR.createFromParcel(data);
            } else {
                _arg1 = null;
            }

            _result2 = this.extraCommand(_arg01, _arg1);
            reply.writeNoException();
            if (_result2 != null) {
                reply.writeInt(1);
                _result2.writeToParcel(reply, 1);
            } else {
                reply.writeInt(0);
            }

            return true;
        case 6:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            _arg0 = ICustomTabsCallback.Stub.asInterface(data.readStrongBinder());
            if (0 != data.readInt()) {
                _arg1 = Bundle.CREATOR.createFromParcel(data);
            } else {
                _arg1 = null;
            }

            _result = this.updateVisuals(_arg0, _arg1);
            reply.writeNoException();
            reply.writeInt(_result ? 1 : 0);
            return true;
        case 1598968902:
            reply.writeString("android.support.customtabs.ICustomTabsService");
            return true;
        default:
            return super.onTransact(code, data, reply, flags);
    }
}
 
Example 10
Project: letv   File: AIDLActivity.java   View Source Code Vote up 4 votes
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch (code) {
        case 1:
            data.enforceInterface(DESCRIPTOR);
            onResult(data.readInt(), data.readString());
            reply.writeNoException();
            return true;
        case 2:
            data.enforceInterface(DESCRIPTOR);
            onResLoadBalance(data.readInt(), data.readString());
            reply.writeNoException();
            return true;
        case 3:
            data.enforceInterface(DESCRIPTOR);
            onResInitDevice(data.readInt(), data.readString());
            reply.writeNoException();
            return true;
        case 4:
            data.enforceInterface(DESCRIPTOR);
            onResDevices(data.readInt(), data.readString());
            reply.writeNoException();
            return true;
        case 5:
            data.enforceInterface(DESCRIPTOR);
            onResPush(data.readInt(), data.readString());
            reply.writeNoException();
            return true;
        case 6:
            data.enforceInterface(DESCRIPTOR);
            onError(data.readString());
            reply.writeNoException();
            return true;
        case 7:
            data.enforceInterface(DESCRIPTOR);
            quit();
            reply.writeNoException();
            return true;
        case 1598968902:
            reply.writeString(DESCRIPTOR);
            return true;
        default:
            return super.onTransact(code, data, reply, flags);
    }
}
 
Example 11
Project: PlusGram   File: ICustomTabsService.java   View Source Code Vote up 4 votes
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    ICustomTabsCallback _arg0;
    Bundle _arg1;
    boolean _result;
    Bundle _result2;
    switch (code) {
        case 2:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            long _arg02 = data.readLong();
            _result = this.warmup(_arg02);
            reply.writeNoException();
            reply.writeInt(_result ? 1 : 0);
            return true;
        case 3:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            _arg0 = ICustomTabsCallback.Stub.asInterface(data.readStrongBinder());
            boolean _arg12 = this.newSession(_arg0);
            reply.writeNoException();
            reply.writeInt(_arg12 ? 1 : 0);
            return true;
        case 4:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            _arg0 = ICustomTabsCallback.Stub.asInterface(data.readStrongBinder());
            Uri _arg11;
            if (0 != data.readInt()) {
                _arg11 = Uri.CREATOR.createFromParcel(data);
            } else {
                _arg11 = null;
            }

            if (0 != data.readInt()) {
                _result2 = Bundle.CREATOR.createFromParcel(data);
            } else {
                _result2 = null;
            }

            ArrayList _arg3 = data.createTypedArrayList(Bundle.CREATOR);
            boolean _result1 = this.mayLaunchUrl(_arg0, _arg11, _result2, _arg3);
            reply.writeNoException();
            reply.writeInt(_result1 ? 1 : 0);
            return true;
        case 5:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            String _arg01 = data.readString();
            if (0 != data.readInt()) {
                _arg1 = Bundle.CREATOR.createFromParcel(data);
            } else {
                _arg1 = null;
            }

            _result2 = this.extraCommand(_arg01, _arg1);
            reply.writeNoException();
            if (_result2 != null) {
                reply.writeInt(1);
                _result2.writeToParcel(reply, 1);
            } else {
                reply.writeInt(0);
            }

            return true;
        case 6:
            data.enforceInterface("android.support.customtabs.ICustomTabsService");
            _arg0 = ICustomTabsCallback.Stub.asInterface(data.readStrongBinder());
            if (0 != data.readInt()) {
                _arg1 = Bundle.CREATOR.createFromParcel(data);
            } else {
                _arg1 = null;
            }

            _result = this.updateVisuals(_arg0, _arg1);
            reply.writeNoException();
            reply.writeInt(_result ? 1 : 0);
            return true;
        case 1598968902:
            reply.writeString("android.support.customtabs.ICustomTabsService");
            return true;
        default:
            return super.onTransact(code, data, reply, flags);
    }
}
 
Example 12
Project: IPCCommunication   File: BaseIPCService.java   View Source Code Vote up 3 votes
/**
 *  处理消息
 * @param code 识别码
 * @param data 调用transact的对象传送过去的参数
 * @param reply 调用onTransact的对象返回的参数
 * @param flags Java里面默认的native方法都是阻塞的,当不需要阻塞的时候设置为IBinder.FLAG_ONEWAY,否则设置为0
 * @return
 * @throws RemoteException
 */
@Override
protected boolean onTransact(final int code, final Parcel data, final Parcel reply, final int flags) throws RemoteException {
    data.enforceInterface(Contant.DESCRIPTOR);
    Bundle bundle = dealMessage(code,data.readBundle());
    reply.writeNoException();
    reply.writeBundle(bundle);
    return true;
}