Skip to content

Commit

Permalink
更新V1.5.6
Browse files Browse the repository at this point in the history
V1.5.x 是V1版本的最终版本,不进行功能性更新,只修复bug

- 修复无法应用流转问题
- 优化界面UI
- 修复荣耀机型无法连接问题(上次编译错了)
- 修复部分设备无法有线连接的问题
  • Loading branch information
mingzhixian committed Apr 23, 2024
1 parent c33a27f commit 9cfbf94
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 22 deletions.
4 changes: 2 additions & 2 deletions easycontrol/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
1 change: 1 addition & 0 deletions easycontrol/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
android:exported="false" />
<activity
android:name=".UsbActivity"
android:directBootAware="true"
android:exported="false">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
// 创建匹配器
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void queryDevices() {
ArrayList<Device> tmp1 = new ArrayList<>();
ArrayList<Device> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}
Expand Down
15 changes: 15 additions & 0 deletions easycontrol/app/src/main/res/drawable/more.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M512,512m-76.8,0a76.8,76.8 0,1 0,153.6 0,76.8 76.8,0 1,0 -153.6,0Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M230.4,512m-76.8,0a76.8,76.8 0,1 0,153.6 0,76.8 76.8,0 1,0 -153.6,0Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M793.6,512m-76.8,0a76.8,76.8 0,1 0,153.6 0,76.8 76.8,0 1,0 -153.6,0Z"/>
</vector>
8 changes: 5 additions & 3 deletions easycontrol/app/src/main/res/layout-land/activity_full.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

Expand All @@ -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"
Expand Down Expand Up @@ -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" />

<LinearLayout
Expand Down
9 changes: 5 additions & 4 deletions easycontrol/app/src/main/res/layout/activity_full.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -85,18 +86,18 @@
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" />

<LinearLayout
android:id="@+id/bar_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_marginBottom="60dp"
android:layout_marginStart="25dp"
android:layout_marginBottom="60dp"
android:background="@drawable/background_cron"
android:elevation="6dp"
android:orientation="vertical"
Expand Down
2 changes: 2 additions & 0 deletions easycontrol/app/src/main/res/values/color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

<!-- 客户端界面色彩 -->
<color name="clientBar">#828282</color>
<color name="blackBacnground">#000000</color>
<color name="onBlackBacnground">#FFFFFF</color>

<!-- 彩色 -->
<color name="color1">#EBF7FF</color>
Expand Down
2 changes: 1 addition & 1 deletion easycontrol/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<string name="app_name_dev">易控•远程控制Beta</string>

<!-- 主页 -->
<string name="main_poem">慈恩塔下题名处,十七人中最少年</string>
<string name="main_poem">春色三分,二分尘土,一分流水</string>
<string name="main_float_permission">请授予悬浮窗权限,否则软件无法使用</string>
<string name="main_float_permission_button">前往设置</string>
<string name="main_scan_device_local">本机</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 9cfbf94

Please sign in to comment.