Methods Summary |
---|
private void | attachToSurfaceWhenReady()
final SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();
if (surfaceTexture == null || mSurface != null) {
// Either not ready to attach, or already attached.
return;
}
mSurface = new Surface(surfaceTexture);
try {
mActivityContainer.setSurface(mSurface, mWidth, mHeight, mMetrics.densityDpi);
} catch (RemoteException e) {
mSurface.release();
mSurface = null;
throw new RuntimeException("ActivityView: Unable to create ActivityContainer. " + e);
}
if (DEBUG) Log.v(TAG, "attachToSurfaceWhenReady: " + (mQueuedIntent != null ||
mQueuedPendingIntent != null ? "" : "no") + " queued intent");
if (mQueuedIntent != null) {
mActivityContainer.startActivity(mQueuedIntent);
mQueuedIntent = null;
} else if (mQueuedPendingIntent != null) {
mActivityContainer.startActivityIntentSender(mQueuedPendingIntent);
mQueuedPendingIntent = null;
}
|
private boolean | injectInputEvent(android.view.InputEvent event)
return mActivityContainer != null && mActivityContainer.injectEvent(event);
|
public boolean | isAttachedToDisplay()
return mSurface != null;
|
public void | onAttachedToWindow()
if (DEBUG) Log.v(TAG, "onAttachedToWindow(): mActivityContainer=" + mActivityContainer +
" mSurface=" + mSurface);
|
public void | onDetachedFromWindow()
if (DEBUG) Log.v(TAG, "onDetachedFromWindow(): mActivityContainer=" + mActivityContainer +
" mSurface=" + mSurface);
|
public boolean | onGenericMotionEvent(android.view.MotionEvent event)
if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
if (injectInputEvent(event)) {
return true;
}
}
return super.onGenericMotionEvent(event);
|
protected void | onLayout(boolean changed, int l, int t, int r, int b)
mTextureView.layout(0, 0, r - l, b - t);
|
public boolean | onTouchEvent(android.view.MotionEvent event)
return injectInputEvent(event) || super.onTouchEvent(event);
|
protected void | onVisibilityChanged(android.view.View changedView, int visibility)
super.onVisibilityChanged(changedView, visibility);
if (mSurface != null) {
try {
if (visibility == View.GONE) {
mActivityContainer.setSurface(null, mWidth, mHeight, mMetrics.densityDpi);
} else if (mLastVisibility == View.GONE) {
// Don't change surface when going between View.VISIBLE and View.INVISIBLE.
mActivityContainer.setSurface(mSurface, mWidth, mHeight, mMetrics.densityDpi);
}
} catch (RemoteException e) {
throw new RuntimeException(
"ActivityView: Unable to set surface of ActivityContainer. " + e);
}
}
mLastVisibility = visibility;
|
public void | release()
if (DEBUG) Log.v(TAG, "release() mActivityContainer=" + mActivityContainer +
" mSurface=" + mSurface);
if (mActivityContainer == null) {
Log.e(TAG, "Duplicate call to release");
return;
}
mActivityContainer.release();
mActivityContainer = null;
if (mSurface != null) {
mSurface.release();
mSurface = null;
}
mTextureView.setSurfaceTextureListener(null);
|
public void | setCallback(android.app.ActivityView$ActivityViewCallback callback)Set the callback to use to report certain state changes.
mActivityViewCallback = callback;
|
public void | startActivity(android.content.Intent intent)
if (mActivityContainer == null) {
throw new IllegalStateException("Attempt to call startActivity after release");
}
if (DEBUG) Log.v(TAG, "startActivity(): intent=" + intent + " " +
(isAttachedToDisplay() ? "" : "not") + " attached");
if (mSurface != null) {
mActivityContainer.startActivity(intent);
} else {
mActivityContainer.checkEmbeddedAllowed(intent);
mQueuedIntent = intent;
mQueuedPendingIntent = null;
}
|
public void | startActivity(android.content.IntentSender intentSender)
if (mActivityContainer == null) {
throw new IllegalStateException("Attempt to call startActivity after release");
}
if (DEBUG) Log.v(TAG, "startActivityIntentSender(): intentSender=" + intentSender + " " +
(isAttachedToDisplay() ? "" : "not") + " attached");
final IIntentSender iIntentSender = intentSender.getTarget();
if (mSurface != null) {
mActivityContainer.startActivityIntentSender(iIntentSender);
} else {
mActivityContainer.checkEmbeddedAllowedIntentSender(iIntentSender);
mQueuedPendingIntent = iIntentSender;
mQueuedIntent = null;
}
|
public void | startActivity(PendingIntent pendingIntent)
if (mActivityContainer == null) {
throw new IllegalStateException("Attempt to call startActivity after release");
}
if (DEBUG) Log.v(TAG, "startActivityPendingIntent(): PendingIntent=" + pendingIntent + " "
+ (isAttachedToDisplay() ? "" : "not") + " attached");
final IIntentSender iIntentSender = pendingIntent.getTarget();
if (mSurface != null) {
mActivityContainer.startActivityIntentSender(iIntentSender);
} else {
mActivityContainer.checkEmbeddedAllowedIntentSender(iIntentSender);
mQueuedPendingIntent = iIntentSender;
mQueuedIntent = null;
}
|