android.app.IAssistDataReceiver

Here are the examples of the java api android.app.IAssistDataReceiver taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : AssistDataReceiverProxy.java
with Apache License 2.0
from lulululbj

/**
 * Proxies replacedist data to the given receiver, skipping all callbacks if the receiver dies.
 */
clreplaced replacedistDataReceiverProxy implements replacedistDataRequesterCallbacks, Binder.DeathRecipient {

    private static final String TAG = TAG_WITH_CLreplaced_NAME ? "replacedistDataReceiverProxy" : TAG_AM;

    private String mCallerPackage;

    private IreplacedistDataReceiver mReceiver;

    public replacedistDataReceiverProxy(IreplacedistDataReceiver receiver, String callerPackage) {
        mReceiver = receiver;
        mCallerPackage = callerPackage;
        linkToDeath();
    }

    @Override
    public boolean canHandleReceivedreplacedistDataLocked() {
        // We are forwarding, so we can always receive this data
        return true;
    }

    @Override
    public void onreplacedistDataReceivedLocked(Bundle data, int activityIndex, int activityCount) {
        if (mReceiver != null) {
            try {
                mReceiver.onHandlereplacedistData(data);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to proxy replacedist data to receiver in package=" + mCallerPackage, e);
            }
        }
    }

    @Override
    public void onreplacedistScreenshotReceivedLocked(Bitmap screenshot) {
        if (mReceiver != null) {
            try {
                mReceiver.onHandlereplacedistScreenshot(screenshot);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to proxy replacedist screenshot to receiver in package=" + mCallerPackage, e);
            }
        }
    }

    @Override
    public void onreplacedistRequestCompleted() {
        unlinkToDeath();
    }

    @Override
    public void binderDied() {
        unlinkToDeath();
    }

    private void linkToDeath() {
        try {
            mReceiver.asBinder().linkToDeath(this, 0);
        } catch (RemoteException e) {
            Log.w(TAG, "Could not link to client death", e);
        }
    }

    private void unlinkToDeath() {
        if (mReceiver != null) {
            mReceiver.asBinder().unlinkToDeath(this, 0);
        }
        mReceiver = null;
    }
}