use of android.annotation.SystemApi in project android_frameworks_base by ResurrectionRemix.
the class AudioPolicy method createAudioRecordSink.
/**
* Create an {@link AudioRecord} instance that is associated with the given {@link AudioMix}.
* Audio buffers recorded through the created instance will contain the mix of the audio
* streams that fed the given mixer.
* @param mix a non-null {@link AudioMix} instance whose routing flags was defined with
* {@link AudioMix#ROUTE_FLAG_LOOP_BACK}, previously added to this policy.
* @return a new {@link AudioRecord} instance whose data format is the one defined in the
* {@link AudioMix}, or null if this policy was not successfully registered
* with {@link AudioManager#registerAudioPolicy(AudioPolicy)}.
* @throws IllegalArgumentException
*/
@SystemApi
public AudioRecord createAudioRecordSink(AudioMix mix) throws IllegalArgumentException {
if (!policyReadyToUse()) {
Log.e(TAG, "Cannot create AudioRecord sink for AudioMix");
return null;
}
checkMixReadyToUse(mix, false);
// create an AudioFormat from the mix format compatible with recording, as the mix
// was defined for playback
AudioFormat mixFormat = new AudioFormat.Builder(mix.getFormat()).setChannelMask(AudioFormat.inChannelMaskFromOutChannelMask(mix.getFormat().getChannelMask())).build();
// create the AudioRecord, configured for loop back, using the same format as the mix
AudioRecord ar = new AudioRecord(new AudioAttributes.Builder().setInternalCapturePreset(MediaRecorder.AudioSource.REMOTE_SUBMIX).addTag(addressForTag(mix)).build(), mixFormat, AudioRecord.getMinBufferSize(mix.getFormat().getSampleRate(), // using stereo for buffer size to avoid the current poor support for masks
AudioFormat.CHANNEL_IN_STEREO, mix.getFormat().getEncoding()), AudioManager.AUDIO_SESSION_ID_GENERATE);
return ar;
}
use of android.annotation.SystemApi in project android_frameworks_base by ResurrectionRemix.
the class AudioPolicy method createAudioTrackSource.
/**
* Create an {@link AudioTrack} instance that is associated with the given {@link AudioMix}.
* Audio buffers played through the created instance will be sent to the given mix
* to be recorded through the recording APIs.
* @param mix a non-null {@link AudioMix} instance whose routing flags was defined with
* {@link AudioMix#ROUTE_FLAG_LOOP_BACK}, previously added to this policy.
* @return a new {@link AudioTrack} instance whose data format is the one defined in the
* {@link AudioMix}, or null if this policy was not successfully registered
* with {@link AudioManager#registerAudioPolicy(AudioPolicy)}.
* @throws IllegalArgumentException
*/
@SystemApi
public AudioTrack createAudioTrackSource(AudioMix mix) throws IllegalArgumentException {
if (!policyReadyToUse()) {
Log.e(TAG, "Cannot create AudioTrack source for AudioMix");
return null;
}
checkMixReadyToUse(mix, true);
// create the AudioTrack, configured for loop back, using the same format as the mix
AudioTrack at = new AudioTrack(new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_VIRTUAL_SOURCE).addTag(addressForTag(mix)).build(), mix.getFormat(), AudioTrack.getMinBufferSize(mix.getFormat().getSampleRate(), mix.getFormat().getChannelMask(), mix.getFormat().getEncoding()), AudioTrack.MODE_STREAM, AudioManager.AUDIO_SESSION_ID_GENERATE);
return at;
}
use of android.annotation.SystemApi in project android_frameworks_base by ResurrectionRemix.
the class TelephonyManager method setDataEnabled.
/** @hide */
@SystemApi
public void setDataEnabled(int subId, boolean enable) {
try {
Log.d(TAG, "setDataEnabled: enabled=" + enable);
AppOpsManager appOps = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
if (enable) {
if (appOps.noteOp(AppOpsManager.OP_DATA_CONNECT_CHANGE) != AppOpsManager.MODE_ALLOWED) {
Log.w(TAG, "Permission denied by user.");
return;
}
}
ITelephony telephony = getITelephony();
if (telephony != null)
telephony.setDataEnabled(subId, enable);
} catch (RemoteException e) {
Log.e(TAG, "Error calling setDataEnabled", e);
}
}
use of android.annotation.SystemApi in project android_frameworks_base by ResurrectionRemix.
the class TelecomManager method dumpAnalytics.
/**
* Dumps telecom analytics for uploading.
*
* @return
* @hide
*/
@SystemApi
@RequiresPermission(Manifest.permission.DUMP)
public TelecomAnalytics dumpAnalytics() {
ITelecomService service = getTelecomService();
TelecomAnalytics result = null;
if (service != null) {
try {
result = service.dumpCallAnalytics();
} catch (RemoteException e) {
Log.e(TAG, "Error dumping call analytics", e);
}
}
return result;
}
use of android.annotation.SystemApi in project android_frameworks_base by ResurrectionRemix.
the class CarrierConfigManager method updateConfigForPhoneId.
/**
* Request the carrier config loader to update the cofig for phoneId.
* <p>
* Depending on simState, the config may be cleared or loaded from config app. This is only used
* by SubscriptionInfoUpdater.
* </p>
*
* @hide
*/
@SystemApi
public void updateConfigForPhoneId(int phoneId, String simState) {
try {
ICarrierConfigLoader loader = getICarrierConfigLoader();
if (loader == null) {
Rlog.w(TAG, "Error updating config for phoneId=" + phoneId + " ICarrierConfigLoader is null");
return;
}
loader.updateConfigForPhoneId(phoneId, simState);
} catch (RemoteException ex) {
Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex.toString());
}
}
Aggregations