List of usage examples for android.media AudioManager STREAM_SYSTEM
int STREAM_SYSTEM
To view the source code for android.media AudioManager STREAM_SYSTEM.
Click Source Link
From source file:Main.java
public static void unmute() { audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, false); audioManager.setStreamMute(AudioManager.STREAM_MUSIC, false); }
From source file:Main.java
public static void setAudioManage(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true); audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true); audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_DTMF, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, 0); }
From source file:Main.java
public static void mute(Context context) { if (audioManager == null) { audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); }/*from w w w .j a v a 2s. c o m*/ audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true); audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true); }
From source file:com.prey.actions.picture.PictureUtil.java
private static byte[] getPicture(Context ctx, String focus) { AudioManager mgr = null;//from w w w .j av a 2s . c om SimpleCameraActivity.dataImagen = null; int streamType = AudioManager.STREAM_SYSTEM; SimpleCameraActivity.activity = null; Intent intent = new Intent(ctx, SimpleCameraActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("focus", focus); ctx.startActivity(intent); int i = 0; mgr = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); mgr.setStreamSolo(streamType, true); mgr.setRingerMode(AudioManager.RINGER_MODE_SILENT); mgr.setStreamMute(streamType, true); while (SimpleCameraActivity.activity == null && i < 10) { try { Thread.sleep(1000); } catch (InterruptedException e) { } i++; } if (SimpleCameraActivity.activity != null) { SimpleCameraActivity.activity.takePicture(ctx, focus); } try { Thread.sleep(4000); } catch (InterruptedException e) { } mgr.setStreamSolo(streamType, false); mgr.setRingerMode(AudioManager.RINGER_MODE_NORMAL); mgr.setStreamMute(streamType, false); try { i = 0; while (SimpleCameraActivity.activity != null && SimpleCameraActivity.dataImagen == null && i < 5) { Thread.sleep(2000); i++; } } catch (InterruptedException e) { PreyLogger.i("Error:" + e.getMessage()); } byte[] out = null; if (SimpleCameraActivity.activity != null) { out = SimpleCameraActivity.dataImagen; SimpleCameraActivity.activity.finish(); SimpleCameraActivity.activity = null; SimpleCameraActivity.dataImagen = null; } return out; }
From source file:com.google.android.car.kitchensink.volume.VolumeTestFragment.java
private static String streamToName(int stream) { switch (stream) { case AudioManager.STREAM_ALARM: return "Alarm"; case AudioManager.STREAM_MUSIC: return "Music"; case AudioManager.STREAM_NOTIFICATION: return "Notification"; case AudioManager.STREAM_RING: return "Ring"; case AudioManager.STREAM_VOICE_CALL: return "Call"; case AudioManager.STREAM_SYSTEM: return "System"; default://from w w w. j a v a 2 s . c o m return "Unknown"; } }
From source file:org.noise_planet.noisecapture.MeasurementService.java
@Override public void onCreate() { mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); this.measurementManager = new MeasurementManager(getApplicationContext()); // Display a notification about us starting. We put an icon in the status bar. showNotification();/* www. j a v a2s . c o m*/ // Mute NoiseCapture while measuring (do not capture android sounds) try { AudioManager mgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mgr.setStreamMute(AudioManager.STREAM_SYSTEM, true); } catch (SecurityException ex) { // Ignore } }
From source file:org.noise_planet.noisecapture.MeasurementService.java
@Override public void onDestroy() { // Hide notification mNM.cancel(NOTIFICATION);//from ww w.ja v a 2 s. com // Stop record if (isRecording()) { cancel(); } try { AudioManager mgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mgr.setStreamMute(AudioManager.STREAM_SYSTEM, false); } catch (SecurityException ex) { // Ignore } }
From source file:com.honglang.zxing.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow();/* w ww .j av a 2 s.com*/ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_capture); app = (HlApp) getApplication(); title = (TextView) this.findViewById(R.id.title); back = (Button) this.findViewById(R.id.back); back.setOnClickListener(this); // ok = (Button) this.findViewById(R.id.ok); // ok.setText(""); // ok.setVisibility(View.VISIBLE); // ok.setOnClickListener(this); linear = (LinearLayout) findViewById(R.id.out); jf = (LinearLayout) findViewById(R.id.jf); jf.setOnClickListener(this); pc = (LinearLayout) findViewById(R.id.pc); pc.setOnClickListener(this); qsno = (TextView) findViewById(R.id.qsno); jfCount = (TextView) findViewById(R.id.jfCount); jfRecords = (TextView) findViewById(R.id.jfRecords); jfCode = (TextView) findViewById(R.id.jfCode); pcno = (TextView) findViewById(R.id.pcno); pcCount = (TextView) findViewById(R.id.pcCount); pcRecords = (TextView) findViewById(R.id.pcRecords); pcCode = (TextView) findViewById(R.id.pcCode); count = (TextView) findViewById(R.id.count); record = (TextView) findViewById(R.id.record); sure = (Button) findViewById(R.id.sure); sure.setOnClickListener(this); soundPool = new SoundPool(4, AudioManager.STREAM_SYSTEM, 5); soundPool.load(this, R.raw.success, 1); soundPool.load(this, R.raw.done, 1); soundPool.load(this, R.raw.both, 1); soundPool.load(this, R.raw.failed, 1); TYPE = this.getIntent().getExtras().getInt("QRTYPE"); switch (TYPE) { case 0: title.setText("???"); break; case 1: title.setText("???"); break; case 2: title.setText("????"); break; case 3: title.setText("????"); break; case 4: title.setText("??"); break; case 5: title.setText("???"); break; case 6: title.setText(""); linear.setVisibility(View.VISIBLE); new NewTask().execute((Void) null); break; } hasSurface = false; historyManager = new HistoryManager(this); historyManager.trimHistory(); inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); ambientLightManager = new AmbientLightManager(this); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); }
From source file:com.thomasokken.free42.Free42Activity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); instance = this; int init_mode; IntHolder version = new IntHolder(); try {//from w w w . jav a2 s.co m stateFileInputStream = openFileInput("state"); } catch (FileNotFoundException e) { stateFileInputStream = null; } if (stateFileInputStream != null) { if (read_shell_state(version)) init_mode = 1; else { init_shell_state(-1); init_mode = 2; } } else { init_shell_state(-1); init_mode = 0; } setAlwaysRepaintFullDisplay(alwaysRepaintFullDisplay); if (alwaysOn) getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); if (style == 1) setTheme(android.R.style.Theme_NoTitleBar_Fullscreen); else if (style == 2) { try { Method m = View.class.getMethod("setSystemUiVisibility", int.class); m.invoke(getWindow().getDecorView(), PreferencesDialog.immersiveModeFlags); } catch (Exception e) { } } Configuration conf = getResources().getConfiguration(); orientation = conf.orientation == Configuration.ORIENTATION_LANDSCAPE ? 1 : 0; mainHandler = new Handler(); calcView = new CalcView(this); setContentView(calcView); printView = new PrintView(this); printScrollView = new ScrollView(this); printScrollView.setBackgroundColor(PRINT_BACKGROUND_COLOR); printScrollView.addView(printView); skin = null; if (skinName[orientation].length() == 0 && externalSkinName[orientation].length() > 0) { try { skin = new SkinLayout(externalSkinName[orientation], skinSmoothing[orientation], displaySmoothing[orientation]); } catch (IllegalArgumentException e) { } } if (skin == null) { try { skin = new SkinLayout(skinName[orientation], skinSmoothing[orientation], displaySmoothing[orientation]); } catch (IllegalArgumentException e) { } } if (skin == null) { try { skin = new SkinLayout(builtinSkinNames[0], skinSmoothing[orientation], displaySmoothing[orientation]); } catch (IllegalArgumentException e) { // This one should never fail; we're loading a built-in skin. } } nativeInit(); core_init(init_mode, version.value); if (stateFileInputStream != null) { try { stateFileInputStream.close(); } catch (IOException e) { } stateFileInputStream = null; } lowBatteryReceiver = new BroadcastReceiver() { public void onReceive(Context ctx, Intent intent) { low_battery = intent.getAction().equals(Intent.ACTION_BATTERY_LOW); Rect inval = skin.update_annunciators(-1, -1, -1, -1, low_battery ? 1 : 0, -1, -1); if (inval != null) calcView.postInvalidateScaled(inval.left, inval.top, inval.right, inval.bottom); } }; IntentFilter iff = new IntentFilter(); iff.addAction(Intent.ACTION_BATTERY_LOW); iff.addAction(Intent.ACTION_BATTERY_OKAY); registerReceiver(lowBatteryReceiver, iff); if (preferredOrientation != this.getRequestedOrientation()) setRequestedOrientation(preferredOrientation); soundPool = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0); int[] soundResourceIds = { R.raw.tone0, R.raw.tone1, R.raw.tone2, R.raw.tone3, R.raw.tone4, R.raw.tone5, R.raw.tone6, R.raw.tone7, R.raw.tone8, R.raw.tone9, R.raw.squeak, R.raw.click }; soundIds = new int[soundResourceIds.length]; for (int i = 0; i < soundResourceIds.length; i++) soundIds[i] = soundPool.load(this, soundResourceIds[i], 1); }
From source file:de.questmaster.fatremote.fragments.RemoteFragment.java
private void invokeSend() { // ring / vibrate if (!mSettings.isOverride() && mAudioManager.getStreamVolume(AudioManager.STREAM_SYSTEM) != 0 || (mSettings.isOverride() && mSettings.isTone())) { mAudioManager.playSoundEffect(AudioManager.FX_KEY_CLICK, 0.5f); }//from w w w . j a v a2 s . c o m if (mSettings.isVibrate()) { Vibrator vibrator = (Vibrator) c.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(25); } // Set sending image ImageView sending = (ImageView) c.findViewById(R.id.sendLED); sending.setImageResource(R.drawable.light_highlight); sending.invalidate(); // start sending NetworkProxy.getInstance(c).addRemoteEvent(new FATRemoteEvent(keyCode, keyModifier)); }