Advertisement
deadman96385

display

Feb 8th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2015 The CyanogenMod Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16.  
  17. package org.cyanogenmod.hardware;
  18.  
  19. import cyanogenmod.hardware.DisplayMode;
  20. import org.cyanogenmod.hardware.util.FileUtils;
  21. import android.util.Log;
  22. import java.io.File;
  23.  
  24. /*
  25. * Display Modes API
  26. *
  27. * A device may implement a list of preset display modes for different
  28. * viewing intents, such as movies, photos, or extra vibrance. These
  29. * modes may have multiple components such as gamma correction, white
  30. * point adjustment, etc, but are activated by a single control point.
  31. *
  32. * This API provides support for enumerating and selecting the
  33. * modes supported by the hardware.
  34. */
  35.  
  36. public class DisplayModeControl {
  37.  
  38. private static String CONTROL_PATH = "/sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/mode";
  39.  
  40. private static final DisplayMode[] ALL_ITEMS = { new DisplayMode (0, Dynamic), (1, Standard), (2, Natural), (3, Movie), (4, Auto)};
  41.  
  42. /*
  43. * All HAF classes should export this boolean.
  44. * Real implementations must, of course, return true
  45. */
  46. public static boolean isSupported() {
  47. File f = new File(CONTROL_PATH);
  48.  
  49. if(f.exists()) {
  50. return true;
  51. } else {
  52. return false;
  53. }
  54. }
  55.  
  56. /*
  57. * Get the list of available modes. A mode has an integer
  58. * identifier and a string name.
  59. *
  60. * It is the responsibility of the upper layers to
  61. * map the name to a human-readable format or perform translation.
  62. */
  63. public static DisplayMode[] getAvailableModes() {
  64. return ALL_ITEMS
  65. }
  66.  
  67. /*
  68. * Get the name of the currently selected mode. This can return
  69. * null if no mode is selected.
  70. */
  71. public static DisplayMode getCurrentMode() {
  72. return (FileUtils.readOneLine(CONTROL_PATH);
  73. }
  74.  
  75. /*
  76. * Selects a mode from the list of available modes by it's
  77. * string identifier. Returns true on success, false for
  78. * failure. It is up to the implementation to determine
  79. * if this mode is valid.
  80. */
  81. public static boolean setMode(DisplayMode mode, boolean makeDefault) {
  82. return false;
  83. }
  84.  
  85. /*
  86. * Gets the preferred default mode for this device by it's
  87. * string identifier. Can return null if there is no default.
  88. */
  89. public static DisplayMode getDefaultMode() {
  90. return DisplayMode Auto;
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement