Merge "add config option for safe volume warning" into pi-dev
am: 5cd354c89c
Change-Id: If90bb4049e307084e6bf3b99fa22e5534826bda5
This commit is contained in:
@@ -40,4 +40,7 @@
|
||||
<item>INTERNET,airtelnet.es,,,vodafone,vodafone,,,,,214,01,1,DUN</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
|
||||
<bool name="config_safe_media_disable_on_volume_up">false</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -28,4 +28,8 @@
|
||||
<string-array translatable="false" name="config_tether_apndata">
|
||||
<item>Tethering Internet,web.omnitel.it,,,,,,,,,222,10,,DUN</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
|
||||
<bool name="config_safe_media_disable_on_volume_up">false</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
25
core/res/res/values-mcc234-mnc15/config.xml
Normal file
25
core/res/res/values-mcc234-mnc15/config.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2018, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
|
||||
<bool name="config_safe_media_disable_on_volume_up">false</bool>
|
||||
|
||||
</resources>
|
||||
25
core/res/res/values-mcc234-mnc91/config.xml
Normal file
25
core/res/res/values-mcc234-mnc91/config.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2018, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
|
||||
<bool name="config_safe_media_disable_on_volume_up">false</bool>
|
||||
|
||||
</resources>
|
||||
25
core/res/res/values-mcc262-mnc02/config.xml
Normal file
25
core/res/res/values-mcc262-mnc02/config.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2018, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
|
||||
<bool name="config_safe_media_disable_on_volume_up">false</bool>
|
||||
|
||||
</resources>
|
||||
@@ -2361,6 +2361,9 @@
|
||||
<!-- Whether safe headphone volume is enabled or not (country specific). -->
|
||||
<bool name="config_safe_media_volume_enabled">true</bool>
|
||||
|
||||
<!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
|
||||
<bool name="config_safe_media_disable_on_volume_up">true</bool>
|
||||
|
||||
<!-- Set to true if the wifi display supports compositing content stored
|
||||
in gralloc protected buffers. For this to be true, there must exist
|
||||
a protected hardware path for surface flinger to composite and send
|
||||
|
||||
@@ -309,6 +309,7 @@
|
||||
<java-symbol type="bool" name="config_allowAnimationsInLowPowerMode" />
|
||||
<java-symbol type="bool" name="config_useDevInputEventForAudioJack" />
|
||||
<java-symbol type="bool" name="config_safe_media_volume_enabled" />
|
||||
<java-symbol type="bool" name="config_safe_media_disable_on_volume_up" />
|
||||
<java-symbol type="bool" name="config_camera_sound_forced" />
|
||||
<java-symbol type="bool" name="config_dontPreferApn" />
|
||||
<java-symbol type="bool" name="config_restartRadioAfterProvisioning" />
|
||||
|
||||
@@ -21,11 +21,13 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Resources.NotFoundException;
|
||||
import android.media.AudioManager;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.WindowManager;
|
||||
|
||||
|
||||
import com.android.systemui.statusbar.phone.SystemUIDialog;
|
||||
|
||||
abstract public class SafetyWarningDialog extends SystemUIDialog
|
||||
@@ -40,12 +42,18 @@ abstract public class SafetyWarningDialog extends SystemUIDialog
|
||||
|
||||
private long mShowTime;
|
||||
private boolean mNewVolumeUp;
|
||||
private boolean mDisableOnVolumeUp;
|
||||
|
||||
public SafetyWarningDialog(Context context, AudioManager audioManager) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
mAudioManager = audioManager;
|
||||
|
||||
try {
|
||||
mDisableOnVolumeUp = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_safe_media_disable_on_volume_up);
|
||||
} catch (NotFoundException e) {
|
||||
mDisableOnVolumeUp = true;
|
||||
}
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
|
||||
setShowForAllUsers(true);
|
||||
setMessage(mContext.getString(com.android.internal.R.string.safe_media_volume_warning));
|
||||
@@ -63,7 +71,8 @@ abstract public class SafetyWarningDialog extends SystemUIDialog
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && event.getRepeatCount() == 0) {
|
||||
if (mDisableOnVolumeUp && keyCode == KeyEvent.KEYCODE_VOLUME_UP
|
||||
&& event.getRepeatCount() == 0) {
|
||||
mNewVolumeUp = true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
|
||||
Reference in New Issue
Block a user