SurfaceControl和 Surface 的 getISurface( ) 是 private。
但是允許幾個 class 可以 direct call,所以宣告了幾個 friend class.:
/*
* Android frameworks friends
* (eventually this should go away and be replaced by proper APIs)
*/
// camera and camcorder need access to the ISurface binder interface for preview
friend class Camera;
friend class MediaRecorder;
// MediaPlayer needs access to ISurface for display
friend class MediaPlayer;
friend class IOMX;
// this is just to be able to write some unit tests
friend class Test;
其中的 class Test 是給方便用的。
所以..要用的話,就:
namespace android {
class Test {
public:
static const sp<ISurface> getISurface(const sp<SurfaceControl>& s) {
return s->getISurface();
}
}
};
這樣,就可以..
sp<ISurface> isurface = Test::getISurface(surface);
沒有留言:
張貼留言