am 898d6d96: am 7f2c9e94: Merge "Add a config override for ViewConfiguration#hasPermanentMenuKey" into klp-dev

* commit '898d6d964cb3b650b5c9bed2276310547e5455e0':
  Add a config override for ViewConfiguration#hasPermanentMenuKey
This commit is contained in:
Adam Powell
2014-03-13 23:53:38 +00:00
committed by Android Git Automerger
3 changed files with 42 additions and 6 deletions

View File

@@ -212,6 +212,14 @@ public class ViewConfiguration {
*/
private static final int OVERFLING_DISTANCE = 6;
/**
* Configuration values for overriding {@link #hasPermanentMenuKey()} behavior.
* These constants must match the definition in res/values/config.xml.
*/
private static final int HAS_PERMANENT_MENU_KEY_AUTODETECT = 0;
private static final int HAS_PERMANENT_MENU_KEY_TRUE = 1;
private static final int HAS_PERMANENT_MENU_KEY_FALSE = 2;
private final int mEdgeSlop;
private final int mFadingEdgeLength;
private final int mMinimumFlingVelocity;
@@ -296,12 +304,31 @@ public class ViewConfiguration {
mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
if (!sHasPermanentMenuKeySet) {
IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
try {
sHasPermanentMenuKey = !wm.hasNavigationBar();
sHasPermanentMenuKeySet = true;
} catch (RemoteException ex) {
sHasPermanentMenuKey = false;
final int configVal = res.getInteger(
com.android.internal.R.integer.config_overrideHasPermanentMenuKey);
switch (configVal) {
default:
case HAS_PERMANENT_MENU_KEY_AUTODETECT: {
IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
try {
sHasPermanentMenuKey = !wm.hasNavigationBar();
sHasPermanentMenuKeySet = true;
} catch (RemoteException ex) {
sHasPermanentMenuKey = false;
}
}
break;
case HAS_PERMANENT_MENU_KEY_TRUE:
sHasPermanentMenuKey = true;
sHasPermanentMenuKeySet = true;
break;
case HAS_PERMANENT_MENU_KEY_FALSE:
sHasPermanentMenuKey = false;
sHasPermanentMenuKeySet = true;
break;
}
}

View File

@@ -1401,4 +1401,12 @@
<item>333</item>
<item>353</item>
</string-array>
<!-- Override the default detection behavior for the framework method
android.view.ViewConfiguration#hasPermanentMenuKey().
Valid settings are:
0 - No change. Use the default autodetection behavior.
1 - The device DOES have a permanent menu key; ignore autodetection.
2 - The device DOES NOT have a permanent menu key; ignore autodetection. -->
<integer name="config_overrideHasPermanentMenuKey">0</integer>
</resources>

View File

@@ -318,6 +318,7 @@
<java-symbol type="integer" name="config_mobile_mtu" />
<java-symbol type="integer" name="config_volte_replacement_rat"/>
<java-symbol type="integer" name="config_valid_wappush_index" />
<java-symbol type="integer" name="config_overrideHasPermanentMenuKey" />
<java-symbol type="color" name="tab_indicator_text_v4" />