Skip to content

Commit

Permalink
Overlay Compilers: Add min and target SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Sep 25, 2023
1 parent bc1051f commit 394ee95
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Const;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.FileUtil;
Expand All @@ -14,6 +16,8 @@
import com.topjohnwu.superuser.Shell;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class MonetCompiler {

Expand Down Expand Up @@ -125,7 +129,15 @@ private static void postExecute(boolean hasErroredOut) {
}

private static boolean createManifest(String pkgName, String source) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + Const.FRAMEWORK_PACKAGE + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + Const.FRAMEWORK_PACKAGE + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + pkgName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import static com.drdisagree.iconify.utils.apksigner.CryptoUtils.readPrivateKey;
import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.Iconify;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.apksigner.JarMap;
Expand All @@ -19,6 +21,8 @@
import java.nio.file.Paths;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class OnBoardingCompiler {
Expand All @@ -32,7 +36,15 @@ public static boolean createManifest(String name, String target, String source)
int attempt = 3;

while (attempt-- != 0) {
result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + name + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + name + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess()) {
Log.i(TAG + " - Manifest", "Successfully created manifest for " + name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.FileUtil;
import com.drdisagree.iconify.utils.OverlayUtil;
Expand All @@ -13,6 +15,8 @@
import com.topjohnwu.superuser.Shell;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class OnDemandCompiler {

Expand Down Expand Up @@ -128,7 +132,15 @@ private static void moveOverlaysToCache() {
}

private static boolean createManifest(String overlayName, String source) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + overlayName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + mPackage + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + overlayName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + mPackage + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + overlayName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import static com.drdisagree.iconify.common.Const.SYSTEMUI_PACKAGE;
import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.FileUtil;
import com.drdisagree.iconify.utils.OverlayUtil;
Expand All @@ -15,6 +17,8 @@
import com.topjohnwu.superuser.Shell;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class QsMarginCompiler {

Expand Down Expand Up @@ -145,7 +149,15 @@ private static void postExecute(boolean hasErroredOut) {
}

private static boolean createManifest(String pkgName, String source, String target) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + pkgName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Const;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.FileUtil;
Expand All @@ -14,6 +16,8 @@
import com.topjohnwu.superuser.Shell;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class QsTileHeightCompiler {

Expand Down Expand Up @@ -125,7 +129,15 @@ private static void postExecute(boolean hasErroredOut) {
}

private static boolean createManifest(String pkgName, String source) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + Const.SYSTEMUI_PACKAGE + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + Const.SYSTEMUI_PACKAGE + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + pkgName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import static com.drdisagree.iconify.common.Const.SYSTEMUI_PACKAGE;
import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.FileUtil;
import com.drdisagree.iconify.utils.OverlayUtil;
Expand All @@ -15,6 +17,8 @@
import com.topjohnwu.superuser.Shell;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class RoundnessCompiler {

Expand Down Expand Up @@ -145,7 +149,15 @@ private static void postExecute(boolean hasErroredOut) {
}

private static boolean createManifest(String pkgName, String source, String target) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + pkgName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.FileUtil;
import com.drdisagree.iconify.utils.OverlayUtil;
Expand All @@ -13,6 +15,8 @@
import com.topjohnwu.superuser.Shell;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class SettingsIconsCompiler {
Expand Down Expand Up @@ -171,7 +175,15 @@ private static void moveOverlaysToCache() {
}

private static boolean createManifest(String overlayName, String pkgName, String source) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + overlayName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + pkgName + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + overlayName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + pkgName + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + pkgName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.FileUtil;
import com.drdisagree.iconify.utils.OverlayUtil;
Expand All @@ -13,6 +15,8 @@
import com.topjohnwu.superuser.Shell;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class SwitchCompiler {

Expand Down Expand Up @@ -148,7 +152,15 @@ private static void moveOverlaysToCache() {
}

private static boolean createManifest(String overlayName, String mPackage, String source) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + overlayName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + mPackage + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + overlayName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + mPackage + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + overlayName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import static com.drdisagree.iconify.common.Dynamic.ZIP;
import static com.drdisagree.iconify.utils.helpers.Logger.writeLog;

import android.os.Build;
import android.util.Log;

import com.drdisagree.iconify.BuildConfig;
import com.drdisagree.iconify.common.Resources;
import com.drdisagree.iconify.utils.AppUtil;
import com.drdisagree.iconify.utils.FileUtil;
Expand All @@ -17,6 +19,8 @@

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class VolumeCompiler {
Expand Down Expand Up @@ -123,7 +127,15 @@ private static void postExecute(boolean hasErroredOut) throws Exception {
}

private static boolean createManifest(String pkgName, String target, String source) {
Shell.Result result = Shell.cmd("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">\\n\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />\\n\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />\\n</manifest>' > " + source + "/AndroidManifest.xml;").exec();
List<String> module = new ArrayList<>();
module.add("printf '<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
module.add("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"v1.0\" package=\"IconifyComponent" + pkgName + ".overlay\">");
module.add("\\t<uses-sdk android:minSdkVersion=\"" + BuildConfig.MIN_SDK_VERSION + "\" android:targetSdkVersion=\"" + Build.VERSION.SDK_INT + "\" />");
module.add("\\t<overlay android:priority=\"1\" android:targetPackage=\"" + target + "\" />");
module.add("\\t<application android:allowBackup=\"false\" android:hasCode=\"false\" />");
module.add("</manifest>' > " + source + "/AndroidManifest.xml;");

Shell.Result result = Shell.cmd(String.join("\\n", module)).exec();

if (result.isSuccess())
Log.i(TAG + " - Manifest", "Successfully created manifest for " + pkgName);
Expand Down

0 comments on commit 394ee95

Please sign in to comment.