Moves BrightnessUtils into SettingsLib DisplayUtils.

(Renamed from DisplayDensityUtils to be more generic)

This allows the AccessibilityMenu accessibility service APK
to include a much smaller dependency static library, decreasing
the post-optimization APK size from 3mb to 200kb.

Bug: 261252772
Test: build-only changes; check local & Treehugger builds
test: inspect AccessibilityMenu APK size
Change-Id: Iad36eb739ac38d923acabe558bc8f9c0395495d3
This commit is contained in:
Daniel Norman
2023-02-01 11:37:12 -08:00
parent e4cf24d703
commit 7bfe573602
8 changed files with 35 additions and 26 deletions

View File

@@ -42,7 +42,7 @@ android_library {
"SettingsLibAdaptiveIcon",
"SettingsLibRadioButtonPreference",
"SettingsLibSelectorWithWidgetPreference",
"SettingsLibDisplayDensityUtils",
"SettingsLibDisplayUtils",
"SettingsLibUtils",
"SettingsLibEmergencyNumber",
"SettingsLibTopIntroPreference",

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.settingslib.display">
</manifest>

View File

@@ -8,7 +8,7 @@ package {
}
android_library {
name: "SettingsLibDisplayDensityUtils",
name: "SettingsLibDisplayUtils",
srcs: ["src/**/*.java"],

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.settingslib.display">
</manifest>

View File

@@ -18,6 +18,7 @@ package com.android.settingslib.display;
import android.util.MathUtils;
/** Utility methods for calculating the display brightness. */
public class BrightnessUtils {
public static final int GAMMA_SPACE_MIN = 0;

View File

@@ -33,7 +33,7 @@ android_app {
static_libs: [
"junit",
"SettingsLibDeviceStateRotationLock",
"SettingsLibDisplayDensityUtils",
"SettingsLibDisplayUtils",
],
platform_apis: true,
certificate: "platform",
@@ -57,7 +57,7 @@ android_test {
"androidx.test.rules",
"mockito-target-minus-junit4",
"SettingsLibDeviceStateRotationLock",
"SettingsLibDisplayDensityUtils",
"SettingsLibDisplayUtils",
"platform-test-annotations",
"truth-prebuilt",
],

View File

@@ -25,9 +25,17 @@ android_app {
"androidx.coordinatorlayout_coordinatorlayout",
"androidx.core_core",
"androidx.viewpager_viewpager",
"SettingsLib",
"SettingsLibDisplayUtils",
],
optimize: {
enabled: true,
optimize: true,
shrink: true,
shrink_resources: true,
proguard_compatibility: false,
},
uses_libs: [
"org.apache.http.legacy",
],