diff --git a/easycontrol/app/build.gradle b/easycontrol/app/build.gradle index fe7d95e8..39c2e247 100644 --- a/easycontrol/app/build.gradle +++ b/easycontrol/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "top.saymzx.easycontrol.app" minSdk 21 targetSdk 34 - versionCode 10502 - versionName "1.5.2" + versionCode 10506 + versionName "1.5.6" ndk { abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64" } diff --git a/easycontrol/app/src/main/AndroidManifest.xml b/easycontrol/app/src/main/AndroidManifest.xml index 52a4fa05..f2399006 100644 --- a/easycontrol/app/src/main/AndroidManifest.xml +++ b/easycontrol/app/src/main/AndroidManifest.xml @@ -55,6 +55,7 @@ android:exported="false" /> diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/UsbActivity.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/UsbActivity.java index a6da3864..731e5493 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/UsbActivity.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/UsbActivity.java @@ -8,6 +8,7 @@ import top.saymzx.easycontrol.app.entity.AppData; import top.saymzx.easycontrol.app.helper.MyBroadcastReceiver; +import top.saymzx.easycontrol.app.helper.PublicTools; public class UsbActivity extends Activity { diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/decode/AudioDecode.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/decode/AudioDecode.java index e5e3b3b4..0c636155 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/decode/AudioDecode.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/decode/AudioDecode.java @@ -87,7 +87,7 @@ private void setAudioDecodec(boolean useOpus, ByteBuffer csd0, Handler playHandl String codecMime = useOpus ? MediaFormat.MIMETYPE_AUDIO_OPUS : MediaFormat.MIMETYPE_AUDIO_AAC; decodec = MediaCodec.createDecoderByType(codecMime); // 音频参数 - int bitRate = 96000; + int bitRate = 128000; MediaFormat decodecFormat = MediaFormat.createAudioFormat(codecMime, SAMPLE_RATE, CHANNELS); decodecFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitRate); decodecFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, AUDIO_PACKET_SIZE); diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/AdbTools.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/AdbTools.java index b3cfdd1f..697df239 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/AdbTools.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/AdbTools.java @@ -21,7 +21,7 @@ public class AdbTools { // 连接ADB public static Adb connectADB(Device device) throws Exception { - String addressId = device.isLinkDevice() ? device.uuid : device.address + ":" + device.adbPort; + String addressId = device.isLinkDevice() ? device.address : device.address + ":" + device.adbPort; Adb adb = allAdbConnect.get(addressId); if (adb == null || adb.isClosed()) { if (device.isLinkDevice()) adb = new Adb(usbDevicesList.get(addressId), AppData.keyPair); diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/ClientController.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/ClientController.java index 7b92f1dc..dcf74a3b 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/ClientController.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/tools/ClientController.java @@ -206,6 +206,10 @@ private boolean noFloatPermission() { } private synchronized void changeToApp() throws Exception { + if (noFloatPermission()) { + PublicTools.logToast("controller", AppData.applicationContext.getString(R.string.toast_float_per), true); + return; + } // 获取当前APP String output = clientStream.runShell("dumpsys window | grep mCurrentFocus=Window"); // 创建匹配器 diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/FullActivity.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/FullActivity.java index f4173838..eff28e05 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/FullActivity.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/FullActivity.java @@ -2,6 +2,7 @@ import android.app.Activity; import android.content.pm.ActivityInfo; +import android.content.res.ColorStateList; import android.content.res.Configuration; import android.hardware.Sensor; import android.hardware.SensorEvent; @@ -54,7 +55,6 @@ protected void onCreate(Bundle savedInstanceState) { activityFullBinding.buttonHome.setVisibility(View.GONE); activityFullBinding.buttonSwitch.setVisibility(View.GONE); activityFullBinding.buttonApp.setVisibility(View.GONE); - activityFullBinding.textureViewLayout.setPadding(0, PublicTools.dp2px(20f), 0, 0); } // 按键监听 setButtonListener(); @@ -148,6 +148,7 @@ private void setNavBarHide(boolean isShow) { activityFullBinding.navBar.setVisibility(isShow ? View.VISIBLE : View.GONE); activityFullBinding.buttonNavBar.setImageResource(isShow ? R.drawable.not_equal : R.drawable.equals); activityFullBinding.textureViewLayout.post(this::updateMaxSize); + activityFullBinding.buttonMore.setImageTintList(ColorStateList.valueOf(getResources().getColor(isShow ? R.color.onCardBackground : R.color.onBlackBacnground))); } private void changeBarView() { diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/SmallView.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/SmallView.java index 6bed4173..34375091 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/SmallView.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/client/view/SmallView.java @@ -79,7 +79,7 @@ public void show() { smallView.buttonHome.setVisibility(View.GONE); smallView.buttonSwitch.setVisibility(View.GONE); smallView.buttonApp.setVisibility(View.GONE); - smallView.textureViewLayout.setPadding(0, PublicTools.dp2px(15f), 0, 0); + smallView.textureViewLayout.setPadding(0, PublicTools.dp2px(25f), 0, 0); } // 自定义分辨率(2:1) if (!device.customResolutionOnConnect && device.changeResolutionOnRunning) clientController.handleAction("writeByteBuffer", ControlPacket.createChangeResolutionEvent(0.5f), 0); diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Device.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Device.java index 69bb6b30..79fadf09 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Device.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Device.java @@ -13,7 +13,7 @@ public class Device { public int adbPort = 5555; public int serverPort = 25166; public boolean listenClip=true; - public boolean isAudio = true; + public boolean isAudio = false; public int maxSize = 1600; public int maxFps = 60; public int maxVideoBit = 4; diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/DeviceListAdapter.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/DeviceListAdapter.java index ab2bf1ca..cf4f0ff8 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/DeviceListAdapter.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/DeviceListAdapter.java @@ -126,7 +126,7 @@ private void queryDevices() { ArrayList tmp1 = new ArrayList<>(); ArrayList tmp2 = new ArrayList<>(); for (Device device : rawDevices) { - if (device.isLinkDevice() && AdbTools.usbDevicesList.containsKey(device.uuid)) tmp1.add(device); + if (device.isLinkDevice() && AdbTools.usbDevicesList.containsKey(device.address)) tmp1.add(device); else if (device.isNetworkDevice()) tmp2.add(device); } AdbTools.devicesList.clear(); diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/MyBroadcastReceiver.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/MyBroadcastReceiver.java index 480ea6f8..ae5fafd5 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/MyBroadcastReceiver.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/helper/MyBroadcastReceiver.java @@ -51,7 +51,7 @@ public void unRegister(Context context) { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) onConnectUsb(context, intent); + if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) AppData.uiHandler.postDelayed(() -> onConnectUsb(context, intent), 1000); else if (ACTION_UPDATE_USB.equals(action) || ACTION_USB_PERMISSION.equals(action) || UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)) updateUSB(); else if (ACTION_SCREEN_OFF.equals(action)) handleScreenOff(); else if (ACTION_UPDATE_DEVICE_LIST.equals(action)) deviceListAdapter.update(); @@ -79,11 +79,14 @@ private void handleControl(Intent intent) { } // 请求USB设备权限 + @SuppressLint({"MutableImplicitPendingIntent", "UnspecifiedImmutableFlag"}) private void onConnectUsb(Context context, Intent intent) { UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); if (usbDevice == null || AppData.usbManager == null) return; if (!AppData.usbManager.hasPermission(usbDevice)) { - @SuppressLint("MutableImplicitPendingIntent") PendingIntent permissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_MUTABLE); + Intent usbPermissionIntent = new Intent(ACTION_USB_PERMISSION); + usbPermissionIntent.setPackage(AppData.applicationContext.getPackageName()); + PendingIntent permissionIntent = PendingIntent.getBroadcast(context, 1, usbPermissionIntent, Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_MUTABLE : 0); AppData.usbManager.requestPermission(usbDevice, permissionIntent); } } diff --git a/easycontrol/app/src/main/res/drawable/more.xml b/easycontrol/app/src/main/res/drawable/more.xml new file mode 100644 index 00000000..57306336 --- /dev/null +++ b/easycontrol/app/src/main/res/drawable/more.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/easycontrol/app/src/main/res/layout-land/activity_full.xml b/easycontrol/app/src/main/res/layout-land/activity_full.xml index b891fc7f..1c7bbe9a 100644 --- a/easycontrol/app/src/main/res/layout-land/activity_full.xml +++ b/easycontrol/app/src/main/res/layout-land/activity_full.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background" + android:background="@color/blackBacnground" android:keepScreenOn="true" tools:context=".client.view.FullActivity"> @@ -24,6 +24,7 @@ android:layout_width="40dp" android:layout_height="match_parent" android:layout_gravity="end" + android:background="@color/background" android:gravity="center" android:orientation="vertical" android:paddingTop="60dp" @@ -86,9 +87,10 @@ android:layout_height="60dp" android:layout_gravity="top|start" android:focusable="false" - android:padding="4dp" + android:padding="2dp" + android:rotation="90" android:paddingTop="20dp" - android:src="@drawable/bars" + android:src="@drawable/more" android:tint="@color/onCardBackground" /> @@ -31,6 +31,7 @@ android:layout_width="match_parent" android:layout_height="40dp" android:layout_gravity="bottom" + android:background="@color/background" android:gravity="center" android:orientation="horizontal" android:paddingStart="60dp" @@ -85,9 +86,9 @@ android:layout_height="40dp" android:layout_gravity="bottom|start" android:focusable="false" - android:padding="4dp" + android:padding="2dp" android:paddingStart="20dp" - android:src="@drawable/bars" + android:src="@drawable/more" android:tint="@color/onCardBackground" /> #828282 + #000000 + #FFFFFF #EBF7FF diff --git a/easycontrol/app/src/main/res/values/strings.xml b/easycontrol/app/src/main/res/values/strings.xml index 77b0b3f8..e47dc3b6 100644 --- a/easycontrol/app/src/main/res/values/strings.xml +++ b/easycontrol/app/src/main/res/values/strings.xml @@ -5,7 +5,7 @@ 易控•远程控制Beta - 慈恩塔下题名处,十七人中最少年 + 春色三分,二分尘土,一分流水 请授予悬浮窗权限,否则软件无法使用 前往设置 本机 diff --git a/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/helper/AudioEncode.java b/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/helper/AudioEncode.java index 99afcfa8..6bdb7acd 100644 --- a/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/helper/AudioEncode.java +++ b/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/helper/AudioEncode.java @@ -44,7 +44,7 @@ private static void setAudioEncodec() throws IOException { String codecMime = useOpus ? MediaFormat.MIMETYPE_AUDIO_OPUS : MediaFormat.MIMETYPE_AUDIO_AAC; encedec = MediaCodec.createEncoderByType(codecMime); MediaFormat encodecFormat = MediaFormat.createAudioFormat(codecMime, AudioCapture.SAMPLE_RATE, AudioCapture.CHANNELS); - encodecFormat.setInteger(MediaFormat.KEY_BIT_RATE, 96000); + encodecFormat.setInteger(MediaFormat.KEY_BIT_RATE, 128000); encodecFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, AudioCapture.AUDIO_PACKET_SIZE); if (!useOpus) encodecFormat.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectLC); encedec.configure(encodecFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); diff --git a/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/wrappers/SurfaceControl.java b/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/wrappers/SurfaceControl.java index ba8ba211..3f10745e 100644 --- a/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/wrappers/SurfaceControl.java +++ b/easycontrol/server/src/main/java/top/saymzx/easycontrol/server/wrappers/SurfaceControl.java @@ -46,10 +46,10 @@ private static void getMethodAndroid14() throws Exception { Method createClassLoaderMethod = Class.forName("com.android.internal.os.ClassLoaderFactory").getDeclaredMethod("createClassLoader", String.class, String.class, String.class, ClassLoader.class, int.class, boolean.class, String.class); ClassLoader classLoader = (ClassLoader) createClassLoaderMethod.invoke(null, "/system/framework/services.jar", null, null, ClassLoader.getSystemClassLoader(), 0, true, null); displayControlClass = classLoader.loadClass("com.android.server.display.DisplayControl"); - Method loadMethod = Runtime.class.getDeclaredMethod("loadLibrary0", Class.class, String.class); - loadMethod.setAccessible(true); +// Method loadMethod = Runtime.class.getDeclaredMethod("loadLibrary0", Class.class, String.class); +// loadMethod.setAccessible(true); // if ((Build.BRAND.toLowerCase() + Build.MANUFACTURER.toLowerCase()).contains("honor")) throw new Exception("Honor device"); - loadMethod.invoke(Runtime.getRuntime(), displayControlClass, "android_servers"); +// loadMethod.invoke(Runtime.getRuntime(), displayControlClass, "android_servers"); } catch (Throwable ignored) { } if (displayControlClass == null) throw new Exception("Failed to load DisplayControl class");