Merge "Add settings for altering VR display behavior." into nyc-dev
This commit is contained in:
@@ -6059,6 +6059,15 @@
|
|||||||
applications in virtual reality mode.
|
applications in virtual reality mode.
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<!-- Title for what display preferences are applied when device is in VR mode -->
|
||||||
|
<string name="display_vr_pref_title">When device is in VR mode</string>
|
||||||
|
|
||||||
|
<!-- [CHAR LIMIT=70] Put display into low-persistence mode, this decreases motion blur. -->
|
||||||
|
<string name="display_vr_pref_low_persistence">Use low motion blur settings</string>
|
||||||
|
|
||||||
|
<!-- [CHAR LIMIT=70] Do not change display settings. -->
|
||||||
|
<string name="display_vr_pref_off">Do nothing</string>
|
||||||
|
|
||||||
<!-- Sound & notification > Advanced section: Title for managing Do Not Disturb access option. [CHAR LIMIT=40] -->
|
<!-- Sound & notification > Advanced section: Title for managing Do Not Disturb access option. [CHAR LIMIT=40] -->
|
||||||
<string name="manage_zen_access_title">Do Not Disturb access</string>
|
<string name="manage_zen_access_title">Do Not Disturb access</string>
|
||||||
|
|
||||||
@@ -6938,7 +6947,7 @@
|
|||||||
<!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
|
<!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
|
||||||
<string name="allow_overlay_description">This permission allows an app to display on top of other apps you\u2019re using and may interfere with your use of the interface in other applications, or change what you think you are seeing in other applications.</string>
|
<string name="allow_overlay_description">This permission allows an app to display on top of other apps you\u2019re using and may interfere with your use of the interface in other applications, or change what you think you are seeing in other applications.</string>
|
||||||
|
|
||||||
<!-- Keyword for VR settinsg -->
|
<!-- Keyword for VR setting -->
|
||||||
<string name="keywords_vr_listener">vr virtual reality listener stereo helper service</string>
|
<string name="keywords_vr_listener">vr virtual reality listener stereo helper service</string>
|
||||||
<!-- Keyword for SYSTEM_ALERT_WINDOW -->
|
<!-- Keyword for SYSTEM_ALERT_WINDOW -->
|
||||||
<string name="keywords_system_alert_window">system alert window dialog draw on top other apps</string>
|
<string name="keywords_system_alert_window">system alert window dialog draw on top other apps</string>
|
||||||
|
@@ -106,4 +106,9 @@
|
|||||||
settings:keywords="@string/keywords_display_cast_screen"
|
settings:keywords="@string/keywords_display_cast_screen"
|
||||||
android:fragment="com.android.settings.wfd.WifiDisplaySettings" />
|
android:fragment="com.android.settings.wfd.WifiDisplaySettings" />
|
||||||
|
|
||||||
|
<DropDownPreference
|
||||||
|
android:key="vr_display_pref"
|
||||||
|
android:summary="%s"
|
||||||
|
android:title="@string/display_vr_pref_title" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -17,12 +17,14 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.ActivityManager;
|
||||||
import android.app.UiModeManager;
|
import android.app.UiModeManager;
|
||||||
import android.app.WallpaperManager;
|
import android.app.WallpaperManager;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
@@ -87,6 +89,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
private static final String KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE
|
private static final String KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE
|
||||||
= "camera_double_tap_power_gesture";
|
= "camera_double_tap_power_gesture";
|
||||||
private static final String KEY_WALLPAPER = "wallpaper";
|
private static final String KEY_WALLPAPER = "wallpaper";
|
||||||
|
private static final String KEY_VR_DISPLAY_PREF = "vr_display_pref";
|
||||||
|
|
||||||
private Preference mFontSizePref;
|
private Preference mFontSizePref;
|
||||||
|
|
||||||
@@ -207,6 +210,40 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
removePreference(KEY_AUTO_ROTATE);
|
removePreference(KEY_AUTO_ROTATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isVrDisplayModeAvailable(activity)) {
|
||||||
|
DropDownPreference vrDisplayPref =
|
||||||
|
(DropDownPreference) findPreference(KEY_VR_DISPLAY_PREF);
|
||||||
|
vrDisplayPref.setEntries(new CharSequence[] {
|
||||||
|
activity.getString(R.string.display_vr_pref_low_persistence),
|
||||||
|
activity.getString(R.string.display_vr_pref_off),
|
||||||
|
});
|
||||||
|
vrDisplayPref.setEntryValues(new CharSequence[] { "0", "1" });
|
||||||
|
|
||||||
|
final Context c = activity;
|
||||||
|
int currentUser = ActivityManager.getCurrentUser();
|
||||||
|
int current = Settings.Secure.getIntForUser(c.getContentResolver(),
|
||||||
|
Settings.Secure.VR_DISPLAY_MODE,
|
||||||
|
/*default*/Settings.Secure.VR_DISPLAY_MODE_LOW_PERSISTENCE,
|
||||||
|
currentUser);
|
||||||
|
vrDisplayPref.setValueIndex(current);
|
||||||
|
vrDisplayPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
int i = Integer.parseInt((String) newValue);
|
||||||
|
int u = ActivityManager.getCurrentUser();
|
||||||
|
if (!Settings.Secure.putIntForUser(c.getContentResolver(),
|
||||||
|
Settings.Secure.VR_DISPLAY_MODE,
|
||||||
|
i, u)) {
|
||||||
|
Log.e(TAG, "Could not change setting for " +
|
||||||
|
Settings.Secure.VR_DISPLAY_MODE);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
removePreference(KEY_VR_DISPLAY_PREF);
|
||||||
|
}
|
||||||
|
|
||||||
mNightModePreference = (ListPreference) findPreference(KEY_NIGHT_MODE);
|
mNightModePreference = (ListPreference) findPreference(KEY_NIGHT_MODE);
|
||||||
if (mNightModePreference != null) {
|
if (mNightModePreference != null) {
|
||||||
final UiModeManager uiManager = (UiModeManager) getSystemService(
|
final UiModeManager uiManager = (UiModeManager) getSystemService(
|
||||||
@@ -256,6 +293,11 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled);
|
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isVrDisplayModeAvailable(Context context) {
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
return pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateTimeoutPreferenceDescription(long currentTimeout) {
|
private void updateTimeoutPreferenceDescription(long currentTimeout) {
|
||||||
TimeoutListPreference preference = mScreenTimeoutPreference;
|
TimeoutListPreference preference = mScreenTimeoutPreference;
|
||||||
String summary;
|
String summary;
|
||||||
@@ -515,6 +557,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
if (!isCameraDoubleTapPowerGestureAvailable(context.getResources())) {
|
if (!isCameraDoubleTapPowerGestureAvailable(context.getResources())) {
|
||||||
result.add(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
|
result.add(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
|
||||||
}
|
}
|
||||||
|
if (!isVrDisplayModeAvailable(context)) {
|
||||||
|
result.add(KEY_VR_DISPLAY_PREF);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user