From a0e91567df6bb17a3a235b84dfb20a56535da3e4 Mon Sep 17 00:00:00 2001 From: ewt45 <79033456+ewt45@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:29:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=97=A7=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=88=B0/opt/edpatch=20=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=20=E6=96=B0=E5=9C=B0=E5=9D=80=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复移动旧txt到/opt/edpatch中时,如果新地址存在则会抛出异常的问题(容器设置 - 渲染设置无法显示) --- .gitignore | 2 +- .../axs/widgets/popupMenu/AXSPopupMenu.java | 2 + .../TouchScreenControlsInputWidget.java | 6 --- .../FAB/dialogfragment/PulseAudio.java | 2 +- .../containerSettings/ConSetRenderer.java | 2 +- app/src/main/java/com/example/test.java | 38 ++++++++++++++++--- patchapp/build.gradle | 5 ++- patchapp/release/output-metadata.json | 4 +- 8 files changed, 42 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 61d693ec..43ba4542 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,4 @@ google-services.json *.smali edapi(旧module,已删除).zip app/src/main/cpp/libadrenotools/ -/patchapp/release +/patchapp/release/ diff --git a/app/src/main/java/com/eltechs/axs/widgets/popupMenu/AXSPopupMenu.java b/app/src/main/java/com/eltechs/axs/widgets/popupMenu/AXSPopupMenu.java index d8d507f7..02edbafb 100644 --- a/app/src/main/java/com/eltechs/axs/widgets/popupMenu/AXSPopupMenu.java +++ b/app/src/main/java/com/eltechs/axs/widgets/popupMenu/AXSPopupMenu.java @@ -10,6 +10,7 @@ import com.eltechs.axs.widgets.actions.Action; import com.eltechs.axs.widgets.actions.ActionGroup; import com.example.datainsert.exagear.action.AddPopupMenuItems; +import com.example.test; import java.util.ArrayList; import java.util.Iterator; @@ -87,6 +88,7 @@ public void show() { //大部分操作模式(除了自定义)都用的是这个类来显示弹窗菜单。那么在每次显示前都添加一个选项好了 // AddPopupMenuItems.addBeforeShow(this); +// test.add_popupmenu(menu); this.impl.show(); } diff --git a/app/src/main/java/com/eltechs/axs/widgets/touchScreenControlsOverlay/TouchScreenControlsInputWidget.java b/app/src/main/java/com/eltechs/axs/widgets/touchScreenControlsOverlay/TouchScreenControlsInputWidget.java index a36c51af..d0bc6914 100644 --- a/app/src/main/java/com/eltechs/axs/widgets/touchScreenControlsOverlay/TouchScreenControlsInputWidget.java +++ b/app/src/main/java/com/eltechs/axs/widgets/touchScreenControlsOverlay/TouchScreenControlsInputWidget.java @@ -67,12 +67,6 @@ public boolean onKey(View view, int i, KeyEvent keyEvent) { } else if (i != 82 || keyEvent.getAction() != 1) { if (i == 4 && TouchScreenControlsInputWidget.this.configuration.backKeyAction == SHOW_POPUP_MENU) { if (keyEvent.getAction() == 1) { - //仅供调试 -// if( QH.isTesting()){ -// XServerDisplayActivityInterfaceOverlay ui = ((XServerDisplayActivityConfigurationAware) Globals.getApplicationState()).getXServerDisplayActivityInterfaceOverlay(); -// ((FalloutInterfaceOverlay2)ui).getControlsFactory().getPopupMenu().getMenu().clear(); -// ((FalloutInterfaceOverlay2)ui).getControlsFactory().getPopupMenu().show(); -// } getHost().showPopupMenu(); } return true; diff --git a/app/src/main/java/com/example/datainsert/exagear/FAB/dialogfragment/PulseAudio.java b/app/src/main/java/com/example/datainsert/exagear/FAB/dialogfragment/PulseAudio.java index 45e67eb4..b60136ba 100644 --- a/app/src/main/java/com/example/datainsert/exagear/FAB/dialogfragment/PulseAudio.java +++ b/app/src/main/java/com/example/datainsert/exagear/FAB/dialogfragment/PulseAudio.java @@ -336,7 +336,7 @@ public static boolean shouldStartByPref(){ public void callWhenFirstStart(AppCompatActivity activity) { //移除旧文件 File oldWorkDir = new File(activity.getFilesDir(),"pulseaudio-xsdl"); - if(oldWorkDir.exists()) { + if(oldWorkDir.exists() && !paWorkDir.exists()) { try { FileUtils.moveDirectory(oldWorkDir,paWorkDir); } catch (IOException e) { diff --git a/app/src/main/java/com/example/datainsert/exagear/containerSettings/ConSetRenderer.java b/app/src/main/java/com/example/datainsert/exagear/containerSettings/ConSetRenderer.java index 30c5cd01..31a58683 100644 --- a/app/src/main/java/com/example/datainsert/exagear/containerSettings/ConSetRenderer.java +++ b/app/src/main/java/com/example/datainsert/exagear/containerSettings/ConSetRenderer.java @@ -106,7 +106,7 @@ public static void readRendererTxt() { try { //迁移txt位置 File oldFile = new File(((ExagearImageAware) Globals.getApplicationState()).getExagearImage().getPath(), "opt/renderers.txt"); - if (oldFile.exists()) + if (oldFile.exists() && !configFile.exists()) FileUtils.moveFile(oldFile, configFile); //若没有该文件,自己创建一个并写入默认内容 diff --git a/app/src/main/java/com/example/test.java b/app/src/main/java/com/example/test.java index 067aa272..0b7cecb4 100644 --- a/app/src/main/java/com/example/test.java +++ b/app/src/main/java/com/example/test.java @@ -5,12 +5,12 @@ import android.content.Context; import android.media.AudioAttributes; import android.media.AudioManager; -import android.media.AudioPlaybackCaptureConfiguration; import android.media.AudioPlaybackConfiguration; +import android.media.AudioRecordingConfiguration; import android.os.AsyncTask; import android.os.Build; -import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.view.Menu; import com.eltechs.axs.Globals; import com.eltechs.axs.applicationState.ApplicationStateBase; @@ -30,7 +30,7 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicReference; -public class test extends AppCompatActivity { +public class test { private static final File mUserAreaDir = DriveD.getDriveDDir(); private static boolean staticNotFinal = false; private final static boolean staticAndFinal = true; //smali声明变量那一行就会赋值 @@ -40,9 +40,17 @@ public test() { } + public static void add_popupmenu(Menu menu){ + menu.add("current playing audio").setOnMenuItemClickListener(item -> { + viewNowPlayback(); + return true; + }); + } public static void test_call_audioset(){ + //1. AXSPopupMenu show show前添加这个 + test.add_popupmenu(null); + //2. activity onCreate时调用这个 test.setAllowAudioRecord(); - test.viewNowPlayback(); } @SuppressLint("WrongConstant") @@ -56,17 +64,35 @@ public static void setAllowAudioRecord(){ } public static void viewNowPlayback(){ + /* + Usage: + 0 = USAGE_UNKNOWN + 1 = USAGE_MEDIA + Allow: + 1 = ALLOW_CAPTURE_BY_ALL + 2 = ALLOW_CAPTURE_BY_SYSTEM + 3 = ALLOW_CAPTURE_BY_NONE + */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { AudioManager manager = Globals.getAppContext().getSystemService(AudioManager.class); //这个应该是此时正在播放的音频的设置? List list = manager.getActivePlaybackConfigurations(); StringBuilder builder = new StringBuilder(); + builder.append("ActivePlaybackConfigurations:\n"); for(AudioPlaybackConfiguration c:list){ AudioAttributes attr = c.getAudioAttributes(); builder.append("Usage: ").append(attr.getUsage()).append(", AllowedCapturePolicy").append(attr.getAllowedCapturePolicy()).append("\n"); } if(list.size()==0) - builder.append("no active playback right now"); + + builder.append("\nActiveRecordingConfigurations\n"); + List list2 = manager.getActiveRecordingConfigurations(); + for(AudioRecordingConfiguration c:list2){ + builder.append(c).append("\n"); + } + if(list2.size()==0) + builder.append("none\n"); + new AlertDialog.Builder(((ApplicationStateBase)Globals.getApplicationState()).getCurrentActivity()) .setMessage(builder.toString()).show(); } @@ -91,7 +117,7 @@ public void test_int_to_smali(){ } public void send_inputstream_instead_of_file(){ - TarZstdUtils.extract(this,new File("")); +// TarZstdUtils.extract(this,new File("")); } public static int winlatorObb(Context context, AtomicReference result){ result.set(new File("/this/should/not/exist")); diff --git a/patchapp/build.gradle b/patchapp/build.gradle index 53d189f0..73f0ff4b 100644 --- a/patchapp/build.gradle +++ b/patchapp/build.gradle @@ -9,9 +9,10 @@ android { defaultConfig { applicationId "com.ewt45.patchapp" minSdk 21 + //noinspection ExpiredTargetSdkVersion targetSdk 27 - versionCode 11 - versionName '1.0.1' + versionCode 12 + versionName '1.0.2' resourceConfigurations += ['en', 'zh', 'ru'] testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/patchapp/release/output-metadata.json b/patchapp/release/output-metadata.json index 5a3f4d7c..cd4ee1d7 100644 --- a/patchapp/release/output-metadata.json +++ b/patchapp/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 11, - "versionName": "1.0.1", + "versionCode": 12, + "versionName": "1.0.2", "outputFile": "EDPatch-beta.apk" } ],