lineage-sdk: Migrate to androidx
* Migrate from support library to androidx * Various improvements and cleanup by @bgcngm Change-Id: I10bbf5056125e8309f344c3eb18cc628bd7ec34e
This commit is contained in:
21
Android.bp
21
Android.bp
@@ -54,11 +54,8 @@ 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_JAVA_LIBRARIES = [
|
||||
"android-support-annotations",
|
||||
"android-support-v7-preference",
|
||||
"android-support-v7-recyclerview",
|
||||
"android-support-v14-preference",
|
||||
lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES = [
|
||||
"androidx.preference_preference",
|
||||
]
|
||||
|
||||
lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES = [
|
||||
@@ -79,11 +76,13 @@ lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES = [
|
||||
|
||||
java_library {
|
||||
name: "org.lineageos.platform",
|
||||
static_libs: ["telephony-ext"] + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
static_libs: [
|
||||
"telephony-ext"
|
||||
] + lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
|
||||
libs: [
|
||||
"services",
|
||||
] + lineage_sdk_LOCAL_JAVA_LIBRARIES,
|
||||
],
|
||||
|
||||
srcs: [
|
||||
lineage_sdk_src + "/**/*.java",
|
||||
@@ -105,8 +104,9 @@ java_library {
|
||||
java_library_static {
|
||||
name: "org.lineageos.platform.internal",
|
||||
required: ["services"],
|
||||
static_libs: ["telephony-ext"] + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
libs: lineage_sdk_LOCAL_JAVA_LIBRARIES,
|
||||
static_libs: [
|
||||
"telephony-ext"
|
||||
] + lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
|
||||
srcs: [
|
||||
lineage_sdk_src + "/**/*.java",
|
||||
@@ -128,8 +128,7 @@ java_library_static {
|
||||
java_library_static {
|
||||
name: "org.lineageos.platform.sdk",
|
||||
required: ["services"],
|
||||
libs: lineage_sdk_LOCAL_JAVA_LIBRARIES,
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
static_libs: lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES + lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES,
|
||||
|
||||
srcs: [
|
||||
lineage_sdk_src + "/**/*.java",
|
||||
|
||||
@@ -57,9 +57,6 @@ lineage_sdk_exclude_files := 'lineageos/library'
|
||||
LOCAL_JAR_EXCLUDE_PACKAGES := $(lineage_sdk_exclude_files)
|
||||
LOCAL_JAR_EXCLUDE_FILES := none
|
||||
|
||||
LOCAL_JAVA_LIBRARIES := \
|
||||
$(lineage_sdk_LOCAL_JAVA_LIBRARIES)
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := org.lineageos.platform.sdk
|
||||
|
||||
include $(BUILD_STATIC_JAVA_LIBRARY)
|
||||
@@ -72,9 +69,7 @@ lineage_platform_docs_src_files := \
|
||||
$(call all-html-files-under, $(lineage_sdk_src))
|
||||
|
||||
lineage_platform_docs_java_libraries := \
|
||||
android-support-v4 \
|
||||
org.lineageos.platform.sdk \
|
||||
$(lineage_sdk_LOCAL_JAVA_LIBRARIES)
|
||||
org.lineageos.platform.sdk
|
||||
|
||||
# SDK version as defined
|
||||
lineage_platform_docs_SDK_VERSION := 15.1
|
||||
|
||||
@@ -529,7 +529,7 @@ package lineageos.preference {
|
||||
ctor public SecureSettingSwitchPreference(android.content.Context);
|
||||
}
|
||||
|
||||
public class SelfRemovingDropDownPreference extends android.support.v7.preference.DropDownPreference {
|
||||
public class SelfRemovingDropDownPreference extends androidx.preference.DropDownPreference {
|
||||
ctor public SelfRemovingDropDownPreference(android.content.Context, android.util.AttributeSet, int);
|
||||
ctor public SelfRemovingDropDownPreference(android.content.Context, android.util.AttributeSet);
|
||||
ctor public SelfRemovingDropDownPreference(android.content.Context);
|
||||
@@ -537,7 +537,7 @@ package lineageos.preference {
|
||||
method public void setAvailable(boolean);
|
||||
}
|
||||
|
||||
public class SelfRemovingListPreference extends android.support.v7.preference.ListPreference {
|
||||
public class SelfRemovingListPreference extends androidx.preference.ListPreference {
|
||||
ctor public SelfRemovingListPreference(android.content.Context, android.util.AttributeSet, int);
|
||||
ctor public SelfRemovingListPreference(android.content.Context, android.util.AttributeSet);
|
||||
ctor public SelfRemovingListPreference(android.content.Context);
|
||||
@@ -545,7 +545,7 @@ package lineageos.preference {
|
||||
method public void setAvailable(boolean);
|
||||
}
|
||||
|
||||
public class SelfRemovingPreference extends android.support.v7.preference.Preference {
|
||||
public class SelfRemovingPreference extends androidx.preference.Preference {
|
||||
ctor public SelfRemovingPreference(android.content.Context, android.util.AttributeSet, int, int);
|
||||
ctor public SelfRemovingPreference(android.content.Context, android.util.AttributeSet, int);
|
||||
ctor public SelfRemovingPreference(android.content.Context, android.util.AttributeSet);
|
||||
@@ -554,7 +554,7 @@ package lineageos.preference {
|
||||
method public void setAvailable(boolean);
|
||||
}
|
||||
|
||||
public class SelfRemovingSwitchPreference extends android.support.v14.preference.SwitchPreference {
|
||||
public class SelfRemovingSwitchPreference extends androidx.preference.SwitchPreference {
|
||||
ctor public SelfRemovingSwitchPreference(android.content.Context, android.util.AttributeSet, int);
|
||||
ctor public SelfRemovingSwitchPreference(android.content.Context, android.util.AttributeSet);
|
||||
ctor public SelfRemovingSwitchPreference(android.content.Context);
|
||||
|
||||
@@ -23,11 +23,6 @@ android_app {
|
||||
privileged: true,
|
||||
|
||||
static_libs: [
|
||||
"android-support-v4",
|
||||
"android-support-v7-appcompat",
|
||||
"android-support-v7-preference",
|
||||
"android-support-v7-recyclerview",
|
||||
"android-support-v14-preference",
|
||||
"org.lineageos.platform.internal",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
-dontskipnonpubliclibraryclassmembers
|
||||
|
||||
# Keep test packages
|
||||
-keep class android.support.** { *; }
|
||||
-keep class androidx.** { *; }
|
||||
-keep class android.test.** { *; }
|
||||
-keep public class * extends android.support.** { *; }
|
||||
-keep public class * extends androidx.** { *; }
|
||||
-keep public class * extends android.test.** { *; }
|
||||
-keep interface android.support.** { *; }
|
||||
-keep interface androidx.** { *; }
|
||||
-keep interface android.test.** { *; }
|
||||
|
||||
# Keep all junit classes
|
||||
@@ -36,7 +36,7 @@
|
||||
-keep public class * extends android.os.IInterface { *; }
|
||||
|
||||
# Don't warn about the Android Support Test JUnit Runner
|
||||
-dontwarn android.support.**
|
||||
-dontwarn androidx.**
|
||||
-dontwarn android.test.**
|
||||
|
||||
# Don't warn about junit
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@@ -15,6 +14,8 @@ import android.widget.Button;
|
||||
import android.widget.RemoteViews;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -24,10 +24,6 @@ import android.content.pm.ResolveInfo;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
import android.support.v7.preference.PreferenceManager;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.ArraySet;
|
||||
import android.util.AttributeSet;
|
||||
@@ -35,6 +31,11 @@ import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.support.v7.preference.R;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -94,8 +93,9 @@ public class RemotePreference extends SelfRemovingPreference
|
||||
}
|
||||
|
||||
public RemotePreference(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, ConstraintsHelper.getAttr(
|
||||
context, R.attr.preferenceScreenStyle, android.R.attr.preferenceScreenStyle));
|
||||
this(context, attrs, ConstraintsHelper.getAttr(context,
|
||||
androidx.preference.R.attr.preferenceScreenStyle,
|
||||
android.R.attr.preferenceScreenStyle));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
package lineageos.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.DropDownPreference;
|
||||
import android.support.v7.preference.PreferenceDataStore;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.preference.DropDownPreference;
|
||||
import androidx.preference.PreferenceDataStore;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
/**
|
||||
* A Preference which can automatically remove itself from the hierarchy
|
||||
* based on constraints set in XML.
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
package lineageos.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.PreferenceDataStore;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.PreferenceDataStore;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
/**
|
||||
* A Preference which can automatically remove itself from the hierarchy
|
||||
* based on constraints set in XML.
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
package lineageos.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.support.v7.preference.R;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
/**
|
||||
* A Preference which can automatically remove itself from the hierarchy
|
||||
* based on constraints set in XML.
|
||||
@@ -40,8 +40,9 @@ public class SelfRemovingPreference extends Preference {
|
||||
}
|
||||
|
||||
public SelfRemovingPreference(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, ConstraintsHelper.getAttr(
|
||||
context, R.attr.preferenceStyle, android.R.attr.preferenceStyle));
|
||||
this(context, attrs, ConstraintsHelper.getAttr(context,
|
||||
androidx.preference.R.attr.preferenceStyle,
|
||||
android.R.attr.preferenceStyle));
|
||||
}
|
||||
|
||||
public SelfRemovingPreference(Context context) {
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
package lineageos.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.PreferenceDataStore;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.preference.PreferenceDataStore;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
/**
|
||||
* A SwitchPreference which can automatically remove itself from the hierarchy
|
||||
* based on constraints set in XML.
|
||||
|
||||
@@ -51,7 +51,7 @@ public class LineagePartsPreference extends RemotePreference {
|
||||
}
|
||||
|
||||
public LineagePartsPreference(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, android.support.v7.preference.R.attr.preferenceScreenStyle);
|
||||
this(context, attrs, androidx.preference.R.attr.preferenceScreenStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,11 +19,12 @@ package org.lineageos.internal.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.SystemProperties;
|
||||
import android.support.v7.preference.EditTextPreference;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.EditTextPreference;
|
||||
|
||||
import lineageos.providers.LineageSettings;
|
||||
|
||||
public class HostnamePreference extends EditTextPreference {
|
||||
|
||||
@@ -18,10 +18,11 @@ package org.lineageos.internal.preference.deviceinfo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import lineageos.preference.SelfRemovingPreference;
|
||||
|
||||
import org.lineageos.platform.internal.R;
|
||||
|
||||
@@ -4,4 +4,4 @@ tests which can be ran utilizing the InstrumentationTestRunner from android.
|
||||
|
||||
To run the tests (on a live device):
|
||||
|
||||
```adb shell am instrument -w org.lineageos.tests/android.support.test.runner.AndroidJUnitRunner```
|
||||
```adb shell am instrument -w org.lineageos.tests/androidx.test.runner.AndroidJUnitRunner```
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
-dontskipnonpubliclibraryclassmembers
|
||||
|
||||
# Keep test packages
|
||||
-keep class android.support.** { *; }
|
||||
-keep class androidx.** { *; }
|
||||
-keep class android.test.** { *; }
|
||||
-keep public class * extends android.support.** { *; }
|
||||
-keep public class * extends androidx.** { *; }
|
||||
-keep public class * extends android.test.** { *; }
|
||||
-keep interface android.support.** { *; }
|
||||
-keep interface androidx.** { *; }
|
||||
-keep interface android.test.** { *; }
|
||||
|
||||
# Keep all junit classes
|
||||
@@ -36,7 +36,7 @@
|
||||
-keep public class * extends android.os.IInterface { *; }
|
||||
|
||||
# Don't warn about the Android Support Test JUnit Runner
|
||||
-dontwarn android.support.**
|
||||
-dontwarn androidx.**
|
||||
-dontwarn android.test.**
|
||||
|
||||
# Don't warn about junit
|
||||
|
||||
@@ -23,6 +23,10 @@ import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import androidx.test.runner.AndroidJUnitRunner;
|
||||
|
||||
import org.lineageos.tests.LineageOSTestApplication;
|
||||
import org.lineageos.tests.versioning.unit.apiv2.ApiV2PriorReleaseInterfaces;
|
||||
import org.lineageos.tests.versioning.unit.apiv4.ApiV4PriorReleaseInterfaces;
|
||||
@@ -32,9 +36,6 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.support.test.runner.AndroidJUnitRunner;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
Reference in New Issue
Block a user