下面列出了怎么用androidx.annotation.RestrictTo.Scope的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* {@inheritDoc}
*
* @hide
*/
@RestrictTo(Scope.LIBRARY_GROUP)
@Override
public void clear() {
mVideoHandlerThread.quitSafely();
// audio encoder release
mAudioHandlerThread.quitSafely();
if (mAudioEncoder != null) {
mAudioEncoder.release();
mAudioEncoder = null;
}
if (mAudioRecorder != null) {
mAudioRecorder.release();
mAudioRecorder = null;
}
if (mCameraSurface != null) {
releaseCameraSurface(true);
}
super.clear();
}
/**
* {@inheritDoc}
*
* @hide
*/
@Override
@Nullable
@RestrictTo(Scope.LIBRARY_GROUP)
protected UseCaseConfig.Builder<?, ?, ?> getDefaultBuilder(@Nullable CameraInfo cameraInfo) {
VideoCaptureConfig defaults = CameraX.getDefaultUseCaseConfig(VideoCaptureConfig.class,
cameraInfo);
if (defaults != null) {
return VideoCaptureConfig.Builder.fromConfig(defaults);
}
return null;
}
/**
* {@inheritDoc}
*
* @hide
*/
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
protected Map<String, Size> onSuggestedResolutionUpdated(
@NonNull Map<String, Size> suggestedResolutionMap) {
if (mCameraSurface != null) {
mVideoEncoder.stop();
mVideoEncoder.release();
mAudioEncoder.stop();
mAudioEncoder.release();
releaseCameraSurface(false);
}
try {
mVideoEncoder = MediaCodec.createEncoderByType(VIDEO_MIME_TYPE);
mAudioEncoder = MediaCodec.createEncoderByType(AUDIO_MIME_TYPE);
} catch (IOException e) {
throw new IllegalStateException("Unable to create MediaCodec due to: " + e.getCause());
}
String cameraId = getBoundCameraId();
Size resolution = suggestedResolutionMap.get(cameraId);
if (resolution == null) {
throw new IllegalArgumentException(
"Suggested resolution map missing resolution for camera " + cameraId);
}
setupEncoder(cameraId, resolution);
return suggestedResolutionMap;
}
/**
* Writes the given {@link ShapeAppearanceModel} to {@code path}
*
* @param shapeAppearanceModel The shape to be applied in the path.
* @param interpolation the desired interpolation.
* @param bounds the desired bounds for the path.
* @param pathListener the path
* @param path the returned path out-var.
*/
@RestrictTo(Scope.LIBRARY_GROUP)
public void calculatePath(
ShapeAppearanceModel shapeAppearanceModel,
float interpolation,
RectF bounds,
PathListener pathListener,
@NonNull Path path) {
path.rewind();
overlappedEdgePath.rewind();
boundsPath.rewind();
boundsPath.addRect(bounds, Direction.CW);
ShapeAppearancePathSpec spec =
new ShapeAppearancePathSpec(
shapeAppearanceModel, interpolation, bounds, pathListener, path);
// Calculate the transformations (rotations and translations) necessary for each edge and
// corner treatment.
for (int index = 0; index < 4; index++) {
setCornerPathAndTransform(spec, index);
setEdgePathAndTransform(index);
}
for (int index = 0; index < 4; index++) {
appendCornerPath(spec, index);
appendEdgePath(spec, index);
}
path.close();
overlappedEdgePath.close();
// Union with the edge paths that had an intersection to handle overlaps.
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT && !overlappedEdgePath.isEmpty()) {
path.op(overlappedEdgePath, Op.UNION);
}
}
@RestrictTo(Scope.TESTS)
CycledLeScanCallback getCycledLeScanCallback() {
return mCycledLeScanCallback;
}
@RestrictTo(Scope.TESTS)
protected CycledLeScanCallback getCycledLeScanCallback() {
return mScanHelper.getCycledLeScanCallback();
}
@RestrictTo(Scope.TESTS)
static long getSampleExpirationMilliseconds() {
return sampleExpirationMilliseconds;
}
/**
* Returns the maximum duration of videos, or {@link #INDEFINITE_VIDEO_DURATION} if there is no
* timeout.
*
* @hide Not currently implemented.
*/
@RestrictTo(Scope.LIBRARY_GROUP)
public long getMaxVideoDuration() {
return mCameraModule.getMaxVideoDuration();
}