sdk: Introduce LineagePreferenceLib
Because of some nested dependency breakage, we can no longer include Android libraries in main SDK lib, therefore we are moving all preference related code to a separate package that Settings/LineageParts will depend on. Change-Id: Iea379a580a08ea13f71e3503aa096ba0ed7e7cef
This commit is contained in:
14
Android.bp
14
Android.bp
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2018-2021 The LineageOS Project
|
||||
// Copyright (C) 2018-2022 The LineageOS Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,6 @@ android_app {
|
||||
|
||||
resource_dirs: [
|
||||
"lineage/res/res",
|
||||
"sdk/res/res",
|
||||
],
|
||||
|
||||
// Create package-export.apk, which other packages can use to get
|
||||
@@ -66,11 +65,6 @@ lineage_sdk_src = "sdk/src/java/lineageos"
|
||||
lineage_sdk_internal_src = "sdk/src/java/org/lineageos/internal"
|
||||
library_src = "lineage/lib/main/java"
|
||||
|
||||
lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES = [
|
||||
"androidx.preference_preference",
|
||||
"SettingsLibMainSwitchPreference",
|
||||
]
|
||||
|
||||
lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES = [
|
||||
"android.hardware.usb-V1.3-java",
|
||||
"vendor.lineage.livedisplay-V2.0-java",
|
||||
@@ -94,7 +88,7 @@ java_library {
|
||||
name: "org.lineageos.platform",
|
||||
installable: true,
|
||||
sdk_version: "core_platform",
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
|
||||
libs: [
|
||||
"framework",
|
||||
@@ -124,7 +118,7 @@ java_library {
|
||||
java_library {
|
||||
name: "org.lineageos.platform.internal",
|
||||
required: ["services"],
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
|
||||
srcs: [
|
||||
lineage_sdk_src + "/**/*.java",
|
||||
@@ -149,7 +143,7 @@ java_library {
|
||||
java_library {
|
||||
name: "org.lineageos.platform.sdk",
|
||||
required: ["services"],
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
|
||||
srcs: [
|
||||
lineage_sdk_src + "/**/*.java",
|
||||
|
||||
32
packages/LineagePreferenceLib/Android.bp
Normal file
32
packages/LineagePreferenceLib/Android.bp
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Copyright (C) 2022 The LineageOS 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.
|
||||
//
|
||||
|
||||
android_library {
|
||||
name: "LineagePreferenceLib",
|
||||
min_sdk_version: "30",
|
||||
static_libs: [
|
||||
"androidx.preference_preference",
|
||||
"SettingsLibMainSwitchPreference",
|
||||
"org.lineageos.platform",
|
||||
],
|
||||
|
||||
srcs: ["java/**/*.java"],
|
||||
resource_dirs: ["res"],
|
||||
|
||||
aidl: {
|
||||
local_include_dirs: ["java"],
|
||||
},
|
||||
}
|
||||
2
packages/LineagePreferenceLib/AndroidManifest.xml
Normal file
2
packages/LineagePreferenceLib/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="lineageos.preference" />
|
||||
@@ -43,7 +43,8 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import lineageos.hardware.LineageHardwareManager;
|
||||
import lineageos.platform.R;
|
||||
import static lineageos.preference.R.styleable.lineage_SelfRemovingPreference_minSummaryLines;
|
||||
import static lineageos.preference.R.styleable.lineage_SelfRemovingPreference_replacesKey;
|
||||
|
||||
|
||||
/**
|
||||
@@ -78,8 +79,8 @@ public class ConstraintsHelper {
|
||||
|
||||
TypedArray a = context.getResources().obtainAttributes(attrs,
|
||||
R.styleable.lineage_SelfRemovingPreference);
|
||||
mSummaryMinLines = a.getInteger(R.styleable.lineage_SelfRemovingPreference_minSummaryLines, -1);
|
||||
String replacesKey = a.getString(R.styleable.lineage_SelfRemovingPreference_replacesKey);
|
||||
mSummaryMinLines = a.getInteger(lineage_SelfRemovingPreference_minSummaryLines, -1);
|
||||
String replacesKey = a.getString(lineage_SelfRemovingPreference_replacesKey);
|
||||
if (replacesKey != null) {
|
||||
mReplacesKey = replacesKey.split("\\|");
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.lineageos.internal.lineageparts;
|
||||
package lineageos.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.internal.lineageparts;
|
||||
package lineageos.preference;
|
||||
|
||||
parcelable PartInfo;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.lineageos.internal.lineageparts;
|
||||
package lineageos.preference;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.lineageos.internal.lineageparts;
|
||||
package lineageos.preference;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -42,8 +42,8 @@ import static com.android.internal.R.styleable.Preference_icon;
|
||||
import static com.android.internal.R.styleable.Preference_key;
|
||||
import static com.android.internal.R.styleable.Preference_summary;
|
||||
import static com.android.internal.R.styleable.Preference_title;
|
||||
import static lineageos.platform.R.styleable.lineage_Searchable;
|
||||
import static lineageos.platform.R.styleable.lineage_Searchable_xmlRes;
|
||||
import static lineageos.preference.R.styleable.lineage_Searchable;
|
||||
import static lineageos.preference.R.styleable.lineage_Searchable_xmlRes;
|
||||
|
||||
public class PartsList {
|
||||
|
||||
14
packages/LineagePreferenceLib/res/values/public.xml
Normal file
14
packages/LineagePreferenceLib/res/values/public.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<resources>
|
||||
|
||||
<public type="attr" name="requiresPackage" />
|
||||
<public type="attr" name="requiresFeature" />
|
||||
<public type="attr" name="requiresConfig" />
|
||||
<public type="attr" name="requiresConfigMask" />
|
||||
<public type="attr" name="requiresProperty" />
|
||||
<public type="attr" name="requiresOwner" />
|
||||
<public type="attr" name="xmlRes" />
|
||||
<public type="attr" name="requiresAction" />
|
||||
<public type="attr" name="replacesKey" />
|
||||
<public type="attr" name="minSummaryLines" />
|
||||
|
||||
</resources>
|
||||
@@ -1,14 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<public type="attr" name="requiresPackage" id="0x3f010002" />
|
||||
<public type="attr" name="requiresFeature" id="0x3f010003" />
|
||||
<public type="attr" name="requiresConfig" id="0x3f010004" />
|
||||
<public type="attr" name="requiresConfigMask" id="0x3f01000b" />
|
||||
<public type="attr" name="requiresProperty" id="0x3f010005" />
|
||||
<public type="attr" name="requiresOwner" id="0x3f010006" />
|
||||
<public type="attr" name="xmlRes" id="0x3f010007" />
|
||||
<public type="attr" name="requiresAction" id="0x3f010008" />
|
||||
<public type="attr" name="replacesKey" id="0x3f010009" />
|
||||
<public type="attr" name="minSummaryLines" id="0x3f01000a" />
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user