Java Code Examples for android.os.Parcel#readException()

The following examples show how to use android.os.Parcel#readException() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void onPostMessage(String message, Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

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

        this.mRemote.transact(5, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }

}
 
Example 2
public void onNavigationEvent(int navigationEvent, Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = 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, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }

}
 
Example 3
Source Project: letv   File: IMediaSession.java    License: Apache License 2.0 6 votes vote down vote up
public void playFromSearch(String string, Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeString(string);
        if (extras != null) {
            _data.writeInt(1);
            extras.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }
        this.mRemote.transact(15, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 4
public void onMessageChannelReady(Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

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

        this.mRemote.transact(4, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }

}
 
Example 5
Source Project: android-art-res   File: BookManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<Book> getBookList() throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    List<Book> result;
    try {
        data.writeInterfaceToken(DESCRIPTOR);
        mRemote.transact(TRANSACTION_getBookList, data, reply, 0);
        reply.readException();
        result = reply.createTypedArrayList(Book.CREATOR);
    } finally {
        reply.recycle();
        data.recycle();
    }
    return result;
}
 
Example 6
public boolean newSession(ICustomTabsCallback callback) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

    boolean _result;
    try {
        _data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
        _data.writeStrongBinder(callback != null?callback.asBinder():null);
        this.mRemote.transact(3, _data, _reply, 0);
        _reply.readException();
        _result = 0 != _reply.readInt();
    } finally {
        _reply.recycle();
        _data.recycle();
    }

    return _result;
}
 
Example 7
Source Project: letv   File: d.java    License: Apache License 2.0 6 votes vote down vote up
public final String a(String str, String str2) {
    Parcel obtain = Parcel.obtain();
    Parcel obtain2 = Parcel.obtain();
    try {
        obtain.writeInterfaceToken(z);
        obtain.writeString(str);
        obtain.writeString(str2);
        this.a.transact(8, obtain, obtain2, 0);
        obtain2.readException();
        String readString = obtain2.readString();
        return readString;
    } finally {
        obtain2.recycle();
        obtain.recycle();
    }
}
 
Example 8
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;
}
 
Example 9
public void onMessageChannelReady(Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

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

        this.mRemote.transact(4, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }

}
 
Example 10
Source Project: letv   File: IMediaSession.java    License: Apache License 2.0 6 votes vote down vote up
public void playFromUri(Uri uri, Bundle extras) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        if (uri != null) {
            _data.writeInt(1);
            uri.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }
        if (extras != null) {
            _data.writeInt(1);
            extras.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }
        this.mRemote.transact(16, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 11
Source Project: letv   File: ExceptionUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static final void readExceptionFromParcel(Parcel reply, String msg, int code) {
    switch (code) {
        case 1:
            throw new DeviceUnavailableException(msg);
        default:
            reply.readException(code, msg);
            return;
    }
}
 
Example 12
Source Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public String getPackageName() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(6, _data, _reply, 0);
        _reply.readException();
        String _result = _reply.readString();
        return _result;
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 13
Source Project: letv   File: RubbishScanListenerProxy.java    License: Apache License 2.0 5 votes vote down vote up
public void onScanStarted() throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        this.mRemote.transact(1, data, reply, 0);
        reply.readException();
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 14
Source Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public void fastForward() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(22, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 15
Source Project: letv   File: RubbishScanListenerProxy.java    License: Apache License 2.0 5 votes vote down vote up
public void onScanCanceled() throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        this.mRemote.transact(4, data, reply, 0);
        reply.readException();
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 16
public Bundle extraCommand(String commandName, Bundle args) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

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

        this.mRemote.transact(5, _data, _reply, 0);
        _reply.readException();
        if(0 != _reply.readInt()) {
            _result = Bundle.CREATOR.createFromParcel(_reply);
        } else {
            _result = null;
        }
    } finally {
        _reply.recycle();
        _data.recycle();
    }

    return _result;
}
 
Example 17
Source Project: letv   File: TmsCallbackProxy.java    License: Apache License 2.0 5 votes vote down vote up
public void onResultGot(int err, DataEntity result) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInt(err);
        result.writeToParcel(data, 0);
        this.mRemote.transact(1, data, reply, 0);
        reply.readException();
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 18
Source Project: letv   File: DeviceCallback.java    License: Apache License 2.0 5 votes vote down vote up
public void onFocusOnEditText(String deviceId, int editTextId, String currentText) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeString(deviceId);
        _data.writeInt(editTextId);
        _data.writeString(currentText);
        this.mRemote.transact(3, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 19
Source Project: letv   File: ICdeBinder.java    License: Apache License 2.0 5 votes vote down vote up
public int getUpgradePercentage() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(11, _data, _reply, 0);
        _reply.readException();
        int _result = _reply.readInt();
        return _result;
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 20
public Bundle extraCommand(String commandName, Bundle args) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

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

        this.mRemote.transact(5, _data, _reply, 0);
        _reply.readException();
        if(0 != _reply.readInt()) {
            _result = Bundle.CREATOR.createFromParcel(_reply);
        } else {
            _result = null;
        }
    } finally {
        _reply.recycle();
        _data.recycle();
    }

    return _result;
}