OSDN Git Service

Remove calls to silence ringer; these require new permissions in N
authorEino-Ville Talvala <etalvala@google.com>
Wed, 24 Aug 2016 22:35:00 +0000 (15:35 -0700)
committerEino-Ville Talvala <etalvala@google.com>
Wed, 24 Aug 2016 22:35:00 +0000 (15:35 -0700)
In N, only applications with permission to manage do-not-disturb
or notification settings are allowed to silence the ringer.

Requesting that permission is not straightforward, and may not be
the right solution, so for now, disable the ringer muting for video
recording.

Bug: 29591150
Change-Id: I630812c0e4ca813bf4fa123321d60a4be6c2fbf7

src/com/android/camera/VideoModule.java

index 3465953..9a941c7 100644 (file)
@@ -1323,25 +1323,14 @@ public class VideoModule extends CameraModule
         // Store current ringer mode so we can set it once video recording is
         // finished.
         mOriginalRingerMode = mAudioManager.getRingerMode();
-        // Make sure no system sounds and vibrations happen during video
-        // recording.
-        try {
-            mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
-        } catch (SecurityException e) {
-            Log.e(TAG, "Error: " + e);
-        }
+        // TODO: Use new DND APIs to properly silence device
     }
 
     private void restoreRingerMode() {
         // First check if ringer mode was changed during the recording. If not,
         // re-set the mode that was set before video recording started.
         if (mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT) {
-            // Set the original ringer mode back.
-            try {
-                mAudioManager.setRingerMode(mOriginalRingerMode);
-            } catch (SecurityException e) {
-                Log.e(TAG, "Error: " + e);
-            }
+            // TODO: Use new DND APIs to properly restore device notification/alarm settings
         }
     }