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

The following examples show how to use android.os.Parcel#writeInterfaceToken() .
Example 1
Project: android_9.0.0_r45   File: DisplayTransformManager.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Propagates the provided color transformation matrix to the SurfaceFlinger.
 */
private static void applyColorMatrix(float[] m) {
    final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER);
    if (flinger != null) {
        final Parcel data = Parcel.obtain();
        data.writeInterfaceToken("android.ui.ISurfaceComposer");
        if (m != null) {
            data.writeInt(1);
            for (int i = 0; i < 16; i++) {
                data.writeFloat(m[i]);
            }
        } else {
            data.writeInt(0);
        }
        try {
            flinger.transact(SURFACE_FLINGER_TRANSACTION_COLOR_MATRIX, data, null, 0);
        } catch (RemoteException ex) {
            Slog.e(TAG, "Failed to set color transform", ex);
        } finally {
            data.recycle();
        }
    }
}
 
Example 2
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 3
Project: TelePlus-Android   File: ICustomTabsCallback.java    License: GNU General Public License v2.0 6 votes vote down vote up
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 4
Project: Telegram-FOSS   File: ICustomTabsService.java    License: GNU General Public License v2.0 6 votes vote down vote up
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 5
Project: letv   File: d.java    License: Apache License 2.0 6 votes vote down vote up
public final void b(String str, boolean z) {
    int i = 0;
    Parcel obtain = Parcel.obtain();
    Parcel obtain2 = Parcel.obtain();
    try {
        obtain.writeInterfaceToken(z);
        obtain.writeString(str);
        if (z) {
            i = 1;
        }
        obtain.writeInt(i);
        this.a.transact(7, obtain, obtain2, 0);
        obtain2.readException();
    } finally {
        obtain2.recycle();
        obtain.recycle();
    }
}
 
Example 6
Project: android_9.0.0_r45   File: ContentProviderNative.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public int bulkInsert(String callingPkg, Uri url, ContentValues[] values) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);
        data.writeTypedArray(values, 0);

        mRemote.transact(IContentProvider.BULK_INSERT_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        int count = reply.readInt();
        return count;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 7
Project: letv   File: d.java    License: Apache License 2.0 6 votes vote down vote up
public final int a(String str, int i) {
    Parcel obtain = Parcel.obtain();
    Parcel obtain2 = Parcel.obtain();
    try {
        obtain.writeInterfaceToken(z);
        obtain.writeString(str);
        obtain.writeInt(i);
        this.a.transact(2, obtain, obtain2, 0);
        obtain2.readException();
        int readInt = obtain2.readInt();
        return readInt;
    } finally {
        obtain2.recycle();
        obtain.recycle();
    }
}
 
Example 8
Project: letv   File: AdvertisingInfoServiceStrategy.java    License: Apache License 2.0 6 votes vote down vote up
public String getId() throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    String id = null;
    try {
        data.writeInterfaceToken(ADVERTISING_ID_SERVICE_INTERFACE_TOKEN);
        this.binder.transact(1, data, reply, 0);
        reply.readException();
        id = reply.readString();
    } catch (Exception e) {
        Fabric.getLogger().d(Fabric.TAG, "Could not get parcel from Google Play Service to capture AdvertisingId");
    } finally {
        reply.recycle();
        data.recycle();
    }
    return id;
}
 
Example 9
Project: letv   File: IMediaControllerCallback.java    License: Apache License 2.0 5 votes vote down vote up
public void onPlaybackStateChanged(PlaybackStateCompat state) throws RemoteException {
    Parcel _data = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        if (state != null) {
            _data.writeInt(1);
            state.writeToParcel(_data, 0);
        } else {
            _data.writeInt(0);
        }
        this.mRemote.transact(3, _data, null, 1);
    } finally {
        _data.recycle();
    }
}
 
Example 10
Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public void registerCallbackListener(IMediaControllerCallback cb) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeStrongBinder(cb != null ? cb.asBinder() : null);
        this.mRemote.transact(3, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 11
Project: android_9.0.0_r45   File: BulkCursorNative.java    License: Apache License 2.0 5 votes vote down vote up
public void onMove(int position) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IBulkCursor.descriptor);
        data.writeInt(position);

        mRemote.transact(ON_MOVE_TRANSACTION, data, reply, 0);
        DatabaseUtils.readExceptionFromParcel(reply);
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 12
Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public List<QueueItem> getQueue() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(29, _data, _reply, 0);
        _reply.readException();
        List<QueueItem> _result = _reply.createTypedArrayList(QueueItem.CREATOR);
        return _result;
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 13
Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public void previous() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(21, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 14
Project: letv   File: RemoteDeviceManager.java    License: Apache License 2.0 5 votes vote down vote up
public void registerDeviceCallback(String deviceId, DeviceCallback callback, int events) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeString(deviceId);
        _data.writeStrongBinder(callback != null ? callback.asBinder() : null);
        _data.writeInt(events);
        this.mRemote.transact(5, _data, _reply, 0);
        ExceptionUtils.readExceptionFromParcel(_reply);
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 15
Project: letv   File: INotificationSideChannel.java    License: Apache License 2.0 5 votes vote down vote up
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();
    }
}
 
Example 16
Project: letv   File: d.java    License: Apache License 2.0 5 votes vote down vote up
public final void b(String str, long j) {
    Parcel obtain = Parcel.obtain();
    Parcel obtain2 = Parcel.obtain();
    try {
        obtain.writeInterfaceToken(z);
        obtain.writeString(str);
        obtain.writeLong(j);
        this.a.transact(5, obtain, obtain2, 0);
        obtain2.readException();
    } finally {
        obtain2.recycle();
        obtain.recycle();
    }
}
 
Example 17
Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public String getTag() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(7, _data, _reply, 0);
        _reply.readException();
        String _result = _reply.readString();
        return _result;
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 18
Project: Noyze   File: AudioFlingerProxy.java    License: Apache License 2.0 5 votes vote down vote up
public float getStreamVolume(int stream) throws RemoteException {
    LogUtils.LOGI("AudioFlingerProxy", "getStreamVolume(" + stream + ")");
    if (null == mAudioFlinger || TextUtils.isEmpty(mInterfaceDescriptor)) {
        return BAD_VALUE;
    }

    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    data.writeInterfaceToken(mInterfaceDescriptor);
    data.writeInt(stream);
    mAudioFlinger.transact(STREAM_VOLUME, data, reply, 0);
    float ret = Float.intBitsToFloat(reply.readInt());
    LogUtils.LOGI("AudioFlingerProxy", "Stream = " + stream + ", volume_3 = " + ret);
    return ret;
}
 
Example 19
Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public void stop() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(19, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 20
Project: letv   File: IMediaSession.java    License: Apache License 2.0 5 votes vote down vote up
public void next() throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        this.mRemote.transact(20, _data, _reply, 0);
        _reply.readException();
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}