diff --git a/ApkManager/AdbWindow.xaml b/ApkManager/AdbWindow.xaml index 1881c5f..d419272 100644 --- a/ApkManager/AdbWindow.xaml +++ b/ApkManager/AdbWindow.xaml @@ -76,7 +76,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/ApkManager/AdbWindow.xaml.cs b/ApkManager/AdbWindow.xaml.cs index 3af87da..5a4f0fc 100644 --- a/ApkManager/AdbWindow.xaml.cs +++ b/ApkManager/AdbWindow.xaml.cs @@ -115,7 +115,7 @@ private async void ComboDevices_SelectionChanged(object sender, SelectionChanged txtDevice.Text = device.Name; txtAndroid.Text = device.Android; - txtArch.Text = device.Arch; + txtArch.Text = device.Abi; txtArch.Foreground = isArchCompatible ? txtArch.Foreground : Brushes.Red; txtArch.ToolTip = isArchCompatible ? null : "not compatible"; txtSdk.Text = device.Sdk.ToString(); diff --git a/ApkManager/Lib/Aapt.cs b/ApkManager/Lib/Aapt.cs index b88ba65..971f7e5 100644 --- a/ApkManager/Lib/Aapt.cs +++ b/ApkManager/Lib/Aapt.cs @@ -152,16 +152,7 @@ public static async Task DumbBadging(string pathApk) //native-code match = Regex.Match(output, "native-code: '([^:=]+)'"); - if (match.Success) - { - apk.AbiList = match.Groups[1].Value.Replace("' '",", "); - apk.Platforms = match.Groups[1].Value.Replace("' '"," ").Split(' ').ToList(); - } - else - { - apk.AbiList = "any-cpu"; - apk.Platforms.Add("any-cpu"); - } + apk.AbiList = match.Success ? match.Groups[1].Value.Replace("' '", ", ") : "Unknown"; //launchable-activity match = Regex.Match(output, "launchable-activity: name='(.+?)'"); diff --git a/ApkManager/Lib/Adb.cs b/ApkManager/Lib/Adb.cs index 2ad6e12..dfaf967 100644 --- a/ApkManager/Lib/Adb.cs +++ b/ApkManager/Lib/Adb.cs @@ -14,7 +14,7 @@ public class Device { public string Name { get; set; } public string Android { get; set; } - public string Arch { get; set; } + public string Abi { get; set; } public int Sdk { get; set; } public override string ToString() @@ -274,7 +274,7 @@ public async Task GetDevice(string address) var sdk = await GetProp(address, "ro.build.version.sdk"); int.TryParse(sdk, out int _sdk); - var arch = await GetProp(address, "ro.product.cpu.abi"); + var _abi = await GetProp(address, "ro.product.cpu.abi"); OnProcess?.Invoke(false); OVERRIDE_ONPROCESSEVENT = false; @@ -284,7 +284,7 @@ public async Task GetDevice(string address) Name = name, Android = android, Sdk = _sdk, - Arch = arch + Abi = _abi }; } } diff --git a/ApkManager/Lib/Apk.cs b/ApkManager/Lib/Apk.cs index 77d31c7..dd3b2a2 100644 --- a/ApkManager/Lib/Apk.cs +++ b/ApkManager/Lib/Apk.cs @@ -13,7 +13,6 @@ public class Apk public int TargetSdkVersion { get; set; } public BitmapImage Icon { get; set; } public IList Permissions { get; set; } - public IList Platforms { get; set; } public string AbiList { get; set; } public string FilePath { get; set; } public string LaunchableActivity { get; set; } @@ -21,34 +20,33 @@ public class Apk public Apk() { Permissions = new List(); - Platforms = new List(); } public bool isAbiCompatible(Adb.Device device) { - if (AbiList == "any-cpu") return true; + if (AbiList == "Unknown" || device.Abi == "Unknown") return true; - if (device.Arch == "armeabi-v7a") + if (device.Abi == "armeabi-v7a") { return AbiList.Contains("armeabi"); } - if (device.Arch == "arm64-v8a") + if (device.Abi == "arm64-v8a") { return AbiList.Contains("arm"); } - if (device.Arch == "x86_64") + if (device.Abi == "x86_64") { return AbiList.Contains("x86"); } - return AbiList.Contains(device.Arch); + return AbiList.Contains(device.Abi); } public bool isSdkCompatible(Adb.Device device) { - return SdkVersion <= device.Sdk; + return SdkVersion <= device.Sdk || device.Sdk == 0; } public bool canInstallTo(Adb.Device device) diff --git a/ApkManager/MainWindow.xaml b/ApkManager/MainWindow.xaml index b77b589..0a25035 100644 --- a/ApkManager/MainWindow.xaml +++ b/ApkManager/MainWindow.xaml @@ -100,7 +100,7 @@ - + @@ -109,7 +109,7 @@ - + diff --git a/ApkManager/MainWindow.xaml.cs b/ApkManager/MainWindow.xaml.cs index 215c052..0751d50 100644 --- a/ApkManager/MainWindow.xaml.cs +++ b/ApkManager/MainWindow.xaml.cs @@ -115,8 +115,8 @@ private async void TxtPath_TextChanged(object sender, TextChangedEventArgs e) txtLabel.Text = ". . . ."; txtPackage.Text = ". . . ."; txtVersion.Text = ". . . ."; - txtArch.Text = ". . . ."; - txtArch.ToolTip = null; + txtAbi.Text = ". . . ."; + txtAbi.ToolTip = null; txtSdk.Text = ". . . ."; imgIcon.Source = App.GetPlaystoreImageFromResources(); gbAction.IsEnabled = false; @@ -134,11 +134,11 @@ private async void TxtPath_TextChanged(object sender, TextChangedEventArgs e) txtPackage.Text = loadedApk.PackageName; txtVersion.Text = string.Format("{0} ( {1} )", loadedApk.VersionName, loadedApk.VersionCode); - var foundOne = loadedApk.Platforms.Count <= 1; - txtArch.Text = foundOne ? loadedApk.AbiList : "see list"; - txtArch.ToolTip = foundOne ? null : loadedApk.AbiList; - txtArch.FontStyle = foundOne ? FontStyles.Normal : FontStyles.Italic; - txtArch.Foreground = foundOne ? txtSdk.Foreground : Brushes.Blue; + var foundOne = !loadedApk.AbiList.Contains(","); + txtAbi.Text = foundOne ? loadedApk.AbiList : "see list"; + txtAbi.ToolTip = foundOne ? null : loadedApk.AbiList; + txtAbi.FontStyle = foundOne ? FontStyles.Normal : FontStyles.Italic; + txtAbi.Foreground = foundOne ? txtSdk.Foreground : Brushes.Blue; txtSdk.Text = loadedApk.SdkVersion.ToString(); imgIcon.Source = loadedApk.Icon; @@ -149,7 +149,7 @@ private async void TxtPath_TextChanged(object sender, TextChangedEventArgs e) txtLabel.Text = "file corrupt?"; txtPackage.Text = "not an apk file?"; txtVersion.Text = "???"; - txtArch.Text = "???"; + txtAbi.Text = "???"; txtSdk.Text = "???"; }