Merge tag 'android-6.0.0_r26' into HEAD

Android 6.0.0 release 26

* tag 'android-6.0.0_r26':
  Import translations. DO NOT MERGE
  Fix for safe_media_volume regulation. Equalizer range up to 10 dB
  Import translations. DO NOT MERGE

Change-Id: Ie3abf43605e7e177e79a3d7f5b8daf49ec10eb5f
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 23fb295..031e2aa 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -19,7 +19,7 @@
     <string name="app_name" msgid="5717136097222561957">"MusicFX"</string>
     <string name="no_effects" msgid="5067916002004255814">"Effekte nicht verfügbar"</string>
     <string name="eq_dialog_title" msgid="2020244436368289652">"Equalizer"</string>
-    <string name="headset_plug" msgid="4505819850289423141">"Für diese Effekte benötigen Sie Kopfhörer."</string>
+    <string name="headset_plug" msgid="4505819850289423141">"Für diese Effekte brauchst du Kopfhörer."</string>
     <string name="bass_boost_strength" msgid="882301530007752270">"Bassverstärkung"</string>
     <string name="virtualizer_strength" msgid="106561253469770096">"Surround-Sound"</string>
     <string name="setup" msgid="1103677904576339192">"Einrichtung"</string>
diff --git a/src/com/android/musicfx/ActivityMusic.java b/src/com/android/musicfx/ActivityMusic.java
index fb0b43a..328a923 100644
--- a/src/com/android/musicfx/ActivityMusic.java
+++ b/src/com/android/musicfx/ActivityMusic.java
@@ -73,6 +73,16 @@
     private final static int EQUALIZER_MAX_BANDS = 32;
 
     /**
+     * Max levels per EQ band in millibels (1 dB = 100 mB)
+     */
+    private final static int EQUALIZER_MAX_LEVEL = 1000;
+
+    /**
+     * Min levels per EQ band in millibels (1 dB = 100 mB)
+     */
+    private final static int EQUALIZER_MIN_LEVEL = -1000;
+
+    /**
      * Indicates if Virtualizer effect is supported.
      */
     private boolean mVirtualizerSupported;
@@ -633,8 +643,8 @@
                 mCallingPackageName, mAudioSession, ControlPanelEffect.Key.eq_center_freq);
         final int[] bandLevelRange = ControlPanelEffect.getParameterIntArray(mContext,
                 mCallingPackageName, mAudioSession, ControlPanelEffect.Key.eq_level_range);
-        mEqualizerMinBandLevel = bandLevelRange[0];
-        final int mEqualizerMaxBandLevel = bandLevelRange[1];
+        mEqualizerMinBandLevel = (int) Math.max(EQUALIZER_MIN_LEVEL, bandLevelRange[0]);
+        final int mEqualizerMaxBandLevel = (int) Math.min(EQUALIZER_MAX_LEVEL, bandLevelRange[1]);
 
         for (int band = 0; band < mNumberEqualizerBands; band++) {
             // Unit conversion from mHz to Hz and use k prefix if necessary to display
@@ -661,13 +671,12 @@
             eqcontainer.findViewById(EQViewElementIds[band][1]).setVisibility(View.GONE);
         }
 
-        // TODO: get the actual values from somewhere
         TextView tv = (TextView) findViewById(R.id.maxLevelText);
-        tv.setText("+15 dB");
+        tv.setText(String.format("+%d dB", (int) Math.ceil(mEqualizerMaxBandLevel / 100)));
         tv = (TextView) findViewById(R.id.centerLevelText);
         tv.setText("0 dB");
         tv = (TextView) findViewById(R.id.minLevelText);
-        tv.setText("-15 dB");
+        tv.setText(String.format("%d dB", (int) Math.floor(mEqualizerMinBandLevel / 100)));
         equalizerUpdateDisplay();
     }