Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
移动旧地址到/opt/edpatch 添加判断条件 新地址不存在
Browse files Browse the repository at this point in the history
修复移动旧txt到/opt/edpatch中时,如果新地址存在则会抛出异常的问题(容器设置 - 渲染设置无法显示)
  • Loading branch information
ewt45 committed Nov 30, 2023
1 parent d2455e3 commit a0e9156
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ google-services.json
*.smali
edapi(旧module,已删除).zip
app/src/main/cpp/libadrenotools/
/patchapp/release
/patchapp/release/
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,6 +88,7 @@ public void show() {

//大部分操作模式(除了自定义)都用的是这个类来显示弹窗菜单。那么在每次显示前都添加一个选项好了
// AddPopupMenuItems.addBeforeShow(this);
// test.add_popupmenu(menu);

this.impl.show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

//若没有该文件,自己创建一个并写入默认内容
Expand Down
38 changes: 32 additions & 6 deletions app/src/main/java/com/example/test.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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声明变量那一行就会赋值
Expand All @@ -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")
Expand All @@ -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<AudioPlaybackConfiguration> 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<AudioRecordingConfiguration> 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();
}
Expand All @@ -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<File> result){
result.set(new File("/this/should/not/exist"));
Expand Down
5 changes: 3 additions & 2 deletions patchapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions patchapp/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 11,
"versionName": "1.0.1",
"versionCode": 12,
"versionName": "1.0.2",
"outputFile": "EDPatch-beta.apk"
}
],
Expand Down

0 comments on commit a0e9156

Please sign in to comment.