From c030ab2c165b64a81a7697ce001e971000abbfa1 Mon Sep 17 00:00:00 2001 From: gfdgd xi <3025613752@qq.com> Date: Sun, 19 Jun 2022 14:03:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E7=9A=84=E6=9C=AA=E7=9F=A5?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E5=AE=89=E8=A3=85=E5=BC=80=E5=90=AF=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Language.json | 30 ++++++++++++++++++++++-- api/__init__.py | 15 ++++++++++++ api/__pycache__/__init__.cpython-37.pyc | Bin 0 -> 16047 bytes information.json | 2 +- main.py | 22 ++++++++++++++--- 5 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 api/__pycache__/__init__.cpython-37.pyc diff --git a/Language.json b/Language.json index cc6f332..c400f98 100644 --- a/Language.json +++ b/Language.json @@ -27,6 +27,18 @@ "ApkFileError": "该应用安装包异常,无法查询相关数据!", "InputDataError": "你输入的数值不正确!" }, + "Information": { + "Title": "提示", + "CompleteInformation": "完成" + }, + "Answer": { + "Title": "提示", + "AllowOrDisallowUpdateAndroidAppAnswer": [ + "你确定要启用 UEngine 可以安装以及使用默认的更新程序升级应用?(即允许未知来源)", + "你确定要禁用 UEngine 可以安装以及使用默认的更新程序升级应用?(即禁止未知来源)" + ], + "UseAdbPackageAnswer": "你没有安装 adb 补丁,必须安装才能继续。是否安装?" + }, "Menu": [ { "Name": "程序", @@ -120,7 +132,8 @@ "安装默认的 UEngine 镜像" ] }, - "在 Ubuntu 上安装 UEngine" + "在 Ubuntu 上安装 UEngine", + "(不)允许安装未知来源应用(即支持UEngine安装的安卓程序程序更新)" ] }, { @@ -179,6 +192,18 @@ "ApkFileError": "This apk file is error and can't find any data about the apk file!", "InputDataError": "Your input error data!" }, + "Information": { + "Title": "Tips", + "CompleteInformation": "Complete!" + }, + "Answer": { + "Title": "Tips", + "AllowOrDisallowUpdateAndroidAppAnswer": [ + "Are you sure to allow UEngine to install or update other android program? (Allow )(即允许未知来源)", + "Are you sure to disallow UEngine to install or update other android program? (Allow )(即允许未知来源)" + ], + "UseAdbPackageAnswer": "You don't install adb package with UEngine, you must install, and after install you can connect to set.\nDo you want to install?" + }, "Menu": [ { "Name": "Program", @@ -272,7 +297,8 @@ "Install Defult UEngine Image" ] }, - "Install UEngine On Ubuntu" + "Install UEngine On Ubuntu", + "Allow/Disallow UEngine To Install Or Update Other Android Program" ] }, { diff --git a/api/__init__.py b/api/__init__.py index 2ab579b..9409c47 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -319,6 +319,12 @@ class UEngine: os.system("pkexec uengine-bridge.sh force-reload") class Adb: + def __init__(self, ip=""): + self.ip = ip + + def connect(self): + os.system(f"adb connect {self.ip}") + class Service: def Open(): os.system("adb start-server") @@ -327,6 +333,12 @@ class Adb: def Kill(): os.system("killall adb") + def boolAndroidInstallOtherAppSetting(self): + return subprocess.getoutput(f"adb -s {self.ip} shell settings get secure install_non_market_apps").replace(" ", "") == "1" + + def setAndroidInstallOtherAppSetting(self, op: bool): + os.system(f"adb -s {self.ip} shell settings put secure install_non_market_apps {int(op)}") + class File: def __init__(self, filePath): self.filePath = filePath @@ -350,6 +362,9 @@ class UengineRunner: if __name__ == "__main__": print("本 API 不支持直接运行,请通过引入的方式使用此 API") + adb = Adb("192.168.250.2:5555") + print(adb.boolAndroidInstallOtherAppSetting()) + quit() if not ROOT.GetRoot(): diff --git a/api/__pycache__/__init__.cpython-37.pyc b/api/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..69ef9b18985764d7949b6227ee2b9ee2e125ce29 GIT binary patch literal 16047 zcmd5@+jkqsdEdn@E(AgFB8j@$@`{#BLovXMBFUyrl@vwWsx68UCEJ0UP#|_mt_T9q z?m{G2Ky#sdX^x$^spBTGd;+G?X_6D$IXQ0QIC0#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P2fY6>!;)> zC5I^?X=ewYXx6q^W&HgJ6|W<)#49D$&<3g8gnCxwDf`7s@)kIq`qJ)qzp+4kPdpqK X -# 版本:1.6.1 -# 更新时间:2022年5月21日(要开学了) +# 版本:1.6.2 Alpha +# 更新时间:2022年6月19日(要期末考试了) # 感谢:anbox、deepin 和 UOS # 基于 Python3 的 tkinter 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢 @@ -12,6 +12,7 @@ # 引入所需的库 ################# import os +import api import sys import time import json @@ -663,6 +664,21 @@ def VersionCheck(version1, version2): def ShowHelp(): webbrowser.open_new_tab(programPath + "/Help/index.html") +def AllowOrDisallowUpdateAndroidApp(): + if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"): + if not messagebox.askyesno(title=langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["UseAdbPackageAnswer"]): + return + os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath, + "{}/.android/adbkey.pub".format( + get_home()))) # 写入配置 + + adb = api.Adb("192.168.250.2:5555") + adb.Service.Close() + adb.connect() + if messagebox.askyesno(title=langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["AllowOrDisallowUpdateAndroidAppAnswer"][int(adb.boolAndroidInstallOtherAppSetting())]): + adb.setAndroidInstallOtherAppSetting(not adb.boolAndroidInstallOtherAppSetting()) + messagebox.showinfo(title=langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"]) + class SettingWindow(): saveApkOption = tk.IntVar() def ShowWindow(): @@ -848,7 +864,6 @@ Activity:{} matplotlib.pylab.title("“" + chinese + "”的用户评分(数据只供参考)", fontproperties=fonts) matplotlib.pylab.show() - class AdbChangeUengineDisplaySize(): def ShowWindows(): global displayX @@ -1400,6 +1415,7 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][1], command=AdbStopServer) adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2], command=AdbKillAdbProgress) +uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][13], command=AllowOrDisallowUpdateAndroidApp) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1], command=OpenUengineDebBuilder) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7], command=KeyboardToMouse) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8], command=UengineCheckCpu)