diff options
author | Steve Paik | 2018-06-21 14:20:42 -0500 |
---|---|---|
committer | Steve Paik | 2018-06-21 14:20:42 -0500 |
commit | 56328405e8a4acf2b2c9f748720d261befd815ff (patch) | |
tree | 8d9918d169ee096b648b3c32264d22067bf53f4e /service | |
parent | 15c90b5dee3af45e17bd77a6a82610c23eb9a3a7 (diff) | |
parent | de7be61a2dfb41c54550a4edcde65721f38d5422 (diff) | |
download | platform-packages-services-car-56328405e8a4acf2b2c9f748720d261befd815ff.tar.gz platform-packages-services-car-56328405e8a4acf2b2c9f748720d261befd815ff.tar.xz platform-packages-services-car-56328405e8a4acf2b2c9f748720d261befd815ff.zip |
resolve merge conflicts of de7be61a2dfb41c54550a4edcde65721f38d5422 to pi-dev-plus-aosp
BUG: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ie7032bba7be89a3de65ec300441fc84572e368f2
Diffstat (limited to 'service')
-rw-r--r-- | service/Android.mk | 6 | ||||
-rw-r--r-- | service/src/com/android/car/systeminterface/DisplayInterface.java | 44 |
2 files changed, 21 insertions, 29 deletions
diff --git a/service/Android.mk b/service/Android.mk index 2ec4c4a6..9ab7df36 100644 --- a/service/Android.mk +++ b/service/Android.mk | |||
@@ -27,6 +27,8 @@ include $(CLEAR_VARS) | |||
27 | 27 | ||
28 | LOCAL_SRC_FILES := $(car_service_sources) | 28 | LOCAL_SRC_FILES := $(car_service_sources) |
29 | 29 | ||
30 | LOCAL_USE_AAPT2 := true | ||
31 | |||
30 | LOCAL_PACKAGE_NAME := CarService | 32 | LOCAL_PACKAGE_NAME := CarService |
31 | LOCAL_PRIVATE_PLATFORM_APIS := true | 33 | LOCAL_PRIVATE_PLATFORM_APIS := true |
32 | 34 | ||
@@ -47,6 +49,8 @@ LOCAL_STATIC_JAVA_LIBRARIES += \ | |||
47 | car-systemtest \ | 49 | car-systemtest \ |
48 | com.android.car.procfsinspector-client \ | 50 | com.android.car.procfsinspector-client \ |
49 | 51 | ||
52 | include frameworks/base/packages/SettingsLib/common.mk | ||
53 | |||
50 | include $(BUILD_PACKAGE) | 54 | include $(BUILD_PACKAGE) |
51 | 55 | ||
52 | ##################################################################################### | 56 | ##################################################################################### |
@@ -74,6 +78,8 @@ LOCAL_STATIC_JAVA_LIBRARIES += \ | |||
74 | 78 | ||
75 | LOCAL_MIN_SDK_VERSION := 25 | 79 | LOCAL_MIN_SDK_VERSION := 25 |
76 | 80 | ||
81 | include frameworks/base/packages/SettingsLib/common.mk | ||
82 | |||
77 | include $(BUILD_STATIC_JAVA_LIBRARY) | 83 | include $(BUILD_STATIC_JAVA_LIBRARY) |
78 | 84 | ||
79 | include $(call all-makefiles-under,$(LOCAL_PATH)) | 85 | include $(call all-makefiles-under,$(LOCAL_PATH)) |
diff --git a/service/src/com/android/car/systeminterface/DisplayInterface.java b/service/src/com/android/car/systeminterface/DisplayInterface.java index 015f54dc..8dc7bd40 100644 --- a/service/src/com/android/car/systeminterface/DisplayInterface.java +++ b/service/src/com/android/car/systeminterface/DisplayInterface.java | |||
@@ -16,6 +16,10 @@ | |||
16 | 16 | ||
17 | package com.android.car.systeminterface; | 17 | package com.android.car.systeminterface; |
18 | 18 | ||
19 | import static com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MAX; | ||
20 | import static com.android.settingslib.display.BrightnessUtils.convertGammaToLinear; | ||
21 | import static com.android.settingslib.display.BrightnessUtils.convertLinearToGamma; | ||
22 | |||
19 | import android.content.ContentResolver; | 23 | import android.content.ContentResolver; |
20 | import android.content.Context; | 24 | import android.content.Context; |
21 | import android.database.ContentObserver; | 25 | import android.database.ContentObserver; |
@@ -60,20 +64,18 @@ public interface DisplayInterface { | |||
60 | new ContentObserver(new Handler(Looper.getMainLooper())) { | 64 | new ContentObserver(new Handler(Looper.getMainLooper())) { |
61 | @Override | 65 | @Override |
62 | public void onChange(boolean selfChange) { | 66 | public void onChange(boolean selfChange) { |
63 | int brightness = mMinimumBacklight; | 67 | int linear = GAMMA_SPACE_MAX; |
64 | int range = mMaximumBacklight - mMinimumBacklight; | ||
65 | 68 | ||
66 | try { | 69 | try { |
67 | brightness = System.getInt(mContentResolver, System.SCREEN_BRIGHTNESS); | 70 | linear = System.getInt(mContentResolver, System.SCREEN_BRIGHTNESS); |
68 | } catch (SettingNotFoundException e) { | 71 | } catch (SettingNotFoundException e) { |
69 | Log.e(CarLog.TAG_POWER, "Could not get SCREEN_BRIGHTNESS: " + e); | 72 | Log.e(CarLog.TAG_POWER, "Could not get SCREEN_BRIGHTNESS: " + e); |
70 | } | 73 | } |
71 | // Convert brightness from 0-255 to 0-100% | 74 | int gamma = convertLinearToGamma(linear, mMinimumBacklight, |
72 | brightness -= mMinimumBacklight; | 75 | mMaximumBacklight); |
73 | brightness *= 100; | 76 | int percentBright = (gamma * 100 + ((GAMMA_SPACE_MAX + 1) / 2)) |
74 | brightness += (range + 1) / 2; | 77 | / GAMMA_SPACE_MAX; |
75 | brightness /= range; | 78 | mService.sendDisplayBrightness(percentBright); |
76 | mService.sendDisplayBrightness(brightness); | ||
77 | } | 79 | } |
78 | }; | 80 | }; |
79 | 81 | ||
@@ -124,26 +126,10 @@ public interface DisplayInterface { | |||
124 | } | 126 | } |
125 | 127 | ||
126 | @Override | 128 | @Override |
127 | public void setDisplayBrightness(int brightness) { | 129 | public void setDisplayBrightness(int percentBright) { |
128 | // Brightness is set in percent. Need to convert this into 0-255 scale. The actual | 130 | int gamma = (percentBright * GAMMA_SPACE_MAX + 50) / 100; |
129 | // brightness algorithm should look like this: | 131 | int linear = convertGammaToLinear(gamma, mMinimumBacklight, mMaximumBacklight); |
130 | // | 132 | System.putInt(mContentResolver, System.SCREEN_BRIGHTNESS, linear); |
131 | // newBrightness = (brightness * (max - min)) + min | ||
132 | // | ||
133 | // Since we're using integer arithmetic, do the multiplication first, then add 50 to | ||
134 | // round up as needed. | ||
135 | brightness *= mMaximumBacklight - mMinimumBacklight; // Multiply by full range | ||
136 | brightness += 50; // Integer rounding | ||
137 | brightness /= 100; // Divide by 100 | ||
138 | brightness += mMinimumBacklight; | ||
139 | // Range checking | ||
140 | if (brightness < mMinimumBacklight) { | ||
141 | brightness = mMinimumBacklight; | ||
142 | } else if (brightness > mMaximumBacklight) { | ||
143 | brightness = mMaximumBacklight; | ||
144 | } | ||
145 | // Set the brightness | ||
146 | System.putInt(mContentResolver, System.SCREEN_BRIGHTNESS, brightness); | ||
147 | } | 133 | } |
148 | 134 | ||
149 | @Override | 135 | @Override |