Remove SDK 16 support completely

Android 4.1 init miss several significant features Magisk reply on,
so the final decision is to forget about it in the future.

Pull minSdkVersion of Magisk Manager back to 17 and remove some
unnecessary adjustments done for SDK 16
This commit is contained in:
topjohnwu 2019-02-12 16:58:05 -05:00
parent 0f55fcafe8
commit c137f2de4f
26 changed files with 65 additions and 114 deletions

View File

@ -100,13 +100,9 @@ public class LocaleManager {
}
public static Context getLocaleContext(Context context, Locale locale) {
if (Build.VERSION.SDK_INT >= 17) {
Configuration config = new Configuration(context.getResources().getConfiguration());
config.setLocale(locale);
return context.createConfigurationContext(config);
} else {
return context;
}
Configuration config = new Configuration(context.getResources().getConfiguration());
config.setLocale(locale);
return context.createConfigurationContext(config);
}
public static Context getLocaleContext(Locale locale) {
@ -118,8 +114,6 @@ public class LocaleManager {
}
public static void loadAvailableLocales(@StringRes int compareId) {
if (Build.VERSION.SDK_INT < 17)
return;
Shell.EXECUTOR.execute(() -> {
locales = new ArrayList<>();
HashSet<String> set = new HashSet<>();

View File

@ -77,7 +77,7 @@ public class Utils {
public static String getAppLabel(ApplicationInfo info, PackageManager pm) {
try {
if (info.labelRes > 0 && Build.VERSION.SDK_INT >= 17) {
if (info.labelRes > 0) {
Resources res = pm.getResourcesForApplication(info);
Configuration config = new Configuration();
config.setLocale(LocaleManager.locale);

View File

@ -129,13 +129,8 @@ public class SuRequestActivity extends BaseActivity {
appIcon.setImageDrawable(policy.info.loadIcon(pm));
appNameView.setText(policy.appName);
packageNameView.setText(policy.packageName);
if (Build.VERSION.SDK_INT >= 17) {
warning.setCompoundDrawablesRelativeWithIntrinsicBounds(
AppCompatResources.getDrawable(this, R.drawable.ic_warning), null, null, null);
} else {
warning.setCompoundDrawablesWithIntrinsicBounds(
AppCompatResources.getDrawable(this, R.drawable.ic_warning), null, null, null);
}
warning.setCompoundDrawablesRelativeWithIntrinsicBounds(
AppCompatResources.getDrawable(this, R.drawable.ic_warning), null, null, null);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.allow_timeout, android.R.layout.simple_spinner_item);

View File

@ -73,7 +73,7 @@ public abstract class StringListAdapter<VH extends StringListAdapter.ViewHolder>
((Activity) rv.getContext()).getWindowManager()
.getDefaultDisplay().getMetrics(displayMetrics);
screenWidth = displayMetrics.widthPixels;
padding = rv.getPaddingLeft() + rv.getPaddingRight();
padding = rv.getPaddingStart() + rv.getPaddingEnd();
this.rv = rv;
}

View File

@ -111,10 +111,6 @@ public class SettingsFragment extends BasePreferenceFragment implements Topic.Su
setSummary();
// Remove language setting when API < 17
if (Build.VERSION.SDK_INT < 17)
generalCatagory.removePreference(findPreference(Config.Key.LOCALE));
// Disable dangerous settings in secondary user
if (Const.USER_ID > 0) {
suCategory.removePreference(multiuserConfig);

View File

@ -17,8 +17,8 @@
android:id="@+id/recyclerView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</HorizontalScrollView>

View File

@ -27,8 +27,8 @@
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp">
android:paddingStart="10dp"
android:paddingEnd="10dp">
<ImageView
android:id="@+id/app_icon"
@ -36,9 +36,7 @@
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0" />
<LinearLayout
@ -94,8 +92,8 @@
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingLeft="30dp"
android:paddingRight="30dp">
android:paddingStart="30dp"
android:paddingEnd="30dp">
<Button
android:id="@+id/deny_btn"

View File

@ -11,9 +11,9 @@
style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingStart="25dp"
android:paddingTop="12dp"
android:paddingRight="25dp"
android:paddingEnd="25dp"
android:paddingBottom="12dp"
android:textColor="?android:attr/textColorPrimary" />

View File

@ -3,9 +3,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingStart="15dp"
android:paddingTop="5dp"
android:paddingRight="15dp"
android:paddingEnd="15dp"
android:paddingBottom="5dp">
<TextView

View File

@ -23,9 +23,9 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">
@ -41,7 +41,6 @@
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
app:layout_constraintBottom_toBottomOf="@+id/app_name"
app:layout_constraintEnd_toStartOf="@+id/app_name"
app:layout_constraintHorizontal_bias="0.42"
@ -75,9 +74,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
android:visibility="gone"
app:cardCornerRadius="@dimen/card_corner_radius"
@ -111,7 +110,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:tint="?attr/imageColorTint"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/title"
@ -130,16 +128,16 @@
android:id="@+id/keep_force_enc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:text="@string/keep_force_encryption" />
<CheckBox
android:id="@+id/keep_verity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:text="@string/keep_dm_verity" />
</LinearLayout>
@ -153,9 +151,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">
@ -175,7 +173,6 @@
android:layout_height="30dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginBottom="12dp"
android:tint="@color/green500"
app:layout_constraintBottom_toBottomOf="parent"
@ -218,7 +215,6 @@
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/safetyNet_status"
app:layout_constraintTop_toTopOf="parent"
@ -247,7 +243,6 @@
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="@+id/cts_status"
app:layout_constraintEnd_toStartOf="@+id/cts_status"
app:layout_constraintTop_toTopOf="@+id/cts_status" />
@ -267,7 +262,6 @@
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="@+id/basic_status"
app:layout_constraintEnd_toStartOf="@+id/basic_status"
app:layout_constraintHorizontal_bias="0.5"
@ -299,9 +293,9 @@
style="?attr/cardStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">
@ -446,9 +440,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
android:clickable="true"
android:focusable="true"

View File

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
@ -21,8 +20,8 @@
android:layout_height="match_parent"
android:clipToPadding="false"
android:dividerHeight="@dimen/card_divider_space"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<TextView
android:id="@+id/empty_rv"

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swipeRefreshLayout"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"

View File

@ -1,10 +1,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.topjohnwu.magisk.fragments.SuLogFragment">
android:orientation="vertical">
<TextView
android:id="@+id/empty_rv"

View File

@ -1,9 +1,8 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/empty_rv"

View File

@ -6,9 +6,9 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
android:layout_marginRight="@dimen/card_horizontal_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginBottom="@dimen/card_vertical_margin"
android:minHeight="?android:attr/listPreferredItemHeight"
app:cardCornerRadius="@dimen/card_corner_radius"
@ -24,10 +24,8 @@
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="end"
app:layout_constraintBottom_toBottomOf="parent"
@ -69,9 +67,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:checked="false"
android:focusable="false"
app:layout_constraintBottom_toBottomOf="parent"

View File

@ -6,9 +6,9 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
android:layout_marginRight="@dimen/card_horizontal_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginBottom="@dimen/card_vertical_margin"
android:minHeight="?android:attr/listPreferredItemHeight"
app:cardCornerRadius="@dimen/card_corner_radius"
@ -90,9 +90,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:focusable="false"
app:layout_constraintBottom_toTopOf="@+id/description"
app:layout_constraintEnd_toStartOf="@+id/delete"

View File

@ -5,9 +5,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
android:layout_marginRight="@dimen/card_horizontal_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginBottom="@dimen/card_vertical_margin"
android:minHeight="?android:attr/listPreferredItemHeight"
app:cardCornerRadius="@dimen/card_corner_radius"
@ -28,10 +28,8 @@
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="end"
app:layout_constraintBottom_toBottomOf="parent"
@ -72,7 +70,6 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:tint="?attr/imageColorTint"
app:layout_constraintBottom_toBottomOf="@+id/package_name"
app:layout_constraintEnd_toEndOf="@+id/app_name"
@ -95,9 +92,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:checked="false"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent"
@ -125,7 +120,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:tint="@color/icon_grey"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/notification_switch"
@ -170,7 +164,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:checked="false"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent"

View File

@ -5,9 +5,9 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
android:layout_marginRight="@dimen/card_horizontal_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginBottom="@dimen/card_vertical_margin"
android:minHeight="?android:attr/listPreferredItemHeight"
app:cardCornerRadius="@dimen/card_corner_radius"
@ -101,7 +101,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"

View File

@ -5,9 +5,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="2dp"
android:layout_marginRight="@dimen/card_horizontal_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginBottom="2dp"
card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="@dimen/card_elevation">

View File

@ -14,7 +14,6 @@
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:tint="?attr/imageColorTint"
app:srcCompat="@drawable/ic_arrow" />

View File

@ -7,8 +7,8 @@
android:id="@+id/md_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:paddingTop="10dp" />
</ScrollView>

View File

@ -8,7 +8,6 @@
android:gravity="center_vertical"
android:maxLines="1"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:textAllCaps="true"
android:textColor="?colorAccent"
android:textSize="16sp"

View File

@ -4,9 +4,9 @@
style="?attr/cardStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
android:foreground="?android:attr/selectableItemBackground"
app:cardCornerRadius="@dimen/card_corner_radius"
@ -23,9 +23,7 @@
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/status"
@ -48,7 +46,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:maxLines="1"
android:paddingTop="3dp"
android:paddingBottom="3dp"
@ -102,7 +99,6 @@
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:maxLines="1"
android:text="@string/install"
android:visibility="gone"

View File

@ -34,7 +34,7 @@ subprojects {
defaultConfig {
if (minSdkVersion == null)
minSdkVersion 16
minSdkVersion 17
targetSdkVersion 28
}