[+] UI
This commit is contained in:
72
docs/AOSP.md
72
docs/AOSP.md
@@ -37,26 +37,26 @@ git config --global user.name "acgist"
|
||||
./repo sync
|
||||
```
|
||||
|
||||
ROOT权限
|
||||
|
||||
## 裁剪
|
||||
|
||||
```
|
||||
# 应用
|
||||
|
||||
# 驱动
|
||||
|
||||
build/target/product/handheld_*.mk
|
||||
# root
|
||||
userdebug
|
||||
|
||||
# framework
|
||||
```
|
||||
|
||||
## 驱动
|
||||
|
||||
`Google`官方只提供了`Nexus`和`Pixel`的驱动
|
||||
|
||||
## 编译
|
||||
|
||||
```
|
||||
source build/envsetup.sh
|
||||
lunch aosp_arm64-user
|
||||
make -j 8
|
||||
make udpatepackage
|
||||
```
|
||||
|
||||
## 刷机
|
||||
@@ -64,9 +64,61 @@ make -j 8
|
||||
```
|
||||
adb reboot bootloader
|
||||
fastboot flashall
|
||||
fastboot -w update aosp_arm64-img-eng.xxx.zip
|
||||
```
|
||||
|
||||
## 小米5S
|
||||
|
||||
https://blog.csdn.net/u012932409/article/details/106792906
|
||||
https://blog.csdn.net/qq_33240707/article/details/123704679
|
||||
https://blog.csdn.net/weixin_42929891/article/details/122667831
|
||||
由于使用小米5S作为测试机,没有适合的`LineageOS`版本,所有这里选择了`PixelExperience`作为测试系统,如果其他机器建议使用`LineageOS`,`ROM`下载地址:
|
||||
|
||||
### TWRP
|
||||
|
||||
* https://twrp.me/Devices/
|
||||
|
||||
### MIUI
|
||||
|
||||
* 卡刷:http://bigota.d.miui.com/V11.0.2.0.OAGCNXM/miui_MI5S_V11.0.2.0.OAGCNXM_6ce204eb2c_8.0.zip
|
||||
* 线刷:http://bigota.d.miui.com/V11.0.2.0.OAGCNXM/capricorn_images_V11.0.2.0.OAGCNXM_20191023.0000.00_8.0_cn_714988e4b7.tgz
|
||||
* 文章:https://web.vip.miui.com/page/info/mio/mio/detail?isTop=0&postId=17843063
|
||||
|
||||
### PixelExperience
|
||||
|
||||
* https://get.pixelexperience.org/capricorn
|
||||
|
||||
### 砖头
|
||||
|
||||
如果刷机过程中出现了黑屏,进不了`recovery`和`bootloader`时,需要使用`MiFlash`通过串口刷机。
|
||||
|
||||
## ADB命令
|
||||
|
||||
```
|
||||
adb devices
|
||||
adb reboot
|
||||
adb reboot recovery
|
||||
adb reboot bootloader
|
||||
adb pull
|
||||
adb push
|
||||
adb shell
|
||||
adb logcat
|
||||
adb install
|
||||
adb uninstall
|
||||
```
|
||||
|
||||
## 刷机命令
|
||||
|
||||
注意:注意备份数据
|
||||
|
||||
```
|
||||
fastboot devices
|
||||
fastboot reboot
|
||||
fastboot reboot-bootloader
|
||||
fastboot reboot-recovery
|
||||
fastboot erase boot
|
||||
fastboot erase recovery
|
||||
fastboot erase system
|
||||
fastboot erase userdata
|
||||
fastboot erase cache
|
||||
fastboot flash boot boot.img
|
||||
fastboot flash recovery recovery.img
|
||||
fastboot flash system system.img
|
||||
```
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* 宽带按需`100Mbps/s`(不要固定宽带)
|
||||
* 整个下载过程大概需要半到一个小时
|
||||
* 整个编译过程大概需要一到两个小时
|
||||
* 最痛苦的就是下载回来速度很慢
|
||||
|
||||
```
|
||||
# 编译工具
|
||||
|
||||
@@ -6,7 +6,7 @@ android {
|
||||
namespace 'com.acgist.client.boot'
|
||||
compileSdk 32
|
||||
defaultConfig {
|
||||
minSdk 31
|
||||
minSdk 30
|
||||
targetSdk 32
|
||||
versionCode 100
|
||||
versionName "1.0.0"
|
||||
|
||||
@@ -6,7 +6,7 @@ android {
|
||||
namespace 'com.acgist.taoyao.client'
|
||||
compileSdk 32
|
||||
defaultConfig {
|
||||
minSdk 31
|
||||
minSdk 30
|
||||
targetSdk 32
|
||||
versionCode 100
|
||||
versionName "1.0.0"
|
||||
@@ -31,9 +31,9 @@ android {
|
||||
dependencies {
|
||||
implementation project(path: ':boot')
|
||||
implementation project(path: ':media')
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'org.apache.commons:commons-lang3:3.12.0'
|
||||
implementation 'org.apache.commons:commons-collections4:4.4'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/title_activity_main">
|
||||
android:label="@string/title_activity_main"
|
||||
android:theme="@style/Theme.Taoyao">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@@ -25,7 +26,8 @@
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_settings" />
|
||||
android:label="@string/title_activity_settings"
|
||||
android:theme="@style/Theme.Taoyao" />
|
||||
|
||||
<service
|
||||
android:name=".MediaService"
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.acgist.taoyao.client;
|
||||
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
|
||||
/**
|
||||
* 开机启动
|
||||
@@ -13,11 +19,23 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
|
||||
final Intent mainActivity = new Intent(context, MainActivity.class);
|
||||
mainActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(mainActivity);
|
||||
final Resources resources = context.getResources();
|
||||
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
|
||||
if(resources.getBoolean(R.bool.preview)) {
|
||||
this.launchPreview(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉起预览
|
||||
*
|
||||
* @param context 上下文
|
||||
*/
|
||||
private void launchPreview(Context context) {
|
||||
final Intent mainActivity = new Intent(context, MainActivity.class);
|
||||
mainActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startForegroundService(mainActivity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.acgist.taoyao.client;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
import android.os.Process;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.acgist.taoyao.client.databinding.ActivityMainBinding;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
/**
|
||||
* 预览界面
|
||||
@@ -20,19 +23,53 @@ public class MainActivity extends AppCompatActivity {
|
||||
private ActivityMainBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// 媒体服务
|
||||
final Intent mediaService = new Intent(this, MediaService.class);
|
||||
this.startService(mediaService);
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
// 启动点亮屏幕
|
||||
this.setTurnScreenOn(true);
|
||||
// 锁屏显示屏幕
|
||||
this.setShowWhenLocked(true);
|
||||
// 设置屏幕常亮
|
||||
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
// 拉起媒体服务
|
||||
this.launchMediaService();
|
||||
// 布局
|
||||
this.binding = ActivityMainBinding.inflate(this.getLayoutInflater());
|
||||
this.setContentView(this.binding.getRoot());
|
||||
// 设置按钮
|
||||
this.binding.settings.setOnClickListener(view -> {
|
||||
final Intent settings = new Intent(this, SettingsActivity.class);
|
||||
this.startService(settings);
|
||||
this.startActivity(settings);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉起媒体服务
|
||||
*/
|
||||
private void launchMediaService() {
|
||||
int times = 0;
|
||||
final Display display = this.getWindow().getContext().getDisplay();
|
||||
while(Display.STATE_ON != display.getState() && times++ < 10) {
|
||||
SystemClock.sleep(100);
|
||||
}
|
||||
if(display.STATE_ON == display.getState()) {
|
||||
// 媒体服务
|
||||
Log.i(MainActivity.class.getSimpleName(), "拉起媒体服务");
|
||||
final Intent mediaService = new Intent(this, MediaService.class);
|
||||
this.startService(mediaService);
|
||||
} else {
|
||||
Log.w(MainActivity.class.getSimpleName(), "拉起媒体服务失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.acgist.taoyao.client;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import com.acgist.taoyao.client.signal.Taoyao;
|
||||
|
||||
@@ -20,6 +21,12 @@ public class MediaService extends Service {
|
||||
public MediaService() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.d(MediaService.class.getSimpleName(), "启动媒体服务");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.acgist.taoyao.client;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.acgist.taoyao.client.databinding.ActivitySettingsBinding;
|
||||
import com.acgist.taoyao.client.signal.Taoyao;
|
||||
|
||||
/**
|
||||
* 设置界面
|
||||
@@ -26,12 +25,15 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
this.setContentView(this.binding.getRoot());
|
||||
// 设置按钮
|
||||
this.binding.connect.setOnClickListener(view -> {
|
||||
final String port = this.binding.port.getText().toString();
|
||||
final String name = this.binding.name.getText().toString();
|
||||
final String host = this.binding.host.getText().toString();
|
||||
// final Taoyao taoyao = new Taoyao(
|
||||
//
|
||||
// );
|
||||
// Log.d(SettingsActivity.class.getSimpleName(), "连接信令:" + taoyao);
|
||||
final Intent main = new Intent(this, MainActivity.class);
|
||||
this.startService(main);
|
||||
this.startActivity(main);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,13 +11,14 @@
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:contentDescription="@string/button_setting"
|
||||
android:src="@drawable/settings"
|
||||
app:borderWidth="16dp"
|
||||
app:fabSize="normal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -4,7 +4,8 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.acgist.taoyao.client.SettingsActivity">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/port"
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
</resources>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- 是否开启预览:关闭预览不会播放视频 -->
|
||||
<bool name="preview">true</bool>
|
||||
<string name="version">1.0.0</string>
|
||||
<integer name="timeout">5000</integer>
|
||||
<string name="clientType">MOBILE</string>
|
||||
<string name="algo">DES</string>
|
||||
<string name="secret">DES</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Theme.Taoyao" parent="Theme.MaterialComponents.Light.DarkActionBar">
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -9,7 +9,7 @@ android {
|
||||
namespace 'com.acgist.mediasoup'
|
||||
compileSdk 32
|
||||
defaultConfig {
|
||||
minSdk 31
|
||||
minSdk 30
|
||||
targetSdk 32
|
||||
versionCode 100
|
||||
versionName "1.0.0"
|
||||
|
||||
Reference in New Issue
Block a user