use of android.annotation.TargetApi in project android-beacon-library by AltBeacon.
the class BeaconManager method stopMonitoringBeaconsInRegion.
/**
* Tells the <code>BeaconService</code> to stop looking for beacons that match the passed
* <code>Region</code> object. Note that the Region's unique identifier is used to match it to
* an existing monitored Region.
*
* @param region
* @see BeaconManager#setMonitorNotifier(MonitorNotifier)
* @see BeaconManager#startMonitoringBeaconsInRegion(Region region)
* @see MonitorNotifier
* @see Region
*/
@TargetApi(18)
public void stopMonitoringBeaconsInRegion(Region region) throws RemoteException {
if (android.os.Build.VERSION.SDK_INT < 18) {
LogManager.w(TAG, "Not supported prior to API 18. Method invocation will be ignored");
return;
}
if (serviceMessenger == null) {
throw new RemoteException("The BeaconManager is not bound to the service. Call beaconManager.bind(BeaconConsumer consumer) and wait for a callback to onBeaconServiceConnect()");
}
Message msg = Message.obtain(null, BeaconService.MSG_STOP_MONITORING, 0, 0);
StartRMData obj = new StartRMData(region, callbackPackageName(), this.getScanPeriod(), this.getBetweenScanPeriod(), this.mBackgroundMode);
msg.obj = obj;
serviceMessenger.send(msg);
}
use of android.annotation.TargetApi in project acra by ACRA.
the class MediaCodecListCollector method collectCapabilitiesForType.
/**
* Retrieve capabilities (ColorFormats and CodecProfileLevels) for a
* specific codec type.
*
* @param codecInfo the currently inspected codec
* @param type supported type to collect
* @return the color formats and codec profile levels
* available for a specific codec type.
*/
@NonNull
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private JSONObject collectCapabilitiesForType(@NonNull final MediaCodecInfo codecInfo, @NonNull String type) throws JSONException {
final JSONObject result = new JSONObject();
final MediaCodecInfo.CodecCapabilities codecCapabilities = codecInfo.getCapabilitiesForType(type);
// Color Formats
final int[] colorFormats = codecCapabilities.colorFormats;
if (colorFormats.length > 0) {
JSONArray colorFormatsJson = new JSONArray();
for (int colorFormat : colorFormats) {
colorFormatsJson.put(mColorFormatValues.get(colorFormat));
}
result.put("colorFormats", colorFormatsJson);
}
final CodecType codecType = identifyCodecType(codecInfo);
// Profile Levels
final MediaCodecInfo.CodecProfileLevel[] codecProfileLevels = codecCapabilities.profileLevels;
if (codecProfileLevels.length > 0) {
JSONArray profileLevels = new JSONArray();
for (MediaCodecInfo.CodecProfileLevel codecProfileLevel : codecProfileLevels) {
final int profileValue = codecProfileLevel.profile;
final int levelValue = codecProfileLevel.level;
if (codecType == null) {
// Unknown codec
profileLevels.put(profileValue + '-' + levelValue);
break;
}
switch(codecType) {
case AVC:
profileLevels.put(profileValue + mAVCProfileValues.get(profileValue) + '-' + mAVCLevelValues.get(levelValue));
break;
case H263:
profileLevels.put(mH263ProfileValues.get(profileValue) + '-' + mH263LevelValues.get(levelValue));
break;
case MPEG4:
profileLevels.put(mMPEG4ProfileValues.get(profileValue) + '-' + mMPEG4LevelValues.get(levelValue));
break;
case AAC:
profileLevels.put(mAACProfileValues.get(profileValue));
break;
default:
break;
}
}
result.put("profileLevels", profileLevels);
}
return result;
}
use of android.annotation.TargetApi in project acra by ACRA.
the class MediaCodecListCollector method collectMediaCodecList.
/**
* Builds an Element describing the list of available codecs on the device
* with their capabilities (supported Color Formats, Codec Profiles et
* Levels).
*
* @return The media codecs information
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@NonNull
private Element collectMediaCodecList() throws JSONException {
prepare();
final MediaCodecInfo[] infos;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
//noinspection deprecation
final int codecCount = MediaCodecList.getCodecCount();
infos = new MediaCodecInfo[codecCount];
for (int codecIdx = 0; codecIdx < codecCount; codecIdx++) {
//noinspection deprecation
infos[codecIdx] = MediaCodecList.getCodecInfoAt(codecIdx);
}
} else {
infos = new MediaCodecList(MediaCodecList.ALL_CODECS).getCodecInfos();
}
final ComplexElement result = new ComplexElement();
for (int i = 0; i < infos.length; i++) {
final MediaCodecInfo codecInfo = infos[i];
JSONObject codec = new JSONObject();
final String[] supportedTypes = codecInfo.getSupportedTypes();
codec.put("name", codecInfo.getName()).put("isEncoder", codecInfo.isEncoder());
JSONObject supportedTypesJson = new JSONObject();
for (String type : supportedTypes) {
supportedTypesJson.put(type, collectCapabilitiesForType(codecInfo, type));
}
codec.put("supportedTypes", supportedTypesJson);
result.put(String.valueOf(i), codec);
}
return result;
}
use of android.annotation.TargetApi in project android_frameworks_base by DirtyUnicorns.
the class MediaDecoder method retrieveDefaultRotation.
@TargetApi(17)
private void retrieveDefaultRotation() {
MediaMetadataRetriever metadataRetriever = new MediaMetadataRetriever();
metadataRetriever.setDataSource(mContext, mUri);
String rotationString = metadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
mDefaultRotation = rotationString == null ? 0 : Integer.parseInt(rotationString);
}
use of android.annotation.TargetApi in project android_frameworks_base by DirtyUnicorns.
the class RenderTarget method forSurface.
@TargetApi(11)
public RenderTarget forSurface(Surface surface) {
EGLConfig eglConfig = chooseEglConfig(mEgl, mDisplay);
EGLSurface eglSurf = null;
synchronized (mSurfaceSources) {
eglSurf = mSurfaceSources.get(surface);
if (eglSurf == null) {
eglSurf = mEgl.eglCreateWindowSurface(mDisplay, eglConfig, surface, null);
mSurfaceSources.put(surface, eglSurf);
}
}
checkEglError(mEgl, "eglCreateWindowSurface");
checkSurface(mEgl, eglSurf);
RenderTarget result = new RenderTarget(mDisplay, mContext, eglSurf, 0, false, true);
result.setSurfaceSource(surface);
result.addReferenceTo(eglSurf);
return result;
}
Aggregations